azure-maps-animations
Version:
A module for the Azure Maps Web SDK that provides tools for animating data on the map.
4 lines (2 loc) • 90.7 kB
JavaScript
/* MIT License - Copyright (c) Microsoft Corporation. */
!function(t,P){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function e(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},n=(i.merge=function(t,e){for(var n=window||global,r=0,i=t.split(".");r<i.length;r++){var a=i[r];if(!n[a])return e;n=n[a]}return o(o({},n),e)},i);function i(){}var s=(a.linear=function(t){return t},a.easeInSine=function(t){return 1-Math.cos(t*Math.PI*.5)},a.easeOutSine=function(t){return Math.sin(t*Math.PI*.5)},a.easeInOutSine=function(t){return-.5*(Math.cos(Math.PI*t)-1)},a.easeInQuad=function(t){return t*t},a.easeOutQuad=function(t){return t*(2-t)},a.easeInOutQuad=function(t){return t<.5?2*t*t:(4-2*t)*t-1},a.easeInCubic=function(t){return t*t*t},a.easeOutCubic=function(t){var e=t-1;return e*e*e+1},a.easeInOutCubic=function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},a.easeInQuart=function(t){return t*t*t*t},a.easeOutQuart=function(t){var e=t-1;return 1-e*e*e*e},a.easeInOutQuart=function(t){if(t<.5)return 8*t*t*t*t;var e=t-1;return 1-8*e*e*e*e},a.easeInQuint=function(t){return t*t*t*t*t},a.easeOutQuint=function(t){var e=t-1;return 1+e*e*e*e*e},a.easeInOutQuint=function(t){if(t<.5)return 16*t*t*t*t*t;var e=t-1;return 1+16*e*e*e*e*e},a.easeInExpo=function(t){return 0===t?0:Math.pow(2,10*(t-1))},a.easeOutExpo=function(t){return 1===t?1:1-Math.pow(2,-10*t)},a.easeInOutExpo=function(t){if(0===t||1===t)return t;var e=2*t-1;return e<0?.5*Math.pow(2,10*e):.5*(2-Math.pow(2,-10*e))},a.easeInCirc=function(t){return-1*(Math.sqrt(1-t*t)-1)},a.easeOutCirc=function(t){var e=t-1;return Math.sqrt(1-e*e)},a.easeInOutCirc=function(t){var e=2*t;if(e<1)return-.5*(Math.sqrt(1-e*e)-1);var n=e-2;return.5*(Math.sqrt(1-n*n)+1)},a.easeInBack=function(t,e){return t*t*(((e=e||1.70158)+1)*t-e)},a.easeOutBack=function(t,e){var n=t-1;return n*n*(((e=e||1.70158)+1)*n+e)+1},a.easeInOutBack=function(t,e){var n=2*t,r=1.525*(e=e||1.70158);if(n<1)return.5*n*n*((1+r)*n-r);var i=n-2;return.5*(i*i*((1+r)*i+r)+2)},a.easeInElastic=function(t,e){if(0===t||1===t)return t;var n=t-1,r=1-(e=e||.7),i=r/(2*Math.PI)*Math.asin(1);return-(Math.pow(2,10*n)*Math.sin((n-i)*(2*Math.PI)/r))},a.easeOutElastic=function(t,e){if(0===t||1===t)return t;var n=1-(e=e||.7),r=2*t,i=n/(2*Math.PI)*Math.asin(1);return Math.pow(2,-10*r)*Math.sin((r-i)*(2*Math.PI)/n)+1},a.easeInOutElastic=function(t,e){if(0===t||1===t)return t;var n=1-(e=e||.65),r=2*t-1,i=n/(2*Math.PI)*Math.asin(1);return r<0?Math.pow(2,10*r)*Math.sin((r-i)*(2*Math.PI)/n)*-.5:Math.pow(2,-10*r)*Math.sin((r-i)*(2*Math.PI)/n)*.5+1},a.easeOutBounce=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(e=t-1.5/2.75)*e+.75:t<2.5/2.75?7.5625*(e=t-2.25/2.75)*e+.9375:7.5625*(e=t-2.625/2.75)*e+.984375;var e},a.easeInBounce=function(t){return 1-a.easeOutBounce(1-t)},a.easeInOutBounce=function(t){return t<.5?.5*a.easeInBounce(2*t):.5*a.easeOutBounce(2*t-1)+.5},a);function a(){}var M=(l.getProgress=function(t,e,n,r){return Math.max(Math.min((t-e)*r/n,1),0)},l.getStartTime=function(t,e,n){return performance.now()-Math.round(e*t/n)},l.getDimensions=function(t){if(t&&Array.isArray(t)&&0<t.length){if("number"==typeof t[0])return 0;if(Array.isArray(t[0])&&0<t[0].length){if("number"==typeof t[0][0])return 1;if(Array.isArray(t[0][0])&&0<t[0][0].length){if("number"==typeof t[0][0][0])return 2;if(Array.isArray(t[0][0][0])&&0<t[0][0][0].length&&"number"==typeof t[0][0][0][0])return 3}}}return-1},l.getSuitableCoordinates=function(t,e){var n="Point";if(t instanceof P.Shape&&(n=t.getType()),e){var r=l.getDimensions(e);switch(n){case"Point":switch(r){case 0:return e;case 1:return e[0];case 2:return e[0][0];case 3:return e[0][0][0]}break;case"MultiPoint":case"LineString":switch(r){case 0:return"MultiPoint"===n?[e]:[e,e];case 1:return e;case 2:return e[0];case 3:return e[0][0]}break;case"MultiLineString":case"Polygon":switch(r){case 0:return[[e,e,e]];case 1:return[e];case 2:return e;case 3:return e[0]}break;case"MultiPolygon":switch(r){case 0:return[[[e,e,e]]];case 1:return[[e]];case 2:return[e];case 3:return e}}}return null},l.getPixelHeading=function(t,e){var n=(e[0]-t[0])*Math.PI/180,r=(t[1]-e[1])*Math.PI/180;return 180*(2.5*Math.PI-Math.atan2(r,n))/Math.PI%360},l.getPixelDestination=function(t,e,n){return[t[0]+n*Math.cos((e+270)*Math.PI/180),t[1]+n*Math.sin((e+270)*Math.PI/180)]},l.setMetadata=function(t,e){t&&e&&(t instanceof P.Shape?t.setProperties(Object.assign(t.getProperties(),e)):t instanceof P.HtmlMarker&&(t.metadata=Object.assign(t.metadata||{},e)))},l.setCoordinates=function(t,e,n){if(t)if(t instanceof P.Shape)switch(t.getType()){case"Point":t.setCoordinates(e);break;case"LineString":n&&t.setCoordinates(n)}else t instanceof P.HtmlMarker&&t.setOptions({position:e})},l.getPropertyPath=function(t){return t.split("/")},l.setValue=function(t,e,n){if(1<e.length){var r=e.shift();l.setValue(t[r]="[object Object]"===Object.prototype.toString.call(t[r])?t[r]:{},e,n)}else t[e[0]]=n},l.getValue=function(t,e){var n=e.length;if(0<n&&t){var r=t[e[0]];if(null!=r){var i=void 0;for(i=1;i<n&&null!=(r=r[e[i]]);i++);if(i===n&&null!=r)return r}}return null},l.interpolateValue=function(t,e,n,r,i){if(t&&e&&r){r.interpolation=r.interpolation||"linear";var a=l.getPropertyPath(r.propertyPath),o=l.getValue(t.properties,a),s=l.getValue(e.properties,a),u=typeof o,h=typeof s;if("undefined"!=u&&"undefined"!=h&&u==h){var p=void 0;if(o instanceof Date&&(o=o.getTime(),p="Date"),s instanceof Date&&(s=s.getTime(),"Date"!==p))return null;var c=void 0;if("number"==u&&"number"==h)switch(r.interpolation){case"linear":c=o+(s-o)*n;break;case"min":c=Math.min(o,s);break;case"max":c=Math.max(o,s);break;case"avg":c=.5*(o+s)}else"nearest"===r.interpolation&&(c=n<.5?o:s);void 0!==c&&("Date"===p&&(c=new Date(c)),l.setValue(i,a,c))}}return null},l.extractRoutePointsFromFeature=function(t,e){var n,r,i=[];switch(t.geometry.type){case"Point":(n=l.extractRoutePointFromPoint(t,e))&&(i=[n]);break;case"LineString":case"MultiPoint":if(t.properties[e]&&Array.isArray(t.properties[e])&&t.geometry.coordinates.length===t.properties[e])for(var a=0,o=t.geometry.coordinates.length;a<o;a++)(r=P.math.parseTimestamp(t.properties[e]))&&i.push(new P.data.Feature(new P.data.Point(t.geometry.coordinates[a]),{_timestamp:r.getTime()}));else if(t.properties.waypoints&&Array.isArray(t.properties.waypoints)&&t.geometry.coordinates.length===t.properties.waypoints.length&&0<t.properties.waypoints.length&&t.properties.waypoints[0].geometry)for(a=0,o=t.geometry.coordinates.length;a<o;a++)"Point"===t.properties.waypoints[a].geometry.type&&(n=l.extractRoutePointFromPoint(t.properties.waypoints[a],e))&&i.push(n)}return 0<i.length?i:null},l.extractRoutePointFromPoint=function(t,e){if(t.properties[e]){var n=P.math.parseTimestamp(t.properties[e]);if(void 0!==n)return t.properties._timestamp=n.getTime(),t}return null},l);function l(){}var h=(u.prototype.disable=function(){this._stopped||(this._stopped=!0,cancelAnimationFrame(this._animation))},u.prototype.enable=function(){var t=this;t._stopped&&(t._stopped=!1,t._animation=requestAnimationFrame(t._animate.bind(t)))},u.prototype.add=function(t){return t._id||(t._id=this._getUuid()),this._idTable[t._id]||(this._queue.push(t),this._idTable[t._id]=t),t._id},u.prototype.getById=function(t){return this._idTable[t]},u.prototype.remove=function(t){if(t){var e=t._id;if(this._idTable[e])for(var n=this._queue,r=n.length-1;0<=r;r--)if(e===n[r]._id){this._queue=n.splice(r,1),this._idTable[e]=void 0;break}}},u.prototype.removeById=function(t){this.remove(this._idTable[t])},u.prototype._animate=function(){var t=this;if(!t._stopped){var e=performance.now();if(e-t._lastTime>=t._minFR){for(var n=t._queue,r=n.length-1;0<=r;r--)try{n[r]._onAnimationProgress(e)}catch(t){}t._lastTime=e}t._animation=requestAnimationFrame(t._animate.bind(t))}},u.prototype._getUuid=function(){return this._idCounter++},u.instance=new u,u);function u(){this._animation=null,this._queue=[],this._minFR=33,this._stopped=!0,this._idCounter=1234567890,this._idTable={},this._lastTime=performance.now(),this.enable()}var p,c=(e(f,p=P.internal.EventEmitter),f.prototype.dispose=function(){var t=this;t.stop(),h.instance.remove(t),t._options=null,t._easing=null,t._start=null,t._onComplete=null,t._id=void 0,t._rawProgress=null},f.prototype.getDuration=function(){var t=this._options;return t.loop?1/0:t.duration/t.speedMultiplier},f.prototype.getOptions=function(){return Object.assign({},this._options)},f.prototype.isPlaying=function(){return null!==this._start},f.prototype.play=function(){var t=this;1<=t._rawProgress&&(t._rawProgress=0),0<t._rawProgress?t._start=M.getStartTime(t._rawProgress,t._options.duration,t._options.speedMultiplier):t._start=performance.now()},f.prototype.pause=function(){this._start=null},f.prototype.seek=function(t){var e=this;if("number"==typeof t){var n=e.isPlaying();n&&e.pause(),e._rawProgress=Math.min(Math.max(t,0),1)/e._options.speedMultiplier,e._processFrame(),n&&e.play()}},f.prototype.setOptions=function(t){if(t){var e=this,n=e._options;t.easing&&("string"==typeof t.easing&&s[t.easing]?(e._easing=s[t.easing],n.easing=t.easing):t.easing instanceof Function&&(e._easing=t.easing,n.easing=t.easing)),"boolean"==typeof t.loop&&(n.loop=t.loop),"boolean"==typeof t.disposeOnComplete&&(n.disposeOnComplete=t.disposeOnComplete),"boolean"==typeof t.reverse&&(n.reverse=t.reverse),"number"==typeof t.speedMultiplier&&0<t.speedMultiplier&&(n.speedMultiplier=t.speedMultiplier);var r="number"==typeof t.duration&&0<t.duration&&n.duration!==t.duration,i="boolean"==typeof t.autoPlay;if(r||i){var a=e.isPlaying();a&&e.pause(),i&&(n.autoPlay=t.autoPlay||n.autoPlay,!a&&t.autoPlay&&(a=!0)),r&&(n.duration=t.duration||n.duration),a&&e.play()}}},f.prototype.stop=function(){this._rawProgress=1,this._processFrame(),this._start=null},f.prototype.reset=function(){this._start=null,this._rawProgress=0,this._processFrame()},f.prototype._onAnimationProgress=function(t){var e=this;e._start&&(e._rawProgress=M.getProgress(t,e._start,e._options.duration,e._options.speedMultiplier),e._processFrame())},f.prototype._processFrame=function(){var t=this,e=t._options;if(void 0!==t._id){var n=t._rawProgress||0;1<=n&&(e.loop?(t._rawProgress=0,t._start=performance.now()):(t._rawProgress=1,t._start=null,t._onComplete&&t._onComplete()));var r=e.reverse?1-t._rawProgress:t._rawProgress;t._easing&&(n=t._easing(r));var i=t.onAnimationProgress(n),a=Object.assign({progress:r,easingProgress:n,animation:t},i||{});t._invokeEvent("onprogress",Object.assign({type:"onprogress"},a)),null===t._start&&t._invokeEvent("oncomplete",Object.assign({type:"oncomplete"},a)),e.disposeOnComplete&&t.dispose()}},f);function f(t){var e=p.call(this)||this;e._start=null,e._rawProgress=0,e._options={duration:1e3,autoPlay:!1,easing:"linear",loop:!1,reverse:!1,speedMultiplier:1,disposeOnComplete:!1},e._easing=s.linear;var n=e;return n._id=h.instance.add(n),n.setOptions(t),e}var g,y=(e(v,g=c),v.prototype.getCurrentFrameIdx=function(){return this._numFrames<=0?-1:this._curFrameIdx},v.prototype.getNumberOfFrames=function(){return this._numFrames},v.prototype.setFrameIdx=function(t){(0<=t||t<this._numFrames)&&this.seek(this._numFrames/t)},v.prototype.setNumberOfFrames=function(t){var e=this;"number"==typeof t&&e._numFrames!==t&&(e._numFrames=Math.max(t,0),e._curFrameIdx=t<e._curFrameIdx?e._curFrameIdx:0,t<=0&&(e._curFrameIdx=-1),e._triggerFrame(e._curFrameIdx))},v.prototype.onAnimationProgress=function(t){var e=this._numFrames;if(0<e){var n=Math.round(t*e-.5);if(n!==this._curFrameIdx)return n===e?n--:n<0&&(n=-1),this._triggerFrame(n),{frameIdx:n}}return null},v.prototype._triggerFrame=function(t){var e=this;e._onFrame&&-1!==t&&e._onFrame(t),-1!==(e._curFrameIdx=t)&&e._invokeEvent("onframe",{type:"onFrame",frameIdx:t,animation:e,numFrames:e._numFrames})},v);function v(t,e,n){var r=g.call(this,n)||this;r._numFrames=0,r._curFrameIdx=-1;var i=r;return i._numFrames=t,i._onFrame=e,n&&n.autoPlay&&i.play(),r}var m,d=(e(_,m=P.layer.Layer),_.prototype.dispose=function(){var t=this;t._animation.stop(),h.instance.remove(t),h.instance.remove(t._animation),t._animation=void 0,t._onComplete=void 0,t._id=void 0,t._options=void 0},_.prototype.getDuration=function(){return this._options.loop?1/0:this._options.duration},_.prototype.getOptions=function(){return Object.assign({},this._options,this._animation.getOptions())},_.prototype.getPlayableAnimation=function(){return this._animation},_.prototype.isPlaying=function(){return this._animation.isPlaying()},_.prototype.pause=function(){this._animation.pause()},_.prototype.play=function(){this._animation.play()},_.prototype.reset=function(){this._animation.reset()},_.prototype.stop=function(){this._animation.stop()},_.prototype.setFrameIdx=function(t){this._animation.setFrameIdx(t)},_.prototype.setOptions=function(t){var e=this,n=e._animation,r=e._map,i=e._options,a=e._tileLayers;if(t&&(t.tileLayerOptions&&(0<a.length&&(r&&r.layers.remove(a),a=[],e._tileLayers=a,e._currentTileLayer=null),t.tileLayerOptions.forEach(function(t){t.fadeDuration=0,t.visible=!0,a.push(new P.layer.TileLayer(Object.assign({},t,{opacity:0})))}),r&&r.layers.add(a,e),i.tileLayerOptions=t.tileLayerOptions,n&&n.setNumberOfFrames(i.tileLayerOptions.length),0<=(o=n?e._animation.getCurrentFrameIdx():0)&&(e._currentTileLayer=a[o],e._currentTileLayer.setOptions({fadeDuration:0,visible:!0}))),"boolean"==typeof t.visible))if(i.visible=t.visible,t.visible){var o=n.getCurrentFrameIdx();0<t.tileLayerOptions.length&&e._currentTileLayer.setOptions({fadeDuration:0,opacity:t.tileLayerOptions[o].opacity})}else a.forEach(function(t){return t.setOptions({opacity:0})});if(n){var s=!1;Object.keys(t).forEach(function(t){switch(t){case"tileLayerOptions":case"visible":break;default:s=!0}}),s&&n.setOptions(t)}},_.prototype.onAdd=function(t){(this._map=t).layers.add(this._tileLayers,this)},_.prototype.onRemove=function(){this._map.layers.remove(this._tileLayers),this._map=null},_.prototype._buildLayers=function(){return[]},_.prototype._getLayerIds=function(){return[this.id]},_.prototype._buildSource=function(){return null},_.prototype._getSourceId=function(){return null},_.prototype._onAnimationProgress=function(t){return null},_);function _(t){var o=m.call(this)||this;o._tileLayers=[],o._options={tileLayerOptions:[],visible:!0},o._onFrame=function(t){var e=o,n=e._options;if(n.visible&&n.tileLayerOptions&&0<n.tileLayerOptions.length&&t<n.tileLayerOptions.length){var r=e._map.map,i=e._currentTileLayer,a=void 0;i&&(a=i.getId(),r.setPaintProperty(a,"raster-opacity-transition",{duration:0,delay:0}),r.setPaintProperty(a,"raster-opacity",0)),i=e._tileLayers[t],a=(e._currentTileLayer=i).getId(),r.setPaintProperty(a,"raster-opacity-transition",{duration:0,delay:0}),r.setPaintProperty(a,"raster-opacity",n.tileLayerOptions[t].opacity)}};var e=o;e._id=h.instance.add(e);var n=0;return t&&(e.setOptions(t),t.tileLayerOptions&&(n=t.tileLayerOptions.length)),e._animation=new y(n,e._onFrame,t),e._onComplete=e._animation._onComplete,o}var x,b=Object.freeze({__proto__:null,AnimatedTileLayer:d}),w=(e(O,x=c),O.prototype.onAnimationProgress=function(t){for(var e,n,r=this._shapes,i=0,a=r.length;i<a;i++)if(n=this._y0[i]-this._height*(1-t),e=[this._x0[i],n],r[i]instanceof P.Shape){var o=r[i];o.setProperties(Object.assign(o.getProperties(),{offset:e,opacity:0!==t?1:0}))}else r[i].setOptions({pixelOffset:e,visible:0!==t});return null},O);function O(t,e,n,r){var i=x.call(this,r)||this;if(i._height=200,!(t&&0<t.length))throw"No shape specified for animation.";var a=i;a._shapes=t;var o=[];a._x0=o;var s=[];a._y0=s,a._height="number"==typeof n&&0<n?n:a._height;var u=[],h=void 0,p=void 0,c=void 0,l=[];e instanceof P.source.DataSource&&(p=e),e instanceof P.Map&&(l=(c=e).markers.getMarkers());for(var f=0,g=t.length;f<g;f++){if(h=null,t[f]instanceof P.Shape)h=t[f].getProperties().offset;else h=t[f].getOptions().pixelOffset;if(h&&Array.isArray(h)&&2<=h.length?(o.push(h[0]),s.push(h[1])):(o.push(0),s.push(0),h=[0,0]),h[1]-=a._height,t[f]instanceof P.Shape){var y=t[f];y.setProperties(Object.assign(y.getProperties(),{offset:h,opacity:0})),p&&null===p.getShapeById(t[f].getId())&&u.push(t[f])}else{var v=t[f];v.setOptions({pixelOffset:h,visible:!1}),c&&l&&-1===l.indexOf(v)&&c.markers.add(v)}}return p&&0<u.length&&p.add(u),r&&r.autoPlay&&a.play(),i}var L,A=(e(C,L=c),C.prototype.dispose=function(){this._pathOptions=null,L.prototype.dispose.call(this)},C.prototype.getOptions=function(){return Object.assign({},L.prototype.getOptions.call(this),this._pathOptions)},C.prototype.setOptions=function(t){if(t){var e=this._pathOptions;"number"==typeof t.duration&&0<t.duration&&(e.duration=t.duration||e.duration),"boolean"==typeof t.captureMetadata&&(e.captureMetadata=t.captureMetadata),"boolean"==typeof t.geodesic&&(e.geodesic=t.geodesic),"boolean"==typeof t.reverse&&(e.reverse=t.reverse),"number"==typeof t.pitch&&(e.pitch=t.pitch),"number"==typeof t.zoom&&(e.zoom=t.zoom),"boolean"==typeof t.rotate&&(e.rotate=t.rotate),"number"==typeof t.rotationOffset&&(e.rotationOffset=t.rotationOffset),!t.map&&null!==t.map||(e.map=t.map),L.prototype.setOptions.call(this,t)}},C.prototype._setMapCamera=function(t,e,n){var r=this._pathOptions;if(r.map&&t){var i={center:t};"number"==typeof r.pitch&&(i.pitch=r.pitch),"number"==typeof r.zoom&&(i.zoom=r.zoom),r.rotate&&"number"==typeof e&&(i.bearing=r.reverse?e+180:e,"number"==typeof r.rotationOffset&&(i.bearing+=r.rotationOffset)),n?(i.type="fly",i.duration=Math.min(60,r.duration)):i.type="jump",r.map.setCamera(i)}},C.prototype.onAnimationProgress=function(t){return null},C);function C(t){var e=L.call(this,t)||this;return e._pathOptions={duration:1e3},e.setOptions(t),e}var I,k=(e(S,I=A),S.prototype.setOptions=function(t){t&&I.prototype.setOptions.call(this,t);var e=this,n=e._originPosition,r=e._destinationPosition,i=P.math,a=P.Pixel;if(n&&r){if(e._pathOptions.geodesic)e._dx=i.getDistanceTo(n,r),e._heading=i.getHeading(n,r);else{var o=i.mercatorPositionsToPixels([n,r],21);if(e._originPixel=o[0],180<Math.abs(n[0]-r[0])){var s=512*Math.pow(2,21);o[0][0]>o[1][0]?o[1][0]+=s:o[0][0]+=s}e._dx=a.getDistance(o[0],o[1]),e._heading=a.getHeading(o[0],o[1])}e._pathOptions.captureMetadata&&M.setMetadata(e._shape,{heading:e._heading})}},S.prototype.onAnimationProgress=function(t){var e=this,n=e._originPosition,r=e._heading,i=e._destinationPosition,a=P.math,o=e._pathOptions;if(n&&i&&o){var s=void 0,u=!1;if(1===t)s=i;else if(0===t)s=n;else{var h=e._dx*t;s=o.geodesic?a.getDestination(n,r,h):a.mercatorPixelsToPositions([P.Pixel.getDestination(e._originPixel,r,h)],21)[0],u=!0}return M.setCoordinates(e._shape,s),o.map&&e._setMapCamera(s,r,u),{position:s,heading:r}}return null},S);function S(t,e,n){var r,i=I.call(this)||this,a=i;return r=t instanceof P.Shape?t.getCoordinates():t.getOptions().position,a._originPosition=r,a._shape=t,a._destinationPosition=e,a.setOptions(n),n&&n.autoPlay&&a.play(),i}var T,F=(e(q,T=A),q.prototype.dispose=function(){var e=this;Object.keys(this).forEach(function(t){e[t]=void 0}),T.prototype.dispose.call(this)},q.prototype.setOptions=function(t){var e=this;t&&T.prototype.setOptions.call(this,t);var n=e.isPlaying();if(n&&e.pause(),e._positions){var r=0,i=[],a=[],o=e._positions,s=P.math;if(e._pathOptions.geodesic)for(var u=1,h=o.length;u<h;u++){r+=l=s.getDistanceTo(o[u-1],o[u]),i.push(l);var p=s.getHeading(o[u-1],o[u]);a.push(p)}else{var c=s.mercatorPositionsToPixels(o,21);for(u=1,h=(e._pixels=c).length;u<h;u++){var l;r+=l=P.Pixel.getDistance(c[u-1],c[u]),i.push(l),p=M.getPixelHeading(c[u-1],c[u]),a.push(p)}}e._totalLength=r,e._distances=i,e._headings=a,e._pathOptions.captureMetadata&&M.setMetadata(e._shape,{heading:e._headings[0]})}n&&e.play()},q.prototype.onAnimationProgress=function(t){var e,n,r=this,i=r._shape,a=r._positions,o=r._headings,s=r._distances,u=r._pathOptions,h=r._totalLength,p=P.math;if(1===t)e=a[a.length-1],n=0<o.length?o[o.length-1]:void 0,u.map&&r._setMapCamera(e,n,!1),M.setCoordinates(i,e,a);else if(0===t)e=a[0],n=0<o.length?o[0]:void 0,u.map&&r._setMapCamera(e,n,!1),M.setCoordinates(i,e,[e,e]);else{var c=h*t,l=null;if(u.geodesic)if(h<c)n=o[o.length-1],l=a.slice(0);else if(c<0)n=o[0],l=a.slice(0,1);else for(var f=0,g=0;g<s.length;g++){if(f+s[g]>=c){n=o[g],(l=a.slice(0,g+1)).push(p.getDestination(a[g],n,c-f));break}f+=s[g]}else{var y=null,v=r._pixels;if(h<c)n=o[o.length-1],y=M.getPixelDestination(v[v.length-1],n,c-h),(l=a.slice(0)).push(p.mercatorPixelsToPositions([y],21)[0]);else if(c<0)n=o[0],y=M.getPixelDestination(v[0],n,c),(l=a.slice(0,1)).push(p.mercatorPixelsToPositions([y],21)[0]);else for(g=f=0;g<s.length;g++){if(f+s[g]>=c){n=o[g],y=M.getPixelDestination(v[g],n,c-f),(l=a.slice(0,g+1)).push(p.mercatorPixelsToPositions([y],21)[0]);break}f+=s[g]}}l&&0<l.length&&(e=l[l.length-1],u.map&&r._setMapCamera(e,n,2<l.length),M.setCoordinates(i,e,l))}return u.captureMetadata&&M.setMetadata(i,{heading:n}),{position:e,heading:n}},q);function q(t,e,n){var r=T.call(this)||this,i=r;return i._shape=e,i._positions=t,i.setOptions(Object.assign({rotate:!0,rotationOffset:0},n||{})),n&&n.autoPlay&&i.play(),r}var E,D,j=(function(t){!function(t){function e(t){return 10===t||13===t||8232===t||8233===t||32===t||9===t||11===t||12===t||160===t||t>=5760&&ie.indexOf(t)>=0}function o(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:case 114:return!0}return!1}function h(t){return t>=48&&t<=57}function s(t){return t>=48&&t<=57||43===t||45===t||46===t}function r(t){this.index=0,this.path=t,this.max=t.length,this.result=[],this.param=0,this.err="",this.segmentStart=0,this.data=[]}function u(t){for(;t.index<t.max&&e(t.path.charCodeAt(t.index));)t.index++}function p(t){var e,n=t.index,r=n,i=t.max,a=!1,o=!1,s=!1,u=!1;if(r>=i)return void(t.err="SvgPath: missed param (at pos "+r+")");if(e=t.path.charCodeAt(r),43!==e&&45!==e||(r++,e=r<i?t.path.charCodeAt(r):0),!h(e)&&46!==e)return void(t.err="SvgPath: param should start with 0..9 or `.` (at pos "+r+")");if(46!==e){if(a=48===e,r++,e=r<i?t.path.charCodeAt(r):0,a&&r<i&&e&&h(e))return void(t.err="SvgPath: numbers started with `0` such as `09` are ilegal (at pos "+n+")");for(;r<i&&h(t.path.charCodeAt(r));)r++,o=!0;e=r<i?t.path.charCodeAt(r):0}if(46===e){for(u=!0,r++;h(t.path.charCodeAt(r));)r++,s=!0;e=r<i?t.path.charCodeAt(r):0}if(101===e||69===e){if(u&&!o&&!s)return void(t.err="SvgPath: invalid float exponent (at pos "+r+")");if(r++,e=r<i?t.path.charCodeAt(r):0,43!==e&&45!==e||r++,!(r<i&&h(t.path.charCodeAt(r))))return void(t.err="SvgPath: invalid float exponent (at pos "+r+")");for(;r<i&&h(t.path.charCodeAt(r));)r++}t.index=r,t.param=parseFloat(t.path.slice(n,r))+0}function c(t){var e,n;e=t.path[t.segmentStart],n=e.toLowerCase();var r=t.data;if("m"===n&&r.length>2&&(t.result.push([e,r[0],r[1]]),r=r.slice(2),n="l",e="m"===e?"l":"L"),"r"===n)t.result.push([e].concat(r));else for(;r.length>=re[n]&&(t.result.push([e].concat(r.splice(0,re[n]))),re[n]););}function i(t){var e,n,r,i,a=t.max;if(t.segmentStart=t.index,e=t.path.charCodeAt(t.index),!o(e))return void(t.err="SvgPath: bad command "+t.path[t.index]+" (at pos "+t.index+")");if(r=re[t.path[t.index].toLowerCase()],t.index++,u(t),t.data=[],!r)return void c(t);for(n=!1;;){for(i=r;i>0;i--){if(p(t),t.err.length)return;t.data.push(t.param),u(t),n=!1,t.index<a&&44===t.path.charCodeAt(t.index)&&(t.index++,u(t),n=!0)}if(!n){if(t.index>=t.max)break;if(!s(t.path.charCodeAt(t.index)))break}}c(t)}function n(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}function a(){if(!(this instanceof a))return new a;this.queue=[],this.cache=null}function A(t,e,n,r){var i=t*r-e*n<0?-1:1,a=Math.sqrt(t*t+e*e),o=Math.sqrt(t*t+e*e),s=t*n+e*r,u=s/(a*o);return u>1&&(u=1),u<-1&&(u=-1),i*Math.acos(u)}function x(t,e,n,r,i,a,o,s,u,h){var p=h*(t-n)/2+u*(e-r)/2,c=-u*(t-n)/2+h*(e-r)/2,l=o*o,f=s*s,g=p*p,y=c*c,v=l*f-l*y-f*g;v<0&&(v=0),v/=l*y+f*g,v=Math.sqrt(v)*(i===a?-1:1);var m=v*o/s*c,d=v*-s/o*p,_=h*m-u*d+(t+n)/2,x=u*m+h*d+(e+r)/2,P=(p-m)/o,M=(c-d)/s,b=(-p-m)/o,w=(-c-d)/s,O=A(1,0,P,M),L=A(P,M,b,w);return 0===a&&L>0&&(L-=ce),1===a&&L<0&&(L+=ce),[_,x,O,L]}function P(t,e){var n=4/3*Math.tan(e/4),r=Math.cos(t),i=Math.sin(t),a=Math.cos(t+e),o=Math.sin(t+e);return[r,i,r-i*n,i+r*n,a+o*n,o-a*n,a,o]}function l(t,e,n){if(!(this instanceof l))return new l(t,e,n);this.rx=t,this.ry=e,this.ax=n}function f(t){if(!(this instanceof f))return new f(t);var e=ae(t);this.segments=e.segments,this.err=e.err,this.__stack=[]}function g(t){var e=t.match(xe);return e?e.map(Number):[]}function y(t,e,n,r,i,a,o,s){this.a={x:t,y:e},this.b={x:n,y:r},this.c={x:i,y:a},this.d={x:o,y:s},null!==o&&void 0!==o&&null!==s&&void 0!==s?(this.getArcLength=C,this.getPoint=M,this.getDerivative=m):(this.getArcLength=b,this.getPoint=_,this.getDerivative=v),this.init()}function v(t,e,n){return{x:2*(1-n)*(t[1]-t[0])+2*n*(t[2]-t[1]),y:2*(1-n)*(e[1]-e[0])+2*n*(e[2]-e[1])}}function m(t,e,n){return _([3*(t[1]-t[0]),3*(t[2]-t[1]),3*(t[3]-t[2])],[3*(e[1]-e[0]),3*(e[2]-e[1]),3*(e[3]-e[2])],n)}function d(t,e,n,r,i){for(var a=1,o=t/e,s=(t-n(r,i,o))/e;a>.001;){var u=n(r,i,o+s),h=n(r,i,o-s),p=Math.abs(t-u)/e,c=Math.abs(t-h)/e;p<a?(a=p,o+=s):c<a?(a=c,o-=s):s/=2}return o}function _(t,e,n){return{x:(1-n)*(1-n)*t[0]+2*(1-n)*n*t[1]+n*n*t[2],y:(1-n)*(1-n)*e[0]+2*(1-n)*n*e[1]+n*n*e[2]}}function M(t,e,n){return{x:(1-n)*(1-n)*(1-n)*t[0]+3*(1-n)*(1-n)*n*t[1]+3*(1-n)*n*n*t[2]+n*n*n*t[3],y:(1-n)*(1-n)*(1-n)*e[0]+3*(1-n)*(1-n)*n*e[1]+3*(1-n)*n*n*e[2]+n*n*n*e[3]}}function b(t,e,n){void 0===n&&(n=1);var r=t[0]-2*t[1]+t[2],i=e[0]-2*e[1]+e[2],a=2*t[1]-2*t[0],o=2*e[1]-2*e[0],s=4*(r*r+i*i),u=4*(r*a+i*o),h=a*a+o*o;if(0===s)return n*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));var p=u/(2*s),c=h/s,l=n+p,f=c-p*p;return Math.sqrt(s)/2*(l*Math.sqrt(l*l+f)-p*Math.sqrt(p*p+f)+f*Math.log(Math.abs((l+Math.sqrt(l*l+f))/(p+Math.sqrt(p*p+f)))))}function w(t,e){return we[t][e]}function O(t,e,n){var r,i,a,o=n.length-1;if(0===o)return 0;if(0===t){for(i=0,a=0;a<=o;a++)i+=w(o,a)*Math.pow(1-e,o-a)*Math.pow(e,a)*n[a];return i}for(r=new Array(o),a=0;a<o;a++)r[a]=o*(n[a+1]-n[a]);return O(t-1,e,r)}function L(t,e,n){var r=O(1,n,t),i=O(1,n,e),a=r*r+i*i;return Math.sqrt(a)}function C(t,e,n){var r,i,a,o;void 0===n&&(n=1);for(r=n/2,i=0,a=0;a<20;a++)o=r*Me[20][a]+r,i+=be[20][a]*L(t,e,o);return r*i}function I(t,e,n,r){var i=t*r-e*n<0?-1:1,a=t*n+e*r;return a>1&&(a=1),a<-1&&(a=-1),i*Math.acos(a)}function k(t,e,n,r,i,a,o,s,u,h){var p=h*(t-n)/2+u*(e-r)/2,c=-u*(t-n)/2+h*(e-r)/2,l=o*o,f=s*s,g=p*p,y=c*c,v=l*f-l*y-f*g;v<0&&(v=0),v/=l*y+f*g,v=Math.sqrt(v)*(i===a?-1:1);var m=v*o/s*c,d=v*-s/o*p,_=h*m-u*d+(t+n)/2,x=u*m+h*d+(e+r)/2,P=(p-m)/o,M=(c-d)/s,b=(-p-m)/o,w=(-c-d)/s,O=I(1,0,P,M),L=I(P,M,b,w);return 0===a&&L>0&&(L-=Oe),1===a&&L<0&&(L+=Oe),[_,x,O,L]}function S(t,e){var n=4/3*Math.tan(e/4),r=Math.cos(t),i=Math.sin(t),a=Math.cos(t+e),o=Math.sin(t+e);return[r,i,r-i*n,i+r*n,a+o*n,o-a*n,a,o]}function T(t,e,n,r,i,a,o,s,u){var h=0,p=[],c=[];Le(t,e,n,r,i,a,o,s,u).forEach(function(t){var e=new Pe(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]),n=e.getTotalLength();h+=n,p.push(n),c.push(e)}),this.length=h,this.partialLengths=p,this.curves=c}function F(t,e,n,r){this.x0=t,this.x1=e,this.y0=n,this.y1=r}function q(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function E(t,e,n){return[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n]}function D(t,e){return q(t,e)<1e-9}function j(t,n,r){var i=t.map(function(t,e){return Z(t,n[e])});return function(e){var t=i.map(function(t){return t(e)});return r?N(t):t}}function Z(t,r){return function(n){return t.map(function(t,e){return t+n*(r[e]-t)})}}function G(t){return"number"==typeof t&&isFinite(t)}function z(t){return B(t)?ee(t):[(t[0][0]+t[t.length-1][0])/2,(t[0][1]+t[t.length-1][1])/2]}function B(t){for(var e=0;e<t.length-2;e++){var n=t[e],r=t[e+1],i=t[e+2];if(n[0]*(r[1]-i[1])+r[0]*(i[1]-n[1])+i[0]*(n[1]-r[1]))return!0}return!1}function H(t){return new ve(t).abs()}function V(t){return t.toString().split("M").map(function(t,e){return t=t.trim(),e&&t?"M"+t:t}).filter(function(t){return t})}function N(t){return"M"+t.join("L")+"Z"}function R(t){return V(H(t))}function Q(t,e){var n=H(t);return J(n)||X(n,e)}function J(t){var e=t.segments||[],n=[];if(!e.length||"M"!==e[0][0])return!1;for(var r=0;r<e.length;r++){var i=e[r],a=i[0],o=i[1],s=i[2];if("M"===a&&r||"Z"===a)break;if("M"===a||"L"===a)n.push([o,s]);else if("H"===a)n.push([o,n[n.length-1][1]]);else{if("V"!==a)return!1;n.push([n[n.length-1][0],o])}}return!!n.length&&{ring:n}}function X(t,e){var n,r,i=V(t)[0],a=[],o=3;if(!i)throw new TypeError(ke);r=Y(i),n=r.getTotalLength(),e&&G(e)&&e>0&&(o=Math.max(o,Math.ceil(n/e)));for(var s=0;s<o;s++){var u=r.getPointAtLength(n*s/o);a.push([u.x,u.y])}return{ring:a,skipBisect:!0}}function Y(t){if("undefined"!=typeof window&&window&&window.document)try{var e=window.document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttributeNS(null,"d",t),e}catch(t){}return Ie(t)}function U(t,e){for(var n=t.length+e,r=ne(t)/e,i=0,a=0,o=r/2;t.length<n;){var s=t[i],u=t[(i+1)%t.length],h=q(s,u);o<=a+h?(t.splice(i+1,0,h?E(s,u,(o-a)/h):s.slice(0)),o+=r):(a+=h,i++)}}function W(t,e){void 0===e&&(e=1/0);for(var n=0;n<t.length;n++)for(var r=t[n],i=n===t.length-1?t[0]:t[n+1];q(r,i)>e;)i=E(r,i,.5),t.splice(n+1,0,i)}function $(t,e){var n,r,i;if("string"==typeof t){var a=Q(t,e);t=a.ring,i=a.skipBisect}else if(!Array.isArray(t))throw new TypeError(ke);if(n=t.slice(0),!K(n))throw new TypeError(ke);return n.length>1&&D(n[0],n[n.length-1])&&n.pop(),r=te(n),r>0&&n.reverse(),!i&&e&&G(e)&&e>0&&W(n,e),n}function K(t){return t.every(function(t){return Array.isArray(t)&&t.length>=2&&G(t[0])&&G(t[1])})}function tt(t,e,n){var r;return r=t.length-e.length,U(t,r<0?-1*r:0),U(e,r>0?r:0),Te(t,e),j(t,e,n)}function et(t,e,n){n=n||2;var r=e&&e.length,i=r?e[0]*n:t.length,a=nt(t,0,i,n,!0),o=[];if(!a)return o;var s,u,h,p,c,l,f;if(r&&(a=ht(t,e,a,n)),t.length>80*n){s=h=t[0],u=p=t[1];for(var g=n;g<i;g+=n)c=t[g],l=t[g+1],c<s&&(s=c),l<u&&(u=l),c>h&&(h=c),l>p&&(p=l);f=Math.max(h-s,p-u)}return it(a,o,n,s,u,f),o}function nt(t,e,n,r,i){var a,o;if(i===It(t,e,n,r)>0)for(a=e;a<n;a+=r)o=Lt(a,t[a],t[a+1],o);else for(a=n-r;a>=e;a-=r)o=Lt(a,t[a],t[a+1],o);return o&&xt(o,o.next)&&(At(o),o=o.next),o}function rt(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!xt(r,r.next)&&0!==_t(r.prev,r,r.next))r=r.next;else{if(At(r),(r=e=r.prev)===r.next)return null;n=!0}}while(n||r!==e);return e}function it(t,e,n,r,i,a,o){if(t){!o&&a&&ft(t,r,i,a);for(var s,u,h=t;t.prev!==t.next;)if(s=t.prev,u=t.next,a?ot(t,r,i,a):at(t))e.push(s.i/n),e.push(t.i/n),e.push(u.i/n),At(t),t=u.next,h=u.next;else if((t=u)===h){o?1===o?(t=st(t,e,n),it(t,e,n,r,i,a,2)):2===o&&ut(t,e,n,r,i,a):it(rt(t),e,n,r,i,a,1);break}}}function at(t){var e=t.prev,n=t,r=t.next;if(_t(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(mt(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&_t(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function ot(t,e,n,r){var i=t.prev,a=t,o=t.next;if(_t(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,u=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,h=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,p=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,c=yt(s,u,e,n,r),l=yt(h,p,e,n,r),f=t.nextZ;f&&f.z<=l;){if(f!==t.prev&&f!==t.next&&mt(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&_t(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&mt(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&_t(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function st(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!xt(i,a)&&Pt(i,r,r.next,a)&&bt(i,a)&&bt(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),At(r),At(r.next),r=t=a),r=r.next}while(r!==t);return r}function ut(t,e,n,r,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&dt(o,s)){var u=Ot(o,s);return o=rt(o,o.next),u=rt(u,u.next),it(o,e,n,r,i,a),void it(u,e,n,r,i,a)}s=s.next}o=o.next}while(o!==t)}function ht(t,e,n,r){var i,a,o,s,u,h=[];for(i=0,a=e.length;i<a;i++)o=e[i]*r,s=i<a-1?e[i+1]*r:t.length,u=nt(t,o,s,r,!1),u===u.next&&(u.steiner=!0),h.push(vt(u));for(h.sort(pt),i=0;i<h.length;i++)ct(h[i],n),n=rt(n,n.next);return n}function pt(t,e){return t.x-e.x}function ct(t,e){if(e=lt(t,e)){var n=Ot(e,t);rt(n,n.next)}}function lt(t,e){var n,r=e,i=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!n)return null;if(i===o)return n.prev;var u,h=n,p=n.x,c=n.y,l=1/0;for(r=n.next;r!==h;)i>=r.x&&r.x>=p&&mt(a<c?i:o,a,p,c,a<c?o:i,a,r.x,r.y)&&((u=Math.abs(a-r.y)/(i-r.x))<l||u===l&&r.x>n.x)&&bt(r,t)&&(n=r,l=u),r=r.next;return n}function ft(t,e,n,r){var i=t;do{null===i.z&&(i.z=yt(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,gt(i)}function gt(t){var e,n,r,i,a,o,s,u,h=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e<h&&(s++,r=r.nextZ);e++);for(u=h;s>0||u>0&&r;)0===s?(i=r,r=r.nextZ,u--):0!==u&&r?n.z<=r.z?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,u--):(i=n,n=n.nextZ,s--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,h*=2}while(o>1);return t}function yt(t,e,n,r,i){return t=32767*(t-n)/i,e=32767*(e-r)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function vt(t){var e=t,n=t;do{e.x<n.x&&(n=e),e=e.next}while(e!==t);return n}function mt(t,e,n,r,i,a,o,s){return(i-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(n-o)*(e-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function dt(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Mt(t,e)&&bt(t,e)&&bt(e,t)&&wt(t,e)}function _t(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function xt(t,e){return t.x===e.x&&t.y===e.y}function Pt(t,e,n,r){return!!(xt(t,e)&&xt(n,r)||xt(t,r)&&xt(n,e))||_t(t,e,n)>0!=_t(t,e,r)>0&&_t(n,r,t)>0!=_t(n,r,e)>0}function Mt(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Pt(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function bt(t,e){return _t(t.prev,t,t.next)<0?_t(t,e,t.next)>=0&&_t(t,t.prev,e)>=0:_t(t,e,t.prev)<0||_t(t,t.next,e)<0}function wt(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}function Ot(t,e){var n=new Ct(t.i,t.x,t.y),r=new Ct(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Lt(t,e,n,r){var i=new Ct(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function At(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ct(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function It(t,e,n,r){for(var i=0,a=e,o=n-r;a<n;a+=r)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}function kt(t,e){var n=e.id,r=e.bbox,i=null==e.properties?{}:e.properties,a=St(t,e);return null==n&&null==r?{type:"Feature",properties:i,geometry:a}:null==r?{type:"Feature",id:n,properties:i,geometry:a}:{type:"Feature",id:n,bbox:r,properties:i,geometry:a}}function St(t,e){function i(t,e){e.length&&e.pop();for(var n=h[t<0?~t:t],r=0,i=n.length;r<i;++r)e.push(u(n[r],r));t<0&&je(e,i)}function r(t){return u(t)}function a(t){for(var e=[],n=0,r=t.length;n<r;++n)i(t[n],e);return e.length<2&&e.push(e[0]),e}function n(t){for(var e=a(t);e.length<4;)e.push(e[0]);return e}function o(t){return t.map(n)}function s(t){var e,n=t.type;switch(n){case"GeometryCollection":return{type:n,geometries:t.geometries.map(s)};case"Point":e=r(t.coordinates);break;case"MultiPoint":e=t.coordinates.map(r);break;case"LineString":e=a(t.arcs);break;case"MultiLineString":e=t.arcs.map(a);break;case"Polygon":e=o(t.arcs);break;case"MultiPolygon":e=t.arcs.map(o);break;default:return null}return{type:n,coordinates:e}}var u=De(t.transform),h=t.arcs;return s(e)}function Tt(t){for(var e,n=-1,r=t.length,i=t[r-1],a=0;++n<r;)e=i,i=t[n],a+=e[0]*i[1]-e[1]*i[0];return Math.abs(a)}function Ft(s,t){function e(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"Polygon":n(t.arcs);break;case"MultiPolygon":t.arcs.forEach(n)}}function n(e){e.forEach(function(t){t.forEach(function(t){(h[t=t<0?~t:t]||(h[t]=[])).push(e)})}),r.push(e)}function u(t){return Tt(St(s,{type:"Polygon",arcs:[t]}).coordinates[0])}var h={},r=[],i=[];return t.forEach(e),r.forEach(function(t){if(!t._){var e=[],n=[t];for(t._=1,i.push(e);t=n.pop();)e.push(t),t.forEach(function(t){t.forEach(function(t){h[t<0?~t:t].forEach(function(t){t._||(t._=1,n.push(t))})})})}}),r.forEach(function(t){delete t._}),{type:"MultiPolygon",arcs:i.map(function(t){var e,n=[];if(t.forEach(function(t){t.forEach(function(t){t.forEach(function(t){h[t<0?~t:t].length<2&&n.push(t)})})}),n=Ge(s,n),(e=n.length)>1)for(var r,i,a=1,o=u(n[0]);a<e;++a)(r=u(n[a]))>o&&(i=n[0],n[0]=n[a],n[a]=i,o=r);return n})}}function qt(n){return function(t,e){return He(n(t),e)}}function Et(t,a){var o={},s={type:"Topology",objects:{triangles:{type:"GeometryCollection",geometries:[]}},arcs:[]};return t.forEach(function(t){var i=[];t.forEach(function(t,e){var n=t[0]<t[1]?t.join(","):t[1]+","+t[0],r=t.map(function(t){return a[t]});n in o?i.push(~o[n]):(i.push(o[n]=s.arcs.length),s.arcs.push(r))}),s.objects.triangles.geometries.push({type:"Polygon",area:Math.abs(te(t.map(function(t){return a[t[0]]}))),arcs:[i]})}),s.objects.triangles.geometries.sort(function(t,e){return t.area-e.area}),s}function Dt(i,t){for(var a=i.objects.triangles.geometries,o=Ve(function(t){return t.area}).left;a.length>t;)!function(){var t=a[0],e=Be(a)[0][0],n=a[e],r=Ft(i,[t,n]);r.area=t.area+n.area,r.type="Polygon",r.arcs=r.arcs[0],a.splice(e,1),a.shift(),a.splice(o(a,r.area),0,r)}();if(t>a.length)throw new RangeError("Can't collapse topology into "+t+" pieces.");return Ze(i,i.objects.triangles).features.map(function(t){return t.geometry.coordinates[0].pop(),t.geometry.coordinates[0]})}function jt(t){for(var e=qe(t.reduce(function(t,e){return t.concat([e[0]],[e[1]])},[])),n=[],r=0,i=e.length;r<i;r+=3)n.push([[e[r],e[r+1]],[e[r+1],e[r+2]],[e[r+2],e[r]]]);return n}function Zt(t,e,o){function s(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=0);for(var r=0;r<t.length;r++){var i=t.splice(r,1),a=o[i[0]][e.length];n+a<u&&(t.length?s(t.slice(),e.concat(i),n+a):(u=n+a,h=e.concat(i))),t.length&&t.splice(r,0,i[0])}}var u=1/0,h=t.map(function(t,e){return e});return s(h),h}function Gt(t,e){var n=q(z(t),z(e));return n*n}function zt(t,e,n){void 0===n&&(n={});var r=n.maxSegmentLength;void 0===r&&(r=10);var i=n.string;void 0===i&&(i=!0);var a=n.single;void 0===a&&(a=!1);var o=$(t,r);o.length<e.length+2&&U(o,e.length+2-o.length);var s,u=Re(o,e.length),h=e.map(function(t){return $(t,r)}),p="string"==typeof t&&t;return a&&!e.every(function(t){return"string"==typeof t})||(s=e.slice(0)),Vt(u,h,{match:!0,string:i,single:a,t0:p,t1:s})}function Bt(t,e,n){void 0===n&&(n={});var r=n.maxSegmentLength;void 0===r&&(r=10);var i=n.string;void 0===i&&(i=!0);var a=n.single;void 0===a&&(a=!1);var o=zt(e,t,{maxSegmentLength:r,string:i,single:a});return a?function(t){return o(1-t)}:o.map(function(e){return function(t){return e(1-t)}})}function Ht(t,e,n){void 0===n&&(n={});var r=n.maxSegmentLength;void 0===r&&(r=10);var i=n.string;void 0===i&&(i=!0);var a=n.single;if(void 0===a&&(a=!1),!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length||!t.length)throw new TypeError(Se);var o,s,u=function(t){return $(t,r)},h=t.map(u),p=e.map(u);return a?(t.every(function(t){return"string"==typeof t})&&(o=t.slice(0)),e.every(function(t){return"string"==typeof t})&&(s=e.slice(0))):(o=t.slice(0),s=e.slice(0)),Vt(h,p,{string:i,single:a,t0:o,t1:s,match:!1})}function Vt(n,r,t){void 0===t&&(t={});var i=t.string,e=t.single,a=t.t0,o=t.t1,s=t.match,u=s?Qe(n,r):n.map(function(t,e){return e}),h=u.map(function(t,e){return tt(n[t],r[e],i)});if(s&&Array.isArray(a)&&(a=u.map(function(t){return a[t]})),e&&i&&(Array.isArray(a)&&(a=a.join(" ")),Array.isArray(o)&&(o=o.join(" "))),e){var p=i?function(e){return h.map(function(t){return t(e)}).join(" ")}:function(e){return h.map(function(t){return t(e)})};return i&&(a||o)?function(t){return t<1e-4&&a||1-t<1e-4&&o||p(t)}:p}return i?(a=Array.isArray(a)?a.map(function(t){return"string"==typeof t&&t}):[],o=Array.isArray(o)?o.map(function(t){return"string"==typeof t&&t}):[],h.map(function(e,n){return a[n]||o[n]?function(t){return t<1e-4&&a[n]||1-t<1e-4&&o[n]||e(t)}:e})):h}function Nt(t,e,n,r,i){return Xt(Yt(t,e,n),r,$t(t,e,n),2*Math.PI*n,i)}function Rt(t,e,n,r,i){var a=Nt(e,n,r,t,i);return function(t){return a(1-t)}}function Qt(t,e,n,r,i,a){return Xt(Ut(t,e,n,r),i,Kt(t,e,n,r),2*n+2*r,a)}function Jt(t,e,n,r,i,a){var o=Qt(e,n,r,i,t,a);return function(t){return o(1-t)}}function Xt(t,e,n,r,i){void 0===i&&(i={});var a=i.maxSegmentLength;void 0===a&&(a=10);var o=i.string;void 0===o&&(o=!0);var s,u,h=$(e,a);return G(r)&&h.length<r/a&&U(h,Math.ceil(r/a-h.length)),s=t(h),u=j(s,h,o),o?function(t){return t<1e-4?n:u(t)}:u}function Yt(s,u,h){return function(r){var t=z(r),i=ne(r.concat([r[0]])),a=Math.atan2(r[0][1]-t[1],r[0][0]-t[0]),o=0;return r.map(function(t,e){var n;return e&&(o+=q(t,r[e-1])),n=a+2*Math.PI*(i?o/i:e/r.length),[Math.cos(n)*h+s,Math.sin(n)*h+u]})}}function Ut(s,u,h,p){return function(r){var t=z(r),i=ne(r.concat([r[0]])),e=Math.atan2(r[0][1]-t[1],r[0][0]-t[0]),a=0;e<0&&(e=2*Math.PI+e);var o=e/(2*Math.PI);return r.map(function(t,e){e&&(a+=q(t,r[e-1]));var n=Wt((o+(i?a/i:e/r.length))%1);return[s+n[0]*h,u+n[1]*p]})}}function Wt(t){return t<=1/8?[1,.5+4*t]:t<=3/8?[1.5-4*t,1]:t<=5/8?[0,2.5-4*t]:t<=7/8?[4*t-2.5,0]:[1,4*t-3.5]}function $t(t,e,n){var r=t-n+","+e,i=t+n+","+e,a="A"+n+","+n+",0,1,1,";return"M"+r+a+i+a+r+"Z"}function Kt(t,e,n,r){var i=t+n,a=e+r;return"M"+t+","+e+"L"+i+","+e+"L"+i+","+a+"L"+t+","+a+"Z"}var te=function(t){for(var e,n=-1,r=t.length,i=t[r-1],a=0;++n<r;)e=i,i=t[n],a+=e[1]*i[0]-e[0]*i[1];return a/2},ee=function(t){for(var e,n,r=-1,i=t.length,a=0,o=0,s=t[i-1],u=0;++r<i;)e=s,s=t[r],u+=n=e[0]*s[1]-s[0]*e[1],a+=(e[0]+s[0])*n,o+=(e[1]+s[1])*n;return u*=3,[a/u,o/u]},ne=function(t){for(var e,n,r=-1,i=t.length,a=t[i-1],o=a[0],s=a[1],u=0;++r<i;)e=o,n=s,a=t[r],o=a[0],s=a[1],e-=o,n-=s,u+=Math.sqrt(e*e+n*n);return u},re={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},ie=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],ae=function(t){var e=new r(t),n=e.max;for(u(e);e.index<n&&!e.err.length;)i(e);return e.err.length?e.result=[]:e.result.length&&("mM".indexOf(e.result[0][0])<0?(e.err="SvgPath: string should start with `M` or `m`",e.result=[]):e.result[0][0]="M"),{err:e.err,segments:e.result}};a.prototype.matrix=function(t){return 1===t[0]&&0===t[1]&&0===t[2]&&1===t[3]&&0===t[4]&&0===t[5]?this:(this.cache=null,this.queue.push(t),this)},a.prototype.translate=function(t,e){return 0===t&&0===e||(this.cache=null,this.queue.push([1,0,0,1,t,e])),this},a.prototype.scale=function(t,e){return 1===t&&1===e||(this.cache=null,this.queue.push([t,0,0,e,0,0])),this},a.prototype.rotate=function(t,e,n){var r,i,a;return 0!==t&&(this.translate(e,n),r=t*Math.PI/180,i=Math.cos(r),a=Math.sin(r),this.queue.push([i,a,-a,i,0,0]),this.cache=null,this.translate(-e,-n)),this},a.prototype.skewX=function(t){return 0!==t&&(this.cache=null,this.queue.push([1,0,Math.tan(t*Math.PI/180),1,0,0])),this},a.prototype.skewY=function(t){return 0!==t&&(this.cache=null,this.queue.push([1,Math.tan(t*Math.PI/180),0,1,0,0])),this},a.prototype.toArray=function(){var t=this;if(this.cache)return this.cache;if(!this.queue.length)return this.cache=[1,0,0,1,0,0],this.cache;if(this.cache=this.queue[0],1===this.queue.length)return this.cache;for(var e=1;e<this.queue.length;e++)t.cache=n(t.cache,t.queue[e]);return this.cache},a.prototype.calc=function(t,e,n){var r;return this.queue.length?(this.cache||(this.cache=this.toArray()),r=this.cache,[t*r[0]+e*r[2]+(n?0:r[4]),t*r[1]+e*r[3]+(n?0:r[5])]):[t,e]};var oe=a,se={matrix:!0,scale:!0,rotate:!0,translate:!0,skewX:!0,skewY:!0},ue=/\s*(matrix|translate|scale|rotate|skewX|skewY)\s*\(\s*(.+?)\s*\)[\s,]*/,he=/[\s,]+/,pe=function(t){var e,n,r=new oe;return t.split(ue).forEach(function(t){if(t.length){if(void 0!==se[t])return void(e=t);switch(n=t.split(he).map(function(t){return+t||0}),e){case"matrix":return void(6===n.length&&r.matrix(n));case"scale":return void(1===n.length?r.scale(n[0],n[0]):2===n.length&&r.scale(n[0],n[1]));case"rotate":return void(1===n.length?r.rotate(n[0],0,0):3===n.length&&r.rotate(n[0],n[1],n[2]));case"translate":return void(1===n.length?r.translate(n[0],0):2===n.length&&r.translate(n[0],n[1]));case"skewX":return void(1===n.length&&r.skewX(n[0]));case"skewY":return void(1===n.length&&r.skewY(n[0]))}}}),r},ce=2*Math.PI,le=function(t,e,n,r,i,a,o,s,u){var h=Math.sin(u*ce/360),p=Math.cos(u*ce/360),c=p*(t-n)/2+h*(e-r)/2,l=-h*(t-n)/2+p*(e-r)/2;if(0===c&&0===l)return[];if(0===o||0===s)return[];o=Math.abs(o),s=Math.abs(s);var f=c*c/(o*o)+l*l/(s*s);f>1&&(o*=Math.sqrt(f),s*=Math.sqrt(f));var g=x(t,e,n,r,i,a,o,s,h,p),y=[],v=g[2],m=g[3],d=Math.max(Math.ceil(Math.abs(m)/(ce/4)),1);m/=d;for(var _=0;_<d;_++)y.push(P(v,m)),v+=m;return y.map(function(t){for(var e=0;e<t.length;e+=2){var n=t[e+0],r=t[e+1];n*=o,r*=s;var i=p*n-h*r,a=h*n+p*r;t[e+0]=i+g[0],t[e+1]=a+g[1]}return t})},fe=Math.PI/180;l.prototype.transform=function(t){var e=Math.cos(this.ax*fe),n=Math.sin(this.ax*fe),r=[this.rx*(t[0]*e+t[2]*n),this.rx*(t[1]*e+t[3]*n),this.ry*(-t[0]*n+t[2]*e),this.ry*(-t[1]*n+t[3]*e)],i=r[0]*r[0]+r[2]*r[2],a=r[1]*r[1]+r[3]*r[3],o=((r[0]-r[3])*(r[0]-r[3])+(r[2]+r[1])*(r[2]+r[1]))*((r[0]+r[3])*(r[0]+r[3])+(r[2]-r[1])*(r[2]-r[1])),s=(i+a)/2;if(o<1e-10*s)return this.rx=this.ry=Math.sqrt(s),this.ax=0,this;var u=r[0]*r[1]+r[2]*r[3];o=Math.sqrt(o);var h=s+o/2,p=s-o/2;return this.ax=Math.abs(u)<1e-10&&Math.abs(h-a)<1e-10?90:180*Math.atan(Math.abs(u)>Math.abs(h-a)?(h-i)/u:u/(h-a))/Math.PI,this.ax>=0?(this.rx=Math.sqrt(h),this.ry=Math.sqrt(p)):(this.ax+=90,this.rx=Math.sqrt(p),this.ry=Math.sqrt(h)),this},l.prototype.isDegenerate=function(){return this.rx<1e-10*this.ry||this.ry<1e-10*this.rx};var ge=l;f.prototype.__matrix=function(p){var c,l=this;p.queue.length&&this.iterate(function(t,e,n,r){var i,a,o,s;switch(t[0]){case"v":i=p.calc(0,t[1],!0),a=0===i[0]?["v",i[1]]:["l",i[0],i[1]];break;case"V":i=p.calc(n,t[1],!1),a=i[0]===p.calc(n,r,!1)[0]?["V",i[1]]:["L",i[0],i[1]];break;case"h":i=p.calc(t[1],0,!0),a=0===i[1]?["h",i[0]]:["l",i[0],i[1]];break;case"H":i=p.calc(t[1],r,!1),a=i[1]===p.calc(n,r,!1)[1]?["H",i[0]]:["L",i[0],i[1]];break;case"a":case"A":var u=p.toArray(),h=ge(t[1],t[2],t[3]).transform(u);if(u[0]*u[3]-u[1]*u[2]<0&&(t[5]=t[5]?"0":"1"),i=p.calc(t[6],t[7],"a"===t[0]),"A"===t[0]&&t[6]===n&&t[7]===r||"a"===t[0]&&0===t[6]&&0===t[7]){a=["a"===t[0]?"l":"L",i[0],i[1]];break}a=h.isDegenerate()?["a"===t[0]?"l":"L",i[0],i[1]]:[t[0],h.rx,h.ry,h.ax,t[4],t[5],i[0],i[1]];break;case"m":s=e>0,i=p.calc(t[1],t[2],s),a=["m",i[0],i[1]];break;default:for(o=t[0],a=[o],s=o.toLowerCase()===o,c=1;c<t.length;c+=2)i=p.calc(t[c],t[c+1],s),a.push(i[0],i[1])}l.segments[e]=a},!0)},f.prototype.__evaluateStack=function(){var t,e,n=this;if(this.__stack.length){if(1===this.__stack.length)return this.__matrix(this.__stack[0]),void(this.__stack=[]);for(t=oe(),e=this.__stack.length;--e>=0;)t.matrix(n.__stack[e].toArray());this.__matrix(t),this.__stack=[]}},f.prototype.toString=function(){var t,e,n=this,r=[];this.__evaluateStack();for(var i=0;i<this.segments.length;i++)e=n.segments[i][0],t=i>0&&"m"!==e&&"M"!==e&&e===n.segments[i-1][0],r=r.concat(t?n.segments[i].slice(1):n.segments[i]);return r.join(" ").replace(/ ?([achlmqrstvz]) ?/gi,"$1").replace(/ \-/g,"-").replace(/zm/g,"z m")},f.prototype.translate=function(t,e){return this.__stack.push(oe().translate(t,e||0)),this},f.prototype.scale=function(t,e){return this.__stack.push(oe().scale(t,e||0===e?e:t)),this},f.prototype.rotate=function(t,e,n){return this.__stack.push(oe().rotate(t,e||0,n||0)),this},f.prototype.skewX=function(t){return this.__stack.push(oe().skewX(t)),this},f.prototype.skewY=function(t){return this.__stack.push(oe().skewY(t)),this},f.prototype.matrix=function(t){return this.__stack.push(oe().matrix(t)),this},f.prototype.transform=function(t){return t.trim()?(this.__stack.push(pe(t)),this):this},f.prototype.round=function(r){var e,i=0,a=0,o=0,s=0;return r=r||0,this.__evaluateStack(),this.segments.forEach(function(n){var t=n[0].toLowerCase()===n[0];switch(n[0]){case"H":case"h":return t&&(n[1]+=o),o=n[1]-n[1].toFixed(r),void(n[1]=+n[1].toFixed(r));case"V":case"v":return t&&(n[1]+=s),s=n[1]-n[1].toFixed(r),void(n[1]=+n[1].toFixed(r));case"Z":case"z":return o=i,void(s=a);case"M":case"m":return t&&(n[1]+=o,n[2]+=s),o=n[1]-n[1].toFixed(r),s=n[2]-n[2].toFixed(r),i=o,a=s,n[1]=+n[1].toFixed(r),void(n[2]=+n[2].toFixed(r));case"A":case"a":return t&&(n[6]+=o,n[7]+=s),o=n[6]-n[6].toFixed(r),s=n[7]-n[7].toFixed(r),n[1]=+n[1].toFixed(r),n[2]=+n[2].toFixed(r),n[3]=+n[3].toFixed(r+2),n[6]=+n[6].toFixed(r),void(n[7]=+n[7].toFixed(r));default:return e=n.length,t&&(n[e-2]+=o,n[e-1]+=s),o=n[e-2]-n[e-2].toFixed(r),s=n[e-1]-n[e-1].toFixed(r),void n.forEach(function(t,e){e&&(n[e]=+n[e].toFixed(r))})}}),this},f.prototype.iterate=function(i,t){var e,n,r,a=this.segments,o={},s=!1,u=0,h=0,p=0,c=0;if(t||this.__evaluateStack(),a.forEach(function(t,e){var n=i(t,e,u,h);Array.isArray(n)&&(o[e]=n,s=!0);var r=t[0]===t[0].