-
Notifications
You must be signed in to change notification settings - Fork 28
/
bundle.min.js
1 lines (1 loc) · 11.5 KB
/
bundle.min.js
1
!function(w){"use strict";function n(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var t=n(w);function e(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function o(n,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function i(n,t,i){return t&&o(n.prototype,t),i&&o(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n}function r(n,t,i){return t in n?Object.defineProperty(n,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[t]=i,n}function _(n,t){return function(n){if(Array.isArray(n))return n}(n)||function(n,t){var i=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null==i)return;var o,e,r=[],a=!0,s=!1;try{for(i=i.call(n);!(a=(o=i.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(n){s=!0,e=n}finally{try{a||null==i.return||i.return()}finally{if(s)throw e}}return r}(n,t)||function(n,t){if(!n)return;if("string"==typeof n)return a(n,t);var i=Object.prototype.toString.call(n).slice(8,-1);"Object"===i&&n.constructor&&(i=n.constructor.name);if("Map"===i||"Set"===i)return Array.from(n);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return a(n,t)}(n,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(n,t){(null==t||t>n.length)&&(t=n.length);for(var i=0,o=new Array(t);i<t;i++)o[i]=n[i];return o}function S(n,t){return function(n,t){if(t.get)return t.get.call(n);return t.value}(n,c(n,t,"get"))}function s(n,t,i){return function(n,t,i){if(t.set)t.set.call(n,i);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=i}}(n,c(n,t,"set"),i),i}function c(n,t,i){if(!t.has(n))throw new TypeError("attempted to "+i+" private field on non-instance");return t.get(n)}function u(n,t,i){!function(n,t){if(t.has(n))throw new TypeError("Cannot initialize the same private elements twice on an object")}(n,t),t.set(n,i)}var h=function(){function t(n){e(this,t),r(this,"bounceHeight",15),r(this,"contractHeight",12),r(this,"bounceSpeed",52),r(this,"contractSpeed",52),r(this,"shadowAngle",-Math.PI/4),r(this,"elastic",!0),r(this,"exclusive",!1),n&&Object.assign(this,n)}return i(t,[{key:"override",value:function(n){return Object.assign(new t(this),n)}}]),t}(),l=new WeakMap,p=function(){function n(){e(this,n),u(this,l,{writable:!0,value:[]})}return i(n,[{key:"getBouncingMarkers",value:function(){return S(this,l)}},{key:"addBouncingMarker",value:function(n,t){t||n._bouncingMotion.bouncingOptions.exclusive?this.stopAllBouncingMarkers():this.stopExclusiveMarkerBouncing(),S(this,l).push(n)}},{key:"stopExclusiveMarkerBouncing",value:function(){var n=S(this,l).find(function(n){return n._bouncingMotion.bouncingOptions.exclusive});n&&n.stopBouncing()}},{key:"removeBouncingMarker",value:function(n){var t=S(this,l).indexOf(n);~t&&S(this,l).splice(t,1)}},{key:"stopAllBouncingMarkers",value:function(){for(var n;n=S(this,l).shift();)n.stopBouncing()}}]),n}(),d=w.Marker.prototype._setPos,m=w.Marker.prototype.onAdd,f=w.Marker.prototype.setIcon,v={_bouncingOptions:new h,_orchestration:new p,setBouncingOptions:function(n){return this._bouncingMotion.updateBouncingOptions(n),this},isBouncing:function(){return this._bouncingMotion.isBouncing},bounce:function(n){var t=this,i=0<arguments.length&&void 0!==n?n:null;i&&(this._bouncingMotion.onMotionEnd=function(){w.Marker.prototype._orchestration.removeBouncingMarker(t)}),this._bouncingMotion.bounce(i);var o=this._bouncingMotion.bouncingOptions.exclusive;return w.Marker.prototype._orchestration.addBouncingMarker(this,o),this},stopBouncing:function(){return this._bouncingMotion.stopBouncing(),w.Marker.prototype._orchestration.removeBouncingMarker(this),this},toggleBouncing:function(){return this._bouncingMotion.isBouncing?this.stopBouncing():this.bounce(),this},isRealMarker:function(){return this.__proto__===w.Marker.prototype},_setPos:function(n){d.call(this,n),this.isRealMarker()&&(this._bouncingMotion.position=n,this._bouncingMotion.resetStyles(this))},onAdd:function(n){m.call(this,n),this.isRealMarker()&&this._bouncingMotion.resetStyles(this)},setIcon:function(n){f.call(this,n),this.isRealMarker()&&this._icon&&this._bouncingMotion.resetStyles(this)}};!function(n,t){void 0===t&&(t={});var i,o,e=t.insertAt;n&&"undefined"!=typeof document&&(i=document.head||document.getElementsByTagName("head")[0],(o=document.createElement("style")).type="text/css","top"===e&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=n:o.appendChild(document.createTextNode(n)))}("@keyframes l-smooth-marker-bouncing-move {\n from {\n transform: translate(var(--pos-x), var(--pos-y))\n }\n to {\n transform: translate(var(--pos-x-jump, var(--pos-x)), var(--pos-y-jump))\n }\n}\n\n@keyframes l-smooth-marker-bouncing-contract {\n from {\n transform: translate(var(--pos-x), var(--pos-y))\n }\n to {\n transform: translate(var(--pos-x), var(--pos-y-contract)) scaleY(var(--scale-contract))\n }\n}\n\n.bouncing {\n animation-name: l-smooth-marker-bouncing-move, l-smooth-marker-bouncing-move, l-smooth-marker-bouncing-contract, l-smooth-marker-bouncing-contract;\n animation-direction: normal, reverse, normal, reverse;\n animation-duration: var(--duration-jump), var(--duration-jump), var(--duration-contract), var(--duration-contract);\n animation-delay: var(--delays)\n}\n\n.bouncing.simple {\n animation-name: l-smooth-marker-bouncing-move, l-smooth-marker-bouncing-move;\n animation-direction: normal, reverse;\n animation-duration: var(--duration-jump), var(--duration-jump);\n animation-delay: var(--delays)\n}\n");var g=/([\w-]+): ([^;]+);/g,x=function(){function o(n){e(this,o),n&&Object.assign(this,n)}return i(o,[{key:"findOpacity",value:function(n){this.opacity=(null==n?void 0:n.opacityWhenUnclustered)||(null==n?void 0:n.opacity)||1}},{key:"withStyles",value:function(n){var t=new o(this);return t&&Object.assign(t,n),t}},{key:"toString",value:function(){return Object.entries(this).map(function(n){return"".concat(n[0],": ").concat(n[1],";")}).join(" ")}}],[{key:"parse",value:function(n){for(var t={},i=g.exec(n);i;)t[i[1]]=i[2],i=g.exec(n);return delete t["z-index"],delete t.opacity,t.outline="none",new o(t)}},{key:"ofMarker",value:function(n){var t=o.parse(n._icon.style.cssText);return t.findOpacity(n.options),t["z-index"]=n._zIndex,t}}]),o}(),y="l-smooth-marker-bouncing-",k=y+"contract";function B(t,n){n.forEach(function(n){return w.DomUtil.removeClass(t,n)}),t.offsetWidth,n.forEach(function(n){return w.DomUtil.addClass(t,n)})}var b=new WeakMap,O=new WeakMap,j=new WeakMap,A=new WeakMap,E=new WeakMap,M=function(){function M(n,t,i){var o=this;e(this,M),r(this,"marker",void 0),r(this,"position",void 0),r(this,"bouncingOptions",void 0),r(this,"isBouncing",!1),r(this,"iconStyles",void 0),r(this,"shadowStyles",void 0),r(this,"bouncingAnimationPlaying",!1),r(this,"onMotionEnd",void 0),u(this,b,{writable:!0,value:k}),u(this,O,{writable:!0,value:["bouncing"]}),u(this,j,{writable:!0,value:void 0}),u(this,A,{writable:!0,value:void 0}),u(this,E,{writable:!0,value:function(n){return o.onAnimationEnd(n)}}),this.marker=n,this.position=t,this.updateBouncingOptions(i)}return i(M,[{key:"updateBouncingOptions",value:function(n){var t;this.bouncingOptions=n instanceof h?n:this.bouncingOptions.override(n),this.bouncingOptions.elastic&&this.bouncingOptions.contractHeight?(s(this,b,k),-1<(t=S(this,O).indexOf("simple"))&&S(this,O).splice(t,1),this.marker._icon&&w.DomUtil.removeClass(this.marker._icon,"simple")):(s(this,b,"l-smooth-marker-bouncing-move"),S(this,O).push("simple")),this.marker._icon&&this.resetStyles(this.marker)}},{key:"onAnimationEnd",value:function(n){var t,i,o=this;n.animationName===S(this,b)&&(s(this,j,(t=S(this,j),++t)),s(this,j,S(this,j)%2),S(this,j)||(this.isBouncing&&(null===S(this,A)||s(this,A,(i=S(this,A),--i)))?(B(this.marker._icon,S(this,O)),this.marker._shadow&&this.bouncingOptions.shadowAngle&&B(this.marker._shadow,S(this,O))):(S(this,O).forEach(function(n){w.DomUtil.removeClass(o.marker._icon,n),o.marker._shadow&&w.DomUtil.removeClass(o.marker._shadow,n)}),this.bouncingAnimationPlaying=!1,this.onMotionEnd&&(this.onMotionEnd(),this.onMotionEnd=null),this.marker.fire("bounceend"))))}},{key:"resetStyles",value:function(n){var t,i,o,e,r,a=this;this.marker=n,this.iconStyles=x.ofMarker(n),n._shadow&&(this.shadowStyles=x.parse(n._shadow.style.cssText));var s=(null===(t=this.marker.getIcon())||void 0===t||null===(i=t.options)||void 0===i?void 0:i.iconSize[1])||(null===(o=this.marker)||void 0===o||null===(e=o._iconObj)||void 0===e||null===(r=e.options)||void 0===r?void 0:r.iconSize[1]),c=M.animationParams(this.position,this.bouncingOptions,s);this.iconStyles=this.iconStyles.withStyles(c),this.marker._icon.style.cssText=this.iconStyles.toString(),this.bouncingAnimationPlaying&&(B(this.marker._icon,S(this,O)),this.marker._icon.addEventListener("animationend",S(this,E)));var u,h,l,p,d,m,f,v,g=this.bouncingOptions,y=g.bounceHeight,k=g.contractHeight,b=g.shadowAngle;this.marker._shadow&&(b?(d=(p=_(function(n,t,i,o){for(var e,r=Math.round(n+Math.cos(i)*(2*o)),a=Math.round(t+Math.sin(i)*(2*o)),s=Math.abs(r-n),c=n<r?1:-1,u=Math.abs(a-t),h=t<a?1:-1,l=(u<s?s:-u)/2,p=[],d=0;p.push([n,t]),++d!==o;)-s<(e=l)&&(l-=u,n+=c),e<u&&(l+=s,t+=h);return p}((l=this.position).x,l.y,b,y+1)[y],2))[0],m=p[1],f=null===(u=this.marker.getIcon())||void 0===u||null===(h=u.options)||void 0===h?void 0:h.shadowSize[1],v=M.contractScale(f,k),this.shadowStyles=this.shadowStyles.withStyles(c).withStyles({"--pos-x-jump":"".concat(d,"px"),"--pos-y-jump":"".concat(m,"px"),"--scale-contract":v}),this.marker._shadow.style.cssText=this.shadowStyles.toString(),this.bouncingAnimationPlaying&&B(this.marker._shadow,S(this,O))):S(this,O).forEach(function(n){w.DomUtil.removeClass(a.marker._shadow,n)}))}},{key:"bounce",value:function(n){s(this,A,0<arguments.length&&void 0!==n?n:null),this.isBouncing=!0,this.bouncingAnimationPlaying||(s(this,j,0),this.bouncingAnimationPlaying=!0,B(this.marker._icon,S(this,O)),this.marker._shadow&&this.bouncingOptions.shadowAngle&&B(this.marker._shadow,S(this,O)),this.marker._icon.addEventListener("animationend",S(this,E)))}},{key:"stopBouncing",value:function(){this.isBouncing=!1}}],[{key:"animationParams",value:function(n,t,i){var o=n.x,e=n.y,r=t.bounceHeight,a=t.contractHeight,s=t.bounceSpeed,c=t.contractSpeed,u=M.contractScale(i,a),h=M.calculateDuration(r,s),l=M.calculateDuration(a,c),p=[0,h,2*h,2*h+l];return{"--pos-x":"".concat(o,"px"),"--pos-y":"".concat(e,"px"),"--pos-y-jump":"".concat(e-r,"px"),"--pos-y-contract":"".concat(e+a,"px"),"--scale-contract":u,"--duration-jump":"".concat(h,"ms"),"--duration-contract":"".concat(l,"ms"),"--delays":"0ms, ".concat(p[1],"ms, ").concat(p[2],"ms, ").concat(p[3],"ms")}}},{key:"contractScale",value:function(n,t){return(n-t)/n}},{key:"calculateDuration",value:function(n,t){if(0===n)return 0;for(var i=Math.round(.8*t),o=n;--o;)i+=Math.round(t/(n-o));return i}}]),M}();t.default.Marker.include(v),t.default.Marker.setBouncingOptions=function(n){w.Marker.prototype._bouncingOptions=n instanceof h?n:new h(n)},t.default.Marker.getBouncingMarkers=function(){w.Marker.prototype._orchestration.getBouncingMarkers()},t.default.Marker.stopAllBouncingMarkers=function(){w.Marker.prototype._orchestration.stopAllBouncingMarkers()},t.default.Marker.addInitHook(function(){var n;this.isRealMarker()&&(n=new h(w.Marker.prototype._bouncingOptions),this._bouncingMotion=new M(this,new w.Point(0,0),n))})}(L);