mobility-toolbox-js 2.0.0-beta.40 → 2.0.0-beta.41
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.js +2 -2
- package/mbt.js.map +2 -2
- package/mbt.min.js +1 -1
- package/mbt.min.js.map +2 -2
- package/ol/layers/RealtimeLayer.js +2 -2
- package/package.json +1 -1
package/mbt.min.js
CHANGED
|
@@ -1079,5 +1079,5 @@ uniform ${st} ${pt} u_${vt};
|
|
|
1079
1079
|
`||N===V){s=Math.max(s,P),r.push(P),P=0,R+=B;continue}var Et=l[N+1]||y.font,It=tg(Et,mt);o.push(It),P+=It;var Vt=vw(Et);c.push(Vt),B=Math.max(B,Vt)}return{width:s,height:R,widths:o,heights:c,lineWidths:r}}function Rx(y,l,o,c,r,s,P,R,B,N,V){y.save(),o!==1&&(y.globalAlpha*=o),l&&y.setTransform.apply(y,l),c.contextInstructions?(y.translate(B,N),y.scale(V[0],V[1]),xw(c,y)):V[0]<0||V[1]<0?(y.translate(B,N),y.scale(V[0],V[1]),y.drawImage(c,r,s,P,R,0,0,P,R)):y.drawImage(c,r,s,P,R,B,N,P*V[0],R*V[1]),y.restore()}function xw(y,l){for(var o=y.contextInstructions,c=0,r=o.length;c<r;c+=2)Array.isArray(o[c+1])?l[o[c]].apply(l,o[c+1]):l[o[c]]=o[c+1]}var bw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),ww=function(y){bw(l,y);function l(o){var c=this,r=o.rotateWithView!==void 0?o.rotateWithView:!1;return c=y.call(this,{opacity:1,rotateWithView:r,rotation:o.rotation!==void 0?o.rotation:0,scale:o.scale!==void 0?o.scale:1,displacement:o.displacement!==void 0?o.displacement:[0,0]})||this,c.canvas_=void 0,c.hitDetectionCanvas_=null,c.fill_=o.fill!==void 0?o.fill:null,c.origin_=[0,0],c.points_=o.points,c.radius_=o.radius!==void 0?o.radius:o.radius1,c.radius2_=o.radius2,c.angle_=o.angle!==void 0?o.angle:0,c.stroke_=o.stroke!==void 0?o.stroke:null,c.size_=null,c.renderOptions_=null,c.render(),c}return l.prototype.clone=function(){var o=this.getScale(),c=new l({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(o)?o.slice():o,displacement:this.getDisplacement().slice()});return c.setOpacity(this.getOpacity()),c},l.prototype.getAnchor=function(){var o=this.size_;if(!o)return null;var c=this.getDisplacement();return[o[0]/2-c[0],o[1]/2+c[1]]},l.prototype.getAngle=function(){return this.angle_},l.prototype.getFill=function(){return this.fill_},l.prototype.getHitDetectionImage=function(){return this.hitDetectionCanvas_||this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_},l.prototype.getImage=function(o){var c=this.canvas_[o];if(!c){var r=this.renderOptions_,s=Ja(r.size*o,r.size*o);this.draw_(r,s,o),c=s.canvas,this.canvas_[o]=c}return c},l.prototype.getPixelRatio=function(o){return o},l.prototype.getImageSize=function(){return this.size_},l.prototype.getImageState=function(){return qi.LOADED},l.prototype.getOrigin=function(){return this.origin_},l.prototype.getPoints=function(){return this.points_},l.prototype.getRadius=function(){return this.radius_},l.prototype.getRadius2=function(){return this.radius2_},l.prototype.getSize=function(){return this.size_},l.prototype.getStroke=function(){return this.stroke_},l.prototype.listenImageChange=function(o){},l.prototype.load=function(){},l.prototype.unlistenImageChange=function(o){},l.prototype.calculateLineJoinSize_=function(o,c,r){if(c===0||this.points_===1/0||o!=="bevel"&&o!=="miter")return c;var s=this.radius_,P=this.radius2_===void 0?s:this.radius2_;if(s<P){var R=s;s=P,P=R}var B=this.radius2_===void 0?this.points_:this.points_*2,N=2*Math.PI/B,V=P*Math.sin(N),mt=Math.sqrt(P*P-V*V),Et=s-mt,It=Math.sqrt(V*V+Et*Et),Vt=It/V;if(o==="miter"&&Vt<=r)return Vt*c;var Ht=c/2/Vt,Ct=c/2*(Et/It),Gt=Math.sqrt((s+Ht)*(s+Ht)+Ct*Ct),te=Gt-s;if(this.radius2_===void 0||o==="bevel")return te*2;var re=s*Math.sin(N),_e=Math.sqrt(s*s-re*re),ye=P-_e,ce=Math.sqrt(re*re+ye*ye),Te=ce/re;if(Te<=r){var Ie=Te*c/2-P-s;return 2*Math.max(te,Ie)}return te*2},l.prototype.createRenderOptions=function(){var o=Iu,c=0,r=null,s=0,P,R=0;this.stroke_&&(P=this.stroke_.getColor(),P===null&&(P=fc),P=Ss(P),R=this.stroke_.getWidth(),R===void 0&&(R=mc),r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),o=this.stroke_.getLineJoin(),o===void 0&&(o=Iu),c=this.stroke_.getMiterLimit(),c===void 0&&(c=pc));var B=this.calculateLineJoinSize_(o,R,c),N=Math.max(this.radius_,this.radius2_||0),V=Math.ceil(2*N+B);return{strokeStyle:P,strokeWidth:R,size:V,lineDash:r,lineDashOffset:s,lineJoin:o,miterLimit:c}},l.prototype.render=function(){this.renderOptions_=this.createRenderOptions();var o=this.renderOptions_.size;this.canvas_={},this.size_=[o,o]},l.prototype.draw_=function(o,c,r){if(c.scale(r,r),c.translate(o.size/2,o.size/2),this.createPath_(c),this.fill_){var s=this.fill_.getColor();s===null&&(s=Is),c.fillStyle=Ss(s),c.fill()}this.stroke_&&(c.strokeStyle=o.strokeStyle,c.lineWidth=o.strokeWidth,c.setLineDash&&o.lineDash&&(c.setLineDash(o.lineDash),c.lineDashOffset=o.lineDashOffset),c.lineJoin=o.lineJoin,c.miterLimit=o.miterLimit,c.stroke())},l.prototype.createHitDetectionCanvas_=function(o){if(this.fill_){var c=this.fill_.getColor(),r=0;if(typeof c=="string"&&(c=Qh(c)),c===null?r=1:Array.isArray(c)&&(r=c.length===4?c[3]:1),r===0){var s=Ja(o.size,o.size);this.hitDetectionCanvas_=s.canvas,this.drawHitDetectionCanvas_(o,s)}}this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.getImage(1))},l.prototype.createPath_=function(o){var c=this.points_,r=this.radius_;if(c===1/0)o.arc(0,0,r,0,2*Math.PI);else{var s=this.radius2_===void 0?r:this.radius2_;this.radius2_!==void 0&&(c*=2);for(var P=this.angle_-Math.PI/2,R=2*Math.PI/c,B=0;B<c;B++){var N=P+B*R,V=B%2===0?r:s;o.lineTo(V*Math.cos(N),V*Math.sin(N))}o.closePath()}},l.prototype.drawHitDetectionCanvas_=function(o,c){c.translate(o.size/2,o.size/2),this.createPath_(c),c.fillStyle=Is,c.fill(),this.stroke_&&(c.strokeStyle=o.strokeStyle,c.lineWidth=o.strokeWidth,o.lineDash&&(c.setLineDash(o.lineDash),c.lineDashOffset=o.lineDashOffset),c.lineJoin=o.lineJoin,c.miterLimit=o.miterLimit,c.stroke())},l}(Jm),Ox=ww;var Ew=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Tw=function(y){Ew(l,y);function l(o){var c=o||{};return y.call(this,{points:1/0,fill:c.fill,radius:c.radius,stroke:c.stroke,scale:c.scale!==void 0?c.scale:1,rotation:c.rotation!==void 0?c.rotation:0,rotateWithView:c.rotateWithView!==void 0?c.rotateWithView:!1,displacement:c.displacement!==void 0?c.displacement:[0,0]})||this}return l.prototype.clone=function(){var o=this.getScale(),c=new l({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(o)?o.slice():o,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return c.setOpacity(this.getOpacity()),c},l.prototype.setRadius=function(o){this.radius_=o,this.render()},l}(Ox),xl=Tw;var lf=function(){function y(l){var o=l||{};this.geometry_=null,this.geometryFunction_=Fx,o.geometry!==void 0&&this.setGeometry(o.geometry),this.fill_=o.fill!==void 0?o.fill:null,this.image_=o.image!==void 0?o.image:null,this.renderer_=o.renderer!==void 0?o.renderer:null,this.hitDetectionRenderer_=o.hitDetectionRenderer!==void 0?o.hitDetectionRenderer:null,this.stroke_=o.stroke!==void 0?o.stroke:null,this.text_=o.text!==void 0?o.text:null,this.zIndex_=o.zIndex}return y.prototype.clone=function(){var l=this.getGeometry();return l&&typeof l=="object"&&(l=l.clone()),new y({geometry:l,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(l){this.renderer_=l},y.prototype.setHitDetectionRenderer=function(l){this.hitDetectionRenderer_=l},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(l){this.fill_=l},y.prototype.getImage=function(){return this.image_},y.prototype.setImage=function(l){this.image_=l},y.prototype.getStroke=function(){return this.stroke_},y.prototype.setStroke=function(l){this.stroke_=l},y.prototype.getText=function(){return this.text_},y.prototype.setText=function(l){this.text_=l},y.prototype.getZIndex=function(){return this.zIndex_},y.prototype.setGeometry=function(l){typeof l=="function"?this.geometryFunction_=l:typeof l=="string"?this.geometryFunction_=function(o){return o.get(l)}:l?l!==void 0&&(this.geometryFunction_=function(){return l}):this.geometryFunction_=Fx,this.geometry_=l},y.prototype.setZIndex=function(l){this.zIndex_=l},y}();function Bx(y){var l;if(typeof y=="function")l=y;else{var o;if(Array.isArray(y))o=y;else{wn(typeof y.getZIndex=="function",41);var c=y;o=[c]}l=function(){return o}}return l}var Jy=null;function Ux(y,l){if(!Jy){var o=new Ks({color:"rgba(255,255,255,0.4)"}),c=new _a({color:"#3399CC",width:1.25});Jy=[new lf({image:new xl({fill:o,stroke:c,radius:5}),fill:o,stroke:c})]}return Jy}function Nx(){var y={},l=[255,255,255,1],o=[0,153,255,1],c=3;return y[Pe.POLYGON]=[new lf({fill:new Ks({color:[255,255,255,.5]})})],y[Pe.MULTI_POLYGON]=y[Pe.POLYGON],y[Pe.LINE_STRING]=[new lf({stroke:new _a({color:l,width:c+2})}),new lf({stroke:new _a({color:o,width:c})})],y[Pe.MULTI_LINE_STRING]=y[Pe.LINE_STRING],y[Pe.CIRCLE]=y[Pe.POLYGON].concat(y[Pe.LINE_STRING]),y[Pe.POINT]=[new lf({image:new xl({radius:c*2,fill:new Ks({color:o}),stroke:new _a({color:l,width:c/2})}),zIndex:1/0})],y[Pe.MULTI_POINT]=y[Pe.POINT],y[Pe.GEOMETRY_COLLECTION]=y[Pe.POLYGON].concat(y[Pe.LINE_STRING],y[Pe.POINT]),y}function Fx(y){return y.getGeometry()}var Wl=lf;var Vx={POINT:"point",LINE:"line"};var jx=jp(e_(),1);var Sw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Gx={RENDER_ORDER:"renderOrder"},Iw=function(y){Sw(l,y);function l(o){var c=this,r=o||{},s=La({},r);return delete s.style,delete s.renderBuffer,delete s.updateWhileAnimating,delete s.updateWhileInteracting,c=y.call(this,s)||this,c.declutter_=r.declutter!==void 0?r.declutter:!1,c.renderBuffer_=r.renderBuffer!==void 0?r.renderBuffer:100,c.style_=null,c.styleFunction_=void 0,c.setStyle(r.style),c.updateWhileAnimating_=r.updateWhileAnimating!==void 0?r.updateWhileAnimating:!1,c.updateWhileInteracting_=r.updateWhileInteracting!==void 0?r.updateWhileInteracting:!1,c}return l.prototype.getDeclutter=function(){return this.declutter_},l.prototype.getFeatures=function(o){return y.prototype.getFeatures.call(this,o)},l.prototype.getRenderBuffer=function(){return this.renderBuffer_},l.prototype.getRenderOrder=function(){return this.get(Gx.RENDER_ORDER)},l.prototype.getStyle=function(){return this.style_},l.prototype.getStyleFunction=function(){return this.styleFunction_},l.prototype.getUpdateWhileAnimating=function(){return this.updateWhileAnimating_},l.prototype.getUpdateWhileInteracting=function(){return this.updateWhileInteracting_},l.prototype.renderDeclutter=function(o){o.declutterTree||(o.declutterTree=new jx.default(9)),this.getRenderer().renderDeclutter(o)},l.prototype.setRenderOrder=function(o){this.set(Gx.RENDER_ORDER,o)},l.prototype.setStyle=function(o){this.style_=o!==void 0?o:Ux,this.styleFunction_=o===null?void 0:Bx(this.style_),this.changed()},l}(Yh),qx=Iw;var fd={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},dd=[fd.FILL],Cu=[fd.STROKE],gc=[fd.BEGIN_PATH],r_=[fd.CLOSE_PATH],qr=fd;var Cw=function(){function y(){}return y.prototype.drawCustom=function(l,o,c,r){},y.prototype.drawGeometry=function(l){},y.prototype.setStyle=function(l){},y.prototype.drawCircle=function(l,o){},y.prototype.drawFeature=function(l,o){},y.prototype.drawGeometryCollection=function(l,o){},y.prototype.drawLineString=function(l,o){},y.prototype.drawMultiLineString=function(l,o){},y.prototype.drawMultiPoint=function(l,o){},y.prototype.drawMultiPolygon=function(l,o){},y.prototype.drawPoint=function(l,o){},y.prototype.drawPolygon=function(l,o){},y.prototype.drawText=function(l,o){},y.prototype.setFillStrokeStyle=function(l,o){},y.prototype.setImageStyle=function(l,o){},y.prototype.setTextStyle=function(l,o){},y}(),rg=Cw;var Aw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Pw=function(y){Aw(l,y);function l(o,c,r,s){var P=y.call(this)||this;return P.tolerance=o,P.maxExtent=c,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 l.prototype.applyPixelRatio=function(o){var c=this.pixelRatio;return c==1?o:o.map(function(r){return r*c})},l.prototype.appendFlatPointCoordinates=function(o,c){for(var r=this.getBufferedMaxExtent(),s=this.tmpCoordinate_,P=this.coordinates,R=P.length,B=0,N=o.length;B<N;B+=c)s[0]=o[B],s[1]=o[B+1],Hp(r,s)&&(P[R++]=s[0],P[R++]=s[1]);return R},l.prototype.appendFlatLineCoordinates=function(o,c,r,s,P,R){var B=this.coordinates,N=B.length,V=this.getBufferedMaxExtent();R&&(c+=s);var mt=o[c],Et=o[c+1],It=this.tmpCoordinate_,Vt=!0,Ht,Ct,Gt;for(Ht=c+s;Ht<r;Ht+=s)It[0]=o[Ht],It[1]=o[Ht+1],Gt=Rm(V,It),Gt!==Ct?(Vt&&(B[N++]=mt,B[N++]=Et,Vt=!1),B[N++]=It[0],B[N++]=It[1]):Gt===Mo.INTERSECTING?(B[N++]=It[0],B[N++]=It[1],Vt=!1):Vt=!0,mt=It[0],Et=It[1],Ct=Gt;return(P&&Vt||Ht===c+s)&&(B[N++]=mt,B[N++]=Et),N},l.prototype.drawCustomCoordinates_=function(o,c,r,s,P){for(var R=0,B=r.length;R<B;++R){var N=r[R],V=this.appendFlatLineCoordinates(o,c,N,s,!1,!1);P.push(V),c=N}return c},l.prototype.drawCustom=function(o,c,r,s){this.beginGeometry(o,c);var P=o.getType(),R=o.getStride(),B=this.coordinates.length,N,V,mt,Et,It;switch(P){case Pe.MULTI_POLYGON:N=o.getOrientedFlatCoordinates(),Et=[];var Vt=o.getEndss();It=0;for(var Ht=0,Ct=Vt.length;Ht<Ct;++Ht){var Gt=[];It=this.drawCustomCoordinates_(N,It,Vt[Ht],R,Gt),Et.push(Gt)}this.instructions.push([qr.CUSTOM,B,Et,o,r,ud]),this.hitDetectionInstructions.push([qr.CUSTOM,B,Et,o,s||r,ud]);break;case Pe.POLYGON:case Pe.MULTI_LINE_STRING:mt=[],N=P==Pe.POLYGON?o.getOrientedFlatCoordinates():o.getFlatCoordinates(),It=this.drawCustomCoordinates_(N,0,o.getEnds(),R,mt),this.instructions.push([qr.CUSTOM,B,mt,o,r,fh]),this.hitDetectionInstructions.push([qr.CUSTOM,B,mt,o,s||r,fh]);break;case Pe.LINE_STRING:case Pe.CIRCLE:N=o.getFlatCoordinates(),V=this.appendFlatLineCoordinates(N,0,N.length,R,!1,!1),this.instructions.push([qr.CUSTOM,B,V,o,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,B,V,o,s||r,vl]);break;case Pe.MULTI_POINT:N=o.getFlatCoordinates(),V=this.appendFlatPointCoordinates(N,R),V>B&&(this.instructions.push([qr.CUSTOM,B,V,o,r,vl]),this.hitDetectionInstructions.push([qr.CUSTOM,B,V,o,s||r,vl]));break;case Pe.POINT:N=o.getFlatCoordinates(),this.coordinates.push(N[0],N[1]),V=this.coordinates.length,this.instructions.push([qr.CUSTOM,B,V,o,r]),this.hitDetectionInstructions.push([qr.CUSTOM,B,V,o,s||r]);break;default:}this.endGeometry(c)},l.prototype.beginGeometry=function(o,c){this.beginGeometryInstruction1_=[qr.BEGIN_GEOMETRY,c,0,o],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[qr.BEGIN_GEOMETRY,c,0,o],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)},l.prototype.finish=function(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}},l.prototype.reverseHitDetectionInstructions=function(){var o=this.hitDetectionInstructions;o.reverse();var c,r=o.length,s,P,R=-1;for(c=0;c<r;++c)s=o[c],P=s[0],P==qr.END_GEOMETRY?R=c:P==qr.BEGIN_GEOMETRY&&(s[2]=c,fv(this.hitDetectionInstructions,R,c),R=-1)},l.prototype.setFillStrokeStyle=function(o,c){var r=this.state;if(o){var s=o.getColor();r.fillStyle=Ss(s||Is)}else r.fillStyle=void 0;if(c){var P=c.getColor();r.strokeStyle=Ss(P||fc);var R=c.getLineCap();r.lineCap=R!==void 0?R:tp;var B=c.getLineDash();r.lineDash=B?B.slice():cc;var N=c.getLineDashOffset();r.lineDashOffset=N||hc;var V=c.getLineJoin();r.lineJoin=V!==void 0?V:Iu;var mt=c.getWidth();r.lineWidth=mt!==void 0?mt:mc;var Et=c.getMiterLimit();r.miterLimit=Et!==void 0?Et: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},l.prototype.createFill=function(o){var c=o.fillStyle,r=[qr.SET_FILL_STYLE,c];return typeof c!="string"&&r.push(!0),r},l.prototype.applyStroke=function(o){this.instructions.push(this.createStroke(o))},l.prototype.createStroke=function(o){return[qr.SET_STROKE_STYLE,o.strokeStyle,o.lineWidth*this.pixelRatio,o.lineCap,o.lineJoin,o.miterLimit,this.applyPixelRatio(o.lineDash),o.lineDashOffset*this.pixelRatio]},l.prototype.updateFillStyle=function(o,c){var r=o.fillStyle;(typeof r!="string"||o.currentFillStyle!=r)&&(r!==void 0&&this.instructions.push(c.call(this,o)),o.currentFillStyle=r)},l.prototype.updateStrokeStyle=function(o,c){var r=o.strokeStyle,s=o.lineCap,P=o.lineDash,R=o.lineDashOffset,B=o.lineJoin,N=o.lineWidth,V=o.miterLimit;(o.currentStrokeStyle!=r||o.currentLineCap!=s||P!=o.currentLineDash&&!vs(o.currentLineDash,P)||o.currentLineDashOffset!=R||o.currentLineJoin!=B||o.currentLineWidth!=N||o.currentMiterLimit!=V)&&(r!==void 0&&c.call(this,o),o.currentStrokeStyle=r,o.currentLineCap=s,o.currentLineDash=P,o.currentLineDashOffset=R,o.currentLineJoin=B,o.currentLineWidth=N,o.currentMiterLimit=V)},l.prototype.endGeometry=function(o){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var c=[qr.END_GEOMETRY,o];this.instructions.push(c),this.hitDetectionInstructions.push(c)},l.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Uv(this.maxExtent),this.maxLineWidth>0)){var o=this.resolution*(this.maxLineWidth+1)/2;yl(this.bufferedMaxExtent_,o,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},l}(rg),Au=Pw;var Mw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),kw=function(y){Mw(l,y);function l(o,c,r,s){var P=y.call(this,o,c,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 l.prototype.drawPoint=function(o,c){if(!!this.image_){this.beginGeometry(o,c);var r=o.getFlatCoordinates(),s=o.getStride(),P=this.coordinates.length,R=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,R,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,R,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(c)}},l.prototype.drawMultiPoint=function(o,c){if(!!this.image_){this.beginGeometry(o,c);var r=o.getFlatCoordinates(),s=o.getStride(),P=this.coordinates.length,R=this.appendFlatPointCoordinates(r,s);this.instructions.push([qr.DRAW_IMAGE,P,R,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,R,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(c)}},l.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)},l.prototype.setImageStyle=function(o,c){var r=o.getAnchor(),s=o.getSize(),P=o.getHitDetectionImage(),R=o.getImage(this.pixelRatio),B=o.getOrigin();this.imagePixelRatio_=o.getPixelRatio(this.pixelRatio),this.anchorX_=r[0],this.anchorY_=r[1],this.hitDetectionImage_=P,this.image_=R,this.height_=s[1],this.opacity_=o.getOpacity(),this.originX_=B[0]*this.imagePixelRatio_,this.originY_=B[1]*this.imagePixelRatio_,this.rotateWithView_=o.getRotateWithView(),this.rotation_=o.getRotation(),this.scale_=o.getScaleArray(),this.width_=s[0],this.declutterImageWithText_=c},l}(Au),Zx=kw;var Lw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),zw=function(y){Lw(l,y);function l(o,c,r,s){return y.call(this,o,c,r,s)||this}return l.prototype.drawFlatCoordinates_=function(o,c,r,s){var P=this.coordinates.length,R=this.appendFlatLineCoordinates(o,c,r,s,!1,!1),B=[qr.MOVE_TO_LINE_TO,P,R];return this.instructions.push(B),this.hitDetectionInstructions.push(B),r},l.prototype.drawLineString=function(o,c){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(o,c),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,cc,hc],gc);var R=o.getFlatCoordinates(),B=o.getStride();this.drawFlatCoordinates_(R,0,R.length,B),this.hitDetectionInstructions.push(Cu),this.endGeometry(c)}},l.prototype.drawMultiLineString=function(o,c){var r=this.state,s=r.strokeStyle,P=r.lineWidth;if(!(s===void 0||P===void 0)){this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(o,c),this.hitDetectionInstructions.push([qr.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,r.lineDash,r.lineDashOffset],gc);for(var R=o.getEnds(),B=o.getFlatCoordinates(),N=o.getStride(),V=0,mt=0,Et=R.length;mt<Et;++mt)V=this.drawFlatCoordinates_(B,V,R[mt],N);this.hitDetectionInstructions.push(Cu),this.endGeometry(c)}},l.prototype.finish=function(){var o=this.state;return o.lastStroke!=null&&o.lastStroke!=this.coordinates.length&&this.instructions.push(Cu),this.reverseHitDetectionInstructions(),this.state=null,y.prototype.finish.call(this)},l.prototype.applyStroke=function(o){o.lastStroke!=null&&o.lastStroke!=this.coordinates.length&&(this.instructions.push(Cu),o.lastStroke=this.coordinates.length),o.lastStroke=0,y.prototype.applyStroke.call(this,o),this.instructions.push(gc)},l}(Au),Xx=zw;var Dw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Rw=function(y){Dw(l,y);function l(o,c,r,s){return y.call(this,o,c,r,s)||this}return l.prototype.drawFlatCoordinatess_=function(o,c,r,s){var P=this.state,R=P.fillStyle!==void 0,B=P.strokeStyle!==void 0,N=r.length;this.instructions.push(gc),this.hitDetectionInstructions.push(gc);for(var V=0;V<N;++V){var mt=r[V],Et=this.coordinates.length,It=this.appendFlatLineCoordinates(o,c,mt,s,!0,!B),Vt=[qr.MOVE_TO_LINE_TO,Et,It];this.instructions.push(Vt),this.hitDetectionInstructions.push(Vt),B&&(this.instructions.push(r_),this.hitDetectionInstructions.push(r_)),c=mt}return R&&(this.instructions.push(dd),this.hitDetectionInstructions.push(dd)),B&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),c},l.prototype.drawCircle=function(o,c){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(o,c),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Is]),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 R=o.getFlatCoordinates(),B=o.getStride(),N=this.coordinates.length;this.appendFlatLineCoordinates(R,0,R.length,B,!1,!1);var V=[qr.CIRCLE,N];this.instructions.push(gc,V),this.hitDetectionInstructions.push(gc,V),r.fillStyle!==void 0&&(this.instructions.push(dd),this.hitDetectionInstructions.push(dd)),r.strokeStyle!==void 0&&(this.instructions.push(Cu),this.hitDetectionInstructions.push(Cu)),this.endGeometry(c)}},l.prototype.drawPolygon=function(o,c){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(o,c),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Is]),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 R=o.getEnds(),B=o.getOrientedFlatCoordinates(),N=o.getStride();this.drawFlatCoordinatess_(B,0,R,N),this.endGeometry(c)}},l.prototype.drawMultiPolygon=function(o,c){var r=this.state,s=r.fillStyle,P=r.strokeStyle;if(!(s===void 0&&P===void 0)){this.setFillStrokeStyles_(),this.beginGeometry(o,c),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([qr.SET_FILL_STYLE,Is]),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 R=o.getEndss(),B=o.getOrientedFlatCoordinates(),N=o.getStride(),V=0,mt=0,Et=R.length;mt<Et;++mt)V=this.drawFlatCoordinatess_(B,V,R[mt],N);this.endGeometry(c)}},l.prototype.finish=function(){this.reverseHitDetectionInstructions(),this.state=null;var o=this.tolerance;if(o!==0)for(var c=this.coordinates,r=0,s=c.length;r<s;++r)c[r]=ph(c[r],o);return y.prototype.finish.call(this)},l.prototype.setFillStrokeStyles_=function(){var o=this.state,c=o.fillStyle;c!==void 0&&this.updateFillStyle(o,this.createFill),o.strokeStyle!==void 0&&this.updateStrokeStyle(o,this.applyStroke)},l}(Au),i_=Rw;function Wx(y,l,o,c,r){var s=o,P=o,R=0,B=0,N=o,V,mt,Et,It,Vt,Ht,Ct,Gt,te,re;for(mt=o;mt<c;mt+=r){var _e=l[mt],ye=l[mt+1];Vt!==void 0&&(te=_e-Vt,re=ye-Ht,It=Math.sqrt(te*te+re*re),Ct!==void 0&&(B+=Et,V=Math.acos((Ct*te+Gt*re)/(Et*It)),V>y&&(B>R&&(R=B,s=N,P=mt),B=0,N=mt-r)),Et=It,Ct=te,Gt=re),Vt=_e,Ht=ye}return B+=It,B>R?[N,mt]:[s,P]}var Ow=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),md={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Fw=function(y){Ow(l,y);function l(o,c,r,s){var P=y.call(this,o,c,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 l.prototype.finish=function(){var o=y.prototype.finish.call(this);return o.textStates=this.textStates,o.fillStates=this.fillStates,o.strokeStates=this.strokeStates,o},l.prototype.drawText=function(o,c){var r=this.textFillState_,s=this.textStrokeState_,P=this.textState_;if(!(this.text_===""||!P||!r&&!s)){var R=this.coordinates,B=R.length,N=o.getType(),V=null,mt=o.getStride();if(P.placement===Vx.LINE&&(N==Pe.LINE_STRING||N==Pe.MULTI_LINE_STRING||N==Pe.POLYGON||N==Pe.MULTI_POLYGON)){if(!ko(this.getBufferedMaxExtent(),o.getExtent()))return;var Et=void 0;if(V=o.getFlatCoordinates(),N==Pe.LINE_STRING)Et=[V.length];else if(N==Pe.MULTI_LINE_STRING)Et=o.getEnds();else if(N==Pe.POLYGON)Et=o.getEnds().slice(0,1);else if(N==Pe.MULTI_POLYGON){var It=o.getEndss();Et=[];for(var Vt=0,Ht=It.length;Vt<Ht;++Vt)Et.push(It[Vt][0])}this.beginGeometry(o,c);for(var Ct=P.textAlign,Gt=0,te=void 0,re=0,_e=Et.length;re<_e;++re){if(Ct==null){var ye=Wx(P.maxAngle,V,Gt,Et[re],mt);Gt=ye[0],te=ye[1]}else te=Et[re];for(var Vt=Gt;Vt<te;Vt+=mt)R.push(V[Vt],V[Vt+1]);var ce=R.length;Gt=Et[re],this.drawChars_(B,ce),B=ce}this.endGeometry(c)}else{var Te=P.overflow?null:[];switch(N){case Pe.POINT:case Pe.MULTI_POINT:V=o.getFlatCoordinates();break;case Pe.LINE_STRING:V=o.getFlatMidpoint();break;case Pe.CIRCLE:V=o.getCenter();break;case Pe.MULTI_LINE_STRING:V=o.getFlatMidpoints(),mt=2;break;case Pe.POLYGON:V=o.getFlatInteriorPoint(),P.overflow||Te.push(V[2]/this.resolution),mt=3;break;case Pe.MULTI_POLYGON:var Ie=o.getFlatInteriorPoints();V=[];for(var Vt=0,Ht=Ie.length;Vt<Ht;Vt+=3)P.overflow||Te.push(Ie[Vt+2]/this.resolution),V.push(Ie[Vt],Ie[Vt+1]);if(V.length===0)return;mt=2;break;default:}var ce=this.appendFlatPointCoordinates(V,mt);if(ce===B)return;if(Te&&(ce-B)/2!==V.length/mt){var Le=B/2;Te=Te.filter(function(Pr,Ir){var xr=R[(Le+Ir)*2]===V[Ir*mt]&&R[(Le+Ir)*2+1]===V[Ir*mt+1];return xr||--Le,xr})}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(o,c);var ur=P.padding;if(ur!=dc&&(P.scale[0]<0||P.scale[1]<0)){var Ve=P.padding[0],Qe=P.padding[1],or=P.padding[2],Me=P.padding[3];P.scale[0]<0&&(Qe=-Qe,Me=-Me),P.scale[1]<0&&(Ve=-Ve,or=-or),ur=[Ve,Qe,or,Me]}var Br=this.pixelRatio;this.instructions.push([qr.DRAW_IMAGE,B,ce,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterImageWithText_,ur==dc?dc:ur.map(function(Pr){return Pr*Br}),!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Te]);var Tr=1/Br;this.hitDetectionInstructions.push([qr.DRAW_IMAGE,B,ce,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[Tr,Tr],NaN,this.declutterImageWithText_,ur,!!P.backgroundFill,!!P.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,Te]),this.endGeometry(c)}}},l.prototype.saveTextStates_=function(){var o=this.textStrokeState_,c=this.textState_,r=this.textFillState_,s=this.strokeKey_;o&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:o.strokeStyle,lineCap:o.lineCap,lineDashOffset:o.lineDashOffset,lineWidth:o.lineWidth,lineJoin:o.lineJoin,miterLimit:o.miterLimit,lineDash:o.lineDash}));var P=this.textKey_;P in this.textStates||(this.textStates[P]={font:c.font,textAlign:c.textAlign||gh,textBaseline:c.textBaseline||ep,scale:c.scale});var R=this.fillKey_;r&&(R in this.fillStates||(this.fillStates[R]={fillStyle:r.fillStyle}))},l.prototype.drawChars_=function(o,c){var r=this.textStrokeState_,s=this.textState_,P=this.strokeKey_,R=this.textKey_,B=this.fillKey_;this.saveTextStates_();var N=this.pixelRatio,V=md[s.textBaseline],mt=this.textOffsetY_*N,Et=this.text_,It=r?r.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([qr.DRAW_CHARS,o,c,V,s.overflow,B,s.maxAngle,N,mt,P,It*N,Et,R,1]),this.hitDetectionInstructions.push([qr.DRAW_CHARS,o,c,V,s.overflow,B,s.maxAngle,1,mt,P,It,Et,R,1/N])},l.prototype.setTextStyle=function(o,c){var r,s,P;if(!o)this.text_="";else{var R=o.getFill();R?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=Ss(R.getColor()||Is)):(s=null,this.textFillState_=s);var B=o.getStroke();if(!B)P=null,this.textStrokeState_=P;else{P=this.textStrokeState_,P||(P={},this.textStrokeState_=P);var N=B.getLineDash(),V=B.getLineDashOffset(),mt=B.getWidth(),Et=B.getMiterLimit();P.lineCap=B.getLineCap()||tp,P.lineDash=N?N.slice():cc,P.lineDashOffset=V===void 0?hc:V,P.lineJoin=B.getLineJoin()||Iu,P.lineWidth=mt===void 0?mc:mt,P.miterLimit=Et===void 0?pc:Et,P.strokeStyle=Ss(B.getColor()||fc)}r=this.textState_;var It=o.getFont()||eg;Lx(It);var Vt=o.getScaleArray();r.overflow=o.getOverflow(),r.font=It,r.maxAngle=o.getMaxAngle(),r.placement=o.getPlacement(),r.textAlign=o.getTextAlign(),r.textBaseline=o.getTextBaseline()||ep,r.backgroundFill=o.getBackgroundFill(),r.backgroundStroke=o.getBackgroundStroke(),r.padding=o.getPadding()||dc,r.scale=Vt===void 0?[1,1]:Vt;var Ht=o.getOffsetX(),Ct=o.getOffsetY(),Gt=o.getRotateWithView(),te=o.getRotation();this.text_=o.getText()||"",this.textOffsetX_=Ht===void 0?0:Ht,this.textOffsetY_=Ct===void 0?0:Ct,this.textRotateWithView_=Gt===void 0?!1:Gt,this.textRotation_=te===void 0?0:te,this.strokeKey_=P?(typeof P.strokeStyle=="string"?P.strokeStyle:Ai(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:"|"+Ai(s.fillStyle):""}this.declutterImageWithText_=c},l}(Au),$x=Fw;var Bw={Circle:i_,Default:Au,Image:Zx,LineString:Xx,Polygon:i_,Text:$x},Uw=function(){function y(l,o,c,r){this.tolerance_=l,this.maxExtent_=o,this.pixelRatio_=r,this.resolution_=c,this.buildersByZIndex_={}}return y.prototype.finish=function(){var l={};for(var o in this.buildersByZIndex_){l[o]=l[o]||{};var c=this.buildersByZIndex_[o];for(var r in c){var s=c[r].finish();l[o][r]=s}}return l},y.prototype.getBuilder=function(l,o){var c=l!==void 0?l.toString():"0",r=this.buildersByZIndex_[c];r===void 0&&(r={},this.buildersByZIndex_[c]=r);var s=r[o];if(s===void 0){var P=Bw[o];s=new P(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[o]=s}return s},y}(),n_=Uw;var Nw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Vw=function(y){Nw(l,y);function l(o){var c=y.call(this)||this;return c.ready=!0,c.boundHandleImageChange_=c.handleImageChange_.bind(c),c.layer_=o,c.declutterExecutorGroup=null,c}return l.prototype.getFeatures=function(o){return jr()},l.prototype.getData=function(o){return null},l.prototype.prepareFrame=function(o){return jr()},l.prototype.renderFrame=function(o,c){return jr()},l.prototype.loadedTileCallback=function(o,c,r){o[c]||(o[c]={}),o[c][r.tileCoord.toString()]=r},l.prototype.createLoadedTileFinder=function(o,c,r){return function(s,P){var R=this.loadedTileCallback.bind(this,r,s);return o.forEachLoadedTile(c,s,P,R)}.bind(this)},l.prototype.forEachFeatureAtCoordinate=function(o,c,r,s,P){},l.prototype.getDataAtPixel=function(o,c,r){return null},l.prototype.getLayer=function(){return this.layer_},l.prototype.handleFontsChanged=function(){},l.prototype.handleImageChange_=function(o){var c=o.target;c.getState()===qi.LOADED&&this.renderIfReadyAndVisible()},l.prototype.loadImage=function(o){var c=o.getState();return c!=qi.LOADED&&c!=qi.ERROR&&o.addEventListener(Ji.CHANGE,this.boundHandleImageChange_),c==qi.IDLE&&(o.load(),c=o.getState()),c==qi.LOADED},l.prototype.renderIfReadyAndVisible=function(){var o=this.getLayer();o.getVisible()&&o.getSourceState()==Su.READY&&o.changed()},l.prototype.disposeInternal=function(){delete this.layer_,y.prototype.disposeInternal.call(this)},l}(Cm),Kx=Vw;var Gw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),jw=function(y){Gw(l,y);function l(o,c,r,s){var P=y.call(this,o)||this;return P.inversePixelTransform=c,P.frameState=r,P.context=s,P}return l}(_s),Hx=jw;var qw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),gd=null;function Zw(){var y=document.createElement("canvas");y.width=1,y.height=1,gd=y.getContext("2d")}var Xw=function(y){qw(l,y);function l(o){var c=y.call(this,o)||this;return c.container=null,c.renderedResolution,c.tempTransform=za(),c.pixelTransform=za(),c.inversePixelTransform=za(),c.context=null,c.containerReused=!1,c.pixelContext_=null,c.frameState=null,c}return l.prototype.getImageData=function(o,c,r){gd||Zw(),gd.clearRect(0,0,1,1);var s;try{gd.drawImage(o,c,r,1,1,0,0,1,1),s=gd.getImageData(0,0,1,1).data}catch{return null}return s},l.prototype.getBackground=function(o){var c=this.getLayer(),r=c.getBackground();return typeof r=="function"&&(r=r(o.viewState.resolution)),r||void 0},l.prototype.useContainer=function(o,c,r,s){var P=this.getLayer().getClassName(),R,B;if(o&&o.className===P&&o.style.opacity===""&&r===1&&(!s||o.style.backgroundColor&&vs(Qh(o.style.backgroundColor),Qh(s)))){var N=o.firstElementChild;N instanceof HTMLCanvasElement&&(B=N.getContext("2d"))}if(B&&B.canvas.style.transform===c?(this.container=o,this.context=B,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){R=document.createElement("div"),R.className=P;var V=R.style;V.position="absolute",V.width="100%",V.height="100%",s&&(V.backgroundColor=s),B=Ja();var N=B.canvas;R.appendChild(N),V=N.style,V.position="absolute",V.left="0",V.transformOrigin="top left",this.container=R,this.context=B}},l.prototype.clipUnrotated=function(o,c,r){var s=_y(r),P=vy(r),R=yy(r),B=gy(r);xo(c.coordinateToPixelTransform,s),xo(c.coordinateToPixelTransform,P),xo(c.coordinateToPixelTransform,R),xo(c.coordinateToPixelTransform,B);var N=this.inversePixelTransform;xo(N,s),xo(N,P),xo(N,R),xo(N,B),o.save(),o.beginPath(),o.moveTo(Math.round(s[0]),Math.round(s[1])),o.lineTo(Math.round(P[0]),Math.round(P[1])),o.lineTo(Math.round(R[0]),Math.round(R[1])),o.lineTo(Math.round(B[0]),Math.round(B[1])),o.clip()},l.prototype.dispatchRenderEvent_=function(o,c,r){var s=this.getLayer();if(s.hasListener(o)){var P=new Hx(o,this.inversePixelTransform,r,c);s.dispatchEvent(P)}},l.prototype.preRender=function(o,c){this.frameState=c,this.dispatchRenderEvent_(rd.PRERENDER,o,c)},l.prototype.postRender=function(o,c){this.dispatchRenderEvent_(rd.POSTRENDER,o,c)},l.prototype.getRenderTransform=function(o,c,r,s,P,R,B){var N=P/2,V=R/2,mt=s/c,Et=-mt,It=-o[0]+B,Vt=-o[1];return xs(this.tempTransform,N,V,mt,Et,-r,It,Vt)},l.prototype.getDataAtPixel=function(o,c,r){var s=xo(this.inversePixelTransform,o.slice()),P=this.context,R=this.getLayer(),B=R.getExtent();if(B){var N=xo(c.pixelToCoordinateTransform,o.slice());if(!Hp(B,N))return null}var V=Math.round(s[0]),mt=Math.round(s[1]),Et=this.pixelContext_;if(!Et){var It=document.createElement("canvas");It.width=1,It.height=1,Et=It.getContext("2d"),this.pixelContext_=Et}Et.clearRect(0,0,1,1);var Vt;try{Et.drawImage(P.canvas,V,mt,1,1,0,0,1,1),Vt=Et.getImageData(0,0,1,1).data}catch(Ht){return Ht.name==="SecurityError"?(this.pixelContext_=null,new Uint8Array):Vt}return Vt[3]===0?null:Vt},l.prototype.disposeInternal=function(){delete this.frameState,y.prototype.disposeInternal.call(this)},l}(Kx),Yx=Xw;var Rn={CIRCLE:"Circle",DEFAULT:"Default",IMAGE:"Image",LINE_STRING:"LineString",POLYGON:"Polygon",TEXT:"Text"};function Jx(y,l,o,c,r,s,P,R,B,N,V,mt){var Et=y[l],It=y[l+1],Vt=0,Ht=0,Ct=0,Gt=0;function te(){Vt=Et,Ht=It,l+=c,Et=y[l],It=y[l+1],Gt+=Ct,Ct=Math.sqrt((Et-Vt)*(Et-Vt)+(It-Ht)*(It-Ht))}do te();while(l<o-c&&Gt+Ct<s);for(var re=Ct===0?0:(s-Gt)/Ct,_e=gl(Vt,Et,re),ye=gl(Ht,It,re),ce=l-c,Te=Gt,Ie=s+R*B(N,r,V);l<o-c&&Gt+Ct<Ie;)te();re=Ct===0?0:(Ie-Gt)/Ct;var Le=gl(Vt,Et,re),ur=gl(Ht,It,re),Ve;if(mt){var Qe=[_e,ye,Le,ur];Zm(Qe,0,4,2,mt,Qe,Qe),Ve=Qe[0]>Qe[2]}else Ve=_e>Le;var or=Math.PI,Me=[],Br=ce+c===l;l=ce,Ct=0,Gt=Te,Et=y[l],It=y[l+1];var Tr;if(Br){te(),Tr=Math.atan2(It-Ht,Et-Vt),Ve&&(Tr+=Tr>0?-or:or);var br=(Le+_e)/2,Pr=(ur+ye)/2;return Me[0]=[br,Pr,(Ie-s)/2,Tr,r],Me}for(var Ir=0,xr=r.length;Ir<xr;){te();var ai=Math.atan2(It-Ht,Et-Vt);if(Ve&&(ai+=ai>0?-or:or),Tr!==void 0){var je=ai-Tr;if(je+=je>or?-2*or:je<-or?2*or:0,Math.abs(je)>P)return null}Tr=ai;for(var ti=Ir,vi=0;Ir<xr;++Ir){var di=Ve?xr-Ir-1:Ir,tn=R*B(N,r[di],V);if(l+c<o&&Gt+Ct<s+vi+tn/2)break;vi+=tn}if(Ir!==ti){var Vr=Ve?r.substring(xr-ti,xr-Ir):r.substring(ti,Ir);re=Ct===0?0:(s+vi/2-Gt)/Ct;var br=gl(Vt,Et,re),Pr=gl(Ht,It,re);Me.push([br,Pr,vi/2,ai,Vr]),s+=vi}}return Me}var uf=Ya(),yh=[],yc=[],_c=[],_h=[];function Qx(y){return y[3].declutterBox}var Ww=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 t0(y,l){return(l==="start"||l==="end")&&!Ww.test(y)&&(l=l==="start"?"left":"right"),md[l]}function $w(y,l,o){return o>0&&y.push(`
|
|
1080
1080
|
`,""),y.push(l,""),y}var Kw=function(){function y(l,o,c,r){this.overlaps=c,this.pixelRatio=o,this.resolution=l,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(l,o,c,r){var s=l+o+c+r;if(this.labels_[s])return this.labels_[s];var P=r?this.strokeStates[r]:null,R=c?this.fillStates[c]:null,B=this.textStates[o],N=this.pixelRatio,V=[B.scale[0]*N,B.scale[1]*N],mt=Array.isArray(l),Et=t0(mt?l[0]:l,B.textAlign||gh),It=r&&P.lineWidth?P.lineWidth:0,Vt=mt?l:l.split(`
|
|
1081
1081
|
`).reduce($w,[]),Ht=Dx(B,Vt),Ct=Ht.width,Gt=Ht.height,te=Ht.widths,re=Ht.heights,_e=Ht.lineWidths,ye=Ct+It,ce=[],Te=(ye+2)*V[0],Ie=(Gt+It)*V[1],Le={width:Te<0?Math.floor(Te):Math.ceil(Te),height:Ie<0?Math.floor(Ie):Math.ceil(Ie),contextInstructions:ce};if((V[0]!=1||V[1]!=1)&&ce.push("scale",V),r){ce.push("strokeStyle",P.strokeStyle),ce.push("lineWidth",It),ce.push("lineCap",P.lineCap),ce.push("lineJoin",P.lineJoin),ce.push("miterLimit",P.miterLimit);var ur=ah?OffscreenCanvasRenderingContext2D:CanvasRenderingContext2D;ur.prototype.setLineDash&&(ce.push("setLineDash",[P.lineDash]),ce.push("lineDashOffset",P.lineDashOffset))}c&&ce.push("fillStyle",R.fillStyle),ce.push("textBaseline","middle"),ce.push("textAlign","center");for(var Ve=.5-Et,Qe=Et*ye+Ve*It,or=[],Me=[],Br=0,Tr=0,br=0,Pr=0,Ir,xr=0,ai=Vt.length;xr<ai;xr+=2){var je=Vt[xr];if(je===`
|
|
1082
|
-
`){Tr+=Br,Br=0,Qe=Et*ye+Ve*It,++Pr;continue}var ti=Vt[xr+1]||B.font;ti!==Ir&&(r&&or.push("font",ti),c&&Me.push("font",ti),Ir=ti),Br=Math.max(Br,re[br]);var vi=[je,Qe+Ve*te[br]+Et*(te[br]-_e[Pr]),.5*(It+Br)+Tr];Qe+=te[br],r&&or.push("strokeText",vi),c&&Me.push("fillText",vi),++br}return Array.prototype.push.apply(ce,or),Array.prototype.push.apply(ce,Me),this.labels_[s]=Le,Le},y.prototype.replayTextBackground_=function(l,o,c,r,s,P,R){l.beginPath(),l.moveTo.apply(l,o),l.lineTo.apply(l,c),l.lineTo.apply(l,r),l.lineTo.apply(l,s),l.lineTo.apply(l,o),P&&(this.alignFill_=P[2],this.fill_(l)),R&&(this.setStrokeStyle_(l,R),l.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(l,o,c,r,s,P,R,B,N,V,mt,Et,It,Vt,Ht,Ct){R*=Et[0],B*=Et[1];var Gt=c-R,te=r-B,re=s+N>l?l-N:s,_e=P+V>o?o-V:P,ye=Vt[3]+re*Et[0]+Vt[1],ce=Vt[0]+_e*Et[1]+Vt[2],Te=Gt-Vt[3],Ie=te-Vt[0];(Ht||mt!==0)&&(yh[0]=Te,_h[0]=Te,yh[1]=Ie,yc[1]=Ie,yc[0]=Te+ye,_c[0]=yc[0],_c[1]=Ie+ce,_h[1]=_c[1]);var Le;return mt!==0?(Le=xs(za(),c,r,1,1,mt,-c,-r),xo(Le,yh),xo(Le,yc),xo(Le,_c),xo(Le,_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]),uf)):sh(Math.min(Te,Te+ye),Math.min(Ie,Ie+ce),Math.max(Te,Te+ye),Math.max(Ie,Ie+ce),uf),It&&(Gt=Math.round(Gt),te=Math.round(te)),{drawImageX:Gt,drawImageY:te,drawImageW:re,drawImageH:_e,originX:N,originY:V,declutterBox:{minX:uf[0],minY:uf[1],maxX:uf[2],maxY:uf[3],value:Ct},canvasTransform:Le,scale:Et}},y.prototype.replayImageOrLabel_=function(l,o,c,r,s,P,R){var B=!!(P||R),N=r.declutterBox,V=l.canvas,mt=R?R[2]*r.scale[0]/2:0,Et=N.minX-mt<=V.width/o&&N.maxX+mt>=0&&N.minY-mt<=V.height/o&&N.maxY+mt>=0;return Et&&(B&&this.replayTextBackground_(l,yh,yc,_c,_h,P,R),Rx(l,r.canvasTransform,s,c,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(l){if(this.alignFill_){var o=xo(this.renderedTransform_,[0,0]),c=512*this.pixelRatio;l.save(),l.translate(o[0]%c,o[1]%c),l.rotate(this.viewRotation_)}l.fill(),this.alignFill_&&l.restore()},y.prototype.setStrokeStyle_=function(l,o){l.strokeStyle=o[1],l.lineWidth=o[2],l.lineCap=o[3],l.lineJoin=o[4],l.miterLimit=o[5],l.setLineDash&&(l.lineDashOffset=o[7],l.setLineDash(o[6]))},y.prototype.drawLabelWithPointPlacement_=function(l,o,c,r){var s=this.textStates[o],P=this.createLabel(l,o,r,c),R=this.strokeStates[c],B=this.pixelRatio,N=t0(Array.isArray(l)?l[0]:l,s.textAlign||gh),V=md[s.textBaseline||ep],mt=R&&R.lineWidth?R.lineWidth:0,Et=P.width/B-2*s.scale[0],It=N*Et+2*(.5-N)*mt,Vt=V*P.height/B+2*(.5-V)*mt;return{label:P,anchorX:It,anchorY:Vt}},y.prototype.execute_=function(l,o,c,r,s,P,R,B){var N;this.pixelCoordinates_&&vs(c,this.renderedTransform_)?N=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),N=_l(this.coordinates,0,this.coordinates.length,2,c,this.pixelCoordinates_),Sv(this.renderedTransform_,c));for(var V=0,mt=r.length,Et=0,It,Vt,Ht,Ct,Gt,te,re,_e,ye,ce,Te,Ie,Le=0,ur=0,Ve=null,Qe=null,or=this.coordinateCache_,Me=this.viewRotation_,Br=Math.round(Math.atan2(-c[1],c[0])*1e12)/1e12,Tr={context:l,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Me},br=this.instructions!=r||this.overlaps?0:200,Pr,Ir,xr,ai;V<mt;){var je=r[V],ti=je[0];switch(ti){case qr.BEGIN_GEOMETRY:Pr=je[1],ai=je[3],Pr.getGeometry()?R!==void 0&&!ko(R,ai.getExtent())?V=je[2]+1:++V:V=je[2];break;case qr.BEGIN_PATH:Le>br&&(this.fill_(l),Le=0),ur>br&&(l.stroke(),ur=0),!Le&&!ur&&(l.beginPath(),Ct=NaN,Gt=NaN),++V;break;case qr.CIRCLE:Et=je[1];var vi=N[Et],di=N[Et+1],tn=N[Et+2],Vr=N[Et+3],Ri=tn-vi,Pn=Vr-di,Ni=Math.sqrt(Ri*Ri+Pn*Pn);l.moveTo(vi+Ni,di),l.arc(vi,di,Ni,0,2*Math.PI,!0),++V;break;case qr.CLOSE_PATH:l.closePath(),++V;break;case qr.CUSTOM:Et=je[1],It=je[2];var Mr=je[3],to=je[4],Zi=je.length==6?je[5]:void 0;Tr.geometry=Mr,Tr.feature=Pr,V in or||(or[V]=[]);var sn=or[V];Zi?Zi(N,Et,It,2,sn):(sn[0]=N[Et],sn[1]=N[Et+1],sn.length=2),to(sn,Tr),++V;break;case qr.DRAW_IMAGE:Et=je[1],It=je[2],_e=je[3],Vt=je[4],Ht=je[5];var jo=je[6],Zn=je[7],Yr=je[8],ln=je[9],Xn=je[10],Wn=je[11],On=je[12],Xi=je[13],mn=je[14];if(!_e&&je.length>=19){ye=je[18],ce=je[19],Te=je[20],Ie=je[21];var En=this.drawLabelWithPointPlacement_(ye,ce,Te,Ie);_e=En.label,je[3]=_e;var bo=je[22];Vt=(En.anchorX-bo)*this.pixelRatio,je[4]=Vt;var we=je[23];Ht=(En.anchorY-we)*this.pixelRatio,je[5]=Ht,jo=_e.height,je[6]=jo,Xi=_e.width,je[13]=Xi}var We=void 0;je.length>24&&(We=je[24]);var co=void 0,gn=void 0,Xr=void 0;je.length>16?(co=je[15],gn=je[16],Xr=je[17]):(co=dc,gn=!1,Xr=!1),Xn&&Br?Wn+=Me:!Xn&&!Br&&(Wn-=Me);for(var Mn=0;Et<It;Et+=2)if(!(We&&We[Mn++]<Xi/this.pixelRatio)){var Oi=this.calculateImageOrLabelDimensions_(_e.width,_e.height,N[Et],N[Et+1],Xi,jo,Vt,Ht,Yr,ln,Wn,On,s,co,gn||Xr,Pr),fn=[l,o,_e,Oi,Zn,gn?Ve:null,Xr?Qe:null],$n=void 0,Ze=void 0;if(B&&mn){var Ur=It-Et;if(!mn[Ur]){mn[Ur]=fn;continue}if($n=mn[Ur],delete mn[Ur],Ze=Qx($n),B.collides(Ze))continue}B&&B.collides(Oi.declutterBox)||($n&&(B&&B.insert(Ze),this.replayImageOrLabel_.apply(this,$n)),B&&B.insert(Oi.declutterBox),this.replayImageOrLabel_.apply(this,fn))}++V;break;case qr.DRAW_CHARS:var Rr=je[1],Vi=je[2],Tn=je[3],Cr=je[4];Ie=je[5];var eo=je[6],Wi=je[7],bi=je[8];Te=je[9];var et=je[10];ye=je[11],ce=je[12];var ht=[je[13],je[13]],dt=this.textStates[ce],Tt=dt.font,zt=[dt.scale[0]*Wi,dt.scale[1]*Wi],Wt=void 0;Tt in this.widths_?Wt=this.widths_[Tt]:(Wt={},this.widths_[Tt]=Wt);var Jt=Ym(N,Rr,Vi,2),bt=Math.abs(zt[0])*Yy(Tt,ye,Wt);if(Cr||bt<=Jt){var Ut=this.textStates[ce].textAlign,it=(Jt-bt)*md[Ut],X=Jx(N,Rr,Vi,2,ye,it,eo,Math.abs(zt[0]),Yy,Tt,Wt,Br?0:this.viewRotation_);t:if(X){var J=[],rt=void 0,lt=void 0,At=void 0,kt=void 0,gt=void 0;if(Te)for(rt=0,lt=X.length;rt<lt;++rt){gt=X[rt],At=gt[4],kt=this.createLabel(At,ce,"",Te),Vt=gt[2]+(zt[0]<0?-et:et),Ht=Tn*kt.height+(.5-Tn)*2*et*zt[1]/zt[0]-bi;var Oi=this.calculateImageOrLabelDimensions_(kt.width,kt.height,gt[0],gt[1],kt.width,kt.height,Vt,Ht,0,0,gt[3],ht,!1,dc,!1,Pr);if(B&&B.collides(Oi.declutterBox))break t;J.push([l,o,kt,Oi,1,null,null])}if(Ie)for(rt=0,lt=X.length;rt<lt;++rt){gt=X[rt],At=gt[4],kt=this.createLabel(At,ce,Ie,""),Vt=gt[2],Ht=Tn*kt.height-bi;var Oi=this.calculateImageOrLabelDimensions_(kt.width,kt.height,gt[0],gt[1],kt.width,kt.height,Vt,Ht,0,0,gt[3],ht,!1,dc,!1,Pr);if(B&&B.collides(Oi.declutterBox))break t;J.push([l,o,kt,Oi,1,null,null])}B&&B.load(J.map(Qx));for(var St=0,Lt=J.length;St<Lt;++St)this.replayImageOrLabel_.apply(this,J[St])}}++V;break;case qr.END_GEOMETRY:if(P!==void 0){Pr=je[1];var Kt=P(Pr,ai);if(Kt)return Kt}++V;break;case qr.FILL:br?Le++:this.fill_(l),++V;break;case qr.MOVE_TO_LINE_TO:for(Et=je[1],It=je[2],Ir=N[Et],xr=N[Et+1],te=Ir+.5|0,re=xr+.5|0,(te!==Ct||re!==Gt)&&(l.moveTo(Ir,xr),Ct=te,Gt=re),Et+=2;Et<It;Et+=2)Ir=N[Et],xr=N[Et+1],te=Ir+.5|0,re=xr+.5|0,(Et==It-2||te!==Ct||re!==Gt)&&(l.lineTo(Ir,xr),Ct=te,Gt=re);++V;break;case qr.SET_FILL_STYLE:Ve=je,this.alignFill_=je[2],Le&&(this.fill_(l),Le=0,ur&&(l.stroke(),ur=0)),l.fillStyle=je[1],++V;break;case qr.SET_STROKE_STYLE:Qe=je,ur&&(l.stroke(),ur=0),this.setStrokeStyle_(l,je),++V;break;case qr.STROKE:br?ur++:l.stroke(),++V;break;default:++V;break}}Le&&this.fill_(l),ur&&l.stroke()},y.prototype.execute=function(l,o,c,r,s,P){this.viewRotation_=r,this.execute_(l,o,c,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(l,o,c,r,s){return this.viewRotation_=c,this.execute_(l,1,o,this.hitDetectionInstructions,!0,r,s)},y}(),e0=Kw;var o_=[Rn.POLYGON,Rn.CIRCLE,Rn.LINE_STRING,Rn.IMAGE,Rn.TEXT,Rn.DEFAULT],Hw=function(){function y(l,o,c,r,s,P){this.maxExtent_=l,this.overlaps_=r,this.pixelRatio_=c,this.resolution_=o,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return y.prototype.clip=function(l,o){var c=this.getClipCoords(o);l.beginPath(),l.moveTo(c[0],c[1]),l.lineTo(c[2],c[3]),l.lineTo(c[4],c[5]),l.lineTo(c[6],c[7]),l.clip()},y.prototype.createExecutors_=function(l){for(var o in l){var c=this.executorsByZIndex_[o];c===void 0&&(c={},this.executorsByZIndex_[o]=c);var r=l[o];for(var s in r){var P=r[s];c[s]=new e0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(l){for(var o in this.executorsByZIndex_)for(var c=this.executorsByZIndex_[o],r=0,s=l.length;r<s;++r)if(l[r]in c)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(l,o,c,r,s,P){r=Math.round(r);var R=r*2+1,B=xs(this.hitDetectionTransform_,r+.5,r+.5,1/o,-1/o,-c,-l[0],-l[1]),N=!this.hitDetectionContext_;N&&(this.hitDetectionContext_=Ja(R,R));var V=this.hitDetectionContext_;V.canvas.width!==R||V.canvas.height!==R?(V.canvas.width=R,V.canvas.height=R):N||V.clearRect(0,0,R,R);var mt;this.renderBuffer_!==void 0&&(mt=Ya(),dy(mt,l),yl(mt,o*(this.renderBuffer_+r),mt));var Et=Yw(r),It;function Vt(ce,Te){for(var Ie=V.getImageData(0,0,R,R).data,Le=0,ur=Et.length;Le<ur;Le++)if(Ie[Et[Le]]>0){if(!P||It!==Rn.IMAGE&&It!==Rn.TEXT||P.indexOf(ce)!==-1){var Ve=(Et[Le]-3)/4,Qe=r-Ve%R,or=r-(Ve/R|0),Me=s(ce,Te,Qe*Qe+or*or);if(Me)return Me}V.clearRect(0,0,R,R);break}}var Ht=Object.keys(this.executorsByZIndex_).map(Number);Ht.sort(rh);var Ct,Gt,te,re,_e;for(Ct=Ht.length-1;Ct>=0;--Ct){var ye=Ht[Ct].toString();for(te=this.executorsByZIndex_[ye],Gt=o_.length-1;Gt>=0;--Gt)if(It=o_[Gt],re=te[It],re!==void 0&&(_e=re.executeHitDetection(V,B,c,Vt,mt),_e))return _e}},y.prototype.getClipCoords=function(l){var o=this.maxExtent_;if(!o)return null;var c=o[0],r=o[1],s=o[2],P=o[3],R=[c,r,c,P,s,P,s,r];return _l(R,0,8,2,l,R),R},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(l,o,c,r,s,P,R){var B=Object.keys(this.executorsByZIndex_).map(Number);B.sort(rh),this.maxExtent_&&(l.save(),this.clip(l,c));var N=P||o_,V,mt,Et,It,Vt,Ht;for(R&&B.reverse(),V=0,mt=B.length;V<mt;++V){var Ct=B[V].toString();for(Vt=this.executorsByZIndex_[Ct],Et=0,It=N.length;Et<It;++Et){var Gt=N[Et];Ht=Vt[Gt],Ht!==void 0&&Ht.execute(l,o,c,r,s,R)}}this.maxExtent_&&l.restore()},y}(),a_={};function Yw(y){if(a_[y]!==void 0)return a_[y];for(var l=y*2+1,o=y*y,c=new Array(o+1),r=0;r<=y;++r)for(var s=0;s<=y;++s){var P=r*r+s*s;if(P>o)break;var R=c[P];R||(R=[],c[P]=R),R.push(((y+r)*l+(y+s))*4+3),r>0&&R.push(((y-r)*l+(y+s))*4+3),s>0&&(R.push(((y+r)*l+(y-s))*4+3),r>0&&R.push(((y-r)*l+(y-s))*4+3))}for(var B=[],r=0,N=c.length;r<N;++r)c[r]&&B.push.apply(B,c[r]);return a_[y]=B,B}var s_=Hw;var yd={ANIMATING:0,INTERACTING:1};var Jw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Qw=function(y){Jw(l,y);function l(o,c,r,s,P,R,B){var N=y.call(this)||this;return N.context_=o,N.pixelRatio_=c,N.extent_=r,N.transform_=s,N.viewRotation_=P,N.squaredTolerance_=R,N.userTransform_=B,N.contextFillState_=null,N.contextStrokeState_=null,N.contextTextState_=null,N.fillState_=null,N.strokeState_=null,N.image_=null,N.imageAnchorX_=0,N.imageAnchorY_=0,N.imageHeight_=0,N.imageOpacity_=0,N.imageOriginX_=0,N.imageOriginY_=0,N.imageRotateWithView_=!1,N.imageRotation_=0,N.imageScale_=[0,0],N.imageWidth_=0,N.text_="",N.textOffsetX_=0,N.textOffsetY_=0,N.textRotateWithView_=!1,N.textRotation_=0,N.textScale_=[0,0],N.textFillState_=null,N.textStrokeState_=null,N.textState_=null,N.pixelCoordinates_=[],N.tmpLocalTransform_=za(),N}return l.prototype.drawImages_=function(o,c,r,s){if(!!this.image_){var P=_l(o,c,r,s,this.transform_,this.pixelCoordinates_),R=this.context_,B=this.tmpLocalTransform_,N=R.globalAlpha;this.imageOpacity_!=1&&(R.globalAlpha=N*this.imageOpacity_);var V=this.imageRotation_;this.imageRotateWithView_&&(V+=this.viewRotation_);for(var mt=0,Et=P.length;mt<Et;mt+=2){var It=P[mt]-this.imageAnchorX_,Vt=P[mt+1]-this.imageAnchorY_;if(V!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var Ht=It+this.imageAnchorX_,Ct=Vt+this.imageAnchorY_;xs(B,Ht,Ct,1,1,V,-Ht,-Ct),R.setTransform.apply(R,B),R.translate(Ht,Ct),R.scale(this.imageScale_[0],this.imageScale_[1]),R.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),R.setTransform(1,0,0,1,0,0)}else R.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,It,Vt,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(R.globalAlpha=N)}},l.prototype.drawText_=function(o,c,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(o,c,r,s,this.transform_,this.pixelCoordinates_),R=this.context_,B=this.textRotation_;for(this.textRotateWithView_&&(B+=this.viewRotation_);c<r;c+=s){var N=P[c]+this.textOffsetX_,V=P[c+1]+this.textOffsetY_;if(B!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var mt=xs(this.tmpLocalTransform_,N,V,1,1,B,-N,-V);R.setTransform.apply(R,mt),R.translate(N,V),R.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&R.strokeText(this.text_,0,0),this.textFillState_&&R.fillText(this.text_,0,0),R.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&R.strokeText(this.text_,N,V),this.textFillState_&&R.fillText(this.text_,N,V)}}},l.prototype.moveToLineTo_=function(o,c,r,s,P){var R=this.context_,B=_l(o,c,r,s,this.transform_,this.pixelCoordinates_);R.moveTo(B[0],B[1]);var N=B.length;P&&(N-=2);for(var V=2;V<N;V+=2)R.lineTo(B[V],B[V+1]);return P&&R.closePath(),r},l.prototype.drawRings_=function(o,c,r,s){for(var P=0,R=r.length;P<R;++P)c=this.moveToLineTo_(o,c,r[P],s,!0);return c},l.prototype.drawCircle=function(o){if(!!ko(this.extent_,o.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=cx(o,this.transform_,this.pixelCoordinates_),r=c[2]-c[0],s=c[3]-c[1],P=Math.sqrt(r*r+s*s),R=this.context_;R.beginPath(),R.arc(c[0],c[1],P,0,2*Math.PI),this.fillState_&&R.fill(),this.strokeState_&&R.stroke()}this.text_!==""&&this.drawText_(o.getCenter(),0,2,2)}},l.prototype.setStyle=function(o){this.setFillStrokeStyle(o.getFill(),o.getStroke()),this.setImageStyle(o.getImage()),this.setTextStyle(o.getText())},l.prototype.setTransform=function(o){this.transform_=o},l.prototype.drawGeometry=function(o){var c=o.getType();switch(c){case Pe.POINT:this.drawPoint(o);break;case Pe.LINE_STRING:this.drawLineString(o);break;case Pe.POLYGON:this.drawPolygon(o);break;case Pe.MULTI_POINT:this.drawMultiPoint(o);break;case Pe.MULTI_LINE_STRING:this.drawMultiLineString(o);break;case Pe.MULTI_POLYGON:this.drawMultiPolygon(o);break;case Pe.GEOMETRY_COLLECTION:this.drawGeometryCollection(o);break;case Pe.CIRCLE:this.drawCircle(o);break;default:}},l.prototype.drawFeature=function(o,c){var r=c.getGeometryFunction()(o);!r||!ko(this.extent_,r.getExtent())||(this.setStyle(c),this.drawGeometry(r))},l.prototype.drawGeometryCollection=function(o){for(var c=o.getGeometriesArray(),r=0,s=c.length;r<s;++r)this.drawGeometry(c[r])},l.prototype.drawPoint=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getFlatCoordinates(),r=o.getStride();this.image_&&this.drawImages_(c,0,c.length,r),this.text_!==""&&this.drawText_(c,0,c.length,r)},l.prototype.drawMultiPoint=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getFlatCoordinates(),r=o.getStride();this.image_&&this.drawImages_(c,0,c.length,r),this.text_!==""&&this.drawText_(c,0,c.length,r)},l.prototype.drawLineString=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,o.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var c=this.context_,r=o.getFlatCoordinates();c.beginPath(),this.moveToLineTo_(r,0,r.length,o.getStride(),!1),c.stroke()}if(this.text_!==""){var s=o.getFlatMidpoint();this.drawText_(s,0,2,2)}}},l.prototype.drawMultiLineString=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getExtent();if(!!ko(this.extent_,c)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=o.getFlatCoordinates(),P=0,R=o.getEnds(),B=o.getStride();r.beginPath();for(var N=0,V=R.length;N<V;++N)P=this.moveToLineTo_(s,P,R[N],B,!1);r.stroke()}if(this.text_!==""){var mt=o.getFlatMidpoints();this.drawText_(mt,0,mt.length,2)}}},l.prototype.drawPolygon=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,o.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=this.context_;c.beginPath(),this.drawRings_(o.getOrientedFlatCoordinates(),0,o.getEnds(),o.getStride()),this.fillState_&&c.fill(),this.strokeState_&&c.stroke()}if(this.text_!==""){var r=o.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},l.prototype.drawMultiPolygon=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,o.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=this.context_,r=o.getOrientedFlatCoordinates(),s=0,P=o.getEndss(),R=o.getStride();c.beginPath();for(var B=0,N=P.length;B<N;++B){var V=P[B];s=this.drawRings_(r,s,V,R)}this.fillState_&&c.fill(),this.strokeState_&&c.stroke()}if(this.text_!==""){var mt=o.getFlatInteriorPoints();this.drawText_(mt,0,mt.length,2)}}},l.prototype.setContextFillState_=function(o){var c=this.context_,r=this.contextFillState_;r?r.fillStyle!=o.fillStyle&&(r.fillStyle=o.fillStyle,c.fillStyle=o.fillStyle):(c.fillStyle=o.fillStyle,this.contextFillState_={fillStyle:o.fillStyle})},l.prototype.setContextStrokeState_=function(o){var c=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=o.lineCap&&(r.lineCap=o.lineCap,c.lineCap=o.lineCap),c.setLineDash&&(vs(r.lineDash,o.lineDash)||c.setLineDash(r.lineDash=o.lineDash),r.lineDashOffset!=o.lineDashOffset&&(r.lineDashOffset=o.lineDashOffset,c.lineDashOffset=o.lineDashOffset)),r.lineJoin!=o.lineJoin&&(r.lineJoin=o.lineJoin,c.lineJoin=o.lineJoin),r.lineWidth!=o.lineWidth&&(r.lineWidth=o.lineWidth,c.lineWidth=o.lineWidth),r.miterLimit!=o.miterLimit&&(r.miterLimit=o.miterLimit,c.miterLimit=o.miterLimit),r.strokeStyle!=o.strokeStyle&&(r.strokeStyle=o.strokeStyle,c.strokeStyle=o.strokeStyle)):(c.lineCap=o.lineCap,c.setLineDash&&(c.setLineDash(o.lineDash),c.lineDashOffset=o.lineDashOffset),c.lineJoin=o.lineJoin,c.lineWidth=o.lineWidth,c.miterLimit=o.miterLimit,c.strokeStyle=o.strokeStyle,this.contextStrokeState_={lineCap:o.lineCap,lineDash:o.lineDash,lineDashOffset:o.lineDashOffset,lineJoin:o.lineJoin,lineWidth:o.lineWidth,miterLimit:o.miterLimit,strokeStyle:o.strokeStyle})},l.prototype.setContextTextState_=function(o){var c=this.context_,r=this.contextTextState_,s=o.textAlign?o.textAlign:gh;r?(r.font!=o.font&&(r.font=o.font,c.font=o.font),r.textAlign!=s&&(r.textAlign=s,c.textAlign=s),r.textBaseline!=o.textBaseline&&(r.textBaseline=o.textBaseline,c.textBaseline=o.textBaseline)):(c.font=o.font,c.textAlign=s,c.textBaseline=o.textBaseline,this.contextTextState_={font:o.font,textAlign:s,textBaseline:o.textBaseline})},l.prototype.setFillStrokeStyle=function(o,c){var r=this;if(!o)this.fillState_=null;else{var s=o.getColor();this.fillState_={fillStyle:Ss(s||Is)}}if(!c)this.strokeState_=null;else{var P=c.getColor(),R=c.getLineCap(),B=c.getLineDash(),N=c.getLineDashOffset(),V=c.getLineJoin(),mt=c.getWidth(),Et=c.getMiterLimit(),It=B||cc;this.strokeState_={lineCap:R!==void 0?R:tp,lineDash:this.pixelRatio_===1?It:It.map(function(Vt){return Vt*r.pixelRatio_}),lineDashOffset:(N||hc)*this.pixelRatio_,lineJoin:V!==void 0?V:Iu,lineWidth:(mt!==void 0?mt:mc)*this.pixelRatio_,miterLimit:Et!==void 0?Et:pc,strokeStyle:Ss(P||fc)}}},l.prototype.setImageStyle=function(o){var c;if(!o||!(c=o.getSize())){this.image_=null;return}var r=o.getAnchor(),s=o.getOrigin();this.image_=o.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=c[1]*this.pixelRatio_,this.imageOpacity_=o.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=o.getRotateWithView(),this.imageRotation_=o.getRotation(),this.imageScale_=o.getScaleArray(),this.imageWidth_=c[0]*this.pixelRatio_},l.prototype.setTextStyle=function(o){if(!o)this.text_="";else{var c=o.getFill();if(!c)this.textFillState_=null;else{var r=c.getColor();this.textFillState_={fillStyle:Ss(r||Is)}}var s=o.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),R=s.getLineCap(),B=s.getLineDash(),N=s.getLineDashOffset(),V=s.getLineJoin(),mt=s.getWidth(),Et=s.getMiterLimit();this.textStrokeState_={lineCap:R!==void 0?R:tp,lineDash:B||cc,lineDashOffset:N||hc,lineJoin:V!==void 0?V:Iu,lineWidth:mt!==void 0?mt:mc,miterLimit:Et!==void 0?Et:pc,strokeStyle:Ss(P||fc)}}var It=o.getFont(),Vt=o.getOffsetX(),Ht=o.getOffsetY(),Ct=o.getRotateWithView(),Gt=o.getRotation(),te=o.getScaleArray(),re=o.getText(),_e=o.getTextAlign(),ye=o.getTextBaseline();this.textState_={font:It!==void 0?It:eg,textAlign:_e!==void 0?_e:gh,textBaseline:ye!==void 0?ye:ep},this.text_=re!==void 0?Array.isArray(re)?re.reduce(function(ce,Te,Ie){return ce+=Ie%2?" ":Te},""):re:"",this.textOffsetX_=Vt!==void 0?this.pixelRatio_*Vt:0,this.textOffsetY_=Ht!==void 0?this.pixelRatio_*Ht:0,this.textRotateWithView_=Ct!==void 0?Ct:!1,this.textRotation_=Gt!==void 0?Gt:0,this.textScale_=[this.pixelRatio_*te[0],this.pixelRatio_*te[1]]}},l}(rg),r0=Qw;var Pu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var t2=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 l=0;for(var o in this.cache_){var c=this.cache_[o];(l++&3)===0&&!c.hasListener()&&(delete this.cache_[o],--this.cacheSize_)}}},y.prototype.get=function(l,o,c){var r=i0(l,o,c);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(l,o,c,r){var s=i0(l,o,c);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(l){this.maxCacheSize_=l,this.expire()},y}();function i0(y,l,o){var c=o?Qm(o):"null";return l+":"+y+":"+c}var l_=new t2;var e2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),r2=function(y){e2(l,y);function l(o,c,r,s){var P=y.call(this)||this;return P.extent=o,P.pixelRatio_=r,P.resolution=c,P.state=s,P}return l.prototype.changed=function(){this.dispatchEvent(Ji.CHANGE)},l.prototype.getExtent=function(){return this.extent},l.prototype.getImage=function(){return jr()},l.prototype.getPixelRatio=function(){return this.pixelRatio_},l.prototype.getResolution=function(){return this.resolution},l.prototype.getState=function(){return this.state},l.prototype.load=function(){jr()},l}(nh),n0=r2;var i2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),eL=function(y){i2(l,y);function l(o,c,r,s,P,R){var B=y.call(this,o,c,r,qi.IDLE)||this;return B.src_=s,B.image_=new Image,P!==null&&(B.image_.crossOrigin=P),B.unlisten_=null,B.state=qi.IDLE,B.imageLoadFunction_=R,B}return l.prototype.getImage=function(){return this.image_},l.prototype.handleImageError_=function(){this.state=qi.ERROR,this.unlistenImage_(),this.changed()},l.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Eu(this.extent)/this.image_.height),this.state=qi.LOADED,this.unlistenImage_(),this.changed()},l.prototype.load=function(){(this.state==qi.IDLE||this.state==qi.ERROR)&&(this.state=qi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=u_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},l.prototype.setImage=function(o){this.image_=o,this.resolution=Eu(this.extent)/this.image_.height},l.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},l}(n0);function u_(y,l,o){var c=y,r=!0,s=!1,P=!1,R=[Zp(c,Ji.LOAD,function(){P=!0,s||l()})];return c.src&&Ev?(s=!0,c.decode().then(function(){r&&l()}).catch(function(B){r&&(P?l():o())})):R.push(Zp(c,Ji.ERROR,o)),function(){r=!1,R.forEach(Ao)}}var n2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),_d=null,o2=function(y){n2(l,y);function l(o,c,r,s,P,R){var B=y.call(this)||this;return B.hitDetectionImage_=null,B.image_=o||new Image,s!==null&&(B.image_.crossOrigin=s),B.canvas_={},B.color_=R,B.unlisten_=null,B.imageState_=P,B.size_=r,B.src_=c,B.tainted_,B}return l.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===qi.LOADED){_d||(_d=Ja(1,1)),_d.drawImage(this.image_,0,0);try{_d.getImageData(0,0,1,1),this.tainted_=!1}catch{_d=null,this.tainted_=!0}}return this.tainted_===!0},l.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Ji.CHANGE)},l.prototype.handleImageError_=function(){this.imageState_=qi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},l.prototype.handleImageLoad_=function(){this.imageState_=qi.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_()},l.prototype.getImage=function(o){return this.replaceColor_(o),this.canvas_[o]?this.canvas_[o]:this.image_},l.prototype.getPixelRatio=function(o){return this.replaceColor_(o),this.canvas_[o]?o:1},l.prototype.getImageState=function(){return this.imageState_},l.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var o=this.size_[0],c=this.size_[1],r=Ja(o,c);r.fillRect(0,0,o,c),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},l.prototype.getSize=function(){return this.size_},l.prototype.getSrc=function(){return this.src_},l.prototype.load=function(){if(this.imageState_==qi.IDLE){this.imageState_=qi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=u_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},l.prototype.replaceColor_=function(o){if(!(!this.color_||this.canvas_[o]||this.imageState_!==qi.LOADED)){var c=document.createElement("canvas");this.canvas_[o]=c,c.width=Math.ceil(this.image_.width*o),c.height=Math.ceil(this.image_.height*o);var r=c.getContext("2d");if(r.scale(o,o),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=Qm(this.color_),r.fillRect(0,0,c.width/o,c.height/o),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,c.width,c.height),P=s.data,R=this.color_[0]/255,B=this.color_[1]/255,N=this.color_[2]/255,V=this.color_[3],mt=0,Et=P.length;mt<Et;mt+=4)P[mt]*=R,P[mt+1]*=B,P[mt+2]*=N,P[mt+3]*=V;r.putImageData(s,0,0)}}},l.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},l}(nh);function o0(y,l,o,c,r,s){var P=l_.get(l,c,s);return P||(P=new o2(y,l,o,c,r,s),l_.set(l,c,s,P)),P}var a2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),s2=function(y){a2(l,y);function l(o){var c=this,r=o||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,R=r.scale!==void 0?r.scale:1,B=r.rotateWithView!==void 0?r.rotateWithView:!1;c=y.call(this,{opacity:s,rotation:P,scale:R,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:B})||this,c.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],c.normalizedAnchor_=null,c.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Hs.TOP_LEFT,c.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Pu.FRACTION,c.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Pu.FRACTION,c.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var N=r.img!==void 0?r.img:null;c.imgSize_=r.imgSize;var V=r.src;wn(!(V!==void 0&&N),4),wn(!N||N&&c.imgSize_,5),(V===void 0||V.length===0)&&N&&(V=N.src||Ai(N)),wn(V!==void 0&&V.length>0,6);var mt=r.src!==void 0?qi.IDLE:qi.LOADED;return c.color_=r.color!==void 0?Qh(r.color):null,c.iconImage_=o0(N,V,c.imgSize_!==void 0?c.imgSize_:null,c.crossOrigin_,mt,c.color_),c.offset_=r.offset!==void 0?r.offset:[0,0],c.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Hs.TOP_LEFT,c.origin_=null,c.size_=r.size!==void 0?r.size:null,c}return l.prototype.clone=function(){var o=this.getScale();return new l({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(o)?o.slice():o,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},l.prototype.getAnchor=function(){var o=this.normalizedAnchor_;if(!o){o=this.anchor_;var c=this.getSize();if(this.anchorXUnits_==Pu.FRACTION||this.anchorYUnits_==Pu.FRACTION){if(!c)return null;o=this.anchor_.slice(),this.anchorXUnits_==Pu.FRACTION&&(o[0]*=c[0]),this.anchorYUnits_==Pu.FRACTION&&(o[1]*=c[1])}if(this.anchorOrigin_!=Hs.TOP_LEFT){if(!c)return null;o===this.anchor_&&(o=this.anchor_.slice()),(this.anchorOrigin_==Hs.TOP_RIGHT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(o[0]=-o[0]+c[0]),(this.anchorOrigin_==Hs.BOTTOM_LEFT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(o[1]=-o[1]+c[1])}this.normalizedAnchor_=o}var r=this.getDisplacement();return[o[0]-r[0],o[1]+r[1]]},l.prototype.setAnchor=function(o){this.anchor_=o,this.normalizedAnchor_=null},l.prototype.getColor=function(){return this.color_},l.prototype.getImage=function(o){return this.iconImage_.getImage(o)},l.prototype.getPixelRatio=function(o){return this.iconImage_.getPixelRatio(o)},l.prototype.getImageSize=function(){return this.iconImage_.getSize()},l.prototype.getImageState=function(){return this.iconImage_.getImageState()},l.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},l.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var o=this.offset_;if(this.offsetOrigin_!=Hs.TOP_LEFT){var c=this.getSize(),r=this.iconImage_.getSize();if(!c||!r)return null;o=o.slice(),(this.offsetOrigin_==Hs.TOP_RIGHT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(o[0]=r[0]-c[0]-o[0]),(this.offsetOrigin_==Hs.BOTTOM_LEFT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(o[1]=r[1]-c[1]-o[1])}return this.origin_=o,this.origin_},l.prototype.getSrc=function(){return this.iconImage_.getSrc()},l.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},l.prototype.listenImageChange=function(o){this.iconImage_.addEventListener(Ji.CHANGE,o)},l.prototype.load=function(){this.iconImage_.load()},l.prototype.unlistenImageChange=function(o){this.iconImage_.removeEventListener(Ji.CHANGE,o)},l}(Jm),c_=s2;var $l=.5;function a0(y,l,o,c,r,s,P){var R=y[0]*$l,B=y[1]*$l,N=Ja(R,B);N.imageSmoothingEnabled=!1;for(var V=N.canvas,mt=new r0(N,$l,r,null,P),Et=o.length,It=Math.floor((256*256*256-1)/Et),Vt={},Ht=1;Ht<=Et;++Ht){var Ct=o[Ht-1],Gt=Ct.getStyleFunction()||c;if(!!c){var te=Gt(Ct,s);if(!!te){Array.isArray(te)||(te=[te]);for(var re=Ht*It,_e="#"+("000000"+re.toString(16)).slice(-6),ye=0,ce=te.length;ye<ce;++ye){var Te=te[ye],Ie=Te.getGeometryFunction()(Ct);if(!(!Ie||!ko(r,Ie.getExtent()))){var Le=Te.clone(),ur=Le.getFill();ur&&ur.setColor(_e);var Ve=Le.getStroke();Ve&&(Ve.setColor(_e),Ve.setLineDash(null)),Le.setText(void 0);var Qe=Te.getImage();if(Qe&&Qe.getOpacity()!==0){var or=Qe.getImageSize();if(!or)continue;var Me=Ja(or[0],or[1],void 0,{alpha:!1}),Br=Me.canvas;Me.fillStyle=_e,Me.fillRect(0,0,Br.width,Br.height),Le.setImage(new c_({img:Br,imgSize:or,anchor:Qe.getAnchor(),anchorXUnits:Pu.PIXELS,anchorYUnits:Pu.PIXELS,offset:Qe.getOrigin(),opacity:1,size:Qe.getSize(),scale:Qe.getScale(),rotation:Qe.getRotation(),rotateWithView:Qe.getRotateWithView()}))}var Tr=Le.getZIndex()||0,br=Vt[Tr];br||(br={},Vt[Tr]=br,br[Pe.POLYGON]=[],br[Pe.CIRCLE]=[],br[Pe.LINE_STRING]=[],br[Pe.POINT]=[]),br[Ie.getType().replace("Multi","")].push(Ie,Le)}}}}}for(var Pr=Object.keys(Vt).map(Number).sort(rh),Ht=0,Ir=Pr.length;Ht<Ir;++Ht){var br=Vt[Pr[Ht]];for(var xr in br)for(var ai=br[xr],ye=0,ce=ai.length;ye<ce;ye+=2){mt.setStyle(ai[ye+1]);for(var je=0,ti=l.length;je<ti;++je)mt.setTransform(l[je]),mt.drawGeometry(ai[ye])}}return N.getImageData(0,0,V.width,V.height)}function s0(y,l,o){var c=[];if(o){var r=Math.floor(Math.round(y[0])*$l),s=Math.floor(Math.round(y[1])*$l),P=(jl(r,0,o.width-1)+jl(s,0,o.height-1)*o.width)*4,R=o.data[P],B=o.data[P+1],N=o.data[P+2],V=N+256*(B+256*R),mt=Math.floor((256*256*256-1)/l.length);V&&V%mt===0&&c.push(l[V/mt-1])}return c}var l2=.5,l0={Point:m2,LineString:p2,Polygon:y2,MultiPoint:g2,MultiLineString:f2,MultiPolygon:d2,GeometryCollection:h2,Circle:u2};function u0(y,l){return parseInt(Ai(y),10)-parseInt(Ai(l),10)}function c0(y,l){var o=ig(y,l);return o*o}function ig(y,l){return l2*y/l}function u2(y,l,o,c,r){var s=o.getFill(),P=o.getStroke();if(s||P){var R=y.getBuilder(o.getZIndex(),Rn.CIRCLE);R.setFillStrokeStyle(s,P),R.drawCircle(l,c)}var B=o.getText();if(B&&B.getText()){var N=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);N.setTextStyle(B),N.drawText(l,c)}}function h_(y,l,o,c,r,s,P){var R=!1,B=o.getImage();if(B){var N=B.getImageState();N==qi.LOADED||N==qi.ERROR?B.unlistenImageChange(r):(N==qi.IDLE&&B.load(),N=B.getImageState(),B.listenImageChange(r),R=!0)}return c2(y,l,o,c,s,P),R}function c2(y,l,o,c,r,s){var P=o.getGeometryFunction()(l);if(!!P){var R=P.simplifyTransformed(c,r),B=o.getRenderer();if(B)h0(y,R,o,l);else{var N=l0[R.getType()];N(y,R,o,l,s)}}}function h0(y,l,o,c){if(l.getType()==Pe.GEOMETRY_COLLECTION){for(var r=l.getGeometries(),s=0,P=r.length;s<P;++s)h0(y,r[s],o,c);return}var R=y.getBuilder(o.getZIndex(),Rn.DEFAULT);R.drawCustom(l,c,o.getRenderer(),o.getHitDetectionRenderer())}function h2(y,l,o,c,r){var s=l.getGeometriesArray(),P,R;for(P=0,R=s.length;P<R;++P){var B=l0[s[P].getType()];B(y,s[P],o,c,r)}}function p2(y,l,o,c,r){var s=o.getStroke();if(s){var P=y.getBuilder(o.getZIndex(),Rn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(l,c)}var R=o.getText();if(R&&R.getText()){var B=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);B.setTextStyle(R),B.drawText(l,c)}}function f2(y,l,o,c,r){var s=o.getStroke();if(s){var P=y.getBuilder(o.getZIndex(),Rn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(l,c)}var R=o.getText();if(R&&R.getText()){var B=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);B.setTextStyle(R),B.drawText(l,c)}}function d2(y,l,o,c,r){var s=o.getFill(),P=o.getStroke();if(P||s){var R=y.getBuilder(o.getZIndex(),Rn.POLYGON);R.setFillStrokeStyle(s,P),R.drawMultiPolygon(l,c)}var B=o.getText();if(B&&B.getText()){var N=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);N.setTextStyle(B),N.drawText(l,c)}}function m2(y,l,o,c,r){var s=o.getImage(),P=o.getText(),R;if(r&&(y=r,R=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var B=y.getBuilder(o.getZIndex(),Rn.IMAGE);B.setImageStyle(s,R),B.drawPoint(l,c)}if(P&&P.getText()){var N=y.getBuilder(o.getZIndex(),Rn.TEXT);N.setTextStyle(P,R),N.drawText(l,c)}}function g2(y,l,o,c,r){var s=o.getImage(),P=o.getText(),R;if(r&&(y=r,R=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var B=y.getBuilder(o.getZIndex(),Rn.IMAGE);B.setImageStyle(s,R),B.drawMultiPoint(l,c)}if(P&&P.getText()){var N=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);N.setTextStyle(P,R),N.drawText(l,c)}}function y2(y,l,o,c,r){var s=o.getFill(),P=o.getStroke();if(s||P){var R=y.getBuilder(o.getZIndex(),Rn.POLYGON);R.setFillStrokeStyle(s,P),R.drawPolygon(l,c)}var B=o.getText();if(B&&B.getText()){var N=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);N.setTextStyle(B),N.drawText(l,c)}}var _2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),v2=function(y){_2(l,y);function l(o){var c=y.call(this,o)||this;return c.boundHandleStyleImageChange_=c.handleStyleImageChange_.bind(c),c.animatingOrInteracting_,c.dirty_=!1,c.hitDetectionImageData_=null,c.renderedFeatures_=null,c.renderedRevision_=-1,c.renderedResolution_=NaN,c.renderedExtent_=Ya(),c.wrappedRenderedExtent_=Ya(),c.renderedRotation_,c.renderedCenter_=null,c.renderedProjection_=null,c.renderedRenderOrder_=null,c.replayGroup_=null,c.replayGroupChanged=!0,c.declutterExecutorGroup=null,c.clipping=!0,c}return l.prototype.renderWorlds=function(o,c,r){var s=c.extent,P=c.viewState,R=P.center,B=P.resolution,N=P.projection,V=P.rotation,mt=N.getExtent(),Et=this.getLayer().getSource(),It=c.pixelRatio,Vt=c.viewHints,Ht=!(Vt[yd.ANIMATING]||Vt[yd.INTERACTING]),Ct=this.context,Gt=Math.round(c.size[0]*It),te=Math.round(c.size[1]*It),re=Et.getWrapX()&&N.canWrapX(),_e=re?ws(mt):null,ye=re?Math.ceil((s[2]-mt[2])/_e)+1:1,ce=re?Math.floor((s[0]-mt[0])/_e):0;do{var Te=this.getRenderTransform(R,B,V,It,Gt,te,ce*_e);o.execute(Ct,1,Te,V,Ht,void 0,r)}while(++ce<ye)},l.prototype.renderDeclutter=function(o){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,o,o.declutterTree)},l.prototype.renderFrame=function(o,c){var r=o.pixelRatio,s=o.layerStatesArray[o.layerIndex];Iv(this.pixelTransform,1/r,1/r),Av(this.inversePixelTransform,this.pixelTransform);var P=cy(this.pixelTransform);this.useContainer(c,P,s.opacity,this.getBackground(o));var R=this.context,B=R.canvas,N=this.replayGroup_,V=this.declutterExecutorGroup;if((!N||N.isEmpty())&&(!V||V.isEmpty()))return null;var mt=Math.round(o.size[0]*r),Et=Math.round(o.size[1]*r);B.width!=mt||B.height!=Et?(B.width=mt,B.height=Et,B.style.transform!==P&&(B.style.transform=P)):this.containerReused||R.clearRect(0,0,mt,Et),this.preRender(R,o);var It=o.viewState,Vt=It.projection,Ht=!1,Ct=!0;if(s.extent&&this.clipping){var Gt=ed(s.extent,Vt);Ct=ko(Gt,o.extent),Ht=Ct&&!sc(Gt,o.extent),Ht&&this.clipUnrotated(R,o,Gt)}Ct&&this.renderWorlds(N,o),Ht&&R.restore(),this.postRender(R,o);var te=kx(s.opacity),re=this.container;return te!==re.style.opacity&&(re.style.opacity=te),this.renderedRotation_!==It.rotation&&(this.renderedRotation_=It.rotation,this.hitDetectionImageData_=null),this.container},l.prototype.getFeatures=function(o){return new Promise(function(c){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];xo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,R=this.renderedRotation_,B=this.renderedProjection_,N=this.wrappedRenderedExtent_,V=this.getLayer(),mt=[],Et=r[0]*$l,It=r[1]*$l;mt.push(this.getRenderTransform(s,P,R,$l,Et,It,0).slice());var Vt=V.getSource(),Ht=B.getExtent();if(Vt.getWrapX()&&B.canWrapX()&&!sc(Ht,N)){for(var Ct=N[0],Gt=ws(Ht),te=0,re=void 0;Ct<Ht[0];)--te,re=Gt*te,mt.push(this.getRenderTransform(s,P,R,$l,Et,It,re).slice()),Ct+=Gt;for(te=0,Ct=N[2];Ct>Ht[2];)++te,re=Gt*te,mt.push(this.getRenderTransform(s,P,R,$l,Et,It,re).slice()),Ct-=Gt}this.hitDetectionImageData_=a0(r,mt,this.renderedFeatures_,V.getStyleFunction(),N,P,R)}c(s0(o,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},l.prototype.forEachFeatureAtCoordinate=function(o,c,r,s,P){var R=this;if(!!this.replayGroup_){var B=c.viewState.resolution,N=c.viewState.rotation,V=this.getLayer(),mt={},Et=function(Ht,Ct,Gt){var te=Ai(Ht),re=mt[te];if(re){if(re!==!0&&Gt<re.distanceSq){if(Gt===0)return mt[te]=!0,P.splice(P.lastIndexOf(re),1),s(Ht,V,Ct);re.geometry=Ct,re.distanceSq=Gt}}else{if(Gt===0)return mt[te]=!0,s(Ht,V,Ct);P.push(mt[te]={feature:Ht,layer:V,geometry:Ct,distanceSq:Gt,callback:s})}},It,Vt=[this.replayGroup_];return this.declutterExecutorGroup&&Vt.push(this.declutterExecutorGroup),Vt.some(function(Ht){return It=Ht.forEachFeatureAtCoordinate(o,B,N,r,Et,Ht===R.declutterExecutorGroup&&c.declutterTree?c.declutterTree.all().map(function(Ct){return Ct.value}):null)}),It}},l.prototype.handleFontsChanged=function(){var o=this.getLayer();o.getVisible()&&this.replayGroup_&&o.changed()},l.prototype.handleStyleImageChange_=function(o){this.renderIfReadyAndVisible()},l.prototype.prepareFrame=function(o){var c=this.getLayer(),r=c.getSource();if(!r)return!1;var s=o.viewHints[yd.ANIMATING],P=o.viewHints[yd.INTERACTING],R=c.getUpdateWhileAnimating(),B=c.getUpdateWhileInteracting();if(!this.dirty_&&!R&&s||!B&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var N=o.extent,V=o.viewState,mt=V.projection,Et=V.resolution,It=o.pixelRatio,Vt=c.getRevision(),Ht=c.getRenderBuffer(),Ct=c.getRenderOrder();Ct===void 0&&(Ct=u0);var Gt=V.center.slice(),te=yl(N,Ht*Et),re=te.slice(),_e=[te.slice()],ye=mt.getExtent();if(r.getWrapX()&&mt.canWrapX()&&!sc(ye,o.extent)){var ce=ws(ye),Te=Math.max(ws(te)/2,ce);te[0]=ye[0]-Te,te[2]=ye[2]+Te,$v(Gt,mt);var Ie=Xv(_e[0],mt);Ie[0]<ye[0]&&Ie[2]<ye[2]?_e.push([Ie[0]+ce,Ie[1],Ie[2]+ce,Ie[3]]):Ie[0]>ye[0]&&Ie[2]>ye[2]&&_e.push([Ie[0]-ce,Ie[1],Ie[2]-ce,Ie[3]])}if(!this.dirty_&&this.renderedResolution_==Et&&this.renderedRevision_==Vt&&this.renderedRenderOrder_==Ct&&sc(this.wrappedRenderedExtent_,te))return vs(this.renderedExtent_,re)||(this.hitDetectionImageData_=null,this.renderedExtent_=re),this.renderedCenter_=Gt,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Le=new n_(ig(Et,It),te,Et,It),ur;this.getLayer().getDeclutter()&&(ur=new n_(ig(Et,It),te,Et,It));var Ve=uh(),Qe;if(Ve){for(var or=0,Me=_e.length;or<Me;++or){var Br=_e[or],Tr=tf(Br,mt);r.loadFeatures(Tr,Jv(Et,mt),Ve)}Qe=Bm(Ve,mt)}else for(var or=0,Me=_e.length;or<Me;++or)r.loadFeatures(_e[or],Et,mt);var br=c0(Et,It),Pr=function(ti){var vi,di=ti.getStyleFunction()||c.getStyleFunction();if(di&&(vi=di(ti,Et)),vi){var tn=this.renderFeature(ti,br,vi,Le,Qe,ur);this.dirty_=this.dirty_||tn}}.bind(this),Ir=tf(te,mt),xr=r.getFeaturesInExtent(Ir);Ct&&xr.sort(Ct);for(var or=0,Me=xr.length;or<Me;++or)Pr(xr[or]);this.renderedFeatures_=xr;var ai=Le.finish(),je=new s_(te,Et,It,r.getOverlaps(),ai,c.getRenderBuffer());return ur&&(this.declutterExecutorGroup=new s_(te,Et,It,r.getOverlaps(),ur.finish(),c.getRenderBuffer())),this.renderedResolution_=Et,this.renderedRevision_=Vt,this.renderedRenderOrder_=Ct,this.renderedExtent_=re,this.wrappedRenderedExtent_=te,this.renderedCenter_=Gt,this.renderedProjection_=mt,this.replayGroup_=je,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},l.prototype.renderFeature=function(o,c,r,s,P,R){if(!r)return!1;var B=!1;if(Array.isArray(r))for(var N=0,V=r.length;N<V;++N)B=h_(s,o,r[N],c,this.boundHandleStyleImageChange_,P,R)||B;else B=h_(s,o,r,c,this.boundHandleStyleImageChange_,P,R);return B},l}(Yx),p0=v2;var x2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),b2=function(y){x2(l,y);function l(o){return y.call(this,o)||this}return l.prototype.createRenderer=function(){return new p0(this)},l}(qx),rp=b2;var f0=jp(e_(),1);var w2=function(){function y(l){this.rbush_=new f0.default(l),this.items_={}}return y.prototype.insert=function(l,o){var c={minX:l[0],minY:l[1],maxX:l[2],maxY:l[3],value:o};this.rbush_.insert(c),this.items_[Ai(o)]=c},y.prototype.load=function(l,o){for(var c=new Array(o.length),r=0,s=o.length;r<s;r++){var P=l[r],R=o[r],B={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:R};c[r]=B,this.items_[Ai(R)]=B}this.rbush_.load(c)},y.prototype.remove=function(l){var o=Ai(l),c=this.items_[o];return delete this.items_[o],this.rbush_.remove(c)!==null},y.prototype.update=function(l,o){var c=this.items_[Ai(o)],r=[c.minX,c.minY,c.maxX,c.maxY];Fm(r,l)||(this.remove(o),this.insert(l,o))},y.prototype.getAll=function(){var l=this.rbush_.all();return l.map(function(o){return o.value})},y.prototype.getInExtent=function(l){var o={minX:l[0],minY:l[1],maxX:l[2],maxY:l[3]},c=this.rbush_.search(o);return c.map(function(r){return r.value})},y.prototype.forEach=function(l){return this.forEach_(this.getAll(),l)},y.prototype.forEachInExtent=function(l,o){return this.forEach_(this.getInExtent(l),o)},y.prototype.forEach_=function(l,o){for(var c,r=0,s=l.length;r<s;r++)if(c=o(l[r]),c)return c;return c},y.prototype.isEmpty=function(){return Vl(this.items_)},y.prototype.clear=function(){this.rbush_.clear(),this.items_={}},y.prototype.getExtent=function(l){var o=this.rbush_.toJSON();return sh(o.minX,o.minY,o.maxX,o.maxY,l)},y.prototype.concat=function(l){this.rbush_.load(l.rbush_.all());for(var o in l.items_)this.items_[o]=l.items_[o]},y}(),vd=w2;var E2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),T2=function(y){E2(l,y);function l(o){var c=y.call(this)||this;c.projection=ga(o.projection),c.attributions_=d0(o.attributions),c.attributionsCollapsible_=o.attributionsCollapsible!==void 0?o.attributionsCollapsible:!0,c.loading=!1,c.state_=o.state!==void 0?o.state:Su.READY,c.wrapX_=o.wrapX!==void 0?o.wrapX:!1,c.interpolate_=!!o.interpolate,c.viewResolver=null,c.viewRejector=null;var r=c;return c.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),c}return l.prototype.getAttributions=function(){return this.attributions_},l.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},l.prototype.getProjection=function(){return this.projection},l.prototype.getResolutions=function(){return jr()},l.prototype.getView=function(){return this.viewPromise_},l.prototype.getState=function(){return this.state_},l.prototype.getWrapX=function(){return this.wrapX_},l.prototype.getInterpolate=function(){return this.interpolate_},l.prototype.refresh=function(){this.changed()},l.prototype.setAttributions=function(o){this.attributions_=d0(o),this.changed()},l.prototype.setState=function(o){this.state_=o,this.changed()},l}(Po);function d0(y){return y?Array.isArray(y)?function(l){return y}:typeof y=="function"?y:function(l){return[y]}:null}var cf=T2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function m0(y,l){return[[-1/0,-1/0,1/0,1/0]]}var vh={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var S2=!1;function I2(y,l,o,c,r,s,P){var R=new XMLHttpRequest;R.open("GET",typeof y=="function"?y(o,c,r):y,!0),l.getType()==vh.ARRAY_BUFFER&&(R.responseType="arraybuffer"),R.withCredentials=S2,R.onload=function(B){if(!R.status||R.status>=200&&R.status<300){var N=l.getType(),V=void 0;N==vh.JSON||N==vh.TEXT?V=R.responseText:N==vh.XML?(V=R.responseXML,V||(V=new DOMParser().parseFromString(R.responseText,"application/xml"))):N==vh.ARRAY_BUFFER&&(V=R.response),V?s(l.readFeatures(V,{extent:o,featureProjection:r}),l.readProjection(V)):P()}else P()},R.onerror=P,R.send()}function p_(y,l){return function(o,c,r,s,P){var R=this;I2(y,l,o,c,r,function(B,N){R.addFeatures(B),s!==void 0&&s(B)},P||Zh)}}var g0=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),xh=function(y){g0(l,y);function l(o,c,r){var s=y.call(this,o)||this;return s.feature=c,s.features=r,s}return l}(_s);var C2=function(y){g0(l,y);function l(o){var c=this,r=o||{};c=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Su.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,c.on,c.once,c.un,c.loader_=Zh,c.format_=r.format,c.overlaps_=r.overlaps===void 0?!0:r.overlaps,c.url_=r.url,r.loader!==void 0?c.loader_=r.loader:c.url_!==void 0&&(wn(c.format_,7),c.loader_=p_(c.url_,c.format_)),c.strategy_=r.strategy!==void 0?r.strategy:m0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;c.featuresRtree_=s?new vd:null,c.loadedExtentsRtree_=new vd,c.loadingExtentsCount_=0,c.nullGeometryFeatures_={},c.idIndex_={},c.uidIndex_={},c.featureChangeKeys_={},c.featuresCollection_=null;var P,R;return Array.isArray(r.features)?R=r.features:r.features&&(P=r.features,R=P.getArray()),!s&&P===void 0&&(P=new hh(R)),R!==void 0&&c.addFeaturesInternal(R),P!==void 0&&c.bindFeaturesCollection_(P),c}return l.prototype.addFeature=function(o){this.addFeatureInternal(o),this.changed()},l.prototype.addFeatureInternal=function(o){var c=Ai(o);if(!this.addToIndex_(c,o)){this.featuresCollection_&&this.featuresCollection_.remove(o);return}this.setupChangeEvents_(c,o);var r=o.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,o)}else this.nullGeometryFeatures_[c]=o;this.dispatchEvent(new xh(Qa.ADDFEATURE,o))},l.prototype.setupChangeEvents_=function(o,c){this.featureChangeKeys_[o]=[lo(c,Ji.CHANGE,this.handleFeatureChange_,this),lo(c,qp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},l.prototype.addToIndex_=function(o,c){var r=!0,s=c.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=c),r&&(wn(!(o in this.uidIndex_),30),this.uidIndex_[o]=c),r},l.prototype.addFeatures=function(o){this.addFeaturesInternal(o),this.changed()},l.prototype.addFeaturesInternal=function(o){for(var c=[],r=[],s=[],P=0,R=o.length;P<R;P++){var B=o[P],N=Ai(B);this.addToIndex_(N,B)&&r.push(B)}for(var P=0,V=r.length;P<V;P++){var B=r[P],N=Ai(B);this.setupChangeEvents_(N,B);var mt=B.getGeometry();if(mt){var Et=mt.getExtent();c.push(Et),s.push(B)}else this.nullGeometryFeatures_[N]=B}if(this.featuresRtree_&&this.featuresRtree_.load(c,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,It=r.length;P<It;P++)this.dispatchEvent(new xh(Qa.ADDFEATURE,r[P]))},l.prototype.bindFeaturesCollection_=function(o){var c=!1;this.addEventListener(Qa.ADDFEATURE,function(r){c||(c=!0,o.push(r.feature),c=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){c||(c=!0,o.remove(r.feature),c=!1)}),o.addEventListener(Es.ADD,function(r){c||(c=!0,this.addFeature(r.element),c=!1)}.bind(this)),o.addEventListener(Es.REMOVE,function(r){c||(c=!0,this.removeFeature(r.element),c=!1)}.bind(this)),this.featuresCollection_=o},l.prototype.clear=function(o){if(o){for(var c in this.featureChangeKeys_){var r=this.featureChangeKeys_[c];r.forEach(Ao)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(B){this.removeFeatureInternal(B)}.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 R=new xh(Qa.CLEAR);this.dispatchEvent(R),this.changed()},l.prototype.forEachFeature=function(o){if(this.featuresRtree_)return this.featuresRtree_.forEach(o);this.featuresCollection_&&this.featuresCollection_.forEach(o)},l.prototype.forEachFeatureAtCoordinateDirect=function(o,c){var r=[o[0],o[1],o[0],o[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(o))return c(s)})},l.prototype.forEachFeatureInExtent=function(o,c){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(o,c);this.featuresCollection_&&this.featuresCollection_.forEach(c)},l.prototype.forEachFeatureIntersectingExtent=function(o,c){return this.forEachFeatureInExtent(o,function(r){var s=r.getGeometry();if(s.intersectsExtent(o)){var P=c(r);if(P)return P}})},l.prototype.getFeaturesCollection=function(){return this.featuresCollection_},l.prototype.getFeatures=function(){var o;return this.featuresCollection_?o=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(o=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ka(o,Sm(this.nullGeometryFeatures_))),o},l.prototype.getFeaturesAtCoordinate=function(o){var c=[];return this.forEachFeatureAtCoordinateDirect(o,function(r){c.push(r)}),c},l.prototype.getFeaturesInExtent=function(o){return this.featuresRtree_?this.featuresRtree_.getInExtent(o):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},l.prototype.getClosestFeatureToCoordinate=function(o,c){var r=o[0],s=o[1],P=null,R=[NaN,NaN],B=1/0,N=[-1/0,-1/0,1/0,1/0],V=c||Tm;return this.featuresRtree_.forEachInExtent(N,function(mt){if(V(mt)){var Et=mt.getGeometry(),It=B;if(B=Et.closestPointXY(r,s,R,B),B<It){P=mt;var Vt=Math.sqrt(B);N[0]=r-Vt,N[1]=s-Vt,N[2]=r+Vt,N[3]=s+Vt}}}),P},l.prototype.getExtent=function(o){return this.featuresRtree_.getExtent(o)},l.prototype.getFeatureById=function(o){var c=this.idIndex_[o.toString()];return c!==void 0?c:null},l.prototype.getFeatureByUid=function(o){var c=this.uidIndex_[o];return c!==void 0?c:null},l.prototype.getFormat=function(){return this.format_},l.prototype.getOverlaps=function(){return this.overlaps_},l.prototype.getUrl=function(){return this.url_},l.prototype.handleFeatureChange_=function(o){var c=o.target,r=Ai(c),s=c.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(c),this.nullGeometryFeatures_[r]=c);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,c)):this.featuresRtree_&&this.featuresRtree_.update(P,c)}var R=c.getId();if(R!==void 0){var B=R.toString();this.idIndex_[B]!==c&&(this.removeFromIdIndex_(c),this.idIndex_[B]=c)}else this.removeFromIdIndex_(c),this.uidIndex_[r]=c;this.changed(),this.dispatchEvent(new xh(Qa.CHANGEFEATURE,c))},l.prototype.hasFeature=function(o){var c=o.getId();return c!==void 0?c in this.idIndex_:Ai(o)in this.uidIndex_},l.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},l.prototype.loadFeatures=function(o,c,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(o,c,r),R=function(mt,Et){var It=P[mt],Vt=s.forEachInExtent(It,function(Ht){return sc(Ht.extent,It)});Vt||(++B.loadingExtentsCount_,B.dispatchEvent(new xh(Qa.FEATURESLOADSTART)),B.loader_.call(B,It,c,r,function(Ht){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADEND,void 0,Ht))}.bind(B),function(){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADERROR))}.bind(B)),s.insert(It,{extent:It.slice()}))},B=this,N=0,V=P.length;N<V;++N)R(N,V);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},l.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},l.prototype.removeLoadedExtent=function(o){var c=this.loadedExtentsRtree_,r;c.forEachInExtent(o,function(s){if(Fm(s.extent,o))return r=s,!0}),r&&c.remove(r)},l.prototype.removeFeature=function(o){if(!!o){var c=Ai(o);c in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[c]:this.featuresRtree_&&this.featuresRtree_.remove(o);var r=this.removeFeatureInternal(o);r&&this.changed()}},l.prototype.removeFeatureInternal=function(o){var c=Ai(o),r=this.featureChangeKeys_[c];if(!!r){r.forEach(Ao),delete this.featureChangeKeys_[c];var s=o.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[c],this.dispatchEvent(new xh(Qa.REMOVEFEATURE,o)),o}},l.prototype.removeFromIdIndex_=function(o){var c=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===o){delete this.idIndex_[r],c=!0;break}return c},l.prototype.setLoader=function(o){this.loader_=o},l.prototype.setUrl=function(o){wn(this.format_,7),this.url_=o,this.setLoader(p_(o,this.format_))},l}(cf),ip=C2;var y0=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),hf=function(y){y0(l,y);function l(o,c){var r=y.call(this,o)||this;return r.layer=c,r}return l}(_s);var f_={LAYERS:"layers"},A2=function(y){y0(l,y);function l(o){var c=this,r=o||{},s=La({},r);delete s.layers;var P=r.layers;return c=y.call(this,s)||this,c.on,c.once,c.un,c.layersListenerKeys_=[],c.listenerKeys_={},c.addChangeListener(f_.LAYERS,c.handleLayersChanged_),P?Array.isArray(P)?P=new hh(P.slice(),{unique:!0}):wn(typeof P.getArray=="function",43):P=new hh(void 0,{unique:!0}),c.setLayers(P),c}return l.prototype.handleLayerChange_=function(){this.changed()},l.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Ao),this.layersListenerKeys_.length=0;var o=this.getLayers();this.layersListenerKeys_.push(lo(o,Es.ADD,this.handleLayersAdd_,this),lo(o,Es.REMOVE,this.handleLayersRemove_,this));for(var c in this.listenerKeys_)this.listenerKeys_[c].forEach(Ao);ih(this.listenerKeys_);for(var r=o.getArray(),s=0,P=r.length;s<P;s++){var R=r[s];this.registerLayerListeners_(R),this.dispatchEvent(new hf("addlayer",R))}this.changed()},l.prototype.registerLayerListeners_=function(o){var c=[lo(o,qp.PROPERTYCHANGE,this.handleLayerChange_,this),lo(o,Ji.CHANGE,this.handleLayerChange_,this)];o instanceof l&&c.push(lo(o,"addlayer",this.handleLayerGroupAdd_,this),lo(o,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ai(o)]=c},l.prototype.handleLayerGroupAdd_=function(o){this.dispatchEvent(new hf("addlayer",o.layer))},l.prototype.handleLayerGroupRemove_=function(o){this.dispatchEvent(new hf("removelayer",o.layer))},l.prototype.handleLayersAdd_=function(o){var c=o.element;this.registerLayerListeners_(c),this.dispatchEvent(new hf("addlayer",c)),this.changed()},l.prototype.handleLayersRemove_=function(o){var c=o.element,r=Ai(c);this.listenerKeys_[r].forEach(Ao),delete this.listenerKeys_[r],this.dispatchEvent(new hf("removelayer",c)),this.changed()},l.prototype.getLayers=function(){return this.get(f_.LAYERS)},l.prototype.setLayers=function(o){var c=this.getLayers();if(c)for(var r=c.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new hf("removelayer",r[s]));this.set(f_.LAYERS,o)},l.prototype.getLayersArray=function(o){var c=o!==void 0?o:[];return this.getLayers().forEach(function(r){r.getLayersArray(c)}),c},l.prototype.getLayerStatesArray=function(o){var c=o!==void 0?o:[],r=c.length;this.getLayers().forEach(function(V){V.getLayerStatesArray(c)});var s=this.getLayerState(),P=s.zIndex;!o&&s.zIndex===void 0&&(P=0);for(var R=r,B=c.length;R<B;R++){var N=c[R];N.opacity*=s.opacity,N.visible=N.visible&&s.visible,N.maxResolution=Math.min(N.maxResolution,s.maxResolution),N.minResolution=Math.max(N.minResolution,s.minResolution),N.minZoom=Math.max(N.minZoom,s.minZoom),N.maxZoom=Math.min(N.maxZoom,s.maxZoom),s.extent!==void 0&&(N.extent!==void 0?N.extent=Gv(N.extent,s.extent):N.extent=s.extent),N.zIndex===void 0&&(N.zIndex=P)}return c},l.prototype.getSourceState=function(){return Su.READY},l}(Gm),d_=A2;var ia={SINGLECLICK:"singleclick",CLICK:Ji.CLICK,DBLCLICK:Ji.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var m_={ACTIVE:"active"};var P2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),M2=function(y){P2(l,y);function l(o){var c=y.call(this)||this;return c.on,c.once,c.un,o&&o.handleEvent&&(c.handleEvent=o.handleEvent),c.map_=null,c.setActive(!0),c}return l.prototype.getActive=function(){return this.get(m_.ACTIVE)},l.prototype.getMap=function(){return this.map_},l.prototype.handleEvent=function(o){return!0},l.prototype.setActive=function(o){this.set(m_.ACTIVE,o)},l.prototype.setMap=function(o){this.map_=o},l}(Po);var _0=M2;var k2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),L2=function(y){k2(l,y);function l(o){var c=this,r=o||{};return c=y.call(this,r)||this,r.handleDownEvent&&(c.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(c.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(c.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(c.handleUpEvent=r.handleUpEvent),r.stopDown&&(c.stopDown=r.stopDown),c.handlingDownUpSequence=!1,c.trackedPointers_={},c.targetPointers=[],c}return l.prototype.getPointerCount=function(){return this.targetPointers.length},l.prototype.handleDownEvent=function(o){return!1},l.prototype.handleDragEvent=function(o){},l.prototype.handleEvent=function(o){if(!o.originalEvent)return!0;var c=!1;if(this.updateTrackedPointers_(o),this.handlingDownUpSequence){if(o.type==ia.POINTERDRAG)this.handleDragEvent(o),o.originalEvent.preventDefault();else if(o.type==ia.POINTERUP){var r=this.handleUpEvent(o);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(o.type==ia.POINTERDOWN){var s=this.handleDownEvent(o);this.handlingDownUpSequence=s,c=this.stopDown(s)}else o.type==ia.POINTERMOVE&&this.handleMoveEvent(o);return!c},l.prototype.handleMoveEvent=function(o){},l.prototype.handleUpEvent=function(o){return!1},l.prototype.stopDown=function(o){return o},l.prototype.updateTrackedPointers_=function(o){if(z2(o)){var c=o.originalEvent,r=c.pointerId.toString();o.type==ia.POINTERUP?delete this.trackedPointers_[r]:o.type==ia.POINTERDOWN?this.trackedPointers_[r]=c:r in this.trackedPointers_&&(this.trackedPointers_[r]=c),this.targetPointers=Sm(this.trackedPointers_)}},l}(_0);function z2(y){var l=y.type;return l===ia.POINTERDOWN||l===ia.POINTERDRAG||l===ia.POINTERUP}var v0=L2;var x0=function(y){var l=y.originalEvent;return l.altKey&&!(l.metaKey||l.ctrlKey)&&!l.shiftKey};var b0=Tm,w0=function(y){return y.type==ia.CLICK};var E0=function(y){return y.type==ia.SINGLECLICK};var T0=function(y){var l=y.originalEvent;return wn(l!==void 0,56),l.isPrimary&&l.button===0};var D2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),R2=function(y){D2(l,y);function l(o,c,r){var s=y.call(this)||this;if(s.ends_=[],s.maxDelta_=-1,s.maxDeltaRevision_=-1,Array.isArray(o[0]))s.setCoordinates(o,c);else if(c!==void 0&&r)s.setFlatCoordinates(c,o),s.ends_=r;else{for(var P=s.getLayout(),R=o,B=[],N=[],V=0,mt=R.length;V<mt;++V){var Et=R[V];V===0&&(P=Et.getLayout()),Ka(B,Et.getFlatCoordinates()),N.push(B.length)}s.setFlatCoordinates(P,B),s.ends_=N}return s}return l.prototype.appendLineString=function(o){this.flatCoordinates?Ka(this.flatCoordinates,o.getFlatCoordinates().slice()):this.flatCoordinates=o.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},l.prototype.clone=function(){var o=new l(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,r,s){return s<bs(this.getExtent(),o,c)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(nd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ad(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,o,c,r,s))},l.prototype.getCoordinateAtM=function(o,c,r){if(this.layout!=An.XYM&&this.layout!=An.XYZM||this.flatCoordinates.length===0)return null;var s=c!==void 0?c:!1,P=r!==void 0?r:!1;return Ax(this.flatCoordinates,0,this.ends_,this.stride,o,s,P)},l.prototype.getCoordinates=function(){return fh(this.flatCoordinates,0,this.ends_,this.stride)},l.prototype.getEnds=function(){return this.ends_},l.prototype.getLineString=function(o){return o<0||this.ends_.length<=o?null:new uc(this.flatCoordinates.slice(o===0?0:this.ends_[o-1],this.ends_[o]),this.layout)},l.prototype.getLineStrings=function(){for(var o=this.flatCoordinates,c=this.ends_,r=this.layout,s=[],P=0,R=0,B=c.length;R<B;++R){var N=c[R],V=new uc(o.slice(P,N),r);s.push(V),P=N}return s},l.prototype.getFlatMidpoints=function(){for(var o=[],c=this.flatCoordinates,r=0,s=this.ends_,P=this.stride,R=0,B=s.length;R<B;++R){var N=s[R],V=Hm(c,r,N,P,.5);Ka(o,V),r=N}return o},l.prototype.getSimplifiedGeometryInternal=function(o){var c=[],r=[];return c.length=gx(this.flatCoordinates,0,this.ends_,this.stride,o,c,0,r),new l(c,An.XY,r)},l.prototype.getType=function(){return Pe.MULTI_LINE_STRING},l.prototype.intersectsExtent=function(o){return wx(this.flatCoordinates,0,this.ends_,this.stride,o)},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=sd(this.flatCoordinates,0,o,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},l}(Ts),S0=R2;var O2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),F2=function(y){O2(l,y);function l(o,c){var r=y.call(this)||this;return c&&!Array.isArray(o[0])?r.setFlatCoordinates(c,o):r.setCoordinates(o,c),r}return l.prototype.appendPoint=function(o){this.flatCoordinates?Ka(this.flatCoordinates,o.getFlatCoordinates()):this.flatCoordinates=o.getFlatCoordinates().slice(),this.changed()},l.prototype.clone=function(){var o=new l(this.flatCoordinates.slice(),this.layout);return o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,r,s){if(s<bs(this.getExtent(),o,c))return s;for(var P=this.flatCoordinates,R=this.stride,B=0,N=P.length;B<N;B+=R){var V=ql(o,c,P[B],P[B+1]);if(V<s){s=V;for(var mt=0;mt<R;++mt)r[mt]=P[B+mt];r.length=R}}return s},l.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},l.prototype.getPoint=function(o){var c=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return o<0||c<=o?null:new ya(this.flatCoordinates.slice(o*this.stride,(o+1)*this.stride),this.layout)},l.prototype.getPoints=function(){for(var o=this.flatCoordinates,c=this.layout,r=this.stride,s=[],P=0,R=o.length;P<R;P+=r){var B=new ya(o.slice(P,P+r),c);s.push(B)}return s},l.prototype.getType=function(){return Pe.MULTI_POINT},l.prototype.intersectsExtent=function(o){for(var c=this.flatCoordinates,r=this.stride,s=0,P=c.length;s<P;s+=r){var R=c[s],B=c[s+1];if(Jf(o,R,B))return!0}return!1},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Jh(this.flatCoordinates,0,o,this.stride),this.changed()},l}(Ts),ng=F2;function I0(y,l,o,c){for(var r=[],s=Ya(),P=0,R=o.length;P<R;++P){var B=o[P];s=Om(y,l,B[0],c),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),l=B[B.length-1]}return r}var B2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),U2=function(y){B2(l,y);function l(o,c,r){var s=y.call(this)||this;if(s.endss_=[],s.flatInteriorPointsRevision_=-1,s.flatInteriorPoints_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,!r&&!Array.isArray(o[0])){for(var P=s.getLayout(),R=o,B=[],N=[],V=0,mt=R.length;V<mt;++V){var Et=R[V];V===0&&(P=Et.getLayout());for(var It=B.length,Vt=Et.getEnds(),Ht=0,Ct=Vt.length;Ht<Ct;++Ht)Vt[Ht]+=It;Ka(B,Et.getFlatCoordinates()),N.push(Vt)}c=P,o=B,r=N}return c!==void 0&&r?(s.setFlatCoordinates(c,o),s.endss_=r):s.setCoordinates(o,c),s}return l.prototype.appendPolygon=function(o){var c;if(!this.flatCoordinates)this.flatCoordinates=o.getFlatCoordinates().slice(),c=o.getEnds().slice(),this.endss_.push();else{var r=this.flatCoordinates.length;Ka(this.flatCoordinates,o.getFlatCoordinates()),c=o.getEnds().slice();for(var s=0,P=c.length;s<P;++s)c[s]+=r}this.endss_.push(c),this.changed()},l.prototype.clone=function(){for(var o=this.endss_.length,c=new Array(o),r=0;r<o;++r)c[r]=this.endss_[r].slice();var s=new l(this.flatCoordinates.slice(),this.layout,c);return s.applyProperties(this),s},l.prototype.closestPointXY=function(o,c,r,s){return s<bs(this.getExtent(),o,c)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(px(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),fx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,o,c,r,s))},l.prototype.containsXY=function(o,c){return xx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o,c)},l.prototype.getArea=function(){return _x(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},l.prototype.getCoordinates=function(o){var c;return o!==void 0?(c=this.getOrientedFlatCoordinates().slice(),qy(c,0,this.endss_,this.stride,o)):c=this.flatCoordinates,ud(c,0,this.endss_,this.stride)},l.prototype.getEndss=function(){return this.endss_},l.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var o=I0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=bx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},l.prototype.getInteriorPoints=function(){return new ng(this.getFlatInteriorPoints().slice(),An.XYM)},l.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var o=this.flatCoordinates;Ix(o,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=o:(this.orientedFlatCoordinates_=o.slice(),this.orientedFlatCoordinates_.length=qy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},l.prototype.getSimplifiedGeometryInternal=function(o){var c=[],r=[];return c.length=yx(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(o),c,0,r),new l(c,An.XY,r)},l.prototype.getPolygon=function(o){if(o<0||this.endss_.length<=o)return null;var c;if(o===0)c=0;else{var r=this.endss_[o-1];c=r[r.length-1]}var s=this.endss_[o].slice(),P=s[s.length-1];if(c!==0)for(var R=0,B=s.length;R<B;++R)s[R]-=c;return new pd(this.flatCoordinates.slice(c,P),this.layout,s)},l.prototype.getPolygons=function(){for(var o=this.layout,c=this.flatCoordinates,r=this.endss_,s=[],P=0,R=0,B=r.length;R<B;++R){var N=r[R].slice(),V=N[N.length-1];if(P!==0)for(var mt=0,Et=N.length;mt<Et;++mt)N[mt]-=P;var It=new pd(c.slice(P,V),o,N);s.push(It),P=V}return s},l.prototype.getType=function(){return Pe.MULTI_POLYGON},l.prototype.intersectsExtent=function(o){return Ex(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o)},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=mx(this.flatCoordinates,0,o,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{var s=r[r.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()},l}(Ts),C0=U2;var L0=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),A0=0,xd=1,P0=[0,0,0,0],pf=[],g_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},y_=function(y){L0(l,y);function l(o,c,r){var s=y.call(this,o)||this;return s.features=c,s.mapBrowserEvent=r,s}return l}(_s);var N2=function(y){L0(l,y);function l(o){var c=y.call(this,o)||this;c.on,c.once,c.un,c.boundHandleFeatureChange_=c.handleFeatureChange_.bind(c),c.condition_=o.condition?o.condition:T0,c.defaultDeleteCondition_=function(s){return x0(s)&&E0(s)},c.deleteCondition_=o.deleteCondition?o.deleteCondition:c.defaultDeleteCondition_,c.insertVertexCondition_=o.insertVertexCondition?o.insertVertexCondition:b0,c.vertexFeature_=null,c.vertexSegments_=null,c.lastPixel_=[0,0],c.ignoreNextSingleClick_=!1,c.featuresBeingModified_=null,c.rBush_=new vd,c.pixelTolerance_=o.pixelTolerance!==void 0?o.pixelTolerance:10,c.snappedToVertex_=!1,c.changingFeature_=!1,c.dragSegments_=[],c.overlay_=new rp({source:new ip({useSpatialIndex:!1,wrapX:!!o.wrapX}),style:o.style?o.style:G2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),c.SEGMENT_WRITERS_={Point:c.writePointGeometry_.bind(c),LineString:c.writeLineStringGeometry_.bind(c),LinearRing:c.writeLineStringGeometry_.bind(c),Polygon:c.writePolygonGeometry_.bind(c),MultiPoint:c.writeMultiPointGeometry_.bind(c),MultiLineString:c.writeMultiLineStringGeometry_.bind(c),MultiPolygon:c.writeMultiPolygonGeometry_.bind(c),Circle:c.writeCircleGeometry_.bind(c),GeometryCollection:c.writeGeometryCollectionGeometry_.bind(c)},c.source_=null,c.hitDetection_=null;var r;if(o.features?r=o.features:o.source&&(c.source_=o.source,r=new hh(c.source_.getFeatures()),c.source_.addEventListener(Qa.ADDFEATURE,c.handleSourceAdd_.bind(c)),c.source_.addEventListener(Qa.REMOVEFEATURE,c.handleSourceRemove_.bind(c))),!r)throw new Error("The modify interaction requires features, a source or a layer");return o.hitDetection&&(c.hitDetection_=o.hitDetection),c.features_=r,c.features_.forEach(c.addFeature_.bind(c)),c.features_.addEventListener(Es.ADD,c.handleFeatureAdd_.bind(c)),c.features_.addEventListener(Es.REMOVE,c.handleFeatureRemove_.bind(c)),c.lastPointerEvent_=null,c.delta_=[0,0],c.snapToPointer_=o.snapToPointer===void 0?!c.hitDetection_:o.snapToPointer,c}return l.prototype.addFeature_=function(o){var c=o.getGeometry();if(c){var r=this.SEGMENT_WRITERS_[c.getType()];r&&r(o,c)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),o.addEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},l.prototype.willModifyFeatures_=function(o,c){if(!this.featuresBeingModified_){this.featuresBeingModified_=new hh;for(var r=this.featuresBeingModified_.getArray(),s=0,P=c.length;s<P;++s)for(var R=c[s],B=0,N=R.length;B<N;++B){var V=R[B].feature;V&&r.indexOf(V)===-1&&this.featuresBeingModified_.push(V)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new y_(g_.MODIFYSTART,this.featuresBeingModified_,o))}},l.prototype.removeFeature_=function(o){this.removeFeatureSegmentData_(o),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),o.removeEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},l.prototype.removeFeatureSegmentData_=function(o){var c=this.rBush_,r=[];c.forEach(function(B){o===B.feature&&r.push(B)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],R=this.dragSegments_.length-1;R>=0;--R)this.dragSegments_[R][0]===P&&this.dragSegments_.splice(R,1);c.remove(P)}},l.prototype.setActive=function(o){this.vertexFeature_&&!o&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,o)},l.prototype.setMap=function(o){this.overlay_.setMap(o),y.prototype.setMap.call(this,o)},l.prototype.getOverlay=function(){return this.overlay_},l.prototype.handleSourceAdd_=function(o){o.feature&&this.features_.push(o.feature)},l.prototype.handleSourceRemove_=function(o){o.feature&&this.features_.remove(o.feature)},l.prototype.handleFeatureAdd_=function(o){this.addFeature_(o.element)},l.prototype.handleFeatureChange_=function(o){if(!this.changingFeature_){var c=o.target;this.removeFeature_(c),this.addFeature_(c)}},l.prototype.handleFeatureRemove_=function(o){var c=o.element;this.removeFeature_(c)},l.prototype.writePointGeometry_=function(o,c){var r=c.getCoordinates(),s={feature:o,geometry:c,segment:[r,r]};this.rBush_.insert(c.getExtent(),s)},l.prototype.writeMultiPointGeometry_=function(o,c){for(var r=c.getCoordinates(),s=0,P=r.length;s<P;++s){var R=r[s],B={feature:o,geometry:c,depth:[s],index:s,segment:[R,R]};this.rBush_.insert(c.getExtent(),B)}},l.prototype.writeLineStringGeometry_=function(o,c){for(var r=c.getCoordinates(),s=0,P=r.length-1;s<P;++s){var R=r.slice(s,s+2),B={feature:o,geometry:c,index:s,segment:R};this.rBush_.insert(wu(R),B)}},l.prototype.writeMultiLineStringGeometry_=function(o,c){for(var r=c.getCoordinates(),s=0,P=r.length;s<P;++s)for(var R=r[s],B=0,N=R.length-1;B<N;++B){var V=R.slice(B,B+2),mt={feature:o,geometry:c,depth:[s],index:B,segment:V};this.rBush_.insert(wu(V),mt)}},l.prototype.writePolygonGeometry_=function(o,c){for(var r=c.getCoordinates(),s=0,P=r.length;s<P;++s)for(var R=r[s],B=0,N=R.length-1;B<N;++B){var V=R.slice(B,B+2),mt={feature:o,geometry:c,depth:[s],index:B,segment:V};this.rBush_.insert(wu(V),mt)}},l.prototype.writeMultiPolygonGeometry_=function(o,c){for(var r=c.getCoordinates(),s=0,P=r.length;s<P;++s)for(var R=r[s],B=0,N=R.length;B<N;++B)for(var V=R[B],mt=0,Et=V.length-1;mt<Et;++mt){var It=V.slice(mt,mt+2),Vt={feature:o,geometry:c,depth:[B,s],index:mt,segment:It};this.rBush_.insert(wu(It),Vt)}},l.prototype.writeCircleGeometry_=function(o,c){var r=c.getCenter(),s={feature:o,geometry:c,index:A0,segment:[r,r]},P={feature:o,geometry:c,index:xd,segment:[r,r]},R=[s,P];s.featureSegments=R,P.featureSegments=R,this.rBush_.insert(Jp(r),s);var B=c,N=uh();if(N&&this.getMap()){var V=this.getMap().getView().getProjection();B=B.clone().transform(N,V),B=Zy(B).transform(V,N)}this.rBush_.insert(B.getExtent(),P)},l.prototype.writeGeometryCollectionGeometry_=function(o,c){for(var r=c.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],R=this.SEGMENT_WRITERS_[P.getType()];R(o,P)}},l.prototype.createOrUpdateVertexFeature_=function(o,c,r){var s=this.vertexFeature_;if(!s)s=new lc(new ya(o)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(o)}return s.set("features",c),s.set("geometries",r),s},l.prototype.handleEvent=function(o){if(!o.originalEvent)return!0;this.lastPointerEvent_=o;var c;return!o.map.getView().getInteracting()&&o.type==ia.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(o),this.vertexFeature_&&this.deleteCondition_(o)&&(o.type!=ia.SINGLECLICK||!this.ignoreNextSingleClick_?c=this.removePoint():c=!0),o.type==ia.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),y.prototype.handleEvent.call(this,o)&&!c},l.prototype.handleDragEvent=function(o){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(o,this.dragSegments_);for(var c=[o.coordinate[0]+this.delta_[0],o.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,R=this.dragSegments_.length;P<R;++P){var B=this.dragSegments_[P],N=B[0],V=N.feature;r.indexOf(V)===-1&&r.push(V);var mt=N.geometry;s.indexOf(mt)===-1&&s.push(mt);for(var Et=N.depth,It=void 0,Vt=N.segment,Ht=B[1];c.length<mt.getStride();)c.push(Vt[Ht][c.length]);switch(mt.getType()){case Pe.POINT:It=c,Vt[0]=c,Vt[1]=c;break;case Pe.MULTI_POINT:It=mt.getCoordinates(),It[N.index]=c,Vt[0]=c,Vt[1]=c;break;case Pe.LINE_STRING:It=mt.getCoordinates(),It[N.index+Ht]=c,Vt[Ht]=c;break;case Pe.MULTI_LINE_STRING:It=mt.getCoordinates(),It[Et[0]][N.index+Ht]=c,Vt[Ht]=c;break;case Pe.POLYGON:It=mt.getCoordinates(),It[Et[0]][N.index+Ht]=c,Vt[Ht]=c;break;case Pe.MULTI_POLYGON:It=mt.getCoordinates(),It[Et[1]][Et[0]][N.index+Ht]=c,Vt[Ht]=c;break;case Pe.CIRCLE:if(Vt[0]=c,Vt[1]=c,N.index===A0)this.changingFeature_=!0,mt.setCenter(c),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ct=o.map.getView().getProjection(),Gt=by(Xl(mt.getCenter(),Ct),Xl(c,Ct)),te=uh();if(te){var re=mt.clone().transform(te,Ct);re.setRadius(Gt),Gt=re.transform(Ct,te).getRadius()}mt.setRadius(Gt),this.changingFeature_=!1}break;default:}It&&this.setGeometryCoordinates_(mt,It)}this.createOrUpdateVertexFeature_(c,r,s)},l.prototype.handleDownEvent=function(o){if(!this.condition_(o))return!1;var c=o.coordinate;this.handlePointerAtPixel_(o.pixel,o.map,c),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=o.map.getView().getProjection(),P=[],R=r.getGeometry().getCoordinates(),B=wu([R]),N=this.rBush_.getInExtent(B),V={};N.sort(V2);for(var mt=0,Et=N.length;mt<Et;++mt){var It=N[mt],Vt=It.segment,Ht=Ai(It.geometry),Ct=It.depth;if(Ct&&(Ht+="-"+Ct.join("-")),V[Ht]||(V[Ht]=new Array(2)),It.geometry.getType()===Pe.CIRCLE&&It.index===xd){var Gt=k0(c,It,s);Tu(Gt,R)&&!V[Ht][0]&&(this.dragSegments_.push([It,0]),V[Ht][0]=It);continue}if(Tu(Vt[0],R)&&!V[Ht][0]){this.dragSegments_.push([It,0]),V[Ht][0]=It;continue}if(Tu(Vt[1],R)&&!V[Ht][1]){if((It.geometry.getType()===Pe.LINE_STRING||It.geometry.getType()===Pe.MULTI_LINE_STRING)&&V[Ht][0]&&V[Ht][0].index===0)continue;this.dragSegments_.push([It,1]),V[Ht][1]=It;continue}Ai(Vt)in this.vertexSegments_&&!V[Ht][0]&&!V[Ht][1]&&this.insertVertexCondition_(o)&&P.push(It)}P.length&&this.willModifyFeatures_(o,[P]);for(var te=P.length-1;te>=0;--te)this.insertVertex_(P[te],R)}return!!this.vertexFeature_},l.prototype.handleUpEvent=function(o){for(var c=this.dragSegments_.length-1;c>=0;--c){var r=this.dragSegments_[c][0],s=r.geometry;if(s.getType()===Pe.CIRCLE){var P=s.getCenter(),R=r.featureSegments[0],B=r.featureSegments[1];R.segment[0]=P,R.segment[1]=P,B.segment[0]=P,B.segment[1]=P,this.rBush_.update(Jp(P),R);var N=s,V=uh();if(V){var mt=o.map.getView().getProjection();N=N.clone().transform(V,mt),N=Zy(N).transform(mt,V)}this.rBush_.update(N.getExtent(),B)}else this.rBush_.update(wu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new y_(g_.MODIFYEND,this.featuresBeingModified_,o)),this.featuresBeingModified_=null),!1},l.prototype.handlePointerMove_=function(o){this.lastPixel_=o.pixel,this.handlePointerAtPixel_(o.pixel,o.map,o.coordinate)},l.prototype.handlePointerAtPixel_=function(o,c,r){var s=this,P=r||c.getCoordinateFromPixel(o),R=c.getView().getProjection(),B=function(Me,Br){return M0(P,Me,R)-M0(P,Br,R)},N,V;if(this.hitDetection_){var mt=typeof this.hitDetection_=="object"?function(Me){return Me===s.hitDetection_}:void 0;c.forEachFeatureAtPixel(o,function(Me,Br,Tr){if(Tr=Tr||Me.getGeometry(),Tr.getType()===Pe.POINT&&pv(s.features_.getArray(),Me)){V=Tr;var br=Tr.getFlatCoordinates().slice(0,2);N=[{feature:Me,geometry:Tr,segment:[br,br]}]}return!0},{layerFilter:mt})}if(!N){var Et=ed(Jp(P,P0),R),It=c.getView().getResolution()*this.pixelTolerance_,Vt=tf(yl(Et,It,P0),R);N=this.rBush_.getInExtent(Vt)}if(N&&N.length>0){var Ht=N.sort(B)[0],Ct=Ht.segment,Gt=k0(P,Ht,R),te=c.getPixelFromCoordinate(Gt),re=by(o,te);if(V||re<=this.pixelTolerance_){var _e={};if(_e[Ai(Ct)]=!0,this.snapToPointer_||(this.delta_[0]=Gt[0]-P[0],this.delta_[1]=Gt[1]-P[1]),Ht.geometry.getType()===Pe.CIRCLE&&Ht.index===xd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Gt,[Ht.feature],[Ht.geometry]);else{var ye=c.getPixelFromCoordinate(Ct[0]),ce=c.getPixelFromCoordinate(Ct[1]),Te=Qp(te,ye),Ie=Qp(te,ce);re=Math.sqrt(Math.min(Te,Ie)),this.snappedToVertex_=re<=this.pixelTolerance_,this.snappedToVertex_&&(Gt=Te>Ie?Ct[1]:Ct[0]),this.createOrUpdateVertexFeature_(Gt,[Ht.feature],[Ht.geometry]);var Le={};Le[Ai(Ht.geometry)]=!0;for(var ur=1,Ve=N.length;ur<Ve;++ur){var Qe=N[ur].segment;if(Tu(Ct[0],Qe[0])&&Tu(Ct[1],Qe[1])||Tu(Ct[0],Qe[1])&&Tu(Ct[1],Qe[0])){var or=Ai(N[ur].geometry);or in Le||(Le[or]=!0,_e[Ai(Qe)]=!0)}else break}}this.vertexSegments_=_e;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},l.prototype.insertVertex_=function(o,c){for(var r=o.segment,s=o.feature,P=o.geometry,R=o.depth,B=o.index,N;c.length<P.getStride();)c.push(0);switch(P.getType()){case Pe.MULTI_LINE_STRING:N=P.getCoordinates(),N[R[0]].splice(B+1,0,c);break;case Pe.POLYGON:N=P.getCoordinates(),N[R[0]].splice(B+1,0,c);break;case Pe.MULTI_POLYGON:N=P.getCoordinates(),N[R[1]][R[0]].splice(B+1,0,c);break;case Pe.LINE_STRING:N=P.getCoordinates(),N.splice(B+1,0,c);break;default:return}this.setGeometryCoordinates_(P,N);var V=this.rBush_;V.remove(o),this.updateSegmentIndices_(P,B,R,1);var mt={segment:[r[0],c],feature:s,geometry:P,depth:R,index:B};V.insert(wu(mt.segment),mt),this.dragSegments_.push([mt,1]);var Et={segment:[c,r[1]],feature:s,geometry:P,depth:R,index:B+1};V.insert(wu(Et.segment),Et),this.dragSegments_.push([Et,0]),this.ignoreNextSingleClick_=!0},l.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=ia.POINTERDRAG){var o=this.lastPointerEvent_;this.willModifyFeatures_(o,this.dragSegments_);var c=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new y_(g_.MODIFYEND,this.featuresBeingModified_,o)),this.featuresBeingModified_=null,c}return!1},l.prototype.removeVertex_=function(){var o=this.dragSegments_,c={},r=!1,s,P,R,B,N,V,mt,Et,It,Vt,Ht;for(N=o.length-1;N>=0;--N)R=o[N],Vt=R[0],Ht=Ai(Vt.feature),Vt.depth&&(Ht+="-"+Vt.depth.join("-")),Ht in c||(c[Ht]={}),R[1]===0?(c[Ht].right=Vt,c[Ht].index=Vt.index):R[1]==1&&(c[Ht].left=Vt,c[Ht].index=Vt.index+1);for(Ht in c){switch(It=c[Ht].right,mt=c[Ht].left,V=c[Ht].index,Et=V-1,mt!==void 0?Vt=mt:Vt=It,Et<0&&(Et=0),B=Vt.geometry,P=B.getCoordinates(),s=P,r=!1,B.getType()){case Pe.MULTI_LINE_STRING:P[Vt.depth[0]].length>2&&(P[Vt.depth[0]].splice(V,1),r=!0);break;case Pe.LINE_STRING:P.length>2&&(P.splice(V,1),r=!0);break;case Pe.MULTI_POLYGON:s=s[Vt.depth[1]];case Pe.POLYGON:s=s[Vt.depth[0]],s.length>4&&(V==s.length-1&&(V=0),s.splice(V,1),r=!0,V===0&&(s.pop(),s.push(s[0]),Et=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(B,P);var Ct=[];if(mt!==void 0&&(this.rBush_.remove(mt),Ct.push(mt.segment[0])),It!==void 0&&(this.rBush_.remove(It),Ct.push(It.segment[1])),mt!==void 0&&It!==void 0){var Gt={depth:Vt.depth,feature:Vt.feature,geometry:Vt.geometry,index:Et,segment:Ct};this.rBush_.insert(wu(Gt.segment),Gt)}this.updateSegmentIndices_(B,V,Vt.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),o.length=0}}return r},l.prototype.setGeometryCoordinates_=function(o,c){this.changingFeature_=!0,o.setCoordinates(c),this.changingFeature_=!1},l.prototype.updateSegmentIndices_=function(o,c,r,s){this.rBush_.forEachInExtent(o.getExtent(),function(P){P.geometry===o&&(r===void 0||P.depth===void 0||vs(P.depth,r))&&P.index>c&&(P.index+=s)})},l}(v0);function V2(y,l){return y.index-l.index}function M0(y,l,o){var c=l.geometry;if(c.getType()===Pe.CIRCLE){var r=c;if(l.index===xd){var s=uh();s&&(r=r.clone().transform(s,o));var P=Qp(r.getCenter(),Xl(y,o)),R=Math.sqrt(P)-r.getRadius();return R*R}}var B=Xl(y,o);return pf[0]=Xl(l.segment[0],o),pf[1]=Xl(l.segment[1],o),Wv(B,pf)}function k0(y,l,o){var c=l.geometry;if(c.getType()===Pe.CIRCLE&&l.index===xd){var r=c,s=uh();return s&&(r=r.clone().transform(s,o)),Ty(r.getClosestPoint(Xl(y,o)),o)}var P=Xl(y,o);return pf[0]=Xl(l.segment[0],o),pf[1]=Xl(l.segment[1],o),Ty(xy(P,pf),o)}function G2(){var y=Nx();return function(l,o){return y[Pe.POINT]}}var __=N2;var j2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),q2=function(y){j2(l,y);function l(o){var c=y.call(this)||this;return c.geometries_=o||null,c.changeEventsKeys_=[],c.listenGeometriesChange_(),c}return l.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Ao),this.changeEventsKeys_.length=0},l.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var o=0,c=this.geometries_.length;o<c;++o)this.changeEventsKeys_.push(lo(this.geometries_[o],Ji.CHANGE,this.changed,this))},l.prototype.clone=function(){var o=new l(null);return o.setGeometries(this.geometries_),o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,r,s){if(s<bs(this.getExtent(),o,c))return s;for(var P=this.geometries_,R=0,B=P.length;R<B;++R)s=P[R].closestPointXY(o,c,r,s);return s},l.prototype.containsXY=function(o,c){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)if(r[s].containsXY(o,c))return!0;return!1},l.prototype.computeExtent=function(o){Yp(o);for(var c=this.geometries_,r=0,s=c.length;r<s;++r)Nv(o,c[r].getExtent());return o},l.prototype.getGeometries=function(){return z0(this.geometries_)},l.prototype.getGeometriesArray=function(){return this.geometries_},l.prototype.getGeometriesArrayRecursive=function(){for(var o=[],c=this.geometries_,r=0,s=c.length;r<s;++r)c[r].getType()===this.getType()?o=o.concat(c[r].getGeometriesArrayRecursive()):o.push(c[r]);return o},l.prototype.getSimplifiedGeometry=function(o){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),o<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&o<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var c=[],r=this.geometries_,s=!1,P=0,R=r.length;P<R;++P){var B=r[P],N=B.getSimplifiedGeometry(o);c.push(N),N!==B&&(s=!0)}if(s){var V=new l(null);return V.setGeometriesArray(c),V}else return this.simplifiedGeometryMaxMinSquaredTolerance=o,this},l.prototype.getType=function(){return Pe.GEOMETRY_COLLECTION},l.prototype.intersectsExtent=function(o){for(var c=this.geometries_,r=0,s=c.length;r<s;++r)if(c[r].intersectsExtent(o))return!0;return!1},l.prototype.isEmpty=function(){return this.geometries_.length===0},l.prototype.rotate=function(o,c){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].rotate(o,c);this.changed()},l.prototype.scale=function(o,c,r){var s=r;s||(s=Kh(this.getExtent()));for(var P=this.geometries_,R=0,B=P.length;R<B;++R)P[R].scale(o,c,s);this.changed()},l.prototype.setGeometries=function(o){this.setGeometriesArray(z0(o))},l.prototype.setGeometriesArray=function(o){this.unlistenGeometriesChange_(),this.geometries_=o,this.listenGeometriesChange_(),this.changed()},l.prototype.applyTransform=function(o){for(var c=this.geometries_,r=0,s=c.length;r<s;++r)c[r].applyTransform(o);this.changed()},l.prototype.translate=function(o,c){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].translate(o,c);this.changed()},l.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),y.prototype.disposeInternal.call(this)},l}(Xm);function z0(y){for(var l=[],o=0,c=y.length;o<c;++o)l.push(y[o].clone());return l}var D0=q2;var Z2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(l,o){var c;if(o){var r=o.dataProjection?ga(o.dataProjection):this.readProjection(l);o.extent&&r&&r.getUnits()===ac.TILE_PIXELS&&(r=ga(r),r.setWorldExtent(o.extent)),c={dataProjection:r,featureProjection:o.featureProjection}}return this.adaptOptions(c)},y.prototype.adaptOptions=function(l){return La({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},l)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(l,o){return jr()},y.prototype.readFeatures=function(l,o){return jr()},y.prototype.readGeometry=function(l,o){return jr()},y.prototype.readProjection=function(l){return jr()},y.prototype.writeFeature=function(l,o){return jr()},y.prototype.writeFeatures=function(l,o){return jr()},y.prototype.writeGeometry=function(l,o){return jr()},y}(),R0=Z2;function v_(y,l,o){var c=o?ga(o.featureProjection):null,r=o?ga(o.dataProjection):null,s;if(c&&r&&!Yv(c,r)?s=(l?y.clone():y).transform(l?c:r,l?r:c):s=y,l&&o&&o.decimals!==void 0){var P=Math.pow(10,o.decimals),R=function(B){for(var N=0,V=B.length;N<V;++N)B[N]=Math.round(B[N]*P)/P;return B};s===y&&(s=y.clone()),s.applyTransform(R)}return s}var X2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),W2=function(y){X2(l,y);function l(){return y.call(this)||this}return l.prototype.getType=function(){return vh.JSON},l.prototype.readFeature=function(o,c){return this.readFeatureFromObject(og(o),this.getReadOptions(o,c))},l.prototype.readFeatures=function(o,c){return this.readFeaturesFromObject(og(o),this.getReadOptions(o,c))},l.prototype.readFeatureFromObject=function(o,c){return jr()},l.prototype.readFeaturesFromObject=function(o,c){return jr()},l.prototype.readGeometry=function(o,c){return this.readGeometryFromObject(og(o),this.getReadOptions(o,c))},l.prototype.readGeometryFromObject=function(o,c){return jr()},l.prototype.readProjection=function(o){return this.readProjectionFromObject(og(o))},l.prototype.readProjectionFromObject=function(o){return jr()},l.prototype.writeFeature=function(o,c){return JSON.stringify(this.writeFeatureObject(o,c))},l.prototype.writeFeatureObject=function(o,c){return jr()},l.prototype.writeFeatures=function(o,c){return JSON.stringify(this.writeFeaturesObject(o,c))},l.prototype.writeFeaturesObject=function(o,c){return jr()},l.prototype.writeGeometry=function(o,c){return JSON.stringify(this.writeGeometryObject(o,c))},l.prototype.writeGeometryObject=function(o,c){return jr()},l}(R0);function og(y){if(typeof y=="string"){var l=JSON.parse(y);return l||null}else return y!==null?y:null}var O0=W2;var $2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),K2=function(y){$2(l,y);function l(o){var c=this,r=o||{};return c=y.call(this)||this,c.dataProjection=ga(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(c.defaultFeatureProjection=ga(r.featureProjection)),c.geometryName_=r.geometryName,c.extractGeometryName_=r.extractGeometryName,c.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],c}return l.prototype.readFeatureFromObject=function(o,c){var r=null;o.type==="Feature"?r=o:r={type:"Feature",geometry:o,properties:null};var s=x_(r.geometry,c),P=new lc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},l.prototype.readFeaturesFromObject=function(o,c){var r=o,s=null;if(r.type==="FeatureCollection"){var P=o;s=[];for(var R=P.features,B=0,N=R.length;B<N;++B)s.push(this.readFeatureFromObject(R[B],c))}else s=[this.readFeatureFromObject(o,c)];return s},l.prototype.readGeometryFromObject=function(o,c){return x_(o,c)},l.prototype.readProjectionFromObject=function(o){var c=o.crs,r;return c?c.type=="name"?r=ga(c.properties.name):c.type==="EPSG"?r=ga("EPSG:"+c.properties.code):wn(!1,36):r=this.dataProjection,r},l.prototype.writeFeatureObject=function(o,c){c=this.adaptOptions(c);var r={type:"Feature",geometry:null,properties:null},s=o.getId();if(s!==void 0&&(r.id=s),!o.hasProperties())return r;var P=o.getProperties(),R=o.getGeometry();return R&&(r.geometry=b_(R,c),delete P[o.getGeometryName()]),Vl(P)||(r.properties=P),r},l.prototype.writeFeaturesObject=function(o,c){c=this.adaptOptions(c);for(var r=[],s=0,P=o.length;s<P;++s)r.push(this.writeFeatureObject(o[s],c));return{type:"FeatureCollection",features:r}},l.prototype.writeGeometryObject=function(o,c){return b_(o,this.adaptOptions(c))},l}(O0);function x_(y,l){if(!y)return null;var o;switch(y.type){case Pe.POINT:{o=Y2(y);break}case Pe.LINE_STRING:{o=J2(y);break}case Pe.POLYGON:{o=rE(y);break}case Pe.MULTI_POINT:{o=tE(y);break}case Pe.MULTI_LINE_STRING:{o=Q2(y);break}case Pe.MULTI_POLYGON:{o=eE(y);break}case Pe.GEOMETRY_COLLECTION:{o=H2(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return v_(o,!1,l)}function H2(y,l){var o=y.geometries.map(function(c){return x_(c,l)});return new D0(o)}function Y2(y){return new ya(y.coordinates)}function J2(y){return new uc(y.coordinates)}function Q2(y){return new S0(y.coordinates)}function tE(y){return new ng(y.coordinates)}function eE(y){return new C0(y.coordinates)}function rE(y){return new pd(y.coordinates)}function b_(y,l){y=v_(y,!0,l);var o=y.getType(),c;switch(o){case Pe.POINT:{c=lE(y,l);break}case Pe.LINE_STRING:{c=nE(y,l);break}case Pe.POLYGON:{c=uE(y,l);break}case Pe.MULTI_POINT:{c=aE(y,l);break}case Pe.MULTI_LINE_STRING:{c=oE(y,l);break}case Pe.MULTI_POLYGON:{c=sE(y,l);break}case Pe.GEOMETRY_COLLECTION:{c=iE(y,l);break}case Pe.CIRCLE:{c={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+o)}return c}function iE(y,l){var o=y.getGeometriesArray().map(function(c){var r=La({},l);return delete r.featureProjection,b_(c,r)});return{type:"GeometryCollection",geometries:o}}function nE(y,l){return{type:"LineString",coordinates:y.getCoordinates()}}function oE(y,l){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function aE(y,l){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function sE(y,l){var o;return l&&(o=l.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(o)}}function lE(y,l){return{type:"Point",coordinates:y.getCoordinates()}}function uE(y,l){var o;return l&&(o=l.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(o)}}var bl=K2;var ag,cE=new Uint8Array(16);function w_(){if(!ag&&(ag=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ag))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ag(cE)}var F0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function hE(y){return typeof y=="string"&&F0.test(y)}var B0=hE;var va=[];for(sg=0;sg<256;++sg)va.push((sg+256).toString(16).substr(1));var sg;function pE(y){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=(va[y[l+0]]+va[y[l+1]]+va[y[l+2]]+va[y[l+3]]+"-"+va[y[l+4]]+va[y[l+5]]+"-"+va[y[l+6]]+va[y[l+7]]+"-"+va[y[l+8]]+va[y[l+9]]+"-"+va[y[l+10]]+va[y[l+11]]+va[y[l+12]]+va[y[l+13]]+va[y[l+14]]+va[y[l+15]]).toLowerCase();if(!B0(o))throw TypeError("Stringified UUID is invalid");return o}var U0=pE;function fE(y,l,o){y=y||{};var c=y.random||(y.rng||w_)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,l){o=o||0;for(var r=0;r<16;++r)l[o+r]=c[r];return l}return U0(c)}var E_=fE;var np=class extends Po{constructor(l={}){super(),this.defineProperties(l),this.setProperties(l.properties),this.visible=l.visible===void 0?!0:!!l.visible,this.group=l.group,this.copyrights=l.copyrights,this.children=l.children,this.on("change:visible:group",o=>{this.group===o.target.group&&this!==o.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(c=>c.dispatchEvent(o))})}defineProperties(l){let{name:o,key:c,properties:r,hitTolerance:s}={...l},P=E_();Object.defineProperties(this,{name:{value:o},key:{value:c||P},group:{get:()=>this.get("group"),set:R=>{this.set("group",R)}},copyrights:{get:()=>this.get("copyrights"),set:R=>{let B=R&&!Array.isArray(R)?[R]:R;this.set("copyrights",B||[])}},options:{value:l},map:{writable:!0},visible:{get:()=>this.get("visible"),set:R=>{if(R!==this.visible)if(this.set("visible",R),this.visible){if(this.parent&&!this.parent.visible&&(this.parent.visible=!0),this.children&&this.children.find(B=>B.group)){let B=this.children.find(N=>!!N.group);B.visible=!0}if(this.parent&&this.group){let B=this.parent;for(;B.parent;)B=B.parent;B.dispatchEvent({type:"change:visible:group",target:this})}}else this.visible||this.parent&&this.parent.visible&&!this.parent.children.find(B=>B.visible)&&(this.parent.visible=!1)}},disabled:{get:()=>this.get("disabled"),set:R=>{this.set("disabled",R)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:R=>{(this.children||[]).forEach(B=>{B.parent=null}),Array.isArray(R)&&R.forEach(B=>{B.parent=this}),this.set("children",R||[])}},hitTolerance:{value:s||5,writable:!0},properties:{value:{...r||{}}}})}attachToMap(l){this.detachFromMap(),this.map=l,this.children&&this.children.forEach(o=>{o.attachToMap(l)})}detachFromMap(){this.map=null}getFeatureInfoAtCoordinate(l,o){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:l})}flat(){return $f(this)}};var dE=y=>class extends y{constructor(l={}){super(l);let{userInteractions:o=!0,userClickInteractions:c=!0,userHoverInteractions:r=!0,defaultUserInteractions:s=!0}=l;this.userInteractions=o,this.userClickInteractions=c,this.userHoverInteractions=r,this.defaultUserInteractions=s,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:P,onHover:R}=l;this.userInteractions&&this.userClickInteractions&&P&&this.onClick(P),this.userInteractions&&this.userHoverInteractions&&R&&this.onHover(R)}attachToMap(l,o){super.attachToMap(l,o),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(l=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:o,layer:c,coordinate:r}})=>{l(o,c,r)}))}),this.userHoverCallbacks.forEach(l=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:o,layer:c,coordinate:r,event:s}})=>{l(o,c,r,s)}))})}unlistenEvents(){Ha(this.userClickEventsKeys),Ha(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(l){this.userClickCallbacks.push(l),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(l){this.userHoverCallbacks.push(l),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(l){let o=this.userClickCallbacks.indexOf(l);o===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(o,1),this.map&&this.listenEvents())}unHover(l){let o=this.userHoverCallbacks.indexOf(l);o===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(o,1),this.map&&this.listenEvents())}onUserClickCallback(l){let o=l.coordinate||uo(l.lngLat.toArray()),c={features:[],layer:this,coordinate:o,event:l};return this.getFeatureInfoAtCoordinate(o).then(r=>(this.dispatchEvent({type:"user:click",target:r}),r)).catch(()=>c)}onUserMoveCallback(l){let o=l.coordinate||uo(l.lngLat.toArray()),c={features:[],layer:this,coordinate:o,event:l};return this.getFeatureInfoAtCoordinate(o).then(r=>(this.dispatchEvent({type:"user:hover",target:r}),r)).catch(()=>c)}activateUserInteractions(){}deactivateUserInteractions(){}},lg=dE;var bd=class extends lg(np){constructor(l){super(l),this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(l){super.defineProperties(l),Object.defineProperties(this,{olLayer:{value:l.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(l){if(super.attachToMap(l),!!this.map&&(this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.map.getLayers().on("remove",o=>{o.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let o=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(c=>{c.getSource()?.setAttributions(o)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(o)}}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(l){return new bd({...this.options,...l})}},Da=bd;var N0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new _a({color:[0,0,0,1],width:1})}),mE=new Wl({stroke:new _a({color:[0,0,0,1],width:5})}),gE=new Wl({image:N0,stroke:new _a({color:[255,0,0,1],width:3})}),yE=new Wl({image:N0,stroke:new _a({color:[255,0,0,1],width:3,lineDash:[1,10]})}),_E=(y,l)=>{let o=y.get("minResolution"),c=y.get("maxResolution"),r=l<=o&&l>c;return o&&c&&!r?null:y.get("mot")!=="foot"?[mE,gE]:[yE]},wd=class extends Da{constructor(l={}){super(l),this.olLayer=l.olLayer||new rp({source:new ip,style:l.style||_E})}clone(l){return new wd({...this.options,...l})}},ug=wd;var vE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,V0=/^([\d.]+),([\d.]+)$/,G0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,cg="stop-fetch",j0=y=>{let l=[];return y.forEach(o=>{l.push(...o.getGeometry().getCoordinates())}),l},Ed=class extends ch{constructor(l={}){super(l),Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:o=>{o&&(this.set("mot",o),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:o=>{this.set("loading",o)}},modify:{get:()=>this.get("modify"),set:o=>{this.set("modify",o)}}}),this.loading=!1,this.graphs=l.graphs||[["osm",0,99]],this.mot=l.mot||"bus",this.modify=l.modify!==!1,this.routingApiParams=l.routingApiParams||{},this.useRawViaPoints=l.useRawViaPoints||!1,this.snapToClosestStation=l.snapToClosestStation||!1,this.cacheStationData={},this.abortControllers=[],this.apiKey=l.apiKey,this.stopsApiKey=l.stopsApiKey||this.apiKey,this.segments=[],this.stopsApiUrl=l.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Zf({...l}),this.routingLayer=l.routingLayer||new ug({name:"routing-layer",style:l.style}),this.onRouteError=l.onRouteError||(o=>{this.dispatchEvent({type:"change:route",target:this}),this.reset(),console.error(o)}),this.viaPoints=[],this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.apiChangeListener=()=>this.drawRoute(),this.createModifyInteraction()}static getGraphsResolutions(l,o){let c=o.getView();return l.map(([,r,s])=>[c.getResolutionForZoom(r),c.getResolutionForZoom(s||r+1)])}addViaPoint(l,o=-1,c=0){this.viaPoints.splice(o===-1?this.viaPoints.length:o,c,l),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}removeViaPoint(l=this.viaPoints.length-1){this.viaPoints.length&&this.viaPoints[l]&&this.viaPoints.splice(l,1),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}setViaPoints(l){this.viaPoints=[...l],this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer.olLayer.getSource().clear(),this.dispatchEvent({type:"change:route",target:this})}abortRequests(){this.graphs.forEach(([l])=>{this.abortControllers[l]&&this.abortControllers[l].abort(),this.abortControllers[l]=new AbortController}),this.abortControllers[cg]?.abort(),this.abortControllers[cg]=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[cg]);let l=this.viaPoints.map(o=>{if(Array.isArray(o)){let c=this.map.getView().getProjection(),[r,s]=lh(o,c);return this.snapToClosestStation?[`@${s}`,r]:[s,r]}return this.useRawViaPoints?o:`!${o}`});return this.loading=!0,this.routingLayer.olLayer.getSource().clear(),this.viaPoints.forEach((o,c)=>this.drawViaPoint(o,c,this.abortControllers[cg])),Promise.all(this.graphs.map(([o],c)=>{let{signal:r}=this.abortControllers[o];return this.api.route({graph:o,via:`${l.join("|")}`,mot:`${this.mot}`,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams},{signal:r}).then(s=>{if(this.segments=this.format.readFeatures(s),this.mot==="foot"){let B=this.segments.reduce((N,V)=>{let mt=V.get("trg");return N.find(Et=>Et[0]===mt[0]&&Et[1]===mt[1])?N:[...N,mt]},[]);this.segments=B.map(N=>{let V=this.segments.filter(Et=>{let It=Et.get("trg");return It[0]===N[0]&&It[1]===N[1]}),mt=j0(V);return new lc({geometry:new uc(mt)})})}let P=j0(this.segments),R=new lc({geometry:new uc(P)});R.set("graph",o),R.set("mot",this.mot),R.set("minResolution",this.graphsResolutions[c][0]),R.set("maxResolution",this.graphsResolutions[c][1]),this.routingLayer.olLayer.getSource().addFeature(R),this.loading=!1}).catch(s=>{s.name!=="AbortError"&&(this.segments=[],this.dispatchEvent({type:"error",target:this}),this.onRouteError(s,this),this.loading=!1)})}))}drawViaPoint(l,o,c){let r=new lc;if(r.set("viaPointIdx",o),Array.isArray(l))return r.setGeometry(new ya(l)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r);if(!this.useRawViaPoints||G0.test(l)){let N,V;return this.useRawViaPoints?[,N,,V]=G0.exec(l):[N,V]=l.split("$"),fetch(`${this.stopsApiUrl}lookup/${N}?key=${this.stopsApiKey}`,{signal:c.signal}).then(mt=>mt.json()).then(mt=>{let{coordinates:Et}=mt.features[0].geometry;return this.cacheStationData[l]=uo(Et),r.set("viaPointTrack",V),r.setGeometry(new ya(uo(Et))),this.routingLayer.olLayer.getSource().addFeature(r),r}).catch(mt=>{mt.name!=="AbortError"&&(this.dispatchEvent({type:"error",target:this}),this.onRouteError(mt,this),this.loading=!1)})}if(this.useRawViaPoints&&V0.test(l)){let[N,V]=V0.exec(l),mt=uo([parseFloat(V),parseFloat(N)],this.map.getView().getProjection());return r.setGeometry(new ya(mt)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r)}let[,s,,P,R,,B]=vE.exec(l);if(R&&P){let N=uo([parseFloat(R),parseFloat(P)],this.map.getView().getProjection());return r.set("viaPointTrack",B),r.setGeometry(new ya(N)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r)}return s?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${s}&limit=1`,{signal:c.signal}).then(N=>N.json()).then(N=>{let{coordinates:V}=N.features[0].geometry;return this.cacheStationData[l]=uo(V),r.set("viaPointTrack",B),r.setGeometry(new ya(uo(V))),this.routingLayer.olLayer.getSource().addFeature(r),r}).catch(N=>(this.dispatchEvent({type:"error",target:this}),this.onRouteError(N,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(l){let c=l.target.getFeaturesAtPixel(l.pixel).find(r=>r.getGeometry()?.getType()===Pe.POINT&&r.get("viaPointIdx")!==void 0);if(c){this.removeViaPoint(c.get("viaPointIdx"));return}this.addViaPoint(l.coordinate)}onModifyStart(l){let o=-1,c=l.features.getArray().find(s=>s.getGeometry()?.getType()===Pe.LINE_STRING);if(c){let s=yl(new ya(c.getGeometry().getClosestPoint(l.mapBrowserEvent.coordinate)).getExtent(),.001);o=this.segments.findIndex(P=>P.getGeometry().intersectsExtent(s))}let r=(l.features.getArray().filter(s=>s.getGeometry()?.getType()===Pe.POINT)||[])[0];this.initialRouteDrag={viaPoint:r,oldRoute:c&&c.clone(),segmentIndex:o}}onModifyEnd(l){let o=l.mapBrowserEvent.coordinate,{oldRoute:c,viaPoint:r,segmentIndex:s}=this.initialRouteDrag;return r?this.addViaPoint(o,r.get("viaPointIdx"),1):c?s===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(o,s+1):this.addViaPoint(o,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 __({source:this.routingLayer.olLayer.getSource(),pixelTolerance:4,hitDetection:this.routingLayer.olLayer,deleteCondition:l=>{let c=l.target.getFeaturesAtPixel(l.pixel,{hitTolerance:5}).find(r=>r.getGeometry()?.getType()===Pe.POINT&&r.get("index"));return w0(l)&&c?(this.removeViaPoint(c.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(){Ha(this.onMapClickKey)}activate(){super.activate(),this.map?(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Ed.getGraphsResolutions(this.graphs,this.map),this.map.removeInteraction(this.modifyInteraction),this.routingLayer.attachToMap(this.map),this.map.addInteraction(this.modifyInteraction),this.modifyInteraction.setActive(this.modify),this.addListeners()):(this.format=new bl({featureProjection:"EPSG:3857"}),this.graphsResolutions=this.graphs)}deactivate(){this.map&&(this.routingLayer.detachFromMap(this.map),this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset()),super.deactivate()}},q0=Ed;var xE=y=>class extends y{constructor(l={}){super(l);let{apiParams:o,apiKey:c,url:r}=l;this.apiParams={limit:20,...o||{}},this.placeholder=l.placeholder||"Search for a stop...";let s={apiKey:c};r&&(s.url=r),this.api=new Xf(s),this.abortController=new AbortController}render(l){let o=l?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=o.length?"block":"none",this.suggestionsElt.innerHTML="",o.forEach(c=>{let{properties:r}=c,s=document.createElement("div");s.innerHTML=r.name,s.onclick=()=>{this.onSuggestionClick(c)},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=l=>{this.abortController.abort(),this.abortController=new AbortController,this.search(l.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(l,o){return(l!==void 0||l!==null)&&(this.apiParams.q=l),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,o).then(c=>{this.render(c)}).catch(()=>{this.render()})}onSuggestionClick(l){}clear(){!this.suggestionsElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},Z0=xE;var T_=class extends Z0(ch){onSuggestionClick({geometry:l}){let o=uo(l.coordinates);this.map.getView().setCenter(o)}},X0=T_;var $0=jp(W0());var bE=y=>class extends y{constructor(l={}){super(l),this.olLayer=new Yh({source:new cf({}),render:this.getOlLayerRender(this)}),this.styleUrl=l.url,this.apiKey=l.apiKey,this.apiKeyName=l.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(l){super.attachToMap(l),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=null),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 l=document.createElement("div");l.style.position="absolute",l.style.width="100%",l.style.height="100%",!this.apiKey&&!this.styleUrl.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let o=this.getMapboxMapClass();this.mbMap=new o({style:Xh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:l,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent({type:"load",target:this})}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(l){let o=oc(l.target)||[];this.copyrights?.toString()!==o.toString()&&(this.copyrights=o,this.olLayer.getSource()?.setAttributions(o))}getFeatureInfoAtCoordinate(l,o){if(!o||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:l,features:[],layer:this});let c=l&&this.mbMap.project(lh(l));if(this.hitTolerance){let{x:s,y:P}=c;c=[{x:s-this.hitTolerance,y:P-this.hitTolerance},{x:s+this.hitTolerance,y:P+this.hitTolerance}]}let r=this.mbMap.queryRenderedFeatures(c,o).map(s=>{let P=this.format.readFeature(s);return P&&P.set("mapboxFeature",s),P});return Promise.resolve({layer:this,features:r,coordinate:l})}},hg=bE;var op=class extends hg(Da){attachToMap(l){super.attachToMap(l),!(!this.map||this.mbMap)&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(o){console.warn(o)}}))}loadMbMap(){let[l,o]=this.map.getView().getCenter();if((!l||!o)&&(l=0,o=0),this.renderState={center:[l,o],zoom:null,rotation:null,visible:null,opacity:null,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{this.mbMap.resize(),this.copyrights=oc(this.mbMap)||[],this.olLayer.getSource()?.setAttributions(this.copyrights)});let c=this.mbMap.getCanvas();c&&(this.options.tabIndex?c.setAttribute("tabindex",this.options.tabIndex):c.removeAttribute("tabindex"))}getOlLayerRender(){return rf(this)}getMapboxMapClass(){return $0.Map}clone(l){return new op({...this.options,...l})}};var Y0=jp(H0());var ap=class extends hg(Da){getOlLayerRender(){return ef(this)}getMapboxMapClass(){return Y0.Map}clone(l){return new ap({...this.options,...l})}};var Td=class extends Da{constructor(l={}){if(super(l),this.mapboxLayer=l.mapboxLayer,this.disabled=!1,this.styleLayersFilter=l.styleLayersFilter,this.beforeId=l.beforeId,this.featureInfoFilter=l.featureInfoFilter||(o=>o),this.queryRenderedLayersFilter=l.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(l.styleLayer?[l.styleLayer]:l.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),l.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof l.filters=="function"?l.filters(this):l.filters)}),!this.styleLayersFilter&&this.styleLayers){let o=this.styleLayers.map(c=>c.id);this.styleLayersFilter=c=>o.includes(c.id)}}attachToMap(l){if(this.mapboxLayer.map||this.mapboxLayer.attachToMap(l),super.attachToMap(l),!this.map)return;let{mbMap:o}=this.mapboxLayer;if(!o){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(l)}));return}this.mapboxLayer.loaded||o.isStyleLoaded()||o.loaded()?this.onLoad():o.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",c=>{this.applyLayoutVisibility(c)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(l){let{mbMap:o}=this.mapboxLayer;o&&(o.off("load",this.onLoad),this.removeStyleLayers()),super.detachFromMap(l)}addStyleLayers(){let{mbMap:l}=this.mapboxLayer;!l||(this.styleLayers.forEach(o=>{let{id:c,source:r}=o;l.getSource(r)&&!l.getLayer(c)&&l.addLayer(o,this.beforeId)}),this.applyLayoutVisibility())}removeStyleLayers(){let{mbMap:l}=this.mapboxLayer;!l||this.styleLayers.forEach(o=>{l.getLayer(o.id)&&l.removeLayer(o.id)})}onLoad(){this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters();let{mbMap:l}=this.mapboxLayer,o=l.getStyle();if(o&&this.styleLayersFilter){let c=o.layers.filter(this.styleLayersFilter);this.disabled=!c.length}}getFeatureInfoAtCoordinate(l){let{mbMap:o}=this.mapboxLayer;if(!o||!o.isStyleLoaded())return Promise.resolve({coordinate:l,features:[],layer:this});let c=this.styleLayers||[];return this.styleLayersFilter&&(c=o.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(c=o.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(l,{layers:c.map(r=>r&&r.id),validate:!1}).then(r=>{let s=r.features.filter(P=>this.featureInfoFilter(P,this.map.getView().getResolution()));return this.highlight(s),{...r,features:s,layer:this}})}setFilter(l){let{mbMap:o}=this.mapboxLayer;!o||this.styleLayers.forEach(({id:c})=>{o.getLayer(c)&&o.setFilter(c,l)})}setHoverState(l,o){let{mbMap:c}=this.mapboxLayer;!l||!c||l.forEach(r=>{let{source:s,sourceLayer:P}=r.get("mapboxFeature")||{};if(!s&&!P||!r.getId()){r.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.",r.getId(),r.getProperties());return}c.setFeatureState({id:r.getId(),source:s,sourceLayer:P},{hover:o})})}select(l=[]){this.setHoverState(this.selectedFeatures,!1),this.selectedFeatures=l,this.setHoverState(this.selectedFeatures,!0)}highlight(l=[]){let o=this.highlightedFeatures.filter(c=>!this.selectedFeatures.map(r=>r.getId()).includes(c.getId()));this.setHoverState(o,!1),this.highlightedFeatures=l,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(l){let{visible:o}=this,{mbMap:c}=this.mapboxLayer,r=this.styleLayersFilter;if(!c)return;let s=c.getStyle();if(!!s&&r){let P=o?"visible":"none";for(let R=0;R<s.layers.length;R+=1){let B=s.layers[R];r(B)&&c.getLayer(B.id)&&c.setLayoutProperty(B.id,"visibility",P)}}}clone(l){return new Td({...this.options,...l})}},J0=Td;var L_=jp(r1()),z_=jp(s1());var rT=y=>class extends y{constructor(l={}){super({hitTolerance:10,...l}),this.debug=l.debug,this.mode=l.mode||ra.TOPOGRAPHIC,this.api=l.api||new Wf(l),this.tenant=l.tenant||"",this.minZoomNonTrain=l.minZoomNonTrain||9,this.minZoomInterpolation=l.minZoomInterpolation||8,this.format=new bl,this.generalizationLevelByZoom=l.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=o=>l.getGeneralizationLevelByZoom&&l.getGeneralizationLevelByZoom(o,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[o],this.renderTimeIntervalByZoom=l.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=o=>l.getRenderTimeIntervalByZoom&&l.getRenderTimeIntervalByZoom(o,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[o],this.isUpdateBboxOnMoveEnd=l.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,z_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,L_.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(l){let{style:o,speed:c,pixelRatio:r,hoverVehicleId:s,selectedVehicleId:P,filter:R,sort:B,time:N,live:V,canvas:mt,styleOptions:Et}=l,It=c||1,Vt=N||new Date;super.defineProperties(l),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:mt||document.createElement("canvas")},style:{value:o||Hh},styleOptions:{value:{...nf,...Et||{}}},speed:{get:()=>It,set:Ht=>{It=Ht,this.start()}},filter:{value:R,writable:!0},sort:{value:B,writable:!0},live:{value:V===!1?V:!0,writable:!0},time:{get:()=>Vt,set:Ht=>{Vt=Ht&&Ht.getTime?Ht:new Date(Ht),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:s,writable:!0},selectedVehicleId:{value:P,writable:!0},pixelRatio:{value:r||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:l.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:l.useThrottle!==!1,writable:!0},useDebounce:{value:l.useDebounce||!1,writable:!0}})}attachToMap(l){super.attachToMap(l),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",o=>{o.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap()}start(){this.stop(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox()}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs(),this.updateTimeInterval=setInterval(()=>{this.time=this.live?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)}renderTrajectoriesInternal(l,o){if(!this.map)return!1;let c=this.live?Date.now():this.time,r=Object.values(this.trajectories);return this.sort&&r.sort(this.sort),this.renderState=Kf(this.canvas,r,this.style,{...l,pixelRatio:this.pixelRatio,time:c},{noInterpolate:l.zoom<this.minZoomInterpolation?!0:o,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions}),!0}renderTrajectories(l,o){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=null),!o&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(l,o)}):!o&&this.useDebounce?this.debounceRenderTrajectories(l,o):!o&&this.useThrottle?this.throttleRenderTrajectories(l,o):this.renderTrajectoriesInternal(l,o)}setBbox(l,o){let c=Object.keys(this.trajectories);for(let s=c.length-1;s>=0;s-=1)this.purgeTrajectory(this.trajectories[c[s]],l,o);let r=[...l];this.isUpdateBboxOnMoveEnd&&(r.push(o),this.tenant&&r.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(o),this.generalizationLevel&&r.push(`gen=${this.generalizationLevel}`)),this.api.bbox=r}setMode(l){this.mode!==l&&(this.mode=l,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(l){let o=Math.round(l),c=this.getRenderTimeIntervalByZoom(o)||25,r=Math.max(25,c/this.speed),s=Math.min(r,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,z_.default)(this.renderTrajectoriesInternal,s,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,L_.default)(this.renderTrajectoriesInternal,s,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,P]=this.api.buffer;this.api.buffer=[s,P]}return r}getVehicle(l){return Object.values(this.trajectories).filter(l)}getFeatureInfoAtCoordinate(l,o={}){let{resolution:c,nb:r}=o,s=yl([...l,...l],this.hitTolerance*c),P=Object.values(this.trajectories);this.sort&&(P=P.sort(this.sort));let R=[];for(let B=0;B<P.length&&(P[B].properties.coordinate&&Hp(s,P[B].properties.coordinate)&&R.push(P[B]),R.length!==r);B+=1);return Promise.resolve({layer:this,features:R.map(B=>this.format.readFeature(B)),coordinate:l})}getTrajectoryInfos(l){let o=[this.api.getStopSequence(l,this.mode),this.api.getFullTrajectory(l,this.mode,this.generalizationLevel)];return Promise.all(o).then(([c,r])=>({stopSequence:c,fullTrajectory:r}))}purgeTrajectory(l,o,c){let{type:r,bounds:s,train_id:P}=l.properties;return!ko(o,s)||r!=="rail"&&c<(this.minZoomNonTrain||9)?(this.removeTrajectory(P),!0):!1}addTrajectory(l){this.filter&&!this.filter(l)||(this.trajectories[l.properties.train_id]=l,this.renderTrajectories())}removeTrajectory(l){delete this.trajectories[l]}onZoomEnd(l){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?this.stop():this.start())}onTrajectoryMessage(l){if(!l.content)return;let o=l.content,{geometry:c,properties:{train_id:r,time_since_update:s,raw_coordinates:P}}=o;s<0||this.purgeTrajectory(o)||(this.debug&&this.mode===ra.TOPOGRAPHIC&&P?o.properties.olGeometry={type:"Point",coordinates:uo(P,this.map.getView().getProjection())}:o.properties.olGeometry=this.format.readGeometry(c),o.properties.timeOffset=Date.now()-l.timestamp,this.addTrajectory(o))}onDeleteTrajectoryMessage(l){!l.content||this.removeTrajectory(l.content)}onFeatureHover(l,o,c){let[r]=l,s=null;r&&(s=r.get("train_id")),this.hoverVehicleId!==s&&(this.hoverVehicleId=s,this.renderTrajectories(!0))}onFeatureClick(l,o,c){let[r]=l,s=null;r&&(s=r.get("train_id")),this.selectedVehicleId!==s&&(this.selectedVehicleId=s,this.selectedVehicle=r,this.renderTrajectories(!0))}},fg=rT;var iT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new _a({color:"#000000",width:6})}),nT=(y,l,o)=>{let c="#ffffff",r=y.get("type"),s=y.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),c=s||o?.getBgColor(r),c=/#ffffff/i.test(c)?"#ff0000":c,[iT,new Wl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:c})}),stroke:new _a({color:c,width:4})})]},dg=nT;var oT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new _a({color:"#000000",width:6})}),aT=new Wl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new _a({color:"#a0a0a0",width:4})}),sT=()=>[oT,aT],l1=sT;var lT=new bl,Sd=class extends fg(Da){constructor(l={}){super({...l}),this.olLayer=l.olLayer||new d_({layers:[new rp({source:new ip({features:[]}),style:(o,c)=>(l.fullTrajectoryStyle||dg)(o,c,this.styleOptions)}),new Yh({source:new cf({}),render:o=>{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.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:c,resolution:r,rotation:s}=o.viewState,{center:P,resolution:R,rotation:B}=this.renderedViewState;if(R/r>=3)this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height);else{let N=this.map.getPixelFromCoordinate(P),V=this.map.getPixelFromCoordinate(c);this.transformContainer.style.transform=Cv(N[0]-V[0],N[1]-V[1],R/r,R/r,s-B,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:null,rotation:0}}attachToMap(l){super.attachToMap(l),this.map&&this.olListenersKeys.push(this.map.on(["moveend","change:target"],o=>{let c=this.map.getView();if(c.getAnimating()||c.getInteracting())return;let r=c.getZoom();this.currentZoom!==r&&this.onZoomEnd(o),this.currentZoom=r,this.onMoveEnd(o)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(l){if(this.map&&this.canvas){let o=this.canvas.getContext("2d"),c=this.map.getPixelFromCoordinate(l);return!!o.getImageData(c[0]*this.pixelRatio,c[1]*this.pixelRatio,1,1).data[3]}return!1}renderTrajectories(l){if(!this.map)return;let o=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:o.calculateExtent(),resolution:o.getResolution(),rotation:o.getRotation(),zoom:o.getZoom(),pixelRatio:this.pixelRatio},l)}renderTrajectoriesInternal(l,o){if(!this.map)return!1;let c=!1;return c=this.map.getView().getAnimating()||this.map.getView().getInteracting()?!1:super.renderTrajectoriesInternal(l,o),c&&(this.renderedViewState={...l},this.transformContainer&&(this.transformContainer.style.transform="")),c}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(l,o={}){let c=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(l,{resolution:c,...o})}onMoveEnd(){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(l){super.onZoomEnd(l)}onFeatureHover(l,o,c){super.onFeatureHover(l,o,c),this.map.getTargetElement().style.cursor=l.length?"pointer":"auto"}onFeatureClick(l,o,c){super.onFeatureClick(l,o,c),!l.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(l,o,c){return super.purgeTrajectory(l,o||this.map.getView().calculateExtent(),c||this.map.getView().getZoom())}setBbox(l,o){let c=l,r=o;!c&&this.isUpdateBboxOnMoveEnd&&(c=l||this.map.getView().calculateExtent(),r=Math.floor(this.map.getView().getZoom())),super.setBbox(c,r)}highlightTrajectory(l){this.api.getFullTrajectory(l,this.mode,this.generalizationLevel).then(o=>{if(this.vectorLayer.getSource().clear(),!o||!o.features||!o.features.length)return;let r=lT.readFeatures(o);this.vectorLayer.getSource().addFeatures(r)})}clone(l){return new Sd({...this.options,...l})}},u1=Sd;var Id=class extends Da{getFeatureInfoAtCoordinate(l){let o=[];if(this.map){let c=this.map.getPixelFromCoordinate(l);o=this.map.getFeaturesAtPixel(c,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:o,layer:this,coordinate:l})}clone(l){return new Id({...this.options,...l})}},c1=Id;var Cd=class extends Da{constructor(l={}){super(l),this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(l){let o=this.map.getView().getProjection(),c=this.map.getView().getResolution();return this.olLayer.getSource().getFeatureInfoUrl?this.olLayer.getSource().getFeatureInfoUrl(l,c,o,{info_format:"application/json",query_layers:this.olLayer.getSource().getParams().layers}):!1}getFeatureInfoAtCoordinate(l){this.abortController.abort(),this.abortController=new AbortController;let{signal:o}=this.abortController;return fetch(this.getFeatureInfoUrl(l),{signal:o}).then(c=>c.json()).then(c=>c.features).then(c=>({layer:this,coordinate:l,features:c.map(r=>this.format.readFeature(r))})).catch(()=>Promise.resolve({features:[],coordinate:l,layer:this}))}clone(l){return new Cd({...this.options,...l})}},h1=Cd;var _g={};ry(_g,{CopyrightControl:()=>p1,Layer:()=>gg,RealtimeAPI:()=>Wf,RealtimeLayer:()=>C1,RealtimeModes:()=>ra,RoutingAPI:()=>Zf,StopsAPI:()=>Xf,createTrackerFilters:()=>ly,getCircleCanvas:()=>ky,getDelayBgCanvas:()=>Py,getDelayTextCanvas:()=>My,getHoursAndMinutes:()=>wv,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>rf,getMaplibreRender:()=>ef,getTextCanvas:()=>Ly,getUTCDateString:()=>xv,getUTCTimeString:()=>bv,getUrlWithParams:()=>Xh,pad:()=>Mm,realtimeDefaultStyle:()=>Hh,realtimeDelayStyle:()=>zy,realtimeSimpleStyle:()=>Dy,removeDuplicate:()=>Wh,renderTrajectories:()=>Kf,sortByDelay:()=>uy,trackerConfig:()=>nf});var D_=class extends jm(ch){constructor(l){super(l),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return oc(this.map)}},p1=D_;var Ad=class extends lg(np){attachToMap(l){super.attachToMap(l),!!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 l=this.map.getBounds().toArray();return td([...l[0],...l[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(l){return new Ad({...this.options,...l})}},gg=Ad;var Go=63710088e-1,f1={centimeters:Go*100,centimetres:Go*100,degrees:Go/111325,feet:Go*3.28084,inches:Go*39.37,kilometers:Go/1e3,kilometres:Go/1e3,meters:Go,metres:Go,miles:Go/1609.344,millimeters:Go*1e3,millimetres:Go*1e3,nauticalmiles:Go/1852,radians:1,yards:Go*1.0936},s5={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/Go,yards:1.0936133};function d1(y,l,o){o===void 0&&(o={});var c={type:"Feature"};return(o.id===0||o.id)&&(c.id=o.id),o.bbox&&(c.bbox=o.bbox),c.properties=l||{},c.geometry=y,c}function bh(y,l,o){if(o===void 0&&(o={}),!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(!R_(y[0])||!R_(y[1]))throw new Error("coordinates must contain numbers");var c={type:"Point",coordinates:y};return d1(c,l,o)}function uT(y,l){l===void 0&&(l="kilometers");var o=f1[l];if(!o)throw new Error(l+" units is invalid");return y*o}function cT(y,l){l===void 0&&(l="kilometers");var o=f1[l];if(!o)throw new Error(l+" units is invalid");return y/o}function m1(y){var l=y%(2*Math.PI);return l*180/Math.PI}function sp(y){var l=y%360;return l*Math.PI/180}function yg(y,l,o){if(l===void 0&&(l="kilometers"),o===void 0&&(o="kilometers"),!(y>=0))throw new Error("length must be a positive number");return uT(cT(y,l),o)}function R_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function O_(y){return!!y&&y.constructor===Object}function Pd(y,l,o){if(y!==null)for(var c,r,s,P,R,B,N,V=0,mt=0,Et,It=y.type,Vt=It==="FeatureCollection",Ht=It==="Feature",Ct=Vt?y.features.length:1,Gt=0;Gt<Ct;Gt++){N=Vt?y.features[Gt].geometry:Ht?y.geometry:y,Et=N?N.type==="GeometryCollection":!1,R=Et?N.geometries.length:1;for(var te=0;te<R;te++){var re=0,_e=0;if(P=Et?N.geometries[te]:N,P!==null){B=P.coordinates;var ye=P.type;switch(V=o&&(ye==="Polygon"||ye==="MultiPolygon")?1:0,ye){case null:break;case"Point":if(l(B,mt,Gt,re,_e)===!1)return!1;mt++,re++;break;case"LineString":case"MultiPoint":for(c=0;c<B.length;c++){if(l(B[c],mt,Gt,re,_e)===!1)return!1;mt++,ye==="MultiPoint"&&re++}ye==="LineString"&&re++;break;case"Polygon":case"MultiLineString":for(c=0;c<B.length;c++){for(r=0;r<B[c].length-V;r++){if(l(B[c][r],mt,Gt,re,_e)===!1)return!1;mt++}ye==="MultiLineString"&&re++,ye==="Polygon"&&_e++}ye==="Polygon"&&re++;break;case"MultiPolygon":for(c=0;c<B.length;c++){for(_e=0,r=0;r<B[c].length;r++){for(s=0;s<B[c][r].length-V;s++){if(l(B[c][r][s],mt,Gt,re,_e)===!1)return!1;mt++}_e++}re++}break;case"GeometryCollection":for(c=0;c<P.geometries.length;c++)if(Pd(P.geometries[c],l,o)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function hT(y,l){l===void 0&&(l={});var o=0,c=0,r=0;return Pd(y,function(s){o+=s[0],c+=s[1],r++},!0),bh([o/r,c/r],l.properties)}var g1=hT;function Mu(y){if(!y)throw new Error("coord is required");if(!Array.isArray(y)){if(y.type==="Feature"&&y.geometry!==null&&y.geometry.type==="Point")return y.geometry.coordinates;if(y.type==="Point")return y.coordinates}if(Array.isArray(y)&&y.length>=2&&!Array.isArray(y[0])&&!Array.isArray(y[1]))return y;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function y1(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 pT(y,l,o){o===void 0&&(o={});var c;o.final?c=_1(Mu(l),Mu(y)):c=_1(Mu(y),Mu(l));var r=c>180?-(360-c):c;return r}function _1(y,l){var o=sp(y[1]),c=sp(l[1]),r=sp(l[0]-y[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),P=Math.atan2(r,s);return(m1(P)+360)%360}var v1=pT;function fT(y,l,o){o===void 0&&(o={});var c=Mu(y),r=Mu(l);r[0]+=r[0]-c[0]>180?-360:c[0]-r[0]>180?360:0;var s=dT(c,r),P=yg(s,"meters",o.units);return P}function dT(y,l,o){o=o===void 0?Go:Number(o);var c=o,r=y[1]*Math.PI/180,s=l[1]*Math.PI/180,P=s-r,R=Math.abs(l[0]-y[0])*Math.PI/180;R>Math.PI&&(R-=2*Math.PI);var B=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),N=Math.abs(B)>1e-11?P/B:Math.cos(r),V=Math.sqrt(P*P+N*N*R*R),mt=V*c;return mt}var x1=fT;function mT(y,l,o,c){c===void 0&&(c={});var r=l<0,s=yg(Math.abs(l),c.units,"meters");r&&(s=-Math.abs(s));var P=Mu(y),R=gT(P,s,o);return R[0]+=R[0]-P[0]>180?-360:P[0]-R[0]>180?360:0,bh(R,c.properties)}function gT(y,l,o,c){c=c===void 0?Go:Number(c);var r=l/c,s=y[0]*Math.PI/180,P=sp(y[1]),R=sp(o),B=r*Math.cos(R),N=P+B;Math.abs(N)>Math.PI/2&&(N=N>0?Math.PI-N:-Math.PI-N);var V=Math.log(Math.tan(N/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),mt=Math.abs(V)>1e-11?B/V:Math.cos(P),Et=r*Math.sin(R)/mt,It=s+Et;return[(It*180/Math.PI+540)%360-180,N*180/Math.PI]}var b1=mT;function yT(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return w1(y);case"FeatureCollection":return _T(y);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return F_(y);default:throw new Error("unknown GeoJSON type")}}function w1(y){var l={type:"Feature"};return Object.keys(y).forEach(function(o){switch(o){case"type":case"properties":case"geometry":return;default:l[o]=y[o]}}),l.properties=E1(y.properties),l.geometry=F_(y.geometry),l}function E1(y){var l={};return y&&Object.keys(y).forEach(function(o){var c=y[o];typeof c=="object"?c===null?l[o]=null:Array.isArray(c)?l[o]=c.map(function(r){return r}):l[o]=E1(c):l[o]=c}),l}function _T(y){var l={type:"FeatureCollection"};return Object.keys(y).forEach(function(o){switch(o){case"type":case"features":return;default:l[o]=y[o]}}),l.features=y.features.map(function(o){return w1(o)}),l}function F_(y){var l={type:y.type};return y.bbox&&(l.bbox=y.bbox),y.type==="GeometryCollection"?(l.geometries=y.geometries.map(function(o){return F_(o)}),l):(l.coordinates=T1(y.coordinates),l)}function T1(y){var l=y;return typeof l[0]!="object"?l.slice():l.map(function(o){return T1(o)})}var S1=yT;function vT(y,l,o){if(o=o||{},!O_(o))throw new Error("options is invalid");var c=o.pivot,r=o.mutate;if(!y)throw new Error("geojson is required");if(l==null||isNaN(l))throw new Error("angle is required");return l===0||(c||(c=g1(y)),(r===!1||r===void 0)&&(y=S1(y)),Pd(y,function(s){var P=v1(c,s),R=P+l,B=x1(c,s),N=y1(b1(c,B,R));s[0]=N[0],s[1]=N[1]})),y}var B_=vT;var I1=y=>{let l=y.getBounds().toArray(),o=uo(l[0]),c=uo(l[1]),r=[...o,...c],{width:s,height:P}=y.getCanvas(),R=ws(r)/s,B=Eu(r)/P;return Math.max(R,B)},U_=(y,l)=>{let{width:o,height:c}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:c/l}),P=y.unproject({x:o/l,y:c/l}),R=y.unproject({x:o/l,y:0});return[[r.lng,r.lat],[R.lng,R.lat],[P.lng,P.lat],[s.lng,s.lat]]};var N_=class extends fg(gg){constructor(l={}){super({...l}),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(l,o){if(!l)return;let c=l.getCanvas();super.attachToMap(l,{width:c.width/this.pixelRatio,height:c.height/this.pixelRatio}),this.source={type:"canvas",canvas:this.canvas,coordinates:U_(l,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=o,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"}},l.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(l=>{Ha(l)}),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(l){super.onUserMoveCallback({coordinate:uo(l.lngLat.toArray()),...l})}renderTrajectories(l){if(!this.map)return;let{width:o,height:c}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:c/this.pixelRatio}),P=this.map.unproject({x:o/this.pixelRatio,y:0}),R=B_(bh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,B=B_(bh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,N=[...uo(R),...uo(B)],V=ws(N)/(o/this.pixelRatio),mt=Eu(N)/(c/this.pixelRatio),Et=Math.max(V,mt),It={size:[o/this.pixelRatio,c/this.pixelRatio],center:uo([r.lng,r.lat]),extent:N,resolution:Et,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(It,l)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(l,o={}){let c=I1(this.map);return super.getFeatureInfoAtCoordinate(l,{resolution:c,...o})}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(l,o,c){return super.purgeTrajectory(l,o||this.getMercatorExtent(),c||Math.floor(this.map.getZoom()+1))}setBbox(l,o){let c=l,r=o;!c&&this.isUpdateBboxOnMoveEnd&&(c=l||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(c,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(l,o){let c=super.renderTrajectoriesInternal(l,o);if(c&&this.map.style){let r=U_(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return c}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(l,o,c){super.onFeatureHover(l,o,c),this.map.getCanvasContainer().style.cursor=l.length?"pointer":"auto"}},C1=N_;var V_={ol:mg,mapbox:_g};typeof window<"u"&&(window.mbt=V_);var i3=V_;})();
|
|
1082
|
+
`){Tr+=Br,Br=0,Qe=Et*ye+Ve*It,++Pr;continue}var ti=Vt[xr+1]||B.font;ti!==Ir&&(r&&or.push("font",ti),c&&Me.push("font",ti),Ir=ti),Br=Math.max(Br,re[br]);var vi=[je,Qe+Ve*te[br]+Et*(te[br]-_e[Pr]),.5*(It+Br)+Tr];Qe+=te[br],r&&or.push("strokeText",vi),c&&Me.push("fillText",vi),++br}return Array.prototype.push.apply(ce,or),Array.prototype.push.apply(ce,Me),this.labels_[s]=Le,Le},y.prototype.replayTextBackground_=function(l,o,c,r,s,P,R){l.beginPath(),l.moveTo.apply(l,o),l.lineTo.apply(l,c),l.lineTo.apply(l,r),l.lineTo.apply(l,s),l.lineTo.apply(l,o),P&&(this.alignFill_=P[2],this.fill_(l)),R&&(this.setStrokeStyle_(l,R),l.stroke())},y.prototype.calculateImageOrLabelDimensions_=function(l,o,c,r,s,P,R,B,N,V,mt,Et,It,Vt,Ht,Ct){R*=Et[0],B*=Et[1];var Gt=c-R,te=r-B,re=s+N>l?l-N:s,_e=P+V>o?o-V:P,ye=Vt[3]+re*Et[0]+Vt[1],ce=Vt[0]+_e*Et[1]+Vt[2],Te=Gt-Vt[3],Ie=te-Vt[0];(Ht||mt!==0)&&(yh[0]=Te,_h[0]=Te,yh[1]=Ie,yc[1]=Ie,yc[0]=Te+ye,_c[0]=yc[0],_c[1]=Ie+ce,_h[1]=_c[1]);var Le;return mt!==0?(Le=xs(za(),c,r,1,1,mt,-c,-r),xo(Le,yh),xo(Le,yc),xo(Le,_c),xo(Le,_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]),uf)):sh(Math.min(Te,Te+ye),Math.min(Ie,Ie+ce),Math.max(Te,Te+ye),Math.max(Ie,Ie+ce),uf),It&&(Gt=Math.round(Gt),te=Math.round(te)),{drawImageX:Gt,drawImageY:te,drawImageW:re,drawImageH:_e,originX:N,originY:V,declutterBox:{minX:uf[0],minY:uf[1],maxX:uf[2],maxY:uf[3],value:Ct},canvasTransform:Le,scale:Et}},y.prototype.replayImageOrLabel_=function(l,o,c,r,s,P,R){var B=!!(P||R),N=r.declutterBox,V=l.canvas,mt=R?R[2]*r.scale[0]/2:0,Et=N.minX-mt<=V.width/o&&N.maxX+mt>=0&&N.minY-mt<=V.height/o&&N.maxY+mt>=0;return Et&&(B&&this.replayTextBackground_(l,yh,yc,_c,_h,P,R),Rx(l,r.canvasTransform,s,c,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0},y.prototype.fill_=function(l){if(this.alignFill_){var o=xo(this.renderedTransform_,[0,0]),c=512*this.pixelRatio;l.save(),l.translate(o[0]%c,o[1]%c),l.rotate(this.viewRotation_)}l.fill(),this.alignFill_&&l.restore()},y.prototype.setStrokeStyle_=function(l,o){l.strokeStyle=o[1],l.lineWidth=o[2],l.lineCap=o[3],l.lineJoin=o[4],l.miterLimit=o[5],l.setLineDash&&(l.lineDashOffset=o[7],l.setLineDash(o[6]))},y.prototype.drawLabelWithPointPlacement_=function(l,o,c,r){var s=this.textStates[o],P=this.createLabel(l,o,r,c),R=this.strokeStates[c],B=this.pixelRatio,N=t0(Array.isArray(l)?l[0]:l,s.textAlign||gh),V=md[s.textBaseline||ep],mt=R&&R.lineWidth?R.lineWidth:0,Et=P.width/B-2*s.scale[0],It=N*Et+2*(.5-N)*mt,Vt=V*P.height/B+2*(.5-V)*mt;return{label:P,anchorX:It,anchorY:Vt}},y.prototype.execute_=function(l,o,c,r,s,P,R,B){var N;this.pixelCoordinates_&&vs(c,this.renderedTransform_)?N=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),N=_l(this.coordinates,0,this.coordinates.length,2,c,this.pixelCoordinates_),Sv(this.renderedTransform_,c));for(var V=0,mt=r.length,Et=0,It,Vt,Ht,Ct,Gt,te,re,_e,ye,ce,Te,Ie,Le=0,ur=0,Ve=null,Qe=null,or=this.coordinateCache_,Me=this.viewRotation_,Br=Math.round(Math.atan2(-c[1],c[0])*1e12)/1e12,Tr={context:l,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:Me},br=this.instructions!=r||this.overlaps?0:200,Pr,Ir,xr,ai;V<mt;){var je=r[V],ti=je[0];switch(ti){case qr.BEGIN_GEOMETRY:Pr=je[1],ai=je[3],Pr.getGeometry()?R!==void 0&&!ko(R,ai.getExtent())?V=je[2]+1:++V:V=je[2];break;case qr.BEGIN_PATH:Le>br&&(this.fill_(l),Le=0),ur>br&&(l.stroke(),ur=0),!Le&&!ur&&(l.beginPath(),Ct=NaN,Gt=NaN),++V;break;case qr.CIRCLE:Et=je[1];var vi=N[Et],di=N[Et+1],tn=N[Et+2],Vr=N[Et+3],Ri=tn-vi,Pn=Vr-di,Ni=Math.sqrt(Ri*Ri+Pn*Pn);l.moveTo(vi+Ni,di),l.arc(vi,di,Ni,0,2*Math.PI,!0),++V;break;case qr.CLOSE_PATH:l.closePath(),++V;break;case qr.CUSTOM:Et=je[1],It=je[2];var Mr=je[3],to=je[4],Zi=je.length==6?je[5]:void 0;Tr.geometry=Mr,Tr.feature=Pr,V in or||(or[V]=[]);var sn=or[V];Zi?Zi(N,Et,It,2,sn):(sn[0]=N[Et],sn[1]=N[Et+1],sn.length=2),to(sn,Tr),++V;break;case qr.DRAW_IMAGE:Et=je[1],It=je[2],_e=je[3],Vt=je[4],Ht=je[5];var jo=je[6],Zn=je[7],Yr=je[8],ln=je[9],Xn=je[10],Wn=je[11],On=je[12],Xi=je[13],mn=je[14];if(!_e&&je.length>=19){ye=je[18],ce=je[19],Te=je[20],Ie=je[21];var En=this.drawLabelWithPointPlacement_(ye,ce,Te,Ie);_e=En.label,je[3]=_e;var bo=je[22];Vt=(En.anchorX-bo)*this.pixelRatio,je[4]=Vt;var we=je[23];Ht=(En.anchorY-we)*this.pixelRatio,je[5]=Ht,jo=_e.height,je[6]=jo,Xi=_e.width,je[13]=Xi}var We=void 0;je.length>24&&(We=je[24]);var co=void 0,gn=void 0,Xr=void 0;je.length>16?(co=je[15],gn=je[16],Xr=je[17]):(co=dc,gn=!1,Xr=!1),Xn&&Br?Wn+=Me:!Xn&&!Br&&(Wn-=Me);for(var Mn=0;Et<It;Et+=2)if(!(We&&We[Mn++]<Xi/this.pixelRatio)){var Oi=this.calculateImageOrLabelDimensions_(_e.width,_e.height,N[Et],N[Et+1],Xi,jo,Vt,Ht,Yr,ln,Wn,On,s,co,gn||Xr,Pr),fn=[l,o,_e,Oi,Zn,gn?Ve:null,Xr?Qe:null],$n=void 0,Ze=void 0;if(B&&mn){var Ur=It-Et;if(!mn[Ur]){mn[Ur]=fn;continue}if($n=mn[Ur],delete mn[Ur],Ze=Qx($n),B.collides(Ze))continue}B&&B.collides(Oi.declutterBox)||($n&&(B&&B.insert(Ze),this.replayImageOrLabel_.apply(this,$n)),B&&B.insert(Oi.declutterBox),this.replayImageOrLabel_.apply(this,fn))}++V;break;case qr.DRAW_CHARS:var Rr=je[1],Vi=je[2],Tn=je[3],Cr=je[4];Ie=je[5];var eo=je[6],Wi=je[7],bi=je[8];Te=je[9];var et=je[10];ye=je[11],ce=je[12];var ht=[je[13],je[13]],dt=this.textStates[ce],Tt=dt.font,zt=[dt.scale[0]*Wi,dt.scale[1]*Wi],Wt=void 0;Tt in this.widths_?Wt=this.widths_[Tt]:(Wt={},this.widths_[Tt]=Wt);var Jt=Ym(N,Rr,Vi,2),bt=Math.abs(zt[0])*Yy(Tt,ye,Wt);if(Cr||bt<=Jt){var Ut=this.textStates[ce].textAlign,it=(Jt-bt)*md[Ut],X=Jx(N,Rr,Vi,2,ye,it,eo,Math.abs(zt[0]),Yy,Tt,Wt,Br?0:this.viewRotation_);t:if(X){var J=[],rt=void 0,lt=void 0,At=void 0,kt=void 0,gt=void 0;if(Te)for(rt=0,lt=X.length;rt<lt;++rt){gt=X[rt],At=gt[4],kt=this.createLabel(At,ce,"",Te),Vt=gt[2]+(zt[0]<0?-et:et),Ht=Tn*kt.height+(.5-Tn)*2*et*zt[1]/zt[0]-bi;var Oi=this.calculateImageOrLabelDimensions_(kt.width,kt.height,gt[0],gt[1],kt.width,kt.height,Vt,Ht,0,0,gt[3],ht,!1,dc,!1,Pr);if(B&&B.collides(Oi.declutterBox))break t;J.push([l,o,kt,Oi,1,null,null])}if(Ie)for(rt=0,lt=X.length;rt<lt;++rt){gt=X[rt],At=gt[4],kt=this.createLabel(At,ce,Ie,""),Vt=gt[2],Ht=Tn*kt.height-bi;var Oi=this.calculateImageOrLabelDimensions_(kt.width,kt.height,gt[0],gt[1],kt.width,kt.height,Vt,Ht,0,0,gt[3],ht,!1,dc,!1,Pr);if(B&&B.collides(Oi.declutterBox))break t;J.push([l,o,kt,Oi,1,null,null])}B&&B.load(J.map(Qx));for(var St=0,Lt=J.length;St<Lt;++St)this.replayImageOrLabel_.apply(this,J[St])}}++V;break;case qr.END_GEOMETRY:if(P!==void 0){Pr=je[1];var Kt=P(Pr,ai);if(Kt)return Kt}++V;break;case qr.FILL:br?Le++:this.fill_(l),++V;break;case qr.MOVE_TO_LINE_TO:for(Et=je[1],It=je[2],Ir=N[Et],xr=N[Et+1],te=Ir+.5|0,re=xr+.5|0,(te!==Ct||re!==Gt)&&(l.moveTo(Ir,xr),Ct=te,Gt=re),Et+=2;Et<It;Et+=2)Ir=N[Et],xr=N[Et+1],te=Ir+.5|0,re=xr+.5|0,(Et==It-2||te!==Ct||re!==Gt)&&(l.lineTo(Ir,xr),Ct=te,Gt=re);++V;break;case qr.SET_FILL_STYLE:Ve=je,this.alignFill_=je[2],Le&&(this.fill_(l),Le=0,ur&&(l.stroke(),ur=0)),l.fillStyle=je[1],++V;break;case qr.SET_STROKE_STYLE:Qe=je,ur&&(l.stroke(),ur=0),this.setStrokeStyle_(l,je),++V;break;case qr.STROKE:br?ur++:l.stroke(),++V;break;default:++V;break}}Le&&this.fill_(l),ur&&l.stroke()},y.prototype.execute=function(l,o,c,r,s,P){this.viewRotation_=r,this.execute_(l,o,c,this.instructions,s,void 0,void 0,P)},y.prototype.executeHitDetection=function(l,o,c,r,s){return this.viewRotation_=c,this.execute_(l,1,o,this.hitDetectionInstructions,!0,r,s)},y}(),e0=Kw;var o_=[Rn.POLYGON,Rn.CIRCLE,Rn.LINE_STRING,Rn.IMAGE,Rn.TEXT,Rn.DEFAULT],Hw=function(){function y(l,o,c,r,s,P){this.maxExtent_=l,this.overlaps_=r,this.pixelRatio_=c,this.resolution_=o,this.renderBuffer_=P,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=za(),this.createExecutors_(s)}return y.prototype.clip=function(l,o){var c=this.getClipCoords(o);l.beginPath(),l.moveTo(c[0],c[1]),l.lineTo(c[2],c[3]),l.lineTo(c[4],c[5]),l.lineTo(c[6],c[7]),l.clip()},y.prototype.createExecutors_=function(l){for(var o in l){var c=this.executorsByZIndex_[o];c===void 0&&(c={},this.executorsByZIndex_[o]=c);var r=l[o];for(var s in r){var P=r[s];c[s]=new e0(this.resolution_,this.pixelRatio_,this.overlaps_,P)}}},y.prototype.hasExecutors=function(l){for(var o in this.executorsByZIndex_)for(var c=this.executorsByZIndex_[o],r=0,s=l.length;r<s;++r)if(l[r]in c)return!0;return!1},y.prototype.forEachFeatureAtCoordinate=function(l,o,c,r,s,P){r=Math.round(r);var R=r*2+1,B=xs(this.hitDetectionTransform_,r+.5,r+.5,1/o,-1/o,-c,-l[0],-l[1]),N=!this.hitDetectionContext_;N&&(this.hitDetectionContext_=Ja(R,R));var V=this.hitDetectionContext_;V.canvas.width!==R||V.canvas.height!==R?(V.canvas.width=R,V.canvas.height=R):N||V.clearRect(0,0,R,R);var mt;this.renderBuffer_!==void 0&&(mt=Ya(),dy(mt,l),yl(mt,o*(this.renderBuffer_+r),mt));var Et=Yw(r),It;function Vt(ce,Te){for(var Ie=V.getImageData(0,0,R,R).data,Le=0,ur=Et.length;Le<ur;Le++)if(Ie[Et[Le]]>0){if(!P||It!==Rn.IMAGE&&It!==Rn.TEXT||P.indexOf(ce)!==-1){var Ve=(Et[Le]-3)/4,Qe=r-Ve%R,or=r-(Ve/R|0),Me=s(ce,Te,Qe*Qe+or*or);if(Me)return Me}V.clearRect(0,0,R,R);break}}var Ht=Object.keys(this.executorsByZIndex_).map(Number);Ht.sort(rh);var Ct,Gt,te,re,_e;for(Ct=Ht.length-1;Ct>=0;--Ct){var ye=Ht[Ct].toString();for(te=this.executorsByZIndex_[ye],Gt=o_.length-1;Gt>=0;--Gt)if(It=o_[Gt],re=te[It],re!==void 0&&(_e=re.executeHitDetection(V,B,c,Vt,mt),_e))return _e}},y.prototype.getClipCoords=function(l){var o=this.maxExtent_;if(!o)return null;var c=o[0],r=o[1],s=o[2],P=o[3],R=[c,r,c,P,s,P,s,r];return _l(R,0,8,2,l,R),R},y.prototype.isEmpty=function(){return Vl(this.executorsByZIndex_)},y.prototype.execute=function(l,o,c,r,s,P,R){var B=Object.keys(this.executorsByZIndex_).map(Number);B.sort(rh),this.maxExtent_&&(l.save(),this.clip(l,c));var N=P||o_,V,mt,Et,It,Vt,Ht;for(R&&B.reverse(),V=0,mt=B.length;V<mt;++V){var Ct=B[V].toString();for(Vt=this.executorsByZIndex_[Ct],Et=0,It=N.length;Et<It;++Et){var Gt=N[Et];Ht=Vt[Gt],Ht!==void 0&&Ht.execute(l,o,c,r,s,R)}}this.maxExtent_&&l.restore()},y}(),a_={};function Yw(y){if(a_[y]!==void 0)return a_[y];for(var l=y*2+1,o=y*y,c=new Array(o+1),r=0;r<=y;++r)for(var s=0;s<=y;++s){var P=r*r+s*s;if(P>o)break;var R=c[P];R||(R=[],c[P]=R),R.push(((y+r)*l+(y+s))*4+3),r>0&&R.push(((y-r)*l+(y+s))*4+3),s>0&&(R.push(((y+r)*l+(y-s))*4+3),r>0&&R.push(((y-r)*l+(y-s))*4+3))}for(var B=[],r=0,N=c.length;r<N;++r)c[r]&&B.push.apply(B,c[r]);return a_[y]=B,B}var s_=Hw;var yd={ANIMATING:0,INTERACTING:1};var Jw=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),Qw=function(y){Jw(l,y);function l(o,c,r,s,P,R,B){var N=y.call(this)||this;return N.context_=o,N.pixelRatio_=c,N.extent_=r,N.transform_=s,N.viewRotation_=P,N.squaredTolerance_=R,N.userTransform_=B,N.contextFillState_=null,N.contextStrokeState_=null,N.contextTextState_=null,N.fillState_=null,N.strokeState_=null,N.image_=null,N.imageAnchorX_=0,N.imageAnchorY_=0,N.imageHeight_=0,N.imageOpacity_=0,N.imageOriginX_=0,N.imageOriginY_=0,N.imageRotateWithView_=!1,N.imageRotation_=0,N.imageScale_=[0,0],N.imageWidth_=0,N.text_="",N.textOffsetX_=0,N.textOffsetY_=0,N.textRotateWithView_=!1,N.textRotation_=0,N.textScale_=[0,0],N.textFillState_=null,N.textStrokeState_=null,N.textState_=null,N.pixelCoordinates_=[],N.tmpLocalTransform_=za(),N}return l.prototype.drawImages_=function(o,c,r,s){if(!!this.image_){var P=_l(o,c,r,s,this.transform_,this.pixelCoordinates_),R=this.context_,B=this.tmpLocalTransform_,N=R.globalAlpha;this.imageOpacity_!=1&&(R.globalAlpha=N*this.imageOpacity_);var V=this.imageRotation_;this.imageRotateWithView_&&(V+=this.viewRotation_);for(var mt=0,Et=P.length;mt<Et;mt+=2){var It=P[mt]-this.imageAnchorX_,Vt=P[mt+1]-this.imageAnchorY_;if(V!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){var Ht=It+this.imageAnchorX_,Ct=Vt+this.imageAnchorY_;xs(B,Ht,Ct,1,1,V,-Ht,-Ct),R.setTransform.apply(R,B),R.translate(Ht,Ct),R.scale(this.imageScale_[0],this.imageScale_[1]),R.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),R.setTransform(1,0,0,1,0,0)}else R.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,It,Vt,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(R.globalAlpha=N)}},l.prototype.drawText_=function(o,c,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(o,c,r,s,this.transform_,this.pixelCoordinates_),R=this.context_,B=this.textRotation_;for(this.textRotateWithView_&&(B+=this.viewRotation_);c<r;c+=s){var N=P[c]+this.textOffsetX_,V=P[c+1]+this.textOffsetY_;if(B!==0||this.textScale_[0]!=1||this.textScale_[1]!=1){var mt=xs(this.tmpLocalTransform_,N,V,1,1,B,-N,-V);R.setTransform.apply(R,mt),R.translate(N,V),R.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&R.strokeText(this.text_,0,0),this.textFillState_&&R.fillText(this.text_,0,0),R.setTransform(1,0,0,1,0,0)}else this.textStrokeState_&&R.strokeText(this.text_,N,V),this.textFillState_&&R.fillText(this.text_,N,V)}}},l.prototype.moveToLineTo_=function(o,c,r,s,P){var R=this.context_,B=_l(o,c,r,s,this.transform_,this.pixelCoordinates_);R.moveTo(B[0],B[1]);var N=B.length;P&&(N-=2);for(var V=2;V<N;V+=2)R.lineTo(B[V],B[V+1]);return P&&R.closePath(),r},l.prototype.drawRings_=function(o,c,r,s){for(var P=0,R=r.length;P<R;++P)c=this.moveToLineTo_(o,c,r[P],s,!0);return c},l.prototype.drawCircle=function(o){if(!!ko(this.extent_,o.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=cx(o,this.transform_,this.pixelCoordinates_),r=c[2]-c[0],s=c[3]-c[1],P=Math.sqrt(r*r+s*s),R=this.context_;R.beginPath(),R.arc(c[0],c[1],P,0,2*Math.PI),this.fillState_&&R.fill(),this.strokeState_&&R.stroke()}this.text_!==""&&this.drawText_(o.getCenter(),0,2,2)}},l.prototype.setStyle=function(o){this.setFillStrokeStyle(o.getFill(),o.getStroke()),this.setImageStyle(o.getImage()),this.setTextStyle(o.getText())},l.prototype.setTransform=function(o){this.transform_=o},l.prototype.drawGeometry=function(o){var c=o.getType();switch(c){case Pe.POINT:this.drawPoint(o);break;case Pe.LINE_STRING:this.drawLineString(o);break;case Pe.POLYGON:this.drawPolygon(o);break;case Pe.MULTI_POINT:this.drawMultiPoint(o);break;case Pe.MULTI_LINE_STRING:this.drawMultiLineString(o);break;case Pe.MULTI_POLYGON:this.drawMultiPolygon(o);break;case Pe.GEOMETRY_COLLECTION:this.drawGeometryCollection(o);break;case Pe.CIRCLE:this.drawCircle(o);break;default:}},l.prototype.drawFeature=function(o,c){var r=c.getGeometryFunction()(o);!r||!ko(this.extent_,r.getExtent())||(this.setStyle(c),this.drawGeometry(r))},l.prototype.drawGeometryCollection=function(o){for(var c=o.getGeometriesArray(),r=0,s=c.length;r<s;++r)this.drawGeometry(c[r])},l.prototype.drawPoint=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getFlatCoordinates(),r=o.getStride();this.image_&&this.drawImages_(c,0,c.length,r),this.text_!==""&&this.drawText_(c,0,c.length,r)},l.prototype.drawMultiPoint=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getFlatCoordinates(),r=o.getStride();this.image_&&this.drawImages_(c,0,c.length,r),this.text_!==""&&this.drawText_(c,0,c.length,r)},l.prototype.drawLineString=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,o.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var c=this.context_,r=o.getFlatCoordinates();c.beginPath(),this.moveToLineTo_(r,0,r.length,o.getStride(),!1),c.stroke()}if(this.text_!==""){var s=o.getFlatMidpoint();this.drawText_(s,0,2,2)}}},l.prototype.drawMultiLineString=function(o){this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_));var c=o.getExtent();if(!!ko(this.extent_,c)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);var r=this.context_,s=o.getFlatCoordinates(),P=0,R=o.getEnds(),B=o.getStride();r.beginPath();for(var N=0,V=R.length;N<V;++N)P=this.moveToLineTo_(s,P,R[N],B,!1);r.stroke()}if(this.text_!==""){var mt=o.getFlatMidpoints();this.drawText_(mt,0,mt.length,2)}}},l.prototype.drawPolygon=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,o.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=this.context_;c.beginPath(),this.drawRings_(o.getOrientedFlatCoordinates(),0,o.getEnds(),o.getStride()),this.fillState_&&c.fill(),this.strokeState_&&c.stroke()}if(this.text_!==""){var r=o.getFlatInteriorPoint();this.drawText_(r,0,2,2)}}},l.prototype.drawMultiPolygon=function(o){if(this.squaredTolerance_&&(o=o.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ko(this.extent_,o.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);var c=this.context_,r=o.getOrientedFlatCoordinates(),s=0,P=o.getEndss(),R=o.getStride();c.beginPath();for(var B=0,N=P.length;B<N;++B){var V=P[B];s=this.drawRings_(r,s,V,R)}this.fillState_&&c.fill(),this.strokeState_&&c.stroke()}if(this.text_!==""){var mt=o.getFlatInteriorPoints();this.drawText_(mt,0,mt.length,2)}}},l.prototype.setContextFillState_=function(o){var c=this.context_,r=this.contextFillState_;r?r.fillStyle!=o.fillStyle&&(r.fillStyle=o.fillStyle,c.fillStyle=o.fillStyle):(c.fillStyle=o.fillStyle,this.contextFillState_={fillStyle:o.fillStyle})},l.prototype.setContextStrokeState_=function(o){var c=this.context_,r=this.contextStrokeState_;r?(r.lineCap!=o.lineCap&&(r.lineCap=o.lineCap,c.lineCap=o.lineCap),c.setLineDash&&(vs(r.lineDash,o.lineDash)||c.setLineDash(r.lineDash=o.lineDash),r.lineDashOffset!=o.lineDashOffset&&(r.lineDashOffset=o.lineDashOffset,c.lineDashOffset=o.lineDashOffset)),r.lineJoin!=o.lineJoin&&(r.lineJoin=o.lineJoin,c.lineJoin=o.lineJoin),r.lineWidth!=o.lineWidth&&(r.lineWidth=o.lineWidth,c.lineWidth=o.lineWidth),r.miterLimit!=o.miterLimit&&(r.miterLimit=o.miterLimit,c.miterLimit=o.miterLimit),r.strokeStyle!=o.strokeStyle&&(r.strokeStyle=o.strokeStyle,c.strokeStyle=o.strokeStyle)):(c.lineCap=o.lineCap,c.setLineDash&&(c.setLineDash(o.lineDash),c.lineDashOffset=o.lineDashOffset),c.lineJoin=o.lineJoin,c.lineWidth=o.lineWidth,c.miterLimit=o.miterLimit,c.strokeStyle=o.strokeStyle,this.contextStrokeState_={lineCap:o.lineCap,lineDash:o.lineDash,lineDashOffset:o.lineDashOffset,lineJoin:o.lineJoin,lineWidth:o.lineWidth,miterLimit:o.miterLimit,strokeStyle:o.strokeStyle})},l.prototype.setContextTextState_=function(o){var c=this.context_,r=this.contextTextState_,s=o.textAlign?o.textAlign:gh;r?(r.font!=o.font&&(r.font=o.font,c.font=o.font),r.textAlign!=s&&(r.textAlign=s,c.textAlign=s),r.textBaseline!=o.textBaseline&&(r.textBaseline=o.textBaseline,c.textBaseline=o.textBaseline)):(c.font=o.font,c.textAlign=s,c.textBaseline=o.textBaseline,this.contextTextState_={font:o.font,textAlign:s,textBaseline:o.textBaseline})},l.prototype.setFillStrokeStyle=function(o,c){var r=this;if(!o)this.fillState_=null;else{var s=o.getColor();this.fillState_={fillStyle:Ss(s||Is)}}if(!c)this.strokeState_=null;else{var P=c.getColor(),R=c.getLineCap(),B=c.getLineDash(),N=c.getLineDashOffset(),V=c.getLineJoin(),mt=c.getWidth(),Et=c.getMiterLimit(),It=B||cc;this.strokeState_={lineCap:R!==void 0?R:tp,lineDash:this.pixelRatio_===1?It:It.map(function(Vt){return Vt*r.pixelRatio_}),lineDashOffset:(N||hc)*this.pixelRatio_,lineJoin:V!==void 0?V:Iu,lineWidth:(mt!==void 0?mt:mc)*this.pixelRatio_,miterLimit:Et!==void 0?Et:pc,strokeStyle:Ss(P||fc)}}},l.prototype.setImageStyle=function(o){var c;if(!o||!(c=o.getSize())){this.image_=null;return}var r=o.getAnchor(),s=o.getOrigin();this.image_=o.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*this.pixelRatio_,this.imageAnchorY_=r[1]*this.pixelRatio_,this.imageHeight_=c[1]*this.pixelRatio_,this.imageOpacity_=o.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=o.getRotateWithView(),this.imageRotation_=o.getRotation(),this.imageScale_=o.getScaleArray(),this.imageWidth_=c[0]*this.pixelRatio_},l.prototype.setTextStyle=function(o){if(!o)this.text_="";else{var c=o.getFill();if(!c)this.textFillState_=null;else{var r=c.getColor();this.textFillState_={fillStyle:Ss(r||Is)}}var s=o.getStroke();if(!s)this.textStrokeState_=null;else{var P=s.getColor(),R=s.getLineCap(),B=s.getLineDash(),N=s.getLineDashOffset(),V=s.getLineJoin(),mt=s.getWidth(),Et=s.getMiterLimit();this.textStrokeState_={lineCap:R!==void 0?R:tp,lineDash:B||cc,lineDashOffset:N||hc,lineJoin:V!==void 0?V:Iu,lineWidth:mt!==void 0?mt:mc,miterLimit:Et!==void 0?Et:pc,strokeStyle:Ss(P||fc)}}var It=o.getFont(),Vt=o.getOffsetX(),Ht=o.getOffsetY(),Ct=o.getRotateWithView(),Gt=o.getRotation(),te=o.getScaleArray(),re=o.getText(),_e=o.getTextAlign(),ye=o.getTextBaseline();this.textState_={font:It!==void 0?It:eg,textAlign:_e!==void 0?_e:gh,textBaseline:ye!==void 0?ye:ep},this.text_=re!==void 0?Array.isArray(re)?re.reduce(function(ce,Te,Ie){return ce+=Ie%2?" ":Te},""):re:"",this.textOffsetX_=Vt!==void 0?this.pixelRatio_*Vt:0,this.textOffsetY_=Ht!==void 0?this.pixelRatio_*Ht:0,this.textRotateWithView_=Ct!==void 0?Ct:!1,this.textRotation_=Gt!==void 0?Gt:0,this.textScale_=[this.pixelRatio_*te[0],this.pixelRatio_*te[1]]}},l}(rg),r0=Qw;var Pu={FRACTION:"fraction",PIXELS:"pixels"};var Hs={BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};var t2=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 l=0;for(var o in this.cache_){var c=this.cache_[o];(l++&3)===0&&!c.hasListener()&&(delete this.cache_[o],--this.cacheSize_)}}},y.prototype.get=function(l,o,c){var r=i0(l,o,c);return r in this.cache_?this.cache_[r]:null},y.prototype.set=function(l,o,c,r){var s=i0(l,o,c);this.cache_[s]=r,++this.cacheSize_},y.prototype.setSize=function(l){this.maxCacheSize_=l,this.expire()},y}();function i0(y,l,o){var c=o?Qm(o):"null";return l+":"+y+":"+c}var l_=new t2;var e2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),r2=function(y){e2(l,y);function l(o,c,r,s){var P=y.call(this)||this;return P.extent=o,P.pixelRatio_=r,P.resolution=c,P.state=s,P}return l.prototype.changed=function(){this.dispatchEvent(Ji.CHANGE)},l.prototype.getExtent=function(){return this.extent},l.prototype.getImage=function(){return jr()},l.prototype.getPixelRatio=function(){return this.pixelRatio_},l.prototype.getResolution=function(){return this.resolution},l.prototype.getState=function(){return this.state},l.prototype.load=function(){jr()},l}(nh),n0=r2;var i2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),eL=function(y){i2(l,y);function l(o,c,r,s,P,R){var B=y.call(this,o,c,r,qi.IDLE)||this;return B.src_=s,B.image_=new Image,P!==null&&(B.image_.crossOrigin=P),B.unlisten_=null,B.state=qi.IDLE,B.imageLoadFunction_=R,B}return l.prototype.getImage=function(){return this.image_},l.prototype.handleImageError_=function(){this.state=qi.ERROR,this.unlistenImage_(),this.changed()},l.prototype.handleImageLoad_=function(){this.resolution===void 0&&(this.resolution=Eu(this.extent)/this.image_.height),this.state=qi.LOADED,this.unlistenImage_(),this.changed()},l.prototype.load=function(){(this.state==qi.IDLE||this.state==qi.ERROR)&&(this.state=qi.LOADING,this.changed(),this.imageLoadFunction_(this,this.src_),this.unlisten_=u_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},l.prototype.setImage=function(o){this.image_=o,this.resolution=Eu(this.extent)/this.image_.height},l.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},l}(n0);function u_(y,l,o){var c=y,r=!0,s=!1,P=!1,R=[Zp(c,Ji.LOAD,function(){P=!0,s||l()})];return c.src&&Ev?(s=!0,c.decode().then(function(){r&&l()}).catch(function(B){r&&(P?l():o())})):R.push(Zp(c,Ji.ERROR,o)),function(){r=!1,R.forEach(Ao)}}var n2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),_d=null,o2=function(y){n2(l,y);function l(o,c,r,s,P,R){var B=y.call(this)||this;return B.hitDetectionImage_=null,B.image_=o||new Image,s!==null&&(B.image_.crossOrigin=s),B.canvas_={},B.color_=R,B.unlisten_=null,B.imageState_=P,B.size_=r,B.src_=c,B.tainted_,B}return l.prototype.isTainted_=function(){if(this.tainted_===void 0&&this.imageState_===qi.LOADED){_d||(_d=Ja(1,1)),_d.drawImage(this.image_,0,0);try{_d.getImageData(0,0,1,1),this.tainted_=!1}catch{_d=null,this.tainted_=!0}}return this.tainted_===!0},l.prototype.dispatchChangeEvent_=function(){this.dispatchEvent(Ji.CHANGE)},l.prototype.handleImageError_=function(){this.imageState_=qi.ERROR,this.unlistenImage_(),this.dispatchChangeEvent_()},l.prototype.handleImageLoad_=function(){this.imageState_=qi.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_()},l.prototype.getImage=function(o){return this.replaceColor_(o),this.canvas_[o]?this.canvas_[o]:this.image_},l.prototype.getPixelRatio=function(o){return this.replaceColor_(o),this.canvas_[o]?o:1},l.prototype.getImageState=function(){return this.imageState_},l.prototype.getHitDetectionImage=function(){if(!this.hitDetectionImage_)if(this.isTainted_()){var o=this.size_[0],c=this.size_[1],r=Ja(o,c);r.fillRect(0,0,o,c),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_},l.prototype.getSize=function(){return this.size_},l.prototype.getSrc=function(){return this.src_},l.prototype.load=function(){if(this.imageState_==qi.IDLE){this.imageState_=qi.LOADING;try{this.image_.src=this.src_}catch{this.handleImageError_()}this.unlisten_=u_(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this))}},l.prototype.replaceColor_=function(o){if(!(!this.color_||this.canvas_[o]||this.imageState_!==qi.LOADED)){var c=document.createElement("canvas");this.canvas_[o]=c,c.width=Math.ceil(this.image_.width*o),c.height=Math.ceil(this.image_.height*o);var r=c.getContext("2d");if(r.scale(o,o),r.drawImage(this.image_,0,0),r.globalCompositeOperation="multiply",r.globalCompositeOperation==="multiply"||this.isTainted_())r.fillStyle=Qm(this.color_),r.fillRect(0,0,c.width/o,c.height/o),r.globalCompositeOperation="destination-in",r.drawImage(this.image_,0,0);else{for(var s=r.getImageData(0,0,c.width,c.height),P=s.data,R=this.color_[0]/255,B=this.color_[1]/255,N=this.color_[2]/255,V=this.color_[3],mt=0,Et=P.length;mt<Et;mt+=4)P[mt]*=R,P[mt+1]*=B,P[mt+2]*=N,P[mt+3]*=V;r.putImageData(s,0,0)}}},l.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},l}(nh);function o0(y,l,o,c,r,s){var P=l_.get(l,c,s);return P||(P=new o2(y,l,o,c,r,s),l_.set(l,c,s,P)),P}var a2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),s2=function(y){a2(l,y);function l(o){var c=this,r=o||{},s=r.opacity!==void 0?r.opacity:1,P=r.rotation!==void 0?r.rotation:0,R=r.scale!==void 0?r.scale:1,B=r.rotateWithView!==void 0?r.rotateWithView:!1;c=y.call(this,{opacity:s,rotation:P,scale:R,displacement:r.displacement!==void 0?r.displacement:[0,0],rotateWithView:B})||this,c.anchor_=r.anchor!==void 0?r.anchor:[.5,.5],c.normalizedAnchor_=null,c.anchorOrigin_=r.anchorOrigin!==void 0?r.anchorOrigin:Hs.TOP_LEFT,c.anchorXUnits_=r.anchorXUnits!==void 0?r.anchorXUnits:Pu.FRACTION,c.anchorYUnits_=r.anchorYUnits!==void 0?r.anchorYUnits:Pu.FRACTION,c.crossOrigin_=r.crossOrigin!==void 0?r.crossOrigin:null;var N=r.img!==void 0?r.img:null;c.imgSize_=r.imgSize;var V=r.src;wn(!(V!==void 0&&N),4),wn(!N||N&&c.imgSize_,5),(V===void 0||V.length===0)&&N&&(V=N.src||Ai(N)),wn(V!==void 0&&V.length>0,6);var mt=r.src!==void 0?qi.IDLE:qi.LOADED;return c.color_=r.color!==void 0?Qh(r.color):null,c.iconImage_=o0(N,V,c.imgSize_!==void 0?c.imgSize_:null,c.crossOrigin_,mt,c.color_),c.offset_=r.offset!==void 0?r.offset:[0,0],c.offsetOrigin_=r.offsetOrigin!==void 0?r.offsetOrigin:Hs.TOP_LEFT,c.origin_=null,c.size_=r.size!==void 0?r.size:null,c}return l.prototype.clone=function(){var o=this.getScale();return new l({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(o)?o.slice():o,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc()})},l.prototype.getAnchor=function(){var o=this.normalizedAnchor_;if(!o){o=this.anchor_;var c=this.getSize();if(this.anchorXUnits_==Pu.FRACTION||this.anchorYUnits_==Pu.FRACTION){if(!c)return null;o=this.anchor_.slice(),this.anchorXUnits_==Pu.FRACTION&&(o[0]*=c[0]),this.anchorYUnits_==Pu.FRACTION&&(o[1]*=c[1])}if(this.anchorOrigin_!=Hs.TOP_LEFT){if(!c)return null;o===this.anchor_&&(o=this.anchor_.slice()),(this.anchorOrigin_==Hs.TOP_RIGHT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(o[0]=-o[0]+c[0]),(this.anchorOrigin_==Hs.BOTTOM_LEFT||this.anchorOrigin_==Hs.BOTTOM_RIGHT)&&(o[1]=-o[1]+c[1])}this.normalizedAnchor_=o}var r=this.getDisplacement();return[o[0]-r[0],o[1]+r[1]]},l.prototype.setAnchor=function(o){this.anchor_=o,this.normalizedAnchor_=null},l.prototype.getColor=function(){return this.color_},l.prototype.getImage=function(o){return this.iconImage_.getImage(o)},l.prototype.getPixelRatio=function(o){return this.iconImage_.getPixelRatio(o)},l.prototype.getImageSize=function(){return this.iconImage_.getSize()},l.prototype.getImageState=function(){return this.iconImage_.getImageState()},l.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},l.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var o=this.offset_;if(this.offsetOrigin_!=Hs.TOP_LEFT){var c=this.getSize(),r=this.iconImage_.getSize();if(!c||!r)return null;o=o.slice(),(this.offsetOrigin_==Hs.TOP_RIGHT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(o[0]=r[0]-c[0]-o[0]),(this.offsetOrigin_==Hs.BOTTOM_LEFT||this.offsetOrigin_==Hs.BOTTOM_RIGHT)&&(o[1]=r[1]-c[1]-o[1])}return this.origin_=o,this.origin_},l.prototype.getSrc=function(){return this.iconImage_.getSrc()},l.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},l.prototype.listenImageChange=function(o){this.iconImage_.addEventListener(Ji.CHANGE,o)},l.prototype.load=function(){this.iconImage_.load()},l.prototype.unlistenImageChange=function(o){this.iconImage_.removeEventListener(Ji.CHANGE,o)},l}(Jm),c_=s2;var $l=.5;function a0(y,l,o,c,r,s,P){var R=y[0]*$l,B=y[1]*$l,N=Ja(R,B);N.imageSmoothingEnabled=!1;for(var V=N.canvas,mt=new r0(N,$l,r,null,P),Et=o.length,It=Math.floor((256*256*256-1)/Et),Vt={},Ht=1;Ht<=Et;++Ht){var Ct=o[Ht-1],Gt=Ct.getStyleFunction()||c;if(!!c){var te=Gt(Ct,s);if(!!te){Array.isArray(te)||(te=[te]);for(var re=Ht*It,_e="#"+("000000"+re.toString(16)).slice(-6),ye=0,ce=te.length;ye<ce;++ye){var Te=te[ye],Ie=Te.getGeometryFunction()(Ct);if(!(!Ie||!ko(r,Ie.getExtent()))){var Le=Te.clone(),ur=Le.getFill();ur&&ur.setColor(_e);var Ve=Le.getStroke();Ve&&(Ve.setColor(_e),Ve.setLineDash(null)),Le.setText(void 0);var Qe=Te.getImage();if(Qe&&Qe.getOpacity()!==0){var or=Qe.getImageSize();if(!or)continue;var Me=Ja(or[0],or[1],void 0,{alpha:!1}),Br=Me.canvas;Me.fillStyle=_e,Me.fillRect(0,0,Br.width,Br.height),Le.setImage(new c_({img:Br,imgSize:or,anchor:Qe.getAnchor(),anchorXUnits:Pu.PIXELS,anchorYUnits:Pu.PIXELS,offset:Qe.getOrigin(),opacity:1,size:Qe.getSize(),scale:Qe.getScale(),rotation:Qe.getRotation(),rotateWithView:Qe.getRotateWithView()}))}var Tr=Le.getZIndex()||0,br=Vt[Tr];br||(br={},Vt[Tr]=br,br[Pe.POLYGON]=[],br[Pe.CIRCLE]=[],br[Pe.LINE_STRING]=[],br[Pe.POINT]=[]),br[Ie.getType().replace("Multi","")].push(Ie,Le)}}}}}for(var Pr=Object.keys(Vt).map(Number).sort(rh),Ht=0,Ir=Pr.length;Ht<Ir;++Ht){var br=Vt[Pr[Ht]];for(var xr in br)for(var ai=br[xr],ye=0,ce=ai.length;ye<ce;ye+=2){mt.setStyle(ai[ye+1]);for(var je=0,ti=l.length;je<ti;++je)mt.setTransform(l[je]),mt.drawGeometry(ai[ye])}}return N.getImageData(0,0,V.width,V.height)}function s0(y,l,o){var c=[];if(o){var r=Math.floor(Math.round(y[0])*$l),s=Math.floor(Math.round(y[1])*$l),P=(jl(r,0,o.width-1)+jl(s,0,o.height-1)*o.width)*4,R=o.data[P],B=o.data[P+1],N=o.data[P+2],V=N+256*(B+256*R),mt=Math.floor((256*256*256-1)/l.length);V&&V%mt===0&&c.push(l[V/mt-1])}return c}var l2=.5,l0={Point:m2,LineString:p2,Polygon:y2,MultiPoint:g2,MultiLineString:f2,MultiPolygon:d2,GeometryCollection:h2,Circle:u2};function u0(y,l){return parseInt(Ai(y),10)-parseInt(Ai(l),10)}function c0(y,l){var o=ig(y,l);return o*o}function ig(y,l){return l2*y/l}function u2(y,l,o,c,r){var s=o.getFill(),P=o.getStroke();if(s||P){var R=y.getBuilder(o.getZIndex(),Rn.CIRCLE);R.setFillStrokeStyle(s,P),R.drawCircle(l,c)}var B=o.getText();if(B&&B.getText()){var N=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);N.setTextStyle(B),N.drawText(l,c)}}function h_(y,l,o,c,r,s,P){var R=!1,B=o.getImage();if(B){var N=B.getImageState();N==qi.LOADED||N==qi.ERROR?B.unlistenImageChange(r):(N==qi.IDLE&&B.load(),N=B.getImageState(),B.listenImageChange(r),R=!0)}return c2(y,l,o,c,s,P),R}function c2(y,l,o,c,r,s){var P=o.getGeometryFunction()(l);if(!!P){var R=P.simplifyTransformed(c,r),B=o.getRenderer();if(B)h0(y,R,o,l);else{var N=l0[R.getType()];N(y,R,o,l,s)}}}function h0(y,l,o,c){if(l.getType()==Pe.GEOMETRY_COLLECTION){for(var r=l.getGeometries(),s=0,P=r.length;s<P;++s)h0(y,r[s],o,c);return}var R=y.getBuilder(o.getZIndex(),Rn.DEFAULT);R.drawCustom(l,c,o.getRenderer(),o.getHitDetectionRenderer())}function h2(y,l,o,c,r){var s=l.getGeometriesArray(),P,R;for(P=0,R=s.length;P<R;++P){var B=l0[s[P].getType()];B(y,s[P],o,c,r)}}function p2(y,l,o,c,r){var s=o.getStroke();if(s){var P=y.getBuilder(o.getZIndex(),Rn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawLineString(l,c)}var R=o.getText();if(R&&R.getText()){var B=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);B.setTextStyle(R),B.drawText(l,c)}}function f2(y,l,o,c,r){var s=o.getStroke();if(s){var P=y.getBuilder(o.getZIndex(),Rn.LINE_STRING);P.setFillStrokeStyle(null,s),P.drawMultiLineString(l,c)}var R=o.getText();if(R&&R.getText()){var B=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);B.setTextStyle(R),B.drawText(l,c)}}function d2(y,l,o,c,r){var s=o.getFill(),P=o.getStroke();if(P||s){var R=y.getBuilder(o.getZIndex(),Rn.POLYGON);R.setFillStrokeStyle(s,P),R.drawMultiPolygon(l,c)}var B=o.getText();if(B&&B.getText()){var N=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);N.setTextStyle(B),N.drawText(l,c)}}function m2(y,l,o,c,r){var s=o.getImage(),P=o.getText(),R;if(r&&(y=r,R=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var B=y.getBuilder(o.getZIndex(),Rn.IMAGE);B.setImageStyle(s,R),B.drawPoint(l,c)}if(P&&P.getText()){var N=y.getBuilder(o.getZIndex(),Rn.TEXT);N.setTextStyle(P,R),N.drawText(l,c)}}function g2(y,l,o,c,r){var s=o.getImage(),P=o.getText(),R;if(r&&(y=r,R=s&&P&&P.getText()?{}:void 0),s){if(s.getImageState()!=qi.LOADED)return;var B=y.getBuilder(o.getZIndex(),Rn.IMAGE);B.setImageStyle(s,R),B.drawMultiPoint(l,c)}if(P&&P.getText()){var N=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);N.setTextStyle(P,R),N.drawText(l,c)}}function y2(y,l,o,c,r){var s=o.getFill(),P=o.getStroke();if(s||P){var R=y.getBuilder(o.getZIndex(),Rn.POLYGON);R.setFillStrokeStyle(s,P),R.drawPolygon(l,c)}var B=o.getText();if(B&&B.getText()){var N=(r||y).getBuilder(o.getZIndex(),Rn.TEXT);N.setTextStyle(B),N.drawText(l,c)}}var _2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),v2=function(y){_2(l,y);function l(o){var c=y.call(this,o)||this;return c.boundHandleStyleImageChange_=c.handleStyleImageChange_.bind(c),c.animatingOrInteracting_,c.dirty_=!1,c.hitDetectionImageData_=null,c.renderedFeatures_=null,c.renderedRevision_=-1,c.renderedResolution_=NaN,c.renderedExtent_=Ya(),c.wrappedRenderedExtent_=Ya(),c.renderedRotation_,c.renderedCenter_=null,c.renderedProjection_=null,c.renderedRenderOrder_=null,c.replayGroup_=null,c.replayGroupChanged=!0,c.declutterExecutorGroup=null,c.clipping=!0,c}return l.prototype.renderWorlds=function(o,c,r){var s=c.extent,P=c.viewState,R=P.center,B=P.resolution,N=P.projection,V=P.rotation,mt=N.getExtent(),Et=this.getLayer().getSource(),It=c.pixelRatio,Vt=c.viewHints,Ht=!(Vt[yd.ANIMATING]||Vt[yd.INTERACTING]),Ct=this.context,Gt=Math.round(c.size[0]*It),te=Math.round(c.size[1]*It),re=Et.getWrapX()&&N.canWrapX(),_e=re?ws(mt):null,ye=re?Math.ceil((s[2]-mt[2])/_e)+1:1,ce=re?Math.floor((s[0]-mt[0])/_e):0;do{var Te=this.getRenderTransform(R,B,V,It,Gt,te,ce*_e);o.execute(Ct,1,Te,V,Ht,void 0,r)}while(++ce<ye)},l.prototype.renderDeclutter=function(o){this.declutterExecutorGroup&&this.renderWorlds(this.declutterExecutorGroup,o,o.declutterTree)},l.prototype.renderFrame=function(o,c){var r=o.pixelRatio,s=o.layerStatesArray[o.layerIndex];Iv(this.pixelTransform,1/r,1/r),Av(this.inversePixelTransform,this.pixelTransform);var P=cy(this.pixelTransform);this.useContainer(c,P,s.opacity,this.getBackground(o));var R=this.context,B=R.canvas,N=this.replayGroup_,V=this.declutterExecutorGroup;if((!N||N.isEmpty())&&(!V||V.isEmpty()))return null;var mt=Math.round(o.size[0]*r),Et=Math.round(o.size[1]*r);B.width!=mt||B.height!=Et?(B.width=mt,B.height=Et,B.style.transform!==P&&(B.style.transform=P)):this.containerReused||R.clearRect(0,0,mt,Et),this.preRender(R,o);var It=o.viewState,Vt=It.projection,Ht=!1,Ct=!0;if(s.extent&&this.clipping){var Gt=ed(s.extent,Vt);Ct=ko(Gt,o.extent),Ht=Ct&&!sc(Gt,o.extent),Ht&&this.clipUnrotated(R,o,Gt)}Ct&&this.renderWorlds(N,o),Ht&&R.restore(),this.postRender(R,o);var te=kx(s.opacity),re=this.container;return te!==re.style.opacity&&(re.style.opacity=te),this.renderedRotation_!==It.rotation&&(this.renderedRotation_=It.rotation,this.hitDetectionImageData_=null),this.container},l.prototype.getFeatures=function(o){return new Promise(function(c){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var r=[this.context.canvas.width,this.context.canvas.height];xo(this.pixelTransform,r);var s=this.renderedCenter_,P=this.renderedResolution_,R=this.renderedRotation_,B=this.renderedProjection_,N=this.wrappedRenderedExtent_,V=this.getLayer(),mt=[],Et=r[0]*$l,It=r[1]*$l;mt.push(this.getRenderTransform(s,P,R,$l,Et,It,0).slice());var Vt=V.getSource(),Ht=B.getExtent();if(Vt.getWrapX()&&B.canWrapX()&&!sc(Ht,N)){for(var Ct=N[0],Gt=ws(Ht),te=0,re=void 0;Ct<Ht[0];)--te,re=Gt*te,mt.push(this.getRenderTransform(s,P,R,$l,Et,It,re).slice()),Ct+=Gt;for(te=0,Ct=N[2];Ct>Ht[2];)++te,re=Gt*te,mt.push(this.getRenderTransform(s,P,R,$l,Et,It,re).slice()),Ct-=Gt}this.hitDetectionImageData_=a0(r,mt,this.renderedFeatures_,V.getStyleFunction(),N,P,R)}c(s0(o,this.renderedFeatures_,this.hitDetectionImageData_))}.bind(this))},l.prototype.forEachFeatureAtCoordinate=function(o,c,r,s,P){var R=this;if(!!this.replayGroup_){var B=c.viewState.resolution,N=c.viewState.rotation,V=this.getLayer(),mt={},Et=function(Ht,Ct,Gt){var te=Ai(Ht),re=mt[te];if(re){if(re!==!0&&Gt<re.distanceSq){if(Gt===0)return mt[te]=!0,P.splice(P.lastIndexOf(re),1),s(Ht,V,Ct);re.geometry=Ct,re.distanceSq=Gt}}else{if(Gt===0)return mt[te]=!0,s(Ht,V,Ct);P.push(mt[te]={feature:Ht,layer:V,geometry:Ct,distanceSq:Gt,callback:s})}},It,Vt=[this.replayGroup_];return this.declutterExecutorGroup&&Vt.push(this.declutterExecutorGroup),Vt.some(function(Ht){return It=Ht.forEachFeatureAtCoordinate(o,B,N,r,Et,Ht===R.declutterExecutorGroup&&c.declutterTree?c.declutterTree.all().map(function(Ct){return Ct.value}):null)}),It}},l.prototype.handleFontsChanged=function(){var o=this.getLayer();o.getVisible()&&this.replayGroup_&&o.changed()},l.prototype.handleStyleImageChange_=function(o){this.renderIfReadyAndVisible()},l.prototype.prepareFrame=function(o){var c=this.getLayer(),r=c.getSource();if(!r)return!1;var s=o.viewHints[yd.ANIMATING],P=o.viewHints[yd.INTERACTING],R=c.getUpdateWhileAnimating(),B=c.getUpdateWhileInteracting();if(!this.dirty_&&!R&&s||!B&&P)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;var N=o.extent,V=o.viewState,mt=V.projection,Et=V.resolution,It=o.pixelRatio,Vt=c.getRevision(),Ht=c.getRenderBuffer(),Ct=c.getRenderOrder();Ct===void 0&&(Ct=u0);var Gt=V.center.slice(),te=yl(N,Ht*Et),re=te.slice(),_e=[te.slice()],ye=mt.getExtent();if(r.getWrapX()&&mt.canWrapX()&&!sc(ye,o.extent)){var ce=ws(ye),Te=Math.max(ws(te)/2,ce);te[0]=ye[0]-Te,te[2]=ye[2]+Te,$v(Gt,mt);var Ie=Xv(_e[0],mt);Ie[0]<ye[0]&&Ie[2]<ye[2]?_e.push([Ie[0]+ce,Ie[1],Ie[2]+ce,Ie[3]]):Ie[0]>ye[0]&&Ie[2]>ye[2]&&_e.push([Ie[0]-ce,Ie[1],Ie[2]-ce,Ie[3]])}if(!this.dirty_&&this.renderedResolution_==Et&&this.renderedRevision_==Vt&&this.renderedRenderOrder_==Ct&&sc(this.wrappedRenderedExtent_,te))return vs(this.renderedExtent_,re)||(this.hitDetectionImageData_=null,this.renderedExtent_=re),this.renderedCenter_=Gt,this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var Le=new n_(ig(Et,It),te,Et,It),ur;this.getLayer().getDeclutter()&&(ur=new n_(ig(Et,It),te,Et,It));var Ve=uh(),Qe;if(Ve){for(var or=0,Me=_e.length;or<Me;++or){var Br=_e[or],Tr=tf(Br,mt);r.loadFeatures(Tr,Jv(Et,mt),Ve)}Qe=Bm(Ve,mt)}else for(var or=0,Me=_e.length;or<Me;++or)r.loadFeatures(_e[or],Et,mt);var br=c0(Et,It),Pr=function(ti){var vi,di=ti.getStyleFunction()||c.getStyleFunction();if(di&&(vi=di(ti,Et)),vi){var tn=this.renderFeature(ti,br,vi,Le,Qe,ur);this.dirty_=this.dirty_||tn}}.bind(this),Ir=tf(te,mt),xr=r.getFeaturesInExtent(Ir);Ct&&xr.sort(Ct);for(var or=0,Me=xr.length;or<Me;++or)Pr(xr[or]);this.renderedFeatures_=xr;var ai=Le.finish(),je=new s_(te,Et,It,r.getOverlaps(),ai,c.getRenderBuffer());return ur&&(this.declutterExecutorGroup=new s_(te,Et,It,r.getOverlaps(),ur.finish(),c.getRenderBuffer())),this.renderedResolution_=Et,this.renderedRevision_=Vt,this.renderedRenderOrder_=Ct,this.renderedExtent_=re,this.wrappedRenderedExtent_=te,this.renderedCenter_=Gt,this.renderedProjection_=mt,this.replayGroup_=je,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0},l.prototype.renderFeature=function(o,c,r,s,P,R){if(!r)return!1;var B=!1;if(Array.isArray(r))for(var N=0,V=r.length;N<V;++N)B=h_(s,o,r[N],c,this.boundHandleStyleImageChange_,P,R)||B;else B=h_(s,o,r,c,this.boundHandleStyleImageChange_,P,R);return B},l}(Yx),p0=v2;var x2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),b2=function(y){x2(l,y);function l(o){return y.call(this,o)||this}return l.prototype.createRenderer=function(){return new p0(this)},l}(qx),rp=b2;var f0=jp(e_(),1);var w2=function(){function y(l){this.rbush_=new f0.default(l),this.items_={}}return y.prototype.insert=function(l,o){var c={minX:l[0],minY:l[1],maxX:l[2],maxY:l[3],value:o};this.rbush_.insert(c),this.items_[Ai(o)]=c},y.prototype.load=function(l,o){for(var c=new Array(o.length),r=0,s=o.length;r<s;r++){var P=l[r],R=o[r],B={minX:P[0],minY:P[1],maxX:P[2],maxY:P[3],value:R};c[r]=B,this.items_[Ai(R)]=B}this.rbush_.load(c)},y.prototype.remove=function(l){var o=Ai(l),c=this.items_[o];return delete this.items_[o],this.rbush_.remove(c)!==null},y.prototype.update=function(l,o){var c=this.items_[Ai(o)],r=[c.minX,c.minY,c.maxX,c.maxY];Fm(r,l)||(this.remove(o),this.insert(l,o))},y.prototype.getAll=function(){var l=this.rbush_.all();return l.map(function(o){return o.value})},y.prototype.getInExtent=function(l){var o={minX:l[0],minY:l[1],maxX:l[2],maxY:l[3]},c=this.rbush_.search(o);return c.map(function(r){return r.value})},y.prototype.forEach=function(l){return this.forEach_(this.getAll(),l)},y.prototype.forEachInExtent=function(l,o){return this.forEach_(this.getInExtent(l),o)},y.prototype.forEach_=function(l,o){for(var c,r=0,s=l.length;r<s;r++)if(c=o(l[r]),c)return c;return c},y.prototype.isEmpty=function(){return Vl(this.items_)},y.prototype.clear=function(){this.rbush_.clear(),this.items_={}},y.prototype.getExtent=function(l){var o=this.rbush_.toJSON();return sh(o.minX,o.minY,o.maxX,o.maxY,l)},y.prototype.concat=function(l){this.rbush_.load(l.rbush_.all());for(var o in l.items_)this.items_[o]=l.items_[o]},y}(),vd=w2;var E2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),T2=function(y){E2(l,y);function l(o){var c=y.call(this)||this;c.projection=ga(o.projection),c.attributions_=d0(o.attributions),c.attributionsCollapsible_=o.attributionsCollapsible!==void 0?o.attributionsCollapsible:!0,c.loading=!1,c.state_=o.state!==void 0?o.state:Su.READY,c.wrapX_=o.wrapX!==void 0?o.wrapX:!1,c.interpolate_=!!o.interpolate,c.viewResolver=null,c.viewRejector=null;var r=c;return c.viewPromise_=new Promise(function(s,P){r.viewResolver=s,r.viewRejector=P}),c}return l.prototype.getAttributions=function(){return this.attributions_},l.prototype.getAttributionsCollapsible=function(){return this.attributionsCollapsible_},l.prototype.getProjection=function(){return this.projection},l.prototype.getResolutions=function(){return jr()},l.prototype.getView=function(){return this.viewPromise_},l.prototype.getState=function(){return this.state_},l.prototype.getWrapX=function(){return this.wrapX_},l.prototype.getInterpolate=function(){return this.interpolate_},l.prototype.refresh=function(){this.changed()},l.prototype.setAttributions=function(o){this.attributions_=d0(o),this.changed()},l.prototype.setState=function(o){this.state_=o,this.changed()},l}(Po);function d0(y){return y?Array.isArray(y)?function(l){return y}:typeof y=="function"?y:function(l){return[y]}:null}var cf=T2;var Qa={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function m0(y,l){return[[-1/0,-1/0,1/0,1/0]]}var vh={ARRAY_BUFFER:"arraybuffer",JSON:"json",TEXT:"text",XML:"xml"};var S2=!1;function I2(y,l,o,c,r,s,P){var R=new XMLHttpRequest;R.open("GET",typeof y=="function"?y(o,c,r):y,!0),l.getType()==vh.ARRAY_BUFFER&&(R.responseType="arraybuffer"),R.withCredentials=S2,R.onload=function(B){if(!R.status||R.status>=200&&R.status<300){var N=l.getType(),V=void 0;N==vh.JSON||N==vh.TEXT?V=R.responseText:N==vh.XML?(V=R.responseXML,V||(V=new DOMParser().parseFromString(R.responseText,"application/xml"))):N==vh.ARRAY_BUFFER&&(V=R.response),V?s(l.readFeatures(V,{extent:o,featureProjection:r}),l.readProjection(V)):P()}else P()},R.onerror=P,R.send()}function p_(y,l){return function(o,c,r,s,P){var R=this;I2(y,l,o,c,r,function(B,N){R.addFeatures(B),s!==void 0&&s(B)},P||Zh)}}var g0=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),xh=function(y){g0(l,y);function l(o,c,r){var s=y.call(this,o)||this;return s.feature=c,s.features=r,s}return l}(_s);var C2=function(y){g0(l,y);function l(o){var c=this,r=o||{};c=y.call(this,{attributions:r.attributions,interpolate:!0,projection:void 0,state:Su.READY,wrapX:r.wrapX!==void 0?r.wrapX:!0})||this,c.on,c.once,c.un,c.loader_=Zh,c.format_=r.format,c.overlaps_=r.overlaps===void 0?!0:r.overlaps,c.url_=r.url,r.loader!==void 0?c.loader_=r.loader:c.url_!==void 0&&(wn(c.format_,7),c.loader_=p_(c.url_,c.format_)),c.strategy_=r.strategy!==void 0?r.strategy:m0;var s=r.useSpatialIndex!==void 0?r.useSpatialIndex:!0;c.featuresRtree_=s?new vd:null,c.loadedExtentsRtree_=new vd,c.loadingExtentsCount_=0,c.nullGeometryFeatures_={},c.idIndex_={},c.uidIndex_={},c.featureChangeKeys_={},c.featuresCollection_=null;var P,R;return Array.isArray(r.features)?R=r.features:r.features&&(P=r.features,R=P.getArray()),!s&&P===void 0&&(P=new hh(R)),R!==void 0&&c.addFeaturesInternal(R),P!==void 0&&c.bindFeaturesCollection_(P),c}return l.prototype.addFeature=function(o){this.addFeatureInternal(o),this.changed()},l.prototype.addFeatureInternal=function(o){var c=Ai(o);if(!this.addToIndex_(c,o)){this.featuresCollection_&&this.featuresCollection_.remove(o);return}this.setupChangeEvents_(c,o);var r=o.getGeometry();if(r){var s=r.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(s,o)}else this.nullGeometryFeatures_[c]=o;this.dispatchEvent(new xh(Qa.ADDFEATURE,o))},l.prototype.setupChangeEvents_=function(o,c){this.featureChangeKeys_[o]=[lo(c,Ji.CHANGE,this.handleFeatureChange_,this),lo(c,qp.PROPERTYCHANGE,this.handleFeatureChange_,this)]},l.prototype.addToIndex_=function(o,c){var r=!0,s=c.getId();return s!==void 0&&(s.toString()in this.idIndex_?r=!1:this.idIndex_[s.toString()]=c),r&&(wn(!(o in this.uidIndex_),30),this.uidIndex_[o]=c),r},l.prototype.addFeatures=function(o){this.addFeaturesInternal(o),this.changed()},l.prototype.addFeaturesInternal=function(o){for(var c=[],r=[],s=[],P=0,R=o.length;P<R;P++){var B=o[P],N=Ai(B);this.addToIndex_(N,B)&&r.push(B)}for(var P=0,V=r.length;P<V;P++){var B=r[P],N=Ai(B);this.setupChangeEvents_(N,B);var mt=B.getGeometry();if(mt){var Et=mt.getExtent();c.push(Et),s.push(B)}else this.nullGeometryFeatures_[N]=B}if(this.featuresRtree_&&this.featuresRtree_.load(c,s),this.hasListener(Qa.ADDFEATURE))for(var P=0,It=r.length;P<It;P++)this.dispatchEvent(new xh(Qa.ADDFEATURE,r[P]))},l.prototype.bindFeaturesCollection_=function(o){var c=!1;this.addEventListener(Qa.ADDFEATURE,function(r){c||(c=!0,o.push(r.feature),c=!1)}),this.addEventListener(Qa.REMOVEFEATURE,function(r){c||(c=!0,o.remove(r.feature),c=!1)}),o.addEventListener(Es.ADD,function(r){c||(c=!0,this.addFeature(r.element),c=!1)}.bind(this)),o.addEventListener(Es.REMOVE,function(r){c||(c=!0,this.removeFeature(r.element),c=!1)}.bind(this)),this.featuresCollection_=o},l.prototype.clear=function(o){if(o){for(var c in this.featureChangeKeys_){var r=this.featureChangeKeys_[c];r.forEach(Ao)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){var s=function(B){this.removeFeatureInternal(B)}.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 R=new xh(Qa.CLEAR);this.dispatchEvent(R),this.changed()},l.prototype.forEachFeature=function(o){if(this.featuresRtree_)return this.featuresRtree_.forEach(o);this.featuresCollection_&&this.featuresCollection_.forEach(o)},l.prototype.forEachFeatureAtCoordinateDirect=function(o,c){var r=[o[0],o[1],o[0],o[1]];return this.forEachFeatureInExtent(r,function(s){var P=s.getGeometry();if(P.intersectsCoordinate(o))return c(s)})},l.prototype.forEachFeatureInExtent=function(o,c){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(o,c);this.featuresCollection_&&this.featuresCollection_.forEach(c)},l.prototype.forEachFeatureIntersectingExtent=function(o,c){return this.forEachFeatureInExtent(o,function(r){var s=r.getGeometry();if(s.intersectsExtent(o)){var P=c(r);if(P)return P}})},l.prototype.getFeaturesCollection=function(){return this.featuresCollection_},l.prototype.getFeatures=function(){var o;return this.featuresCollection_?o=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(o=this.featuresRtree_.getAll(),Vl(this.nullGeometryFeatures_)||Ka(o,Sm(this.nullGeometryFeatures_))),o},l.prototype.getFeaturesAtCoordinate=function(o){var c=[];return this.forEachFeatureAtCoordinateDirect(o,function(r){c.push(r)}),c},l.prototype.getFeaturesInExtent=function(o){return this.featuresRtree_?this.featuresRtree_.getInExtent(o):this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]},l.prototype.getClosestFeatureToCoordinate=function(o,c){var r=o[0],s=o[1],P=null,R=[NaN,NaN],B=1/0,N=[-1/0,-1/0,1/0,1/0],V=c||Tm;return this.featuresRtree_.forEachInExtent(N,function(mt){if(V(mt)){var Et=mt.getGeometry(),It=B;if(B=Et.closestPointXY(r,s,R,B),B<It){P=mt;var Vt=Math.sqrt(B);N[0]=r-Vt,N[1]=s-Vt,N[2]=r+Vt,N[3]=s+Vt}}}),P},l.prototype.getExtent=function(o){return this.featuresRtree_.getExtent(o)},l.prototype.getFeatureById=function(o){var c=this.idIndex_[o.toString()];return c!==void 0?c:null},l.prototype.getFeatureByUid=function(o){var c=this.uidIndex_[o];return c!==void 0?c:null},l.prototype.getFormat=function(){return this.format_},l.prototype.getOverlaps=function(){return this.overlaps_},l.prototype.getUrl=function(){return this.url_},l.prototype.handleFeatureChange_=function(o){var c=o.target,r=Ai(c),s=c.getGeometry();if(!s)r in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(c),this.nullGeometryFeatures_[r]=c);else{var P=s.getExtent();r in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[r],this.featuresRtree_&&this.featuresRtree_.insert(P,c)):this.featuresRtree_&&this.featuresRtree_.update(P,c)}var R=c.getId();if(R!==void 0){var B=R.toString();this.idIndex_[B]!==c&&(this.removeFromIdIndex_(c),this.idIndex_[B]=c)}else this.removeFromIdIndex_(c),this.uidIndex_[r]=c;this.changed(),this.dispatchEvent(new xh(Qa.CHANGEFEATURE,c))},l.prototype.hasFeature=function(o){var c=o.getId();return c!==void 0?c in this.idIndex_:Ai(o)in this.uidIndex_},l.prototype.isEmpty=function(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Vl(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0},l.prototype.loadFeatures=function(o,c,r){for(var s=this.loadedExtentsRtree_,P=this.strategy_(o,c,r),R=function(mt,Et){var It=P[mt],Vt=s.forEachInExtent(It,function(Ht){return sc(Ht.extent,It)});Vt||(++B.loadingExtentsCount_,B.dispatchEvent(new xh(Qa.FEATURESLOADSTART)),B.loader_.call(B,It,c,r,function(Ht){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADEND,void 0,Ht))}.bind(B),function(){--this.loadingExtentsCount_,this.dispatchEvent(new xh(Qa.FEATURESLOADERROR))}.bind(B)),s.insert(It,{extent:It.slice()}))},B=this,N=0,V=P.length;N<V;++N)R(N,V);this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0},l.prototype.refresh=function(){this.clear(!0),this.loadedExtentsRtree_.clear(),y.prototype.refresh.call(this)},l.prototype.removeLoadedExtent=function(o){var c=this.loadedExtentsRtree_,r;c.forEachInExtent(o,function(s){if(Fm(s.extent,o))return r=s,!0}),r&&c.remove(r)},l.prototype.removeFeature=function(o){if(!!o){var c=Ai(o);c in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[c]:this.featuresRtree_&&this.featuresRtree_.remove(o);var r=this.removeFeatureInternal(o);r&&this.changed()}},l.prototype.removeFeatureInternal=function(o){var c=Ai(o),r=this.featureChangeKeys_[c];if(!!r){r.forEach(Ao),delete this.featureChangeKeys_[c];var s=o.getId();return s!==void 0&&delete this.idIndex_[s.toString()],delete this.uidIndex_[c],this.dispatchEvent(new xh(Qa.REMOVEFEATURE,o)),o}},l.prototype.removeFromIdIndex_=function(o){var c=!1;for(var r in this.idIndex_)if(this.idIndex_[r]===o){delete this.idIndex_[r],c=!0;break}return c},l.prototype.setLoader=function(o){this.loader_=o},l.prototype.setUrl=function(o){wn(this.format_,7),this.url_=o,this.setLoader(p_(o,this.format_))},l}(cf),ip=C2;var y0=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),hf=function(y){y0(l,y);function l(o,c){var r=y.call(this,o)||this;return r.layer=c,r}return l}(_s);var f_={LAYERS:"layers"},A2=function(y){y0(l,y);function l(o){var c=this,r=o||{},s=La({},r);delete s.layers;var P=r.layers;return c=y.call(this,s)||this,c.on,c.once,c.un,c.layersListenerKeys_=[],c.listenerKeys_={},c.addChangeListener(f_.LAYERS,c.handleLayersChanged_),P?Array.isArray(P)?P=new hh(P.slice(),{unique:!0}):wn(typeof P.getArray=="function",43):P=new hh(void 0,{unique:!0}),c.setLayers(P),c}return l.prototype.handleLayerChange_=function(){this.changed()},l.prototype.handleLayersChanged_=function(){this.layersListenerKeys_.forEach(Ao),this.layersListenerKeys_.length=0;var o=this.getLayers();this.layersListenerKeys_.push(lo(o,Es.ADD,this.handleLayersAdd_,this),lo(o,Es.REMOVE,this.handleLayersRemove_,this));for(var c in this.listenerKeys_)this.listenerKeys_[c].forEach(Ao);ih(this.listenerKeys_);for(var r=o.getArray(),s=0,P=r.length;s<P;s++){var R=r[s];this.registerLayerListeners_(R),this.dispatchEvent(new hf("addlayer",R))}this.changed()},l.prototype.registerLayerListeners_=function(o){var c=[lo(o,qp.PROPERTYCHANGE,this.handleLayerChange_,this),lo(o,Ji.CHANGE,this.handleLayerChange_,this)];o instanceof l&&c.push(lo(o,"addlayer",this.handleLayerGroupAdd_,this),lo(o,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ai(o)]=c},l.prototype.handleLayerGroupAdd_=function(o){this.dispatchEvent(new hf("addlayer",o.layer))},l.prototype.handleLayerGroupRemove_=function(o){this.dispatchEvent(new hf("removelayer",o.layer))},l.prototype.handleLayersAdd_=function(o){var c=o.element;this.registerLayerListeners_(c),this.dispatchEvent(new hf("addlayer",c)),this.changed()},l.prototype.handleLayersRemove_=function(o){var c=o.element,r=Ai(c);this.listenerKeys_[r].forEach(Ao),delete this.listenerKeys_[r],this.dispatchEvent(new hf("removelayer",c)),this.changed()},l.prototype.getLayers=function(){return this.get(f_.LAYERS)},l.prototype.setLayers=function(o){var c=this.getLayers();if(c)for(var r=c.getArray(),s=0,P=r.length;s<P;++s)this.dispatchEvent(new hf("removelayer",r[s]));this.set(f_.LAYERS,o)},l.prototype.getLayersArray=function(o){var c=o!==void 0?o:[];return this.getLayers().forEach(function(r){r.getLayersArray(c)}),c},l.prototype.getLayerStatesArray=function(o){var c=o!==void 0?o:[],r=c.length;this.getLayers().forEach(function(V){V.getLayerStatesArray(c)});var s=this.getLayerState(),P=s.zIndex;!o&&s.zIndex===void 0&&(P=0);for(var R=r,B=c.length;R<B;R++){var N=c[R];N.opacity*=s.opacity,N.visible=N.visible&&s.visible,N.maxResolution=Math.min(N.maxResolution,s.maxResolution),N.minResolution=Math.max(N.minResolution,s.minResolution),N.minZoom=Math.max(N.minZoom,s.minZoom),N.maxZoom=Math.min(N.maxZoom,s.maxZoom),s.extent!==void 0&&(N.extent!==void 0?N.extent=Gv(N.extent,s.extent):N.extent=s.extent),N.zIndex===void 0&&(N.zIndex=P)}return c},l.prototype.getSourceState=function(){return Su.READY},l}(Gm),d_=A2;var ia={SINGLECLICK:"singleclick",CLICK:Ji.CLICK,DBLCLICK:Ji.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var m_={ACTIVE:"active"};var P2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),M2=function(y){P2(l,y);function l(o){var c=y.call(this)||this;return c.on,c.once,c.un,o&&o.handleEvent&&(c.handleEvent=o.handleEvent),c.map_=null,c.setActive(!0),c}return l.prototype.getActive=function(){return this.get(m_.ACTIVE)},l.prototype.getMap=function(){return this.map_},l.prototype.handleEvent=function(o){return!0},l.prototype.setActive=function(o){this.set(m_.ACTIVE,o)},l.prototype.setMap=function(o){this.map_=o},l}(Po);var _0=M2;var k2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),L2=function(y){k2(l,y);function l(o){var c=this,r=o||{};return c=y.call(this,r)||this,r.handleDownEvent&&(c.handleDownEvent=r.handleDownEvent),r.handleDragEvent&&(c.handleDragEvent=r.handleDragEvent),r.handleMoveEvent&&(c.handleMoveEvent=r.handleMoveEvent),r.handleUpEvent&&(c.handleUpEvent=r.handleUpEvent),r.stopDown&&(c.stopDown=r.stopDown),c.handlingDownUpSequence=!1,c.trackedPointers_={},c.targetPointers=[],c}return l.prototype.getPointerCount=function(){return this.targetPointers.length},l.prototype.handleDownEvent=function(o){return!1},l.prototype.handleDragEvent=function(o){},l.prototype.handleEvent=function(o){if(!o.originalEvent)return!0;var c=!1;if(this.updateTrackedPointers_(o),this.handlingDownUpSequence){if(o.type==ia.POINTERDRAG)this.handleDragEvent(o),o.originalEvent.preventDefault();else if(o.type==ia.POINTERUP){var r=this.handleUpEvent(o);this.handlingDownUpSequence=r&&this.targetPointers.length>0}}else if(o.type==ia.POINTERDOWN){var s=this.handleDownEvent(o);this.handlingDownUpSequence=s,c=this.stopDown(s)}else o.type==ia.POINTERMOVE&&this.handleMoveEvent(o);return!c},l.prototype.handleMoveEvent=function(o){},l.prototype.handleUpEvent=function(o){return!1},l.prototype.stopDown=function(o){return o},l.prototype.updateTrackedPointers_=function(o){if(z2(o)){var c=o.originalEvent,r=c.pointerId.toString();o.type==ia.POINTERUP?delete this.trackedPointers_[r]:o.type==ia.POINTERDOWN?this.trackedPointers_[r]=c:r in this.trackedPointers_&&(this.trackedPointers_[r]=c),this.targetPointers=Sm(this.trackedPointers_)}},l}(_0);function z2(y){var l=y.type;return l===ia.POINTERDOWN||l===ia.POINTERDRAG||l===ia.POINTERUP}var v0=L2;var x0=function(y){var l=y.originalEvent;return l.altKey&&!(l.metaKey||l.ctrlKey)&&!l.shiftKey};var b0=Tm,w0=function(y){return y.type==ia.CLICK};var E0=function(y){return y.type==ia.SINGLECLICK};var T0=function(y){var l=y.originalEvent;return wn(l!==void 0,56),l.isPrimary&&l.button===0};var D2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),R2=function(y){D2(l,y);function l(o,c,r){var s=y.call(this)||this;if(s.ends_=[],s.maxDelta_=-1,s.maxDeltaRevision_=-1,Array.isArray(o[0]))s.setCoordinates(o,c);else if(c!==void 0&&r)s.setFlatCoordinates(c,o),s.ends_=r;else{for(var P=s.getLayout(),R=o,B=[],N=[],V=0,mt=R.length;V<mt;++V){var Et=R[V];V===0&&(P=Et.getLayout()),Ka(B,Et.getFlatCoordinates()),N.push(B.length)}s.setFlatCoordinates(P,B),s.ends_=N}return s}return l.prototype.appendLineString=function(o){this.flatCoordinates?Ka(this.flatCoordinates,o.getFlatCoordinates().slice()):this.flatCoordinates=o.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()},l.prototype.clone=function(){var o=new l(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,r,s){return s<bs(this.getExtent(),o,c)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(nd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),ad(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,o,c,r,s))},l.prototype.getCoordinateAtM=function(o,c,r){if(this.layout!=An.XYM&&this.layout!=An.XYZM||this.flatCoordinates.length===0)return null;var s=c!==void 0?c:!1,P=r!==void 0?r:!1;return Ax(this.flatCoordinates,0,this.ends_,this.stride,o,s,P)},l.prototype.getCoordinates=function(){return fh(this.flatCoordinates,0,this.ends_,this.stride)},l.prototype.getEnds=function(){return this.ends_},l.prototype.getLineString=function(o){return o<0||this.ends_.length<=o?null:new uc(this.flatCoordinates.slice(o===0?0:this.ends_[o-1],this.ends_[o]),this.layout)},l.prototype.getLineStrings=function(){for(var o=this.flatCoordinates,c=this.ends_,r=this.layout,s=[],P=0,R=0,B=c.length;R<B;++R){var N=c[R],V=new uc(o.slice(P,N),r);s.push(V),P=N}return s},l.prototype.getFlatMidpoints=function(){for(var o=[],c=this.flatCoordinates,r=0,s=this.ends_,P=this.stride,R=0,B=s.length;R<B;++R){var N=s[R],V=Hm(c,r,N,P,.5);Ka(o,V),r=N}return o},l.prototype.getSimplifiedGeometryInternal=function(o){var c=[],r=[];return c.length=gx(this.flatCoordinates,0,this.ends_,this.stride,o,c,0,r),new l(c,An.XY,r)},l.prototype.getType=function(){return Pe.MULTI_LINE_STRING},l.prototype.intersectsExtent=function(o){return wx(this.flatCoordinates,0,this.ends_,this.stride,o)},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,2),this.flatCoordinates||(this.flatCoordinates=[]);var r=sd(this.flatCoordinates,0,o,this.stride,this.ends_);this.flatCoordinates.length=r.length===0?0:r[r.length-1],this.changed()},l}(Ts),S0=R2;var O2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),F2=function(y){O2(l,y);function l(o,c){var r=y.call(this)||this;return c&&!Array.isArray(o[0])?r.setFlatCoordinates(c,o):r.setCoordinates(o,c),r}return l.prototype.appendPoint=function(o){this.flatCoordinates?Ka(this.flatCoordinates,o.getFlatCoordinates()):this.flatCoordinates=o.getFlatCoordinates().slice(),this.changed()},l.prototype.clone=function(){var o=new l(this.flatCoordinates.slice(),this.layout);return o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,r,s){if(s<bs(this.getExtent(),o,c))return s;for(var P=this.flatCoordinates,R=this.stride,B=0,N=P.length;B<N;B+=R){var V=ql(o,c,P[B],P[B+1]);if(V<s){s=V;for(var mt=0;mt<R;++mt)r[mt]=P[B+mt];r.length=R}}return s},l.prototype.getCoordinates=function(){return vl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)},l.prototype.getPoint=function(o){var c=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return o<0||c<=o?null:new ya(this.flatCoordinates.slice(o*this.stride,(o+1)*this.stride),this.layout)},l.prototype.getPoints=function(){for(var o=this.flatCoordinates,c=this.layout,r=this.stride,s=[],P=0,R=o.length;P<R;P+=r){var B=new ya(o.slice(P,P+r),c);s.push(B)}return s},l.prototype.getType=function(){return Pe.MULTI_POINT},l.prototype.intersectsExtent=function(o){for(var c=this.flatCoordinates,r=this.stride,s=0,P=c.length;s<P;s+=r){var R=c[s],B=c[s+1];if(Jf(o,R,B))return!0}return!1},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Jh(this.flatCoordinates,0,o,this.stride),this.changed()},l}(Ts),ng=F2;function I0(y,l,o,c){for(var r=[],s=Ya(),P=0,R=o.length;P<R;++P){var B=o[P];s=Om(y,l,B[0],c),r.push((s[0]+s[2])/2,(s[1]+s[3])/2),l=B[B.length-1]}return r}var B2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),U2=function(y){B2(l,y);function l(o,c,r){var s=y.call(this)||this;if(s.endss_=[],s.flatInteriorPointsRevision_=-1,s.flatInteriorPoints_=null,s.maxDelta_=-1,s.maxDeltaRevision_=-1,s.orientedRevision_=-1,s.orientedFlatCoordinates_=null,!r&&!Array.isArray(o[0])){for(var P=s.getLayout(),R=o,B=[],N=[],V=0,mt=R.length;V<mt;++V){var Et=R[V];V===0&&(P=Et.getLayout());for(var It=B.length,Vt=Et.getEnds(),Ht=0,Ct=Vt.length;Ht<Ct;++Ht)Vt[Ht]+=It;Ka(B,Et.getFlatCoordinates()),N.push(Vt)}c=P,o=B,r=N}return c!==void 0&&r?(s.setFlatCoordinates(c,o),s.endss_=r):s.setCoordinates(o,c),s}return l.prototype.appendPolygon=function(o){var c;if(!this.flatCoordinates)this.flatCoordinates=o.getFlatCoordinates().slice(),c=o.getEnds().slice(),this.endss_.push();else{var r=this.flatCoordinates.length;Ka(this.flatCoordinates,o.getFlatCoordinates()),c=o.getEnds().slice();for(var s=0,P=c.length;s<P;++s)c[s]+=r}this.endss_.push(c),this.changed()},l.prototype.clone=function(){for(var o=this.endss_.length,c=new Array(o),r=0;r<o;++r)c[r]=this.endss_[r].slice();var s=new l(this.flatCoordinates.slice(),this.layout,c);return s.applyProperties(this),s},l.prototype.closestPointXY=function(o,c,r,s){return s<bs(this.getExtent(),o,c)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(px(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),fx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,o,c,r,s))},l.prototype.containsXY=function(o,c){return xx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o,c)},l.prototype.getArea=function(){return _x(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)},l.prototype.getCoordinates=function(o){var c;return o!==void 0?(c=this.getOrientedFlatCoordinates().slice(),qy(c,0,this.endss_,this.stride,o)):c=this.flatCoordinates,ud(c,0,this.endss_,this.stride)},l.prototype.getEndss=function(){return this.endss_},l.prototype.getFlatInteriorPoints=function(){if(this.flatInteriorPointsRevision_!=this.getRevision()){var o=I0(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=bx(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_},l.prototype.getInteriorPoints=function(){return new ng(this.getFlatInteriorPoints().slice(),An.XYM)},l.prototype.getOrientedFlatCoordinates=function(){if(this.orientedRevision_!=this.getRevision()){var o=this.flatCoordinates;Ix(o,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=o:(this.orientedFlatCoordinates_=o.slice(),this.orientedFlatCoordinates_.length=qy(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_},l.prototype.getSimplifiedGeometryInternal=function(o){var c=[],r=[];return c.length=yx(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(o),c,0,r),new l(c,An.XY,r)},l.prototype.getPolygon=function(o){if(o<0||this.endss_.length<=o)return null;var c;if(o===0)c=0;else{var r=this.endss_[o-1];c=r[r.length-1]}var s=this.endss_[o].slice(),P=s[s.length-1];if(c!==0)for(var R=0,B=s.length;R<B;++R)s[R]-=c;return new pd(this.flatCoordinates.slice(c,P),this.layout,s)},l.prototype.getPolygons=function(){for(var o=this.layout,c=this.flatCoordinates,r=this.endss_,s=[],P=0,R=0,B=r.length;R<B;++R){var N=r[R].slice(),V=N[N.length-1];if(P!==0)for(var mt=0,Et=N.length;mt<Et;++mt)N[mt]-=P;var It=new pd(c.slice(P,V),o,N);s.push(It),P=V}return s},l.prototype.getType=function(){return Pe.MULTI_POLYGON},l.prototype.intersectsExtent=function(o){return Ex(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,o)},l.prototype.setCoordinates=function(o,c){this.setLayout(c,o,3),this.flatCoordinates||(this.flatCoordinates=[]);var r=mx(this.flatCoordinates,0,o,this.stride,this.endss_);if(r.length===0)this.flatCoordinates.length=0;else{var s=r[r.length-1];this.flatCoordinates.length=s.length===0?0:s[s.length-1]}this.changed()},l}(Ts),C0=U2;var L0=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),A0=0,xd=1,P0=[0,0,0,0],pf=[],g_={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"},y_=function(y){L0(l,y);function l(o,c,r){var s=y.call(this,o)||this;return s.features=c,s.mapBrowserEvent=r,s}return l}(_s);var N2=function(y){L0(l,y);function l(o){var c=y.call(this,o)||this;c.on,c.once,c.un,c.boundHandleFeatureChange_=c.handleFeatureChange_.bind(c),c.condition_=o.condition?o.condition:T0,c.defaultDeleteCondition_=function(s){return x0(s)&&E0(s)},c.deleteCondition_=o.deleteCondition?o.deleteCondition:c.defaultDeleteCondition_,c.insertVertexCondition_=o.insertVertexCondition?o.insertVertexCondition:b0,c.vertexFeature_=null,c.vertexSegments_=null,c.lastPixel_=[0,0],c.ignoreNextSingleClick_=!1,c.featuresBeingModified_=null,c.rBush_=new vd,c.pixelTolerance_=o.pixelTolerance!==void 0?o.pixelTolerance:10,c.snappedToVertex_=!1,c.changingFeature_=!1,c.dragSegments_=[],c.overlay_=new rp({source:new ip({useSpatialIndex:!1,wrapX:!!o.wrapX}),style:o.style?o.style:G2(),updateWhileAnimating:!0,updateWhileInteracting:!0}),c.SEGMENT_WRITERS_={Point:c.writePointGeometry_.bind(c),LineString:c.writeLineStringGeometry_.bind(c),LinearRing:c.writeLineStringGeometry_.bind(c),Polygon:c.writePolygonGeometry_.bind(c),MultiPoint:c.writeMultiPointGeometry_.bind(c),MultiLineString:c.writeMultiLineStringGeometry_.bind(c),MultiPolygon:c.writeMultiPolygonGeometry_.bind(c),Circle:c.writeCircleGeometry_.bind(c),GeometryCollection:c.writeGeometryCollectionGeometry_.bind(c)},c.source_=null,c.hitDetection_=null;var r;if(o.features?r=o.features:o.source&&(c.source_=o.source,r=new hh(c.source_.getFeatures()),c.source_.addEventListener(Qa.ADDFEATURE,c.handleSourceAdd_.bind(c)),c.source_.addEventListener(Qa.REMOVEFEATURE,c.handleSourceRemove_.bind(c))),!r)throw new Error("The modify interaction requires features, a source or a layer");return o.hitDetection&&(c.hitDetection_=o.hitDetection),c.features_=r,c.features_.forEach(c.addFeature_.bind(c)),c.features_.addEventListener(Es.ADD,c.handleFeatureAdd_.bind(c)),c.features_.addEventListener(Es.REMOVE,c.handleFeatureRemove_.bind(c)),c.lastPointerEvent_=null,c.delta_=[0,0],c.snapToPointer_=o.snapToPointer===void 0?!c.hitDetection_:o.snapToPointer,c}return l.prototype.addFeature_=function(o){var c=o.getGeometry();if(c){var r=this.SEGMENT_WRITERS_[c.getType()];r&&r(o,c)}var s=this.getMap();s&&s.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,s),o.addEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},l.prototype.willModifyFeatures_=function(o,c){if(!this.featuresBeingModified_){this.featuresBeingModified_=new hh;for(var r=this.featuresBeingModified_.getArray(),s=0,P=c.length;s<P;++s)for(var R=c[s],B=0,N=R.length;B<N;++B){var V=R[B].feature;V&&r.indexOf(V)===-1&&this.featuresBeingModified_.push(V)}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new y_(g_.MODIFYSTART,this.featuresBeingModified_,o))}},l.prototype.removeFeature_=function(o){this.removeFeatureSegmentData_(o),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),o.removeEventListener(Ji.CHANGE,this.boundHandleFeatureChange_)},l.prototype.removeFeatureSegmentData_=function(o){var c=this.rBush_,r=[];c.forEach(function(B){o===B.feature&&r.push(B)});for(var s=r.length-1;s>=0;--s){for(var P=r[s],R=this.dragSegments_.length-1;R>=0;--R)this.dragSegments_[R][0]===P&&this.dragSegments_.splice(R,1);c.remove(P)}},l.prototype.setActive=function(o){this.vertexFeature_&&!o&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),y.prototype.setActive.call(this,o)},l.prototype.setMap=function(o){this.overlay_.setMap(o),y.prototype.setMap.call(this,o)},l.prototype.getOverlay=function(){return this.overlay_},l.prototype.handleSourceAdd_=function(o){o.feature&&this.features_.push(o.feature)},l.prototype.handleSourceRemove_=function(o){o.feature&&this.features_.remove(o.feature)},l.prototype.handleFeatureAdd_=function(o){this.addFeature_(o.element)},l.prototype.handleFeatureChange_=function(o){if(!this.changingFeature_){var c=o.target;this.removeFeature_(c),this.addFeature_(c)}},l.prototype.handleFeatureRemove_=function(o){var c=o.element;this.removeFeature_(c)},l.prototype.writePointGeometry_=function(o,c){var r=c.getCoordinates(),s={feature:o,geometry:c,segment:[r,r]};this.rBush_.insert(c.getExtent(),s)},l.prototype.writeMultiPointGeometry_=function(o,c){for(var r=c.getCoordinates(),s=0,P=r.length;s<P;++s){var R=r[s],B={feature:o,geometry:c,depth:[s],index:s,segment:[R,R]};this.rBush_.insert(c.getExtent(),B)}},l.prototype.writeLineStringGeometry_=function(o,c){for(var r=c.getCoordinates(),s=0,P=r.length-1;s<P;++s){var R=r.slice(s,s+2),B={feature:o,geometry:c,index:s,segment:R};this.rBush_.insert(wu(R),B)}},l.prototype.writeMultiLineStringGeometry_=function(o,c){for(var r=c.getCoordinates(),s=0,P=r.length;s<P;++s)for(var R=r[s],B=0,N=R.length-1;B<N;++B){var V=R.slice(B,B+2),mt={feature:o,geometry:c,depth:[s],index:B,segment:V};this.rBush_.insert(wu(V),mt)}},l.prototype.writePolygonGeometry_=function(o,c){for(var r=c.getCoordinates(),s=0,P=r.length;s<P;++s)for(var R=r[s],B=0,N=R.length-1;B<N;++B){var V=R.slice(B,B+2),mt={feature:o,geometry:c,depth:[s],index:B,segment:V};this.rBush_.insert(wu(V),mt)}},l.prototype.writeMultiPolygonGeometry_=function(o,c){for(var r=c.getCoordinates(),s=0,P=r.length;s<P;++s)for(var R=r[s],B=0,N=R.length;B<N;++B)for(var V=R[B],mt=0,Et=V.length-1;mt<Et;++mt){var It=V.slice(mt,mt+2),Vt={feature:o,geometry:c,depth:[B,s],index:mt,segment:It};this.rBush_.insert(wu(It),Vt)}},l.prototype.writeCircleGeometry_=function(o,c){var r=c.getCenter(),s={feature:o,geometry:c,index:A0,segment:[r,r]},P={feature:o,geometry:c,index:xd,segment:[r,r]},R=[s,P];s.featureSegments=R,P.featureSegments=R,this.rBush_.insert(Jp(r),s);var B=c,N=uh();if(N&&this.getMap()){var V=this.getMap().getView().getProjection();B=B.clone().transform(N,V),B=Zy(B).transform(V,N)}this.rBush_.insert(B.getExtent(),P)},l.prototype.writeGeometryCollectionGeometry_=function(o,c){for(var r=c.getGeometriesArray(),s=0;s<r.length;++s){var P=r[s],R=this.SEGMENT_WRITERS_[P.getType()];R(o,P)}},l.prototype.createOrUpdateVertexFeature_=function(o,c,r){var s=this.vertexFeature_;if(!s)s=new lc(new ya(o)),this.vertexFeature_=s,this.overlay_.getSource().addFeature(s);else{var P=s.getGeometry();P.setCoordinates(o)}return s.set("features",c),s.set("geometries",r),s},l.prototype.handleEvent=function(o){if(!o.originalEvent)return!0;this.lastPointerEvent_=o;var c;return!o.map.getView().getInteracting()&&o.type==ia.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(o),this.vertexFeature_&&this.deleteCondition_(o)&&(o.type!=ia.SINGLECLICK||!this.ignoreNextSingleClick_?c=this.removePoint():c=!0),o.type==ia.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),y.prototype.handleEvent.call(this,o)&&!c},l.prototype.handleDragEvent=function(o){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(o,this.dragSegments_);for(var c=[o.coordinate[0]+this.delta_[0],o.coordinate[1]+this.delta_[1]],r=[],s=[],P=0,R=this.dragSegments_.length;P<R;++P){var B=this.dragSegments_[P],N=B[0],V=N.feature;r.indexOf(V)===-1&&r.push(V);var mt=N.geometry;s.indexOf(mt)===-1&&s.push(mt);for(var Et=N.depth,It=void 0,Vt=N.segment,Ht=B[1];c.length<mt.getStride();)c.push(Vt[Ht][c.length]);switch(mt.getType()){case Pe.POINT:It=c,Vt[0]=c,Vt[1]=c;break;case Pe.MULTI_POINT:It=mt.getCoordinates(),It[N.index]=c,Vt[0]=c,Vt[1]=c;break;case Pe.LINE_STRING:It=mt.getCoordinates(),It[N.index+Ht]=c,Vt[Ht]=c;break;case Pe.MULTI_LINE_STRING:It=mt.getCoordinates(),It[Et[0]][N.index+Ht]=c,Vt[Ht]=c;break;case Pe.POLYGON:It=mt.getCoordinates(),It[Et[0]][N.index+Ht]=c,Vt[Ht]=c;break;case Pe.MULTI_POLYGON:It=mt.getCoordinates(),It[Et[1]][Et[0]][N.index+Ht]=c,Vt[Ht]=c;break;case Pe.CIRCLE:if(Vt[0]=c,Vt[1]=c,N.index===A0)this.changingFeature_=!0,mt.setCenter(c),this.changingFeature_=!1;else{this.changingFeature_=!0;var Ct=o.map.getView().getProjection(),Gt=by(Xl(mt.getCenter(),Ct),Xl(c,Ct)),te=uh();if(te){var re=mt.clone().transform(te,Ct);re.setRadius(Gt),Gt=re.transform(Ct,te).getRadius()}mt.setRadius(Gt),this.changingFeature_=!1}break;default:}It&&this.setGeometryCoordinates_(mt,It)}this.createOrUpdateVertexFeature_(c,r,s)},l.prototype.handleDownEvent=function(o){if(!this.condition_(o))return!1;var c=o.coordinate;this.handlePointerAtPixel_(o.pixel,o.map,c),this.dragSegments_.length=0,this.featuresBeingModified_=null;var r=this.vertexFeature_;if(r){var s=o.map.getView().getProjection(),P=[],R=r.getGeometry().getCoordinates(),B=wu([R]),N=this.rBush_.getInExtent(B),V={};N.sort(V2);for(var mt=0,Et=N.length;mt<Et;++mt){var It=N[mt],Vt=It.segment,Ht=Ai(It.geometry),Ct=It.depth;if(Ct&&(Ht+="-"+Ct.join("-")),V[Ht]||(V[Ht]=new Array(2)),It.geometry.getType()===Pe.CIRCLE&&It.index===xd){var Gt=k0(c,It,s);Tu(Gt,R)&&!V[Ht][0]&&(this.dragSegments_.push([It,0]),V[Ht][0]=It);continue}if(Tu(Vt[0],R)&&!V[Ht][0]){this.dragSegments_.push([It,0]),V[Ht][0]=It;continue}if(Tu(Vt[1],R)&&!V[Ht][1]){if((It.geometry.getType()===Pe.LINE_STRING||It.geometry.getType()===Pe.MULTI_LINE_STRING)&&V[Ht][0]&&V[Ht][0].index===0)continue;this.dragSegments_.push([It,1]),V[Ht][1]=It;continue}Ai(Vt)in this.vertexSegments_&&!V[Ht][0]&&!V[Ht][1]&&this.insertVertexCondition_(o)&&P.push(It)}P.length&&this.willModifyFeatures_(o,[P]);for(var te=P.length-1;te>=0;--te)this.insertVertex_(P[te],R)}return!!this.vertexFeature_},l.prototype.handleUpEvent=function(o){for(var c=this.dragSegments_.length-1;c>=0;--c){var r=this.dragSegments_[c][0],s=r.geometry;if(s.getType()===Pe.CIRCLE){var P=s.getCenter(),R=r.featureSegments[0],B=r.featureSegments[1];R.segment[0]=P,R.segment[1]=P,B.segment[0]=P,B.segment[1]=P,this.rBush_.update(Jp(P),R);var N=s,V=uh();if(V){var mt=o.map.getView().getProjection();N=N.clone().transform(V,mt),N=Zy(N).transform(mt,V)}this.rBush_.update(N.getExtent(),B)}else this.rBush_.update(wu(r.segment),r)}return this.featuresBeingModified_&&(this.dispatchEvent(new y_(g_.MODIFYEND,this.featuresBeingModified_,o)),this.featuresBeingModified_=null),!1},l.prototype.handlePointerMove_=function(o){this.lastPixel_=o.pixel,this.handlePointerAtPixel_(o.pixel,o.map,o.coordinate)},l.prototype.handlePointerAtPixel_=function(o,c,r){var s=this,P=r||c.getCoordinateFromPixel(o),R=c.getView().getProjection(),B=function(Me,Br){return M0(P,Me,R)-M0(P,Br,R)},N,V;if(this.hitDetection_){var mt=typeof this.hitDetection_=="object"?function(Me){return Me===s.hitDetection_}:void 0;c.forEachFeatureAtPixel(o,function(Me,Br,Tr){if(Tr=Tr||Me.getGeometry(),Tr.getType()===Pe.POINT&&pv(s.features_.getArray(),Me)){V=Tr;var br=Tr.getFlatCoordinates().slice(0,2);N=[{feature:Me,geometry:Tr,segment:[br,br]}]}return!0},{layerFilter:mt})}if(!N){var Et=ed(Jp(P,P0),R),It=c.getView().getResolution()*this.pixelTolerance_,Vt=tf(yl(Et,It,P0),R);N=this.rBush_.getInExtent(Vt)}if(N&&N.length>0){var Ht=N.sort(B)[0],Ct=Ht.segment,Gt=k0(P,Ht,R),te=c.getPixelFromCoordinate(Gt),re=by(o,te);if(V||re<=this.pixelTolerance_){var _e={};if(_e[Ai(Ct)]=!0,this.snapToPointer_||(this.delta_[0]=Gt[0]-P[0],this.delta_[1]=Gt[1]-P[1]),Ht.geometry.getType()===Pe.CIRCLE&&Ht.index===xd)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(Gt,[Ht.feature],[Ht.geometry]);else{var ye=c.getPixelFromCoordinate(Ct[0]),ce=c.getPixelFromCoordinate(Ct[1]),Te=Qp(te,ye),Ie=Qp(te,ce);re=Math.sqrt(Math.min(Te,Ie)),this.snappedToVertex_=re<=this.pixelTolerance_,this.snappedToVertex_&&(Gt=Te>Ie?Ct[1]:Ct[0]),this.createOrUpdateVertexFeature_(Gt,[Ht.feature],[Ht.geometry]);var Le={};Le[Ai(Ht.geometry)]=!0;for(var ur=1,Ve=N.length;ur<Ve;++ur){var Qe=N[ur].segment;if(Tu(Ct[0],Qe[0])&&Tu(Ct[1],Qe[1])||Tu(Ct[0],Qe[1])&&Tu(Ct[1],Qe[0])){var or=Ai(N[ur].geometry);or in Le||(Le[or]=!0,_e[Ai(Qe)]=!0)}else break}}this.vertexSegments_=_e;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)},l.prototype.insertVertex_=function(o,c){for(var r=o.segment,s=o.feature,P=o.geometry,R=o.depth,B=o.index,N;c.length<P.getStride();)c.push(0);switch(P.getType()){case Pe.MULTI_LINE_STRING:N=P.getCoordinates(),N[R[0]].splice(B+1,0,c);break;case Pe.POLYGON:N=P.getCoordinates(),N[R[0]].splice(B+1,0,c);break;case Pe.MULTI_POLYGON:N=P.getCoordinates(),N[R[1]][R[0]].splice(B+1,0,c);break;case Pe.LINE_STRING:N=P.getCoordinates(),N.splice(B+1,0,c);break;default:return}this.setGeometryCoordinates_(P,N);var V=this.rBush_;V.remove(o),this.updateSegmentIndices_(P,B,R,1);var mt={segment:[r[0],c],feature:s,geometry:P,depth:R,index:B};V.insert(wu(mt.segment),mt),this.dragSegments_.push([mt,1]);var Et={segment:[c,r[1]],feature:s,geometry:P,depth:R,index:B+1};V.insert(wu(Et.segment),Et),this.dragSegments_.push([Et,0]),this.ignoreNextSingleClick_=!0},l.prototype.removePoint=function(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=ia.POINTERDRAG){var o=this.lastPointerEvent_;this.willModifyFeatures_(o,this.dragSegments_);var c=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new y_(g_.MODIFYEND,this.featuresBeingModified_,o)),this.featuresBeingModified_=null,c}return!1},l.prototype.removeVertex_=function(){var o=this.dragSegments_,c={},r=!1,s,P,R,B,N,V,mt,Et,It,Vt,Ht;for(N=o.length-1;N>=0;--N)R=o[N],Vt=R[0],Ht=Ai(Vt.feature),Vt.depth&&(Ht+="-"+Vt.depth.join("-")),Ht in c||(c[Ht]={}),R[1]===0?(c[Ht].right=Vt,c[Ht].index=Vt.index):R[1]==1&&(c[Ht].left=Vt,c[Ht].index=Vt.index+1);for(Ht in c){switch(It=c[Ht].right,mt=c[Ht].left,V=c[Ht].index,Et=V-1,mt!==void 0?Vt=mt:Vt=It,Et<0&&(Et=0),B=Vt.geometry,P=B.getCoordinates(),s=P,r=!1,B.getType()){case Pe.MULTI_LINE_STRING:P[Vt.depth[0]].length>2&&(P[Vt.depth[0]].splice(V,1),r=!0);break;case Pe.LINE_STRING:P.length>2&&(P.splice(V,1),r=!0);break;case Pe.MULTI_POLYGON:s=s[Vt.depth[1]];case Pe.POLYGON:s=s[Vt.depth[0]],s.length>4&&(V==s.length-1&&(V=0),s.splice(V,1),r=!0,V===0&&(s.pop(),s.push(s[0]),Et=s.length-1));break;default:}if(r){this.setGeometryCoordinates_(B,P);var Ct=[];if(mt!==void 0&&(this.rBush_.remove(mt),Ct.push(mt.segment[0])),It!==void 0&&(this.rBush_.remove(It),Ct.push(It.segment[1])),mt!==void 0&&It!==void 0){var Gt={depth:Vt.depth,feature:Vt.feature,geometry:Vt.geometry,index:Et,segment:Ct};this.rBush_.insert(wu(Gt.segment),Gt)}this.updateSegmentIndices_(B,V,Vt.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),o.length=0}}return r},l.prototype.setGeometryCoordinates_=function(o,c){this.changingFeature_=!0,o.setCoordinates(c),this.changingFeature_=!1},l.prototype.updateSegmentIndices_=function(o,c,r,s){this.rBush_.forEachInExtent(o.getExtent(),function(P){P.geometry===o&&(r===void 0||P.depth===void 0||vs(P.depth,r))&&P.index>c&&(P.index+=s)})},l}(v0);function V2(y,l){return y.index-l.index}function M0(y,l,o){var c=l.geometry;if(c.getType()===Pe.CIRCLE){var r=c;if(l.index===xd){var s=uh();s&&(r=r.clone().transform(s,o));var P=Qp(r.getCenter(),Xl(y,o)),R=Math.sqrt(P)-r.getRadius();return R*R}}var B=Xl(y,o);return pf[0]=Xl(l.segment[0],o),pf[1]=Xl(l.segment[1],o),Wv(B,pf)}function k0(y,l,o){var c=l.geometry;if(c.getType()===Pe.CIRCLE&&l.index===xd){var r=c,s=uh();return s&&(r=r.clone().transform(s,o)),Ty(r.getClosestPoint(Xl(y,o)),o)}var P=Xl(y,o);return pf[0]=Xl(l.segment[0],o),pf[1]=Xl(l.segment[1],o),Ty(xy(P,pf),o)}function G2(){var y=Nx();return function(l,o){return y[Pe.POINT]}}var __=N2;var j2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),q2=function(y){j2(l,y);function l(o){var c=y.call(this)||this;return c.geometries_=o||null,c.changeEventsKeys_=[],c.listenGeometriesChange_(),c}return l.prototype.unlistenGeometriesChange_=function(){this.changeEventsKeys_.forEach(Ao),this.changeEventsKeys_.length=0},l.prototype.listenGeometriesChange_=function(){if(!!this.geometries_)for(var o=0,c=this.geometries_.length;o<c;++o)this.changeEventsKeys_.push(lo(this.geometries_[o],Ji.CHANGE,this.changed,this))},l.prototype.clone=function(){var o=new l(null);return o.setGeometries(this.geometries_),o.applyProperties(this),o},l.prototype.closestPointXY=function(o,c,r,s){if(s<bs(this.getExtent(),o,c))return s;for(var P=this.geometries_,R=0,B=P.length;R<B;++R)s=P[R].closestPointXY(o,c,r,s);return s},l.prototype.containsXY=function(o,c){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)if(r[s].containsXY(o,c))return!0;return!1},l.prototype.computeExtent=function(o){Yp(o);for(var c=this.geometries_,r=0,s=c.length;r<s;++r)Nv(o,c[r].getExtent());return o},l.prototype.getGeometries=function(){return z0(this.geometries_)},l.prototype.getGeometriesArray=function(){return this.geometries_},l.prototype.getGeometriesArrayRecursive=function(){for(var o=[],c=this.geometries_,r=0,s=c.length;r<s;++r)c[r].getType()===this.getType()?o=o.concat(c[r].getGeometriesArrayRecursive()):o.push(c[r]);return o},l.prototype.getSimplifiedGeometry=function(o){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),o<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&o<this.simplifiedGeometryMaxMinSquaredTolerance)return this;for(var c=[],r=this.geometries_,s=!1,P=0,R=r.length;P<R;++P){var B=r[P],N=B.getSimplifiedGeometry(o);c.push(N),N!==B&&(s=!0)}if(s){var V=new l(null);return V.setGeometriesArray(c),V}else return this.simplifiedGeometryMaxMinSquaredTolerance=o,this},l.prototype.getType=function(){return Pe.GEOMETRY_COLLECTION},l.prototype.intersectsExtent=function(o){for(var c=this.geometries_,r=0,s=c.length;r<s;++r)if(c[r].intersectsExtent(o))return!0;return!1},l.prototype.isEmpty=function(){return this.geometries_.length===0},l.prototype.rotate=function(o,c){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].rotate(o,c);this.changed()},l.prototype.scale=function(o,c,r){var s=r;s||(s=Kh(this.getExtent()));for(var P=this.geometries_,R=0,B=P.length;R<B;++R)P[R].scale(o,c,s);this.changed()},l.prototype.setGeometries=function(o){this.setGeometriesArray(z0(o))},l.prototype.setGeometriesArray=function(o){this.unlistenGeometriesChange_(),this.geometries_=o,this.listenGeometriesChange_(),this.changed()},l.prototype.applyTransform=function(o){for(var c=this.geometries_,r=0,s=c.length;r<s;++r)c[r].applyTransform(o);this.changed()},l.prototype.translate=function(o,c){for(var r=this.geometries_,s=0,P=r.length;s<P;++s)r[s].translate(o,c);this.changed()},l.prototype.disposeInternal=function(){this.unlistenGeometriesChange_(),y.prototype.disposeInternal.call(this)},l}(Xm);function z0(y){for(var l=[],o=0,c=y.length;o<c;++o)l.push(y[o].clone());return l}var D0=q2;var Z2=function(){function y(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}return y.prototype.getReadOptions=function(l,o){var c;if(o){var r=o.dataProjection?ga(o.dataProjection):this.readProjection(l);o.extent&&r&&r.getUnits()===ac.TILE_PIXELS&&(r=ga(r),r.setWorldExtent(o.extent)),c={dataProjection:r,featureProjection:o.featureProjection}}return this.adaptOptions(c)},y.prototype.adaptOptions=function(l){return La({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},l)},y.prototype.getType=function(){return jr()},y.prototype.readFeature=function(l,o){return jr()},y.prototype.readFeatures=function(l,o){return jr()},y.prototype.readGeometry=function(l,o){return jr()},y.prototype.readProjection=function(l){return jr()},y.prototype.writeFeature=function(l,o){return jr()},y.prototype.writeFeatures=function(l,o){return jr()},y.prototype.writeGeometry=function(l,o){return jr()},y}(),R0=Z2;function v_(y,l,o){var c=o?ga(o.featureProjection):null,r=o?ga(o.dataProjection):null,s;if(c&&r&&!Yv(c,r)?s=(l?y.clone():y).transform(l?c:r,l?r:c):s=y,l&&o&&o.decimals!==void 0){var P=Math.pow(10,o.decimals),R=function(B){for(var N=0,V=B.length;N<V;++N)B[N]=Math.round(B[N]*P)/P;return B};s===y&&(s=y.clone()),s.applyTransform(R)}return s}var X2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),W2=function(y){X2(l,y);function l(){return y.call(this)||this}return l.prototype.getType=function(){return vh.JSON},l.prototype.readFeature=function(o,c){return this.readFeatureFromObject(og(o),this.getReadOptions(o,c))},l.prototype.readFeatures=function(o,c){return this.readFeaturesFromObject(og(o),this.getReadOptions(o,c))},l.prototype.readFeatureFromObject=function(o,c){return jr()},l.prototype.readFeaturesFromObject=function(o,c){return jr()},l.prototype.readGeometry=function(o,c){return this.readGeometryFromObject(og(o),this.getReadOptions(o,c))},l.prototype.readGeometryFromObject=function(o,c){return jr()},l.prototype.readProjection=function(o){return this.readProjectionFromObject(og(o))},l.prototype.readProjectionFromObject=function(o){return jr()},l.prototype.writeFeature=function(o,c){return JSON.stringify(this.writeFeatureObject(o,c))},l.prototype.writeFeatureObject=function(o,c){return jr()},l.prototype.writeFeatures=function(o,c){return JSON.stringify(this.writeFeaturesObject(o,c))},l.prototype.writeFeaturesObject=function(o,c){return jr()},l.prototype.writeGeometry=function(o,c){return JSON.stringify(this.writeGeometryObject(o,c))},l.prototype.writeGeometryObject=function(o,c){return jr()},l}(R0);function og(y){if(typeof y=="string"){var l=JSON.parse(y);return l||null}else return y!==null?y:null}var O0=W2;var $2=function(){var y=function(l,o){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,r){c.__proto__=r}||function(c,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(c[s]=r[s])},y(l,o)};return function(l,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");y(l,o);function c(){this.constructor=l}l.prototype=o===null?Object.create(o):(c.prototype=o.prototype,new c)}}(),K2=function(y){$2(l,y);function l(o){var c=this,r=o||{};return c=y.call(this)||this,c.dataProjection=ga(r.dataProjection?r.dataProjection:"EPSG:4326"),r.featureProjection&&(c.defaultFeatureProjection=ga(r.featureProjection)),c.geometryName_=r.geometryName,c.extractGeometryName_=r.extractGeometryName,c.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"],c}return l.prototype.readFeatureFromObject=function(o,c){var r=null;o.type==="Feature"?r=o:r={type:"Feature",geometry:o,properties:null};var s=x_(r.geometry,c),P=new lc;return this.geometryName_?P.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in r!==void 0&&P.setGeometryName(r.geometry_name),P.setGeometry(s),"id"in r&&P.setId(r.id),r.properties&&P.setProperties(r.properties,!0),P},l.prototype.readFeaturesFromObject=function(o,c){var r=o,s=null;if(r.type==="FeatureCollection"){var P=o;s=[];for(var R=P.features,B=0,N=R.length;B<N;++B)s.push(this.readFeatureFromObject(R[B],c))}else s=[this.readFeatureFromObject(o,c)];return s},l.prototype.readGeometryFromObject=function(o,c){return x_(o,c)},l.prototype.readProjectionFromObject=function(o){var c=o.crs,r;return c?c.type=="name"?r=ga(c.properties.name):c.type==="EPSG"?r=ga("EPSG:"+c.properties.code):wn(!1,36):r=this.dataProjection,r},l.prototype.writeFeatureObject=function(o,c){c=this.adaptOptions(c);var r={type:"Feature",geometry:null,properties:null},s=o.getId();if(s!==void 0&&(r.id=s),!o.hasProperties())return r;var P=o.getProperties(),R=o.getGeometry();return R&&(r.geometry=b_(R,c),delete P[o.getGeometryName()]),Vl(P)||(r.properties=P),r},l.prototype.writeFeaturesObject=function(o,c){c=this.adaptOptions(c);for(var r=[],s=0,P=o.length;s<P;++s)r.push(this.writeFeatureObject(o[s],c));return{type:"FeatureCollection",features:r}},l.prototype.writeGeometryObject=function(o,c){return b_(o,this.adaptOptions(c))},l}(O0);function x_(y,l){if(!y)return null;var o;switch(y.type){case Pe.POINT:{o=Y2(y);break}case Pe.LINE_STRING:{o=J2(y);break}case Pe.POLYGON:{o=rE(y);break}case Pe.MULTI_POINT:{o=tE(y);break}case Pe.MULTI_LINE_STRING:{o=Q2(y);break}case Pe.MULTI_POLYGON:{o=eE(y);break}case Pe.GEOMETRY_COLLECTION:{o=H2(y);break}default:throw new Error("Unsupported GeoJSON type: "+y.type)}return v_(o,!1,l)}function H2(y,l){var o=y.geometries.map(function(c){return x_(c,l)});return new D0(o)}function Y2(y){return new ya(y.coordinates)}function J2(y){return new uc(y.coordinates)}function Q2(y){return new S0(y.coordinates)}function tE(y){return new ng(y.coordinates)}function eE(y){return new C0(y.coordinates)}function rE(y){return new pd(y.coordinates)}function b_(y,l){y=v_(y,!0,l);var o=y.getType(),c;switch(o){case Pe.POINT:{c=lE(y,l);break}case Pe.LINE_STRING:{c=nE(y,l);break}case Pe.POLYGON:{c=uE(y,l);break}case Pe.MULTI_POINT:{c=aE(y,l);break}case Pe.MULTI_LINE_STRING:{c=oE(y,l);break}case Pe.MULTI_POLYGON:{c=sE(y,l);break}case Pe.GEOMETRY_COLLECTION:{c=iE(y,l);break}case Pe.CIRCLE:{c={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+o)}return c}function iE(y,l){var o=y.getGeometriesArray().map(function(c){var r=La({},l);return delete r.featureProjection,b_(c,r)});return{type:"GeometryCollection",geometries:o}}function nE(y,l){return{type:"LineString",coordinates:y.getCoordinates()}}function oE(y,l){return{type:"MultiLineString",coordinates:y.getCoordinates()}}function aE(y,l){return{type:"MultiPoint",coordinates:y.getCoordinates()}}function sE(y,l){var o;return l&&(o=l.rightHanded),{type:"MultiPolygon",coordinates:y.getCoordinates(o)}}function lE(y,l){return{type:"Point",coordinates:y.getCoordinates()}}function uE(y,l){var o;return l&&(o=l.rightHanded),{type:"Polygon",coordinates:y.getCoordinates(o)}}var bl=K2;var ag,cE=new Uint8Array(16);function w_(){if(!ag&&(ag=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ag))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ag(cE)}var F0=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function hE(y){return typeof y=="string"&&F0.test(y)}var B0=hE;var va=[];for(sg=0;sg<256;++sg)va.push((sg+256).toString(16).substr(1));var sg;function pE(y){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=(va[y[l+0]]+va[y[l+1]]+va[y[l+2]]+va[y[l+3]]+"-"+va[y[l+4]]+va[y[l+5]]+"-"+va[y[l+6]]+va[y[l+7]]+"-"+va[y[l+8]]+va[y[l+9]]+"-"+va[y[l+10]]+va[y[l+11]]+va[y[l+12]]+va[y[l+13]]+va[y[l+14]]+va[y[l+15]]).toLowerCase();if(!B0(o))throw TypeError("Stringified UUID is invalid");return o}var U0=pE;function fE(y,l,o){y=y||{};var c=y.random||(y.rng||w_)();if(c[6]=c[6]&15|64,c[8]=c[8]&63|128,l){o=o||0;for(var r=0;r<16;++r)l[o+r]=c[r];return l}return U0(c)}var E_=fE;var np=class extends Po{constructor(l={}){super(),this.defineProperties(l),this.setProperties(l.properties),this.visible=l.visible===void 0?!0:!!l.visible,this.group=l.group,this.copyrights=l.copyrights,this.children=l.children,this.on("change:visible:group",o=>{this.group===o.target.group&&this!==o.target&&this.visible?this.visible=!1:this.children&&this.children.forEach(c=>c.dispatchEvent(o))})}defineProperties(l){let{name:o,key:c,properties:r,hitTolerance:s}={...l},P=E_();Object.defineProperties(this,{name:{value:o},key:{value:c||P},group:{get:()=>this.get("group"),set:R=>{this.set("group",R)}},copyrights:{get:()=>this.get("copyrights"),set:R=>{let B=R&&!Array.isArray(R)?[R]:R;this.set("copyrights",B||[])}},options:{value:l},map:{writable:!0},visible:{get:()=>this.get("visible"),set:R=>{if(R!==this.visible)if(this.set("visible",R),this.visible){if(this.parent&&!this.parent.visible&&(this.parent.visible=!0),this.children&&this.children.find(B=>B.group)){let B=this.children.find(N=>!!N.group);B.visible=!0}if(this.parent&&this.group){let B=this.parent;for(;B.parent;)B=B.parent;B.dispatchEvent({type:"change:visible:group",target:this})}}else this.visible||this.parent&&this.parent.visible&&!this.parent.children.find(B=>B.visible)&&(this.parent.visible=!1)}},disabled:{get:()=>this.get("disabled"),set:R=>{this.set("disabled",R)}},parent:{value:null,writable:!0},children:{get:()=>this.get("children")||[],set:R=>{(this.children||[]).forEach(B=>{B.parent=null}),Array.isArray(R)&&R.forEach(B=>{B.parent=this}),this.set("children",R||[])}},hitTolerance:{value:s||5,writable:!0},properties:{value:{...r||{}}}})}attachToMap(l){this.detachFromMap(),this.map=l,this.children&&this.children.forEach(o=>{o.attachToMap(l)})}detachFromMap(){this.map=null}getFeatureInfoAtCoordinate(l,o){return console.error("getFeatureInfoAtCoordinate must be implemented by inheriting layers",this.key),Promise.resolve({layer:this,features:[],coordinate:l})}flat(){return $f(this)}};var dE=y=>class extends y{constructor(l={}){super(l);let{userInteractions:o=!0,userClickInteractions:c=!0,userHoverInteractions:r=!0,defaultUserInteractions:s=!0}=l;this.userInteractions=o,this.userClickInteractions=c,this.userHoverInteractions=r,this.defaultUserInteractions=s,this.userClickCallbacks=[],this.userHoverCallbacks=[],this.userClickEventsKeys=[],this.userHoverEventsKeys=[],this.onUserClickCallback=this.onUserClickCallback.bind(this),this.onUserMoveCallback=this.onUserMoveCallback.bind(this);let{onClick:P,onHover:R}=l;this.userInteractions&&this.userClickInteractions&&P&&this.onClick(P),this.userInteractions&&this.userHoverInteractions&&R&&this.onHover(R)}attachToMap(l,o){super.attachToMap(l,o),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(l=>{this.userClickEventsKeys.push(this.on("user:click",({target:{features:o,layer:c,coordinate:r}})=>{l(o,c,r)}))}),this.userHoverCallbacks.forEach(l=>{this.userHoverEventsKeys.push(this.on("user:hover",({target:{features:o,layer:c,coordinate:r,event:s}})=>{l(o,c,r,s)}))})}unlistenEvents(){Ha(this.userClickEventsKeys),Ha(this.userHoverEventsKeys),this.userClickEventsKeys=[],this.userHoverEventsKeys=[]}onClick(l){this.userClickCallbacks.push(l),this.activateUserInteractions(),this.map&&this.listenEvents()}onHover(l){this.userHoverCallbacks.push(l),this.activateUserInteractions(),this.map&&this.listenEvents()}unClick(l){let o=this.userClickCallbacks.indexOf(l);o===-1&&(this.userClickCallbacks=this.userClickCallbacks.slice(o,1),this.map&&this.listenEvents())}unHover(l){let o=this.userHoverCallbacks.indexOf(l);o===-1&&(this.userHoverCallbacks=this.userHoverCallbacks.slice(o,1),this.map&&this.listenEvents())}onUserClickCallback(l){let o=l.coordinate||uo(l.lngLat.toArray()),c={features:[],layer:this,coordinate:o,event:l};return this.getFeatureInfoAtCoordinate(o).then(r=>(this.dispatchEvent({type:"user:click",target:r}),r)).catch(()=>c)}onUserMoveCallback(l){let o=l.coordinate||uo(l.lngLat.toArray()),c={features:[],layer:this,coordinate:o,event:l};return this.getFeatureInfoAtCoordinate(o).then(r=>(this.dispatchEvent({type:"user:hover",target:r}),r)).catch(()=>c)}activateUserInteractions(){}deactivateUserInteractions(){}},lg=dE;var bd=class extends lg(np){constructor(l){super(l),this.olLayer&&this.olLayer.setVisible(this.visible)}defineProperties(l){super.defineProperties(l),Object.defineProperties(this,{olLayer:{value:l.olLayer,writable:!0},olListenersKeys:{value:[]}})}attachToMap(l){if(super.attachToMap(l),!!this.map&&(this.olLayer&&!this.map?.getLayers()?.getArray()?.includes(this.olLayer)&&this.map.addLayer(this.olLayer),this.olListenersKeys.push(this.on("change:visible",()=>{this.olLayer&&this.olLayer.setVisible(this.visible)})),this.olListenersKeys.push(this.map.getLayers().on("remove",o=>{o.element===this.olLayer&&this.detachFromMap()})),this.toggleVisibleListeners(),this.olListenersKeys.push(this.on("change:visible",this.toggleVisibleListeners)),this.copyrights&&this.olLayer)){let o=this.copyrights||[];this.olLayer.getLayers?this.olLayer.getLayers().getArray().forEach(c=>{c.getSource()?.setAttributions(o)}):this.olLayer.getSource&&this.olLayer.getSource()?.setAttributions(o)}}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(l){return new bd({...this.options,...l})}},Da=bd;var N0=new xl({radius:6,fill:new Ks({color:[255,0,0,1]}),stroke:new _a({color:[0,0,0,1],width:1})}),mE=new Wl({stroke:new _a({color:[0,0,0,1],width:5})}),gE=new Wl({image:N0,stroke:new _a({color:[255,0,0,1],width:3})}),yE=new Wl({image:N0,stroke:new _a({color:[255,0,0,1],width:3,lineDash:[1,10]})}),_E=(y,l)=>{let o=y.get("minResolution"),c=y.get("maxResolution"),r=l<=o&&l>c;return o&&c&&!r?null:y.get("mot")!=="foot"?[mE,gE]:[yE]},wd=class extends Da{constructor(l={}){super(l),this.olLayer=l.olLayer||new rp({source:new ip,style:l.style||_E})}clone(l){return new wd({...this.options,...l})}},ug=wd;var vE=/^([^@$!\n]*)(@?([\d.]+),([\d.]+))?(\$?([a-zA-Z0-9]{0,2}))$/,V0=/^([\d.]+),([\d.]+)$/,G0=/^!([^$]*)(\$?([a-zA-Z0-9]{0,2}))$/,cg="stop-fetch",j0=y=>{let l=[];return y.forEach(o=>{l.push(...o.getGeometry().getCoordinates())}),l},Ed=class extends ch{constructor(l={}){super(l),Object.defineProperties(this,{mot:{get:()=>this.get("mot"),set:o=>{o&&(this.set("mot",o),this.viaPoints&&this.drawRoute())}},loading:{get:()=>this.get("loading"),set:o=>{this.set("loading",o)}},modify:{get:()=>this.get("modify"),set:o=>{this.set("modify",o)}}}),this.loading=!1,this.graphs=l.graphs||[["osm",0,99]],this.mot=l.mot||"bus",this.modify=l.modify!==!1,this.routingApiParams=l.routingApiParams||{},this.useRawViaPoints=l.useRawViaPoints||!1,this.snapToClosestStation=l.snapToClosestStation||!1,this.cacheStationData={},this.abortControllers=[],this.apiKey=l.apiKey,this.stopsApiKey=l.stopsApiKey||this.apiKey,this.segments=[],this.stopsApiUrl=l.stopsApiUrl||"https://api.geops.io/stops/v1/",this.api=new Zf({...l}),this.routingLayer=l.routingLayer||new ug({name:"routing-layer",style:l.style}),this.onRouteError=l.onRouteError||(o=>{this.dispatchEvent({type:"change:route",target:this}),this.reset(),console.error(o)}),this.viaPoints=[],this.onMapClick=this.onMapClick.bind(this),this.onModifyEnd=this.onModifyEnd.bind(this),this.onModifyStart=this.onModifyStart.bind(this),this.apiChangeListener=()=>this.drawRoute(),this.createModifyInteraction()}static getGraphsResolutions(l,o){let c=o.getView();return l.map(([,r,s])=>[c.getResolutionForZoom(r),c.getResolutionForZoom(s||r+1)])}addViaPoint(l,o=-1,c=0){this.viaPoints.splice(o===-1?this.viaPoints.length:o,c,l),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}removeViaPoint(l=this.viaPoints.length-1){this.viaPoints.length&&this.viaPoints[l]&&this.viaPoints.splice(l,1),this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}setViaPoints(l){this.viaPoints=[...l],this.drawRoute(),this.dispatchEvent({type:"change:route",target:this})}reset(){this.abortRequests(),this.viaPoints=[],this.routingLayer.olLayer.getSource().clear(),this.dispatchEvent({type:"change:route",target:this})}abortRequests(){this.graphs.forEach(([l])=>{this.abortControllers[l]&&this.abortControllers[l].abort(),this.abortControllers[l]=new AbortController}),this.abortControllers[cg]?.abort(),this.abortControllers[cg]=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[cg]);let l=this.viaPoints.map(o=>{if(Array.isArray(o)){let c=this.map.getView().getProjection(),[r,s]=lh(o,c);return this.snapToClosestStation?[`@${s}`,r]:[s,r]}return this.useRawViaPoints?o:`!${o}`});return this.loading=!0,this.routingLayer.olLayer.getSource().clear(),this.viaPoints.forEach((o,c)=>this.drawViaPoint(o,c,this.abortControllers[cg])),Promise.all(this.graphs.map(([o],c)=>{let{signal:r}=this.abortControllers[o];return this.api.route({graph:o,via:`${l.join("|")}`,mot:`${this.mot}`,"resolve-hops":!1,elevation:!1,"coord-radius":100,"coord-punish":1e3,...this.routingApiParams},{signal:r}).then(s=>{if(this.segments=this.format.readFeatures(s),this.mot==="foot"){let B=this.segments.reduce((N,V)=>{let mt=V.get("trg");return N.find(Et=>Et[0]===mt[0]&&Et[1]===mt[1])?N:[...N,mt]},[]);this.segments=B.map(N=>{let V=this.segments.filter(Et=>{let It=Et.get("trg");return It[0]===N[0]&&It[1]===N[1]}),mt=j0(V);return new lc({geometry:new uc(mt)})})}let P=j0(this.segments),R=new lc({geometry:new uc(P)});R.set("graph",o),R.set("mot",this.mot),R.set("minResolution",this.graphsResolutions[c][0]),R.set("maxResolution",this.graphsResolutions[c][1]),this.routingLayer.olLayer.getSource().addFeature(R),this.loading=!1}).catch(s=>{s.name!=="AbortError"&&(this.segments=[],this.dispatchEvent({type:"error",target:this}),this.onRouteError(s,this),this.loading=!1)})}))}drawViaPoint(l,o,c){let r=new lc;if(r.set("viaPointIdx",o),Array.isArray(l))return r.setGeometry(new ya(l)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r);if(!this.useRawViaPoints||G0.test(l)){let N,V;return this.useRawViaPoints?[,N,,V]=G0.exec(l):[N,V]=l.split("$"),fetch(`${this.stopsApiUrl}lookup/${N}?key=${this.stopsApiKey}`,{signal:c.signal}).then(mt=>mt.json()).then(mt=>{let{coordinates:Et}=mt.features[0].geometry;return this.cacheStationData[l]=uo(Et),r.set("viaPointTrack",V),r.setGeometry(new ya(uo(Et))),this.routingLayer.olLayer.getSource().addFeature(r),r}).catch(mt=>{mt.name!=="AbortError"&&(this.dispatchEvent({type:"error",target:this}),this.onRouteError(mt,this),this.loading=!1)})}if(this.useRawViaPoints&&V0.test(l)){let[N,V]=V0.exec(l),mt=uo([parseFloat(V),parseFloat(N)],this.map.getView().getProjection());return r.setGeometry(new ya(mt)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r)}let[,s,,P,R,,B]=vE.exec(l);if(R&&P){let N=uo([parseFloat(R),parseFloat(P)],this.map.getView().getProjection());return r.set("viaPointTrack",B),r.setGeometry(new ya(N)),this.routingLayer.olLayer.getSource().addFeature(r),Promise.resolve(r)}return s?fetch(`${this.stopsApiUrl}?key=${this.stopsApiKey}&q=${s}&limit=1`,{signal:c.signal}).then(N=>N.json()).then(N=>{let{coordinates:V}=N.features[0].geometry;return this.cacheStationData[l]=uo(V),r.set("viaPointTrack",B),r.setGeometry(new ya(uo(V))),this.routingLayer.olLayer.getSource().addFeature(r),r}).catch(N=>(this.dispatchEvent({type:"error",target:this}),this.onRouteError(N,this),this.loading=!1,null)):Promise.resolve(null)}onMapClick(l){let c=l.target.getFeaturesAtPixel(l.pixel).find(r=>r.getGeometry()?.getType()===Pe.POINT&&r.get("viaPointIdx")!==void 0);if(c){this.removeViaPoint(c.get("viaPointIdx"));return}this.addViaPoint(l.coordinate)}onModifyStart(l){let o=-1,c=l.features.getArray().find(s=>s.getGeometry()?.getType()===Pe.LINE_STRING);if(c){let s=yl(new ya(c.getGeometry().getClosestPoint(l.mapBrowserEvent.coordinate)).getExtent(),.001);o=this.segments.findIndex(P=>P.getGeometry().intersectsExtent(s))}let r=(l.features.getArray().filter(s=>s.getGeometry()?.getType()===Pe.POINT)||[])[0];this.initialRouteDrag={viaPoint:r,oldRoute:c&&c.clone(),segmentIndex:o}}onModifyEnd(l){let o=l.mapBrowserEvent.coordinate,{oldRoute:c,viaPoint:r,segmentIndex:s}=this.initialRouteDrag;return r?this.addViaPoint(o,r.get("viaPointIdx"),1):c?s===-1?Promise.reject(new Error("No segment found")):this.addViaPoint(o,s+1):this.addViaPoint(o,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 __({source:this.routingLayer.olLayer.getSource(),pixelTolerance:4,hitDetection:this.routingLayer.olLayer,deleteCondition:l=>{let c=l.target.getFeaturesAtPixel(l.pixel,{hitTolerance:5}).find(r=>r.getGeometry()?.getType()===Pe.POINT&&r.get("index"));return w0(l)&&c?(this.removeViaPoint(c.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(){Ha(this.onMapClickKey)}activate(){super.activate(),this.map?(this.format=new bl({featureProjection:this.map.getView().getProjection()}),this.graphsResolutions=Ed.getGraphsResolutions(this.graphs,this.map),this.map.removeInteraction(this.modifyInteraction),this.routingLayer.attachToMap(this.map),this.map.addInteraction(this.modifyInteraction),this.modifyInteraction.setActive(this.modify),this.addListeners()):(this.format=new bl({featureProjection:"EPSG:3857"}),this.graphsResolutions=this.graphs)}deactivate(){this.map&&(this.routingLayer.detachFromMap(this.map),this.map.removeInteraction(this.modifyInteraction),this.removeListeners(),this.reset()),super.deactivate()}},q0=Ed;var xE=y=>class extends y{constructor(l={}){super(l);let{apiParams:o,apiKey:c,url:r}=l;this.apiParams={limit:20,...o||{}},this.placeholder=l.placeholder||"Search for a stop...";let s={apiKey:c};r&&(s.url=r),this.api=new Xf(s),this.abortController=new AbortController}render(l){let o=l?.features||[];!this.suggestionsElt||(this.suggestionsElt.style.display=o.length?"block":"none",this.suggestionsElt.innerHTML="",o.forEach(c=>{let{properties:r}=c,s=document.createElement("div");s.innerHTML=r.name,s.onclick=()=>{this.onSuggestionClick(c)},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=l=>{this.abortController.abort(),this.abortController=new AbortController,this.search(l.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(l,o){return(l!==void 0||l!==null)&&(this.apiParams.q=l),this.clearElt&&(this.clearElt.style.display="block"),this.api.search(this.apiParams,o).then(c=>{this.render(c)}).catch(()=>{this.render()})}onSuggestionClick(l){}clear(){!this.suggestionsElt||(this.inputElt.value="",this.suggestionsElt.innerHTML="",this.clearElt.style.display="none")}},Z0=xE;var T_=class extends Z0(ch){onSuggestionClick({geometry:l}){let o=uo(l.coordinates);this.map.getView().setCenter(o)}},X0=T_;var $0=jp(W0());var bE=y=>class extends y{constructor(l={}){super(l),this.olLayer=new Yh({source:new cf({}),render:this.getOlLayerRender(this)}),this.styleUrl=l.url,this.apiKey=l.apiKey,this.apiKeyName=l.apiKeyName||"key",this.updateAttribution=this.updateAttribution.bind(this)}attachToMap(l){super.attachToMap(l),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=null),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 l=document.createElement("div");l.style.position="absolute",l.style.width="100%",l.style.height="100%",!this.apiKey&&!this.styleUrl.includes(this.apiKeyName)&&console.error(`No apiKey defined for mapbox layer with style url to ${this.styleUrl}`);let o=this.getMapboxMapClass();this.mbMap=new o({style:Xh(this.styleUrl,{[this.apiKeyName]:this.apiKey}).toString(),container:l,interactive:!1,trackResize:!1,attributionControl:!1,...this.options.mapOptions||{}}),this.mbMap.once("load",()=>{this.loaded=!0,this.dispatchEvent({type:"load",target:this})}),this.mbMap.on("idle",this.updateAttribution)}updateAttribution(l){let o=oc(l.target)||[];this.copyrights?.toString()!==o.toString()&&(this.copyrights=o,this.olLayer.getSource()?.setAttributions(o))}getFeatureInfoAtCoordinate(l,o){if(!o||!this.format||!this.mbMap||!this.mbMap.isStyleLoaded())return Promise.resolve({coordinate:l,features:[],layer:this});let c=l&&this.mbMap.project(lh(l));if(this.hitTolerance){let{x:s,y:P}=c;c=[{x:s-this.hitTolerance,y:P-this.hitTolerance},{x:s+this.hitTolerance,y:P+this.hitTolerance}]}let r=this.mbMap.queryRenderedFeatures(c,o).map(s=>{let P=this.format.readFeature(s);return P&&P.set("mapboxFeature",s),P});return Promise.resolve({layer:this,features:r,coordinate:l})}},hg=bE;var op=class extends hg(Da){attachToMap(l){super.attachToMap(l),!(!this.map||this.mbMap)&&this.olListenersKeys.push(this.map.on("change:size",()=>{try{this.mbMap&&this.mbMap.resize()}catch(o){console.warn(o)}}))}loadMbMap(){let[l,o]=this.map.getView().getCenter();if((!l||!o)&&(l=0,o=0),this.renderState={center:[l,o],zoom:null,rotation:null,visible:null,opacity:null,size:[0,0]},super.loadMbMap(),!this.mbMap)return;this.mbMap.once("load",()=>{this.mbMap.resize(),this.copyrights=oc(this.mbMap)||[],this.olLayer.getSource()?.setAttributions(this.copyrights)});let c=this.mbMap.getCanvas();c&&(this.options.tabIndex?c.setAttribute("tabindex",this.options.tabIndex):c.removeAttribute("tabindex"))}getOlLayerRender(){return rf(this)}getMapboxMapClass(){return $0.Map}clone(l){return new op({...this.options,...l})}};var Y0=jp(H0());var ap=class extends hg(Da){getOlLayerRender(){return ef(this)}getMapboxMapClass(){return Y0.Map}clone(l){return new ap({...this.options,...l})}};var Td=class extends Da{constructor(l={}){if(super(l),this.mapboxLayer=l.mapboxLayer,this.disabled=!1,this.styleLayersFilter=l.styleLayersFilter,this.beforeId=l.beforeId,this.featureInfoFilter=l.featureInfoFilter||(o=>o),this.queryRenderedLayersFilter=l.queryRenderedLayersFilter,this.highlightedFeatures=[],this.selectedFeatures=[],this.styleLayers=(l.styleLayer?[l.styleLayer]:l.styleLayers)||[],this.addStyleLayers=this.addStyleLayers.bind(this),this.onLoad=this.onLoad.bind(this),l.filters&&(this.addDynamicFilters=()=>{this.setFilter(typeof l.filters=="function"?l.filters(this):l.filters)}),!this.styleLayersFilter&&this.styleLayers){let o=this.styleLayers.map(c=>c.id);this.styleLayersFilter=c=>o.includes(c.id)}}attachToMap(l){if(this.mapboxLayer.map||this.mapboxLayer.attachToMap(l),super.attachToMap(l),!this.map)return;let{mbMap:o}=this.mapboxLayer;if(!o){this.olListenersKeys.push(this.map.on("change:target",()=>{this.attachToMap(l)}));return}this.mapboxLayer.loaded||o.isStyleLoaded()||o.loaded()?this.onLoad():o.once("load",this.onLoad),this.olListenersKeys.push(this.on("change:visible",c=>{this.applyLayoutVisibility(c)})),this.olListenersKeys.push(this.mapboxLayer.on("load",()=>{this.onLoad()}))}detachFromMap(l){let{mbMap:o}=this.mapboxLayer;o&&(o.off("load",this.onLoad),this.removeStyleLayers()),super.detachFromMap(l)}addStyleLayers(){let{mbMap:l}=this.mapboxLayer;!l||(this.styleLayers.forEach(o=>{let{id:c,source:r}=o;l.getSource(r)&&!l.getLayer(c)&&l.addLayer(o,this.beforeId)}),this.applyLayoutVisibility())}removeStyleLayers(){let{mbMap:l}=this.mapboxLayer;!l||this.styleLayers.forEach(o=>{l.getLayer(o.id)&&l.removeLayer(o.id)})}onLoad(){this.addStyleLayers(),this.addDynamicFilters&&this.addDynamicFilters();let{mbMap:l}=this.mapboxLayer,o=l.getStyle();if(o&&this.styleLayersFilter){let c=o.layers.filter(this.styleLayersFilter);this.disabled=!c.length}}getFeatureInfoAtCoordinate(l){let{mbMap:o}=this.mapboxLayer;if(!o||!o.isStyleLoaded())return Promise.resolve({coordinate:l,features:[],layer:this});let c=this.styleLayers||[];return this.styleLayersFilter&&(c=o.getStyle().layers.filter(this.styleLayersFilter)),this.queryRenderedLayersFilter&&(c=o.getStyle().layers.filter(this.queryRenderedLayersFilter)),this.mapboxLayer.getFeatureInfoAtCoordinate(l,{layers:c.map(r=>r&&r.id),validate:!1}).then(r=>{let s=r.features.filter(P=>this.featureInfoFilter(P,this.map.getView().getResolution()));return this.highlight(s),{...r,features:s,layer:this}})}setFilter(l){let{mbMap:o}=this.mapboxLayer;!o||this.styleLayers.forEach(({id:c})=>{o.getLayer(c)&&o.setFilter(c,l)})}setHoverState(l,o){let{mbMap:c}=this.mapboxLayer;!l||!c||l.forEach(r=>{let{source:s,sourceLayer:P}=r.get("mapboxFeature")||{};if(!s&&!P||!r.getId()){r.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.",r.getId(),r.getProperties());return}c.setFeatureState({id:r.getId(),source:s,sourceLayer:P},{hover:o})})}select(l=[]){this.setHoverState(this.selectedFeatures,!1),this.selectedFeatures=l,this.setHoverState(this.selectedFeatures,!0)}highlight(l=[]){let o=this.highlightedFeatures.filter(c=>!this.selectedFeatures.map(r=>r.getId()).includes(c.getId()));this.setHoverState(o,!1),this.highlightedFeatures=l,this.setHoverState(this.highlightedFeatures,!0)}applyLayoutVisibility(l){let{visible:o}=this,{mbMap:c}=this.mapboxLayer,r=this.styleLayersFilter;if(!c)return;let s=c.getStyle();if(!!s&&r){let P=o?"visible":"none";for(let R=0;R<s.layers.length;R+=1){let B=s.layers[R];r(B)&&c.getLayer(B.id)&&c.setLayoutProperty(B.id,"visibility",P)}}}clone(l){return new Td({...this.options,...l})}},J0=Td;var L_=jp(r1()),z_=jp(s1());var rT=y=>class extends y{constructor(l={}){super({hitTolerance:10,...l}),this.debug=l.debug,this.mode=l.mode||ra.TOPOGRAPHIC,this.api=l.api||new Wf(l),this.tenant=l.tenant||"",this.minZoomNonTrain=l.minZoomNonTrain||9,this.minZoomInterpolation=l.minZoomInterpolation||8,this.format=new bl,this.generalizationLevelByZoom=l.generalizationLevelByZoom||[5,5,5,5,5,5,5,5,10,30,30,100,100,100],this.getGeneralizationLevelByZoom=o=>l.getGeneralizationLevelByZoom&&l.getGeneralizationLevelByZoom(o,this.generalizationLevelByZoom)||this.generalizationLevelByZoom[o],this.renderTimeIntervalByZoom=l.renderTimeIntervalByZoom||[1e5,5e4,4e4,3e4,2e4,15e3,1e4,5e3,2e3,1e3,400,300,250,180,90,60,50,50,50,50,50],this.getRenderTimeIntervalByZoom=o=>l.getRenderTimeIntervalByZoom&&l.getRenderTimeIntervalByZoom(o,this.renderTimeIntervalByZoom)||this.renderTimeIntervalByZoom[o],this.isUpdateBboxOnMoveEnd=l.isUpdateBboxOnMoveEnd!==!1,this.throttleRenderTrajectories=(0,z_.default)(this.renderTrajectoriesInternal,50,{leading:!1,trailing:!0}),this.debounceRenderTrajectories=(0,L_.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(l){let{style:o,speed:c,pixelRatio:r,hoverVehicleId:s,selectedVehicleId:P,filter:R,sort:B,time:N,live:V,canvas:mt,styleOptions:Et}=l,It=c||1,Vt=N||new Date;super.defineProperties(l),Object.defineProperties(this,{isTrackerLayer:{value:!0},canvas:{value:mt||document.createElement("canvas")},style:{value:o||Hh},styleOptions:{value:{...nf,...Et||{}}},speed:{get:()=>It,set:Ht=>{It=Ht,this.start()}},filter:{value:R,writable:!0},sort:{value:B,writable:!0},live:{value:V===!1?V:!0,writable:!0},time:{get:()=>Vt,set:Ht=>{Vt=Ht&&Ht.getTime?Ht:new Date(Ht),this.renderTrajectories()}},trajectories:{value:{},writable:!0},hoverVehicleId:{value:s,writable:!0},selectedVehicleId:{value:P,writable:!0},pixelRatio:{value:r||(typeof window<"u"?window.devicePixelRatio:1),writable:!0},useRequestAnimationFrame:{value:l.useRequestAnimationFrame||!1,writable:!0},useThrottle:{value:l.useThrottle!==!1,writable:!0},useDebounce:{value:l.useDebounce||!1,writable:!0}})}attachToMap(l){super.attachToMap(l),this.visible&&this.start(),this.visibilityRef=this.on("change:visible",o=>{o.target.visible?this.start():this.stop()}),document.addEventListener("visibilitychange",this.onDocumentVisibilityChange)}detachFromMap(){document.removeEventListener("visibilitychange",this.onDocumentVisibilityChange),this.stop(),Ha(this.visibilityRef),this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height),super.detachFromMap()}start(){this.stop(),this.renderTrajectories(),this.startUpdateTime(),this.api.open(),this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.isUpdateBboxOnMoveEnd&&this.setBbox()}startUpdateTime(){this.stopUpdateTime(),this.updateTimeDelay=this.getRefreshTimeInMs(),this.updateTimeInterval=setInterval(()=>{this.time=this.live?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)}renderTrajectoriesInternal(l,o){if(!this.map)return!1;let c=this.live?Date.now():this.time,r=Object.values(this.trajectories);return this.sort&&r.sort(this.sort),this.renderState=Kf(this.canvas,r,this.style,{...l,pixelRatio:this.pixelRatio,time:c},{noInterpolate:l.zoom<this.minZoomInterpolation?!0:o,hoverVehicleId:this.hoverVehicleId,selectedVehicleId:this.selectedVehicleId,...this.styleOptions}),!0}renderTrajectories(l,o){this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=null),!o&&this.useRequestAnimationFrame?this.requestId=requestAnimationFrame(()=>{this.renderTrajectoriesInternal(l,o)}):!o&&this.useDebounce?this.debounceRenderTrajectories(l,o):!o&&this.useThrottle?this.throttleRenderTrajectories(l,o):this.renderTrajectoriesInternal(l,o)}setBbox(l,o){let c=Object.keys(this.trajectories);for(let s=c.length-1;s>=0;s-=1)this.purgeTrajectory(this.trajectories[c[s]],l,o);let r=[...l];this.isUpdateBboxOnMoveEnd&&(r.push(o),this.tenant&&r.push(`tenant=${this.tenant}`),this.generalizationLevel=this.getGeneralizationLevelByZoom(o),this.generalizationLevel&&r.push(`gen=${this.generalizationLevel}`)),this.api.bbox=r}setMode(l){this.mode!==l&&(this.mode=l,this.api.subscribeTrajectory(this.mode,this.onTrajectoryMessage,this.isUpdateBboxOnMoveEnd),this.api.subscribeDeletedVehicles(this.mode,this.onDeleteTrajectoryMessage,this.isUpdateBboxOnMoveEnd))}getRefreshTimeInMs(l){let o=Math.round(l),c=this.getRenderTimeIntervalByZoom(o)||25,r=Math.max(25,c/this.speed),s=Math.min(r,500);if(this.useThrottle?this.throttleRenderTrajectories=(0,z_.default)(this.renderTrajectoriesInternal,s,{leading:!0,trailing:!0}):this.useDebounce&&(this.debounceRenderTrajectories=(0,L_.default)(this.renderTrajectoriesInternal,s,{leading:!0,trailing:!0,maxWait:5e3})),this.api?.buffer){let[,P]=this.api.buffer;this.api.buffer=[s,P]}return r}getVehicle(l){return Object.values(this.trajectories).filter(l)}getFeatureInfoAtCoordinate(l,o={}){let{resolution:c,nb:r}=o,s=yl([...l,...l],this.hitTolerance*c),P=Object.values(this.trajectories);this.sort&&(P=P.sort(this.sort));let R=[];for(let B=0;B<P.length&&(P[B].properties.coordinate&&Hp(s,P[B].properties.coordinate)&&R.push(P[B]),R.length!==r);B+=1);return Promise.resolve({layer:this,features:R.map(B=>this.format.readFeature(B)),coordinate:l})}getTrajectoryInfos(l){let o=[this.api.getStopSequence(l,this.mode),this.api.getFullTrajectory(l,this.mode,this.generalizationLevel)];return Promise.all(o).then(([c,r])=>({stopSequence:c,fullTrajectory:r}))}purgeTrajectory(l,o,c){let{type:r,bounds:s,train_id:P}=l.properties;return!ko(o,s)||r!=="rail"&&c<(this.minZoomNonTrain||9)?(this.removeTrajectory(P),!0):!1}addTrajectory(l){this.filter&&!this.filter(l)||(this.trajectories[l.properties.train_id]=l,this.renderTrajectories())}removeTrajectory(l){delete this.trajectories[l]}onZoomEnd(l){this.startUpdateTime()}onDocumentVisibilityChange(){!this.visible||(document.hidden?this.stop():this.start())}onTrajectoryMessage(l){if(!l.content)return;let o=l.content,{geometry:c,properties:{train_id:r,time_since_update:s,raw_coordinates:P}}=o;s<0||this.purgeTrajectory(o)||(this.debug&&this.mode===ra.TOPOGRAPHIC&&P?o.properties.olGeometry={type:"Point",coordinates:uo(P,this.map.getView().getProjection())}:o.properties.olGeometry=this.format.readGeometry(c),o.properties.timeOffset=Date.now()-l.timestamp,this.addTrajectory(o))}onDeleteTrajectoryMessage(l){!l.content||this.removeTrajectory(l.content)}onFeatureHover(l,o,c){let[r]=l,s=null;r&&(s=r.get("train_id")),this.hoverVehicleId!==s&&(this.hoverVehicleId=s,this.renderTrajectories(!0))}onFeatureClick(l,o,c){let[r]=l,s=null;r&&(s=r.get("train_id")),this.selectedVehicleId!==s&&(this.selectedVehicleId=s,this.selectedVehicle=r,this.renderTrajectories(!0))}},fg=rT;var iT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new _a({color:"#000000",width:6})}),nT=(y,l,o)=>{let c="#ffffff",r=y.get("type"),s=y.get("stroke");return s&&s[0]!=="#"&&(s=`#${s}`),c=s||o?.getBgColor(r),c=/#ffffff/i.test(c)?"#ff0000":c,[iT,new Wl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:c})}),stroke:new _a({color:c,width:4})})]},dg=nT;var oT=new Wl({zIndex:2,image:new xl({radius:5,fill:new Ks({color:"#000000"})}),stroke:new _a({color:"#000000",width:6})}),aT=new Wl({zIndex:3,image:new xl({radius:4,fill:new Ks({color:"#a0a0a0"})}),stroke:new _a({color:"#a0a0a0",width:4})}),sT=()=>[oT,aT],l1=sT;var lT=new bl,Sd=class extends fg(Da){constructor(l={}){super({...l}),this.olLayer=l.olLayer||new d_({layers:[new rp({source:new ip({features:[]}),style:(o,c)=>(l.fullTrajectoryStyle||dg)(o,c,this.styleOptions)}),new Yh({source:new cf({}),render:o=>{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.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:c,resolution:r,rotation:s}=o.viewState,{center:P,resolution:R,rotation:B}=this.renderedViewState;if(R/r>=3)this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height);else{let N=this.map.getPixelFromCoordinate(P),V=this.map.getPixelFromCoordinate(c);this.transformContainer.style.transform=Cv(N[0]-V[0],N[1]-V[1],R/r,R/r,s-B,0,0)}}return this.container}})]}),this.vectorLayer=this.olLayer.getLayers().item(0),this.renderState={center:[0,0],zoom:null,rotation:0}}attachToMap(l){super.attachToMap(l),this.map&&this.olListenersKeys.push(...this.map.on(["moveend","change:target"],o=>{let c=o.map.getView();if(c.getAnimating()||c.getInteracting())return;let r=c.getZoom();this.currentZoom!==r&&this.onZoomEnd(o),this.currentZoom=r,this.onMoveEnd(o)}))}detachFromMap(){super.detachFromMap(),this.container=null}hasFeatureInfoAtCoordinate(l){if(this.map&&this.canvas){let o=this.canvas.getContext("2d"),c=this.map.getPixelFromCoordinate(l);return!!o.getImageData(c[0]*this.pixelRatio,c[1]*this.pixelRatio,1,1).data[3]}return!1}renderTrajectories(l){if(!this.map)return;let o=this.map.getView();super.renderTrajectories({size:this.map.getSize(),center:this.map.getView().getCenter(),extent:o.calculateExtent(),resolution:o.getResolution(),rotation:o.getRotation(),zoom:o.getZoom(),pixelRatio:this.pixelRatio},l)}renderTrajectoriesInternal(l,o){if(!this.map)return!1;let c=!1;return c=this.map.getView().getAnimating()||this.map.getView().getInteracting()?!1:super.renderTrajectoriesInternal(l,o),c&&(this.renderedViewState={...l},this.transformContainer&&(this.transformContainer.style.transform="")),c}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getView().getZoom())}getFeatureInfoAtCoordinate(l,o={}){let c=this.map.getView().getResolution();return super.getFeatureInfoAtCoordinate(l,{resolution:c,...o})}onMoveEnd(){this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.userClickInteractions&&this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}onZoomEnd(l){super.onZoomEnd(l)}onFeatureHover(l,o,c){super.onFeatureHover(l,o,c),this.map.getTargetElement().style.cursor=l.length?"pointer":"auto"}onFeatureClick(l,o,c){super.onFeatureClick(l,o,c),!l.length&&this.vectorLayer&&this.vectorLayer.getSource().clear(),this.selectedVehicleId&&this.highlightTrajectory(this.selectedVehicleId)}purgeTrajectory(l,o,c){return super.purgeTrajectory(l,o||this.map.getView().calculateExtent(),c||this.map.getView().getZoom())}setBbox(l,o){let c=l,r=o;!c&&this.isUpdateBboxOnMoveEnd&&(c=l||this.map.getView().calculateExtent(),r=Math.floor(this.map.getView().getZoom())),super.setBbox(c,r)}highlightTrajectory(l){this.api.getFullTrajectory(l,this.mode,this.generalizationLevel).then(o=>{if(this.vectorLayer.getSource().clear(),!o||!o.features||!o.features.length)return;let r=lT.readFeatures(o);this.vectorLayer.getSource().addFeatures(r)})}clone(l){return new Sd({...this.options,...l})}},u1=Sd;var Id=class extends Da{getFeatureInfoAtCoordinate(l){let o=[];if(this.map){let c=this.map.getPixelFromCoordinate(l);o=this.map.getFeaturesAtPixel(c,{layerFilter:r=>r===this.olLayer,hitTolerance:this.hitTolerance})}return Promise.resolve({features:o,layer:this,coordinate:l})}clone(l){return new Id({...this.options,...l})}},c1=Id;var Cd=class extends Da{constructor(l={}){super(l),this.abortController=new AbortController,this.format=new bl}getFeatureInfoUrl(l){let o=this.map.getView().getProjection(),c=this.map.getView().getResolution();return this.olLayer.getSource().getFeatureInfoUrl?this.olLayer.getSource().getFeatureInfoUrl(l,c,o,{info_format:"application/json",query_layers:this.olLayer.getSource().getParams().layers}):!1}getFeatureInfoAtCoordinate(l){this.abortController.abort(),this.abortController=new AbortController;let{signal:o}=this.abortController;return fetch(this.getFeatureInfoUrl(l),{signal:o}).then(c=>c.json()).then(c=>c.features).then(c=>({layer:this,coordinate:l,features:c.map(r=>this.format.readFeature(r))})).catch(()=>Promise.resolve({features:[],coordinate:l,layer:this}))}clone(l){return new Cd({...this.options,...l})}},h1=Cd;var _g={};ry(_g,{CopyrightControl:()=>p1,Layer:()=>gg,RealtimeAPI:()=>Wf,RealtimeLayer:()=>C1,RealtimeModes:()=>ra,RoutingAPI:()=>Zf,StopsAPI:()=>Xf,createTrackerFilters:()=>ly,getCircleCanvas:()=>ky,getDelayBgCanvas:()=>Py,getDelayTextCanvas:()=>My,getHoursAndMinutes:()=>wv,getLayersAsFlatArray:()=>$f,getMapboxMapCopyrights:()=>oc,getMapboxRender:()=>rf,getMaplibreRender:()=>ef,getTextCanvas:()=>Ly,getUTCDateString:()=>xv,getUTCTimeString:()=>bv,getUrlWithParams:()=>Xh,pad:()=>Mm,realtimeDefaultStyle:()=>Hh,realtimeDelayStyle:()=>zy,realtimeSimpleStyle:()=>Dy,removeDuplicate:()=>Wh,renderTrajectories:()=>Kf,sortByDelay:()=>uy,trackerConfig:()=>nf});var D_=class extends jm(ch){constructor(l){super(l),this.render=this.render.bind(this)}activate(){super.activate(),this.map&&(this.map.on("sourcedata",this.render),this.map.on("styledata",this.render),this.map.on("idle",this.render))}deactivate(){this.map&&(this.map.off("sourcedata",this.render),this.map.off("styledata",this.render),this.map.off("idle",this.render)),super.deactivate()}getCopyrights(){return oc(this.map)}},p1=D_;var Ad=class extends lg(np){attachToMap(l){super.attachToMap(l),!!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 l=this.map.getBounds().toArray();return td([...l[0],...l[1]],"EPSG:4326","EPSG:3857")}getOlZoom(){return this.map.getZoom()+1}clone(l){return new Ad({...this.options,...l})}},gg=Ad;var Go=63710088e-1,f1={centimeters:Go*100,centimetres:Go*100,degrees:Go/111325,feet:Go*3.28084,inches:Go*39.37,kilometers:Go/1e3,kilometres:Go/1e3,meters:Go,metres:Go,miles:Go/1609.344,millimeters:Go*1e3,millimetres:Go*1e3,nauticalmiles:Go/1852,radians:1,yards:Go*1.0936},s5={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/Go,yards:1.0936133};function d1(y,l,o){o===void 0&&(o={});var c={type:"Feature"};return(o.id===0||o.id)&&(c.id=o.id),o.bbox&&(c.bbox=o.bbox),c.properties=l||{},c.geometry=y,c}function bh(y,l,o){if(o===void 0&&(o={}),!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(!R_(y[0])||!R_(y[1]))throw new Error("coordinates must contain numbers");var c={type:"Point",coordinates:y};return d1(c,l,o)}function uT(y,l){l===void 0&&(l="kilometers");var o=f1[l];if(!o)throw new Error(l+" units is invalid");return y*o}function cT(y,l){l===void 0&&(l="kilometers");var o=f1[l];if(!o)throw new Error(l+" units is invalid");return y/o}function m1(y){var l=y%(2*Math.PI);return l*180/Math.PI}function sp(y){var l=y%360;return l*Math.PI/180}function yg(y,l,o){if(l===void 0&&(l="kilometers"),o===void 0&&(o="kilometers"),!(y>=0))throw new Error("length must be a positive number");return uT(cT(y,l),o)}function R_(y){return!isNaN(y)&&y!==null&&!Array.isArray(y)}function O_(y){return!!y&&y.constructor===Object}function Pd(y,l,o){if(y!==null)for(var c,r,s,P,R,B,N,V=0,mt=0,Et,It=y.type,Vt=It==="FeatureCollection",Ht=It==="Feature",Ct=Vt?y.features.length:1,Gt=0;Gt<Ct;Gt++){N=Vt?y.features[Gt].geometry:Ht?y.geometry:y,Et=N?N.type==="GeometryCollection":!1,R=Et?N.geometries.length:1;for(var te=0;te<R;te++){var re=0,_e=0;if(P=Et?N.geometries[te]:N,P!==null){B=P.coordinates;var ye=P.type;switch(V=o&&(ye==="Polygon"||ye==="MultiPolygon")?1:0,ye){case null:break;case"Point":if(l(B,mt,Gt,re,_e)===!1)return!1;mt++,re++;break;case"LineString":case"MultiPoint":for(c=0;c<B.length;c++){if(l(B[c],mt,Gt,re,_e)===!1)return!1;mt++,ye==="MultiPoint"&&re++}ye==="LineString"&&re++;break;case"Polygon":case"MultiLineString":for(c=0;c<B.length;c++){for(r=0;r<B[c].length-V;r++){if(l(B[c][r],mt,Gt,re,_e)===!1)return!1;mt++}ye==="MultiLineString"&&re++,ye==="Polygon"&&_e++}ye==="Polygon"&&re++;break;case"MultiPolygon":for(c=0;c<B.length;c++){for(_e=0,r=0;r<B[c].length;r++){for(s=0;s<B[c][r].length-V;s++){if(l(B[c][r][s],mt,Gt,re,_e)===!1)return!1;mt++}_e++}re++}break;case"GeometryCollection":for(c=0;c<P.geometries.length;c++)if(Pd(P.geometries[c],l,o)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function hT(y,l){l===void 0&&(l={});var o=0,c=0,r=0;return Pd(y,function(s){o+=s[0],c+=s[1],r++},!0),bh([o/r,c/r],l.properties)}var g1=hT;function Mu(y){if(!y)throw new Error("coord is required");if(!Array.isArray(y)){if(y.type==="Feature"&&y.geometry!==null&&y.geometry.type==="Point")return y.geometry.coordinates;if(y.type==="Point")return y.coordinates}if(Array.isArray(y)&&y.length>=2&&!Array.isArray(y[0])&&!Array.isArray(y[1]))return y;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function y1(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 pT(y,l,o){o===void 0&&(o={});var c;o.final?c=_1(Mu(l),Mu(y)):c=_1(Mu(y),Mu(l));var r=c>180?-(360-c):c;return r}function _1(y,l){var o=sp(y[1]),c=sp(l[1]),r=sp(l[0]-y[0]);r>Math.PI&&(r-=2*Math.PI),r<-Math.PI&&(r+=2*Math.PI);var s=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),P=Math.atan2(r,s);return(m1(P)+360)%360}var v1=pT;function fT(y,l,o){o===void 0&&(o={});var c=Mu(y),r=Mu(l);r[0]+=r[0]-c[0]>180?-360:c[0]-r[0]>180?360:0;var s=dT(c,r),P=yg(s,"meters",o.units);return P}function dT(y,l,o){o=o===void 0?Go:Number(o);var c=o,r=y[1]*Math.PI/180,s=l[1]*Math.PI/180,P=s-r,R=Math.abs(l[0]-y[0])*Math.PI/180;R>Math.PI&&(R-=2*Math.PI);var B=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(r/2+Math.PI/4)),N=Math.abs(B)>1e-11?P/B:Math.cos(r),V=Math.sqrt(P*P+N*N*R*R),mt=V*c;return mt}var x1=fT;function mT(y,l,o,c){c===void 0&&(c={});var r=l<0,s=yg(Math.abs(l),c.units,"meters");r&&(s=-Math.abs(s));var P=Mu(y),R=gT(P,s,o);return R[0]+=R[0]-P[0]>180?-360:P[0]-R[0]>180?360:0,bh(R,c.properties)}function gT(y,l,o,c){c=c===void 0?Go:Number(c);var r=l/c,s=y[0]*Math.PI/180,P=sp(y[1]),R=sp(o),B=r*Math.cos(R),N=P+B;Math.abs(N)>Math.PI/2&&(N=N>0?Math.PI-N:-Math.PI-N);var V=Math.log(Math.tan(N/2+Math.PI/4)/Math.tan(P/2+Math.PI/4)),mt=Math.abs(V)>1e-11?B/V:Math.cos(P),Et=r*Math.sin(R)/mt,It=s+Et;return[(It*180/Math.PI+540)%360-180,N*180/Math.PI]}var b1=mT;function yT(y){if(!y)throw new Error("geojson is required");switch(y.type){case"Feature":return w1(y);case"FeatureCollection":return _T(y);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return F_(y);default:throw new Error("unknown GeoJSON type")}}function w1(y){var l={type:"Feature"};return Object.keys(y).forEach(function(o){switch(o){case"type":case"properties":case"geometry":return;default:l[o]=y[o]}}),l.properties=E1(y.properties),l.geometry=F_(y.geometry),l}function E1(y){var l={};return y&&Object.keys(y).forEach(function(o){var c=y[o];typeof c=="object"?c===null?l[o]=null:Array.isArray(c)?l[o]=c.map(function(r){return r}):l[o]=E1(c):l[o]=c}),l}function _T(y){var l={type:"FeatureCollection"};return Object.keys(y).forEach(function(o){switch(o){case"type":case"features":return;default:l[o]=y[o]}}),l.features=y.features.map(function(o){return w1(o)}),l}function F_(y){var l={type:y.type};return y.bbox&&(l.bbox=y.bbox),y.type==="GeometryCollection"?(l.geometries=y.geometries.map(function(o){return F_(o)}),l):(l.coordinates=T1(y.coordinates),l)}function T1(y){var l=y;return typeof l[0]!="object"?l.slice():l.map(function(o){return T1(o)})}var S1=yT;function vT(y,l,o){if(o=o||{},!O_(o))throw new Error("options is invalid");var c=o.pivot,r=o.mutate;if(!y)throw new Error("geojson is required");if(l==null||isNaN(l))throw new Error("angle is required");return l===0||(c||(c=g1(y)),(r===!1||r===void 0)&&(y=S1(y)),Pd(y,function(s){var P=v1(c,s),R=P+l,B=x1(c,s),N=y1(b1(c,B,R));s[0]=N[0],s[1]=N[1]})),y}var B_=vT;var I1=y=>{let l=y.getBounds().toArray(),o=uo(l[0]),c=uo(l[1]),r=[...o,...c],{width:s,height:P}=y.getCanvas(),R=ws(r)/s,B=Eu(r)/P;return Math.max(R,B)},U_=(y,l)=>{let{width:o,height:c}=y.getCanvas(),r=y.unproject({x:0,y:0}),s=y.unproject({x:0,y:c/l}),P=y.unproject({x:o/l,y:c/l}),R=y.unproject({x:o/l,y:0});return[[r.lng,r.lat],[R.lng,R.lat],[P.lng,P.lat],[s.lng,s.lat]]};var N_=class extends fg(gg){constructor(l={}){super({...l}),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(l,o){if(!l)return;let c=l.getCanvas();super.attachToMap(l,{width:c.width/this.pixelRatio,height:c.height/this.pixelRatio}),this.source={type:"canvas",canvas:this.canvas,coordinates:U_(l,this.pixelRatio),animate:!0,attribution:this.copyrights&&this.copyrights.join(", ")},this.beforeId=o,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"}},l.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(l=>{Ha(l)}),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(l){super.onUserMoveCallback({coordinate:uo(l.lngLat.toArray()),...l})}renderTrajectories(l){if(!this.map)return;let{width:o,height:c}=this.map.getCanvas(),r=this.map.getCenter(),s=this.map.unproject({x:0,y:c/this.pixelRatio}),P=this.map.unproject({x:o/this.pixelRatio,y:0}),R=B_(bh([s.lng,s.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,B=B_(bh([P.lng,P.lat]),-this.map.getBearing(),{pivot:[r.lng,r.lat]}).geometry.coordinates,N=[...uo(R),...uo(B)],V=ws(N)/(o/this.pixelRatio),mt=Eu(N)/(c/this.pixelRatio),Et=Math.max(V,mt),It={size:[o/this.pixelRatio,c/this.pixelRatio],center:uo([r.lng,r.lat]),extent:N,resolution:Et,zoom:this.map.getZoom(),rotation:-(this.map.getBearing()*Math.PI)/180,pixelRatio:this.pixelRatio};super.renderTrajectories(It,l)}getRefreshTimeInMs(){return super.getRefreshTimeInMs(this.map.getZoom())}getFeatureInfoAtCoordinate(l,o={}){let c=I1(this.map);return super.getFeatureInfoAtCoordinate(l,{resolution:c,...o})}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(l,o,c){return super.purgeTrajectory(l,o||this.getMercatorExtent(),c||Math.floor(this.map.getZoom()+1))}setBbox(l,o){let c=l,r=o;!c&&this.isUpdateBboxOnMoveEnd&&(c=l||this.getMercatorExtent(),r=Math.floor(this.getOlZoom())),super.setBbox(c,r)}onMove(){this.renderTrajectories()}renderTrajectoriesInternal(l,o){let c=super.renderTrajectoriesInternal(l,o);if(c&&this.map.style){let r=U_(this.map,this.pixelRatio),s=this.map.getSource(this.key);s&&s.setCoordinates(r)}return c}onMoveEnd(){this.renderTrajectories(),this.visible&&this.isUpdateBboxOnMoveEnd&&this.setBbox()}onFeatureHover(l,o,c){super.onFeatureHover(l,o,c),this.map.getCanvasContainer().style.cursor=l.length?"pointer":"auto"}},C1=N_;var V_={ol:mg,mapbox:_g};typeof window<"u"&&(window.mbt=V_);var i3=V_;})();
|
|
1083
1083
|
//# sourceMappingURL=mbt.min.js.map
|