You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Vestride_Shuffle/dist/shuffle.min.js

3 lines
16 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Shuffle=e()}(this,(function(){"use strict";function t(){}t.prototype={on:function(t,e,i){var s=this.e||(this.e={});return(s[t]||(s[t]=[])).push({fn:e,ctx:i}),this},once:function(t,e,i){var s=this;function n(){s.off(t,n),e.apply(i,arguments)}return n._=e,this.on(t,n,i)},emit:function(t){for(var e=[].slice.call(arguments,1),i=((this.e||(this.e={}))[t]||[]).slice(),s=0,n=i.length;s<n;s++)i[s].fn.apply(i[s].ctx,e);return this},off:function(t,e){var i=this.e||(this.e={}),s=i[t],n=[];if(s&&e)for(var o=0,r=s.length;o<r;o++)s[o].fn!==e&&s[o].fn._!==e&&n.push(s[o]);return n.length?i[t]=n:delete i[t],this}};var e=t,i=t;e.TinyEmitter=i;var s="undefined"!=typeof Element?Element.prototype:{},n=s.matches||s.matchesSelector||s.webkitMatchesSelector||s.mozMatchesSelector||s.msMatchesSelector||s.oMatchesSelector,o=function(t,e){if(!t||1!==t.nodeType)return!1;if(n)return n.call(t,e);for(var i=t.parentNode.querySelectorAll(e),s=0;s<i.length;s++)if(i[s]==t)return!0;return!1};var r=function(t,e){var i,s,n,o,r=0;return function(){i=this,s=arguments;var t=new Date-r;return o||(t>=e?h():o=setTimeout(h,e-t)),n};function h(){o=0,r=+new Date,n=t.apply(i,s),i=null,s=null}};function h(){}function l(t){return parseFloat(t)||0}class a{constructor(t,e){this.x=l(t),this.y=l(e)}static equals(t,e){return t.x===e.x&&t.y===e.y}}class u{constructor(t,e,i,s,n){this.id=n,this.left=t,this.top=e,this.width=i,this.height=s}static intersects(t,e){return t.left<e.left+e.width&&e.left<t.left+t.width&&t.top<e.top+e.height&&e.top<t.top+t.height}}var d={BASE:"shuffle",SHUFFLE_ITEM:"shuffle-item",VISIBLE:"shuffle-item--visible",HIDDEN:"shuffle-item--hidden"};let c=0;class m{constructor(t,e){c+=1,this.id=c,this.element=t,this.isRTL=e,this.isVisible=!0,this.isHidden=!1}show(){this.isVisible=!0,this.element.classList.remove(d.HIDDEN),this.element.classList.add(d.VISIBLE),this.element.removeAttribute("aria-hidden")}hide(){this.isVisible=!1,this.element.classList.remove(d.VISIBLE),this.element.classList.add(d.HIDDEN),this.element.setAttribute("aria-hidden",!0)}init(){this.addClasses([d.SHUFFLE_ITEM,d.VISIBLE]),this.applyCss(m.Css.INITIAL),this.applyCss(this.isRTL?m.Css.DIRECTION.rtl:m.Css.DIRECTION.ltr),this.scale=m.Scale.VISIBLE,this.point=new a}addClasses(t){t.forEach((t=>{this.element.classList.add(t)}))}removeClasses(t){t.forEach((t=>{this.element.classList.remove(t)}))}applyCss(t){Object.keys(t).forEach((e=>{this.element.style[e]=t[e]}))}dispose(){this.removeClasses([d.HIDDEN,d.VISIBLE,d.SHUFFLE_ITEM]),this.element.removeAttribute("style"),this.element=null}}m.Css={INITIAL:{position:"absolute",top:0,visibility:"visible",willChange:"transform"},DIRECTION:{ltr:{left:0},rtl:{right:0}},VISIBLE:{before:{opacity:1,visibility:"visible"},after:{transitionDelay:""}},HIDDEN:{before:{opacity:0},after:{visibility:"hidden",transitionDelay:""}}},m.Scale={VISIBLE:1,HIDDEN:.001};let p=null;var f=()=>{if(null!==p)return p;const t=document.body||document.documentElement,e=document.createElement("div");return e.style.cssText="width:10px;padding:2px;box-sizing:border-box;",t.appendChild(e),p="10px"===window.getComputedStyle(e,null).width,t.removeChild(e),p};function g(t,e,i=window.getComputedStyle(t,null)){let s=l(i[e]);return f()||"width"!==e?f()||"height"!==e||(s+=l(i.paddingTop)+l(i.paddingBottom)+l(i.borderTopWidth)+l(i.borderBottomWidth)):s+=l(i.paddingLeft)+l(i.paddingRight)+l(i.borderLeftWidth)+l(i.borderRightWidth),s}const y={reverse:!1,by:null,compare:null,randomize:!1,key:"element"};function _(t,e){const i=Object.assign({},y,e),s=Array.from(t);let n=!1;return t.length?i.randomize?function(t){let e=t.length;for(;e;){e-=1;const i=Math.floor(Math.random()*(e+1)),s=t[i];t[i]=t[e],t[e]=s}return t}(t):("function"==typeof i.by?t.sort(((t,e)=>{if(n)return 0;const s=i.by(t[i.key]),o=i.by(e[i.key]);return void 0===s&&void 0===o?(n=!0,0):s<o||"sortFirst"===s||"sortLast"===o?-1:s>o||"sortLast"===s||"sortF
//# sourceMappingURL=shuffle.min.js.map