lotr-sut/sut/frontend/build/leaflet/smooth_bounce/bundle.min.js
Fellowship Scholar f6a5823439 init commit
2026-03-29 20:07:56 +00:00

2 lines
11 KiB
JavaScript

!function(M){"use strict";function n(n){return n&&"object"==typeof n&&"default"in n?n:{default:n}}var t=n(M);function o(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function e(n,t){for(var i=0;i<t.length;i++){var e=t[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function i(n,t,i){return t&&e(n.prototype,t),i&&e(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 e,o,r=[],a=!0,s=!1;try{for(i=i.call(n);!(a=(e=i.next()).done)&&(r.push(e.value),!t||r.length!==t);a=!0);}catch(n){s=!0,o=n}finally{try{a||null==i.return||i.return()}finally{if(s)throw o}}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,e=new Array(t);i<t;i++)e[i]=n[i];return e}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 l=function(){function t(n){o(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}(),h=new WeakMap,p=function(){function n(){o(this,n),u(this,h,{writable:!0,value:[]})}return i(n,[{key:"getBouncingMarkers",value:function(){return S(this,h)}},{key:"addBouncingMarker",value:function(n,t){t||n._bouncingMotion.bouncingOptions.exclusive?this.stopAllBouncingMarkers():this.stopExclusiveMarkerBouncing(),S(this,h).push(n)}},{key:"stopExclusiveMarkerBouncing",value:function(){var n=S(this,h).find(function(n){return n._bouncingMotion.bouncingOptions.exclusive});n&&n.stopBouncing()}},{key:"removeBouncingMarker",value:function(n){var t=S(this,h).indexOf(n);~t&&S(this,h).splice(t,1)}},{key:"stopAllBouncingMarkers",value:function(){for(var n;n=S(this,h).shift();)n.stopBouncing()}}]),n}(),m=M.Marker.prototype._setPos,d=M.Marker.prototype.onAdd,f=M.Marker.prototype.setIcon,v={_bouncingOptions:new l,_orchestration:new p,setBouncingOptions:function(n){return this._bouncingMotion.updateBouncingOptions(n),this},isBouncing:function(){return this._bouncingMotion.isBouncing},bounce:function(n){var t=0<arguments.length&&void 0!==n?n:null;this._bouncingMotion.bounce(t);var i=this._bouncingMotion.bouncingOptions.exclusive;return M.Marker.prototype._orchestration.addBouncingMarker(this,i),this},stopBouncing:function(){return this._bouncingMotion.stopBouncing(),M.Marker.prototype._orchestration.removeBouncingMarker(this),this},toggleBouncing:function(){return this._bouncingMotion.isBouncing?this.stopBouncing():this.bounce(),this},isRealMarker:function(){return this.__proto__===M.Marker.prototype},_setPos:function(n){m.call(this,n),this.isRealMarker()&&(this._bouncingMotion.position=n,this._bouncingMotion.resetStyles(this))},onAdd:function(n){d.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,e,o=t.insertAt;n&&"undefined"!=typeof document&&(i=document.head||document.getElementsByTagName("head")[0],(e=document.createElement("style")).type="text/css","top"===o&&i.firstChild?i.insertBefore(e,i.firstChild):i.appendChild(e),e.styleSheet?e.styleSheet.cssText=n:e.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 e(n){o(this,e),n&&Object.assign(this,n)}return i(e,[{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 e(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 e(t)}},{key:"ofMarker",value:function(n){var t=e.parse(n._icon.style.cssText);return t.findOpacity(n.options),t["z-index"]=n._zIndex,t}}]),e}(),y="l-smooth-marker-bouncing-",k=y+"contract";function B(t,n){n.forEach(function(n){return M.DomUtil.removeClass(t,n)}),t.offsetWidth,n.forEach(function(n){return M.DomUtil.addClass(t,n)})}var b=new WeakMap,O=new WeakMap,j=new WeakMap,A=new WeakMap,E=new WeakMap,w=function(){function w(n,t,i){var e=this;o(this,w),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),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 e.onAnimationEnd(n)}}),this.marker=n,this.position=t,this.updateBouncingOptions(i)}return i(w,[{key:"updateBouncingOptions",value:function(n){var t;this.bouncingOptions=n instanceof l?n:this.bouncingOptions.override(n),this.bouncingOptions.elastic?(s(this,b,k),-1<(t=S(this,O).indexOf("simple"))&&S(this,O).splice(t,1),this.marker._icon&&M.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,e=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){M.DomUtil.removeClass(e.marker._icon,n),e.marker._shadow&&M.DomUtil.removeClass(e.marker._shadow,n)}),this.bouncingAnimationPlaying=!1,this.marker.fire("bounceend"))))}},{key:"resetStyles",value:function(n){var t,i,e,o,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===(e=this.marker)||void 0===e||null===(o=e._iconObj)||void 0===o||null===(r=o.options)||void 0===r?void 0:r.iconSize[1]),c=w.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,l,h,p,m,d,f,v,g=this.bouncingOptions,y=g.bounceHeight,k=g.contractHeight,b=g.shadowAngle;this.marker._shadow&&(b?(m=(p=_(function(n,t,i,e){for(var o,r=Math.round(n+Math.cos(i)*(2*e)),a=Math.round(t+Math.sin(i)*(2*e)),s=Math.abs(r-n),c=n<r?1:-1,u=Math.abs(a-t),l=t<a?1:-1,h=(u<s?s:-u)/2,p=[],m=0;p.push([n,t]),++m!==e;)-s<(o=h)&&(h-=u,n+=c),o<u&&(h+=s,t+=l);return p}((h=this.position).x,h.y,b,y+1)[y],2))[0],d=p[1],f=null===(u=this.marker.getIcon())||void 0===u||null===(l=u.options)||void 0===l?void 0:l.shadowSize[1],v=w.contractScale(f,k),this.shadowStyles=this.shadowStyles.withStyles(c).withStyles({"--pos-x-jump":"".concat(m,"px"),"--pos-y-jump":"".concat(d,"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){M.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 e=n.x,o=n.y,r=t.bounceHeight,a=t.contractHeight,s=t.bounceSpeed,c=t.contractSpeed,u=w.contractScale(i,a),l=w.calculateDuration(r,s),h=w.calculateDuration(a,c),p=[0,l,2*l,2*l+h];return{"--pos-x":"".concat(e,"px"),"--pos-y":"".concat(o,"px"),"--pos-y-jump":"".concat(o-r,"px"),"--pos-y-contract":"".concat(o+a,"px"),"--scale-contract":u,"--duration-jump":"".concat(l,"ms"),"--duration-contract":"".concat(h,"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){for(var i=Math.round(.8*t),e=n;--e;)i+=Math.round(t/(n-e));return i}}]),w}();t.default.Marker.include(v),t.default.Marker.setBouncingOptions=function(n){M.Marker.prototype._bouncingOptions=n instanceof l?n:new l(n)},t.default.Marker.getBouncingMarkers=function(){M.Marker.prototype._orchestration.getBouncingMarkers()},t.default.Marker.stopAllBouncingMarkers=function(){M.Marker.prototype._orchestration.stopAllBouncingMarkers()},t.default.Marker.addInitHook(function(){var n;this.isRealMarker()&&(n=new l(M.Marker.prototype._bouncingOptions),this._bouncingMotion=new w(this,new M.Point(0,0),n))})}(L);