2024-11-12 16:42:22 +01:00
( ( ) => {
"use strict" ;
( ( ) => {
function getDom ( t ) {
return function hasDom ( t ) {
return null !== document . querySelector ( t )
} ( t ) ? document . querySelector ( t ) : null
}
function setDom ( t ) {
for ( var e , n = document . createElement ( t ) , o = arguments . length , i = new Array ( o > 1 ? o - 1 : 0 ) , r = 1 ; r < o ; r ++ ) i [ r - 1 ] = arguments [ r ] ;
return ( e = n . classList ) . add . apply ( e , i ) , n
}
function findDom ( t , e ) {
try {
return t . querySelector ( e )
} catch ( t ) {
return null
}
}
var t = "sliderm" , e = "sliderm__slides" , n = "sliderm__paginations" , o = "sliderm__pagination" ,
i = "sliderm__slide--clone" ;
function isInteger ( t ) {
return Number . isFinite ( t )
}
var r = function bold ( t ) {
2024-11-18 19:59:19 +01:00
const e = { 1 : "thin" , 2 : "regular" , 3 : "bold" } ;
2024-11-12 16:42:22 +01:00
return void 0 !== e [ t ] ? e [ t ] : "regular"
} , a = function shape ( t ) {
return "none" === t || "square" === t ? t : "circle"
} , s = function size ( t ) {
return isInteger ( t ) && 16 !== t ? t <= 13 ? 13 : t >= 28 ? 28 : t : null
} , l = function bgColor ( t ) {
return "#000000" !== t ? t : null
} , u = function color ( t ) {
return "#ffffff" !== t ? t : null
} , c = function opacity ( t ) {
return ! isInteger ( t ) || t > 1 || t < . 1 || . 5 === t ? null : t
} ;
function queue ( t ) {
2024-11-18 19:59:19 +01:00
const e = arguments . length > 1 && void 0 !== arguments [ 1 ] ? arguments [ 1 ] : 0 ;
2024-11-12 16:42:22 +01:00
return setTimeout ( ( function ( ) {
t ( )
} ) , e )
}
var p = [ function breakpoint ( t , e ) {
if ( t . getOption ( "breakpoint" ) ) {
! function init ( ) {
2024-11-18 19:59:19 +01:00
const n = t . getOption ( "columns" ) , o = t . getOption ( "breakpoint.columns" ) ,
2024-11-12 16:42:22 +01:00
i = Number ( e . getAttribute ( "data-columns" ) ) , r = function calculate ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = window . innerWidth , o = Object . keys ( t ) . filter ( ( function ( e ) {
2024-11-12 16:42:22 +01:00
return n < t [ e ]
} ) ) ;
return void 0 !== o [ 0 ] ? Number ( o [ 0 ] ) : e
} ( o , n ) ;
if ( e . setAttribute ( "data-columns" , n ) , void 0 !== r && i !== r ) {
2024-11-18 19:59:19 +01:00
const a = t . getItems ( ) ;
2024-11-12 16:42:22 +01:00
t . updateOption ( "columns" , r ) , t . updateCurrentItems ( ) ;
2024-11-18 19:59:19 +01:00
for ( let s = 0 ; s < a . length ; s += 1 ) t . go ( "columns" , a [ s ] ) ;
2024-11-12 16:42:22 +01:00
t . emit ( "breakpoint.changed" )
}
} ( )
}
} , function transition ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = arguments . length , o = new Array ( n > 2 ? n - 2 : 0 ) ;
let i = 2 ;
for ( ; i < n ; i ++ ) o [ i - 2 ] = arguments [ i ] ;
const r = o [ 0 ] , a = t . getOption ( "duration" ) ;
2024-11-12 16:42:22 +01:00
"stop" !== r ? ( e . style . setProperty ( "transition-duration" , "" . concat ( a , "ms" ) ) , t . on ( "destory" , ( function ( ) {
e . style . removeProperty ( "transition-duration" )
} ) ) ) : e . style . removeProperty ( "transition-duration" )
} , function transform ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = arguments . length , o = new Array ( n > 2 ? n - 2 : 0 ) ;
let i = 2 ;
for ( ; i < n ; i ++ ) o [ i - 2 ] = arguments [ i ] ;
const r = o [ 0 ] ;
2024-11-12 16:42:22 +01:00
e . style . setProperty ( "transform" , "translateX(" . concat ( r , "px)" ) ) , t . on ( "destory" , ( function ( ) {
e . style . removeProperty ( "transform" )
} ) )
} , function autoplay ( t ) {
if ( t . getOption ( "autoplay" ) ) {
2024-11-18 19:59:19 +01:00
const e = t . getOption ( "autoplay.duration" ) ,
n = "left" === t . getOption ( "autoplay.direction" ) ? "<" : ">" ,
2024-11-12 16:42:22 +01:00
o = function repeat ( t ) {
return setInterval ( ( function ( ) {
t ( )
} ) , arguments . length > 1 && void 0 !== arguments [ 1 ] ? arguments [ 1 ] : 5e3 )
} ( ( function ( ) {
t . slideTo ( n )
} ) , e ) ;
t . on ( "destory" , ( function ( ) {
! function stop ( t ) {
clearInterval ( t ) , clearTimeout ( t )
} ( o )
} ) )
}
} , function grouping ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = arguments . length , o = new Array ( n > 2 ? n - 2 : 0 ) ;
let i = 2 ;
for ( ; i < n ; i ++ ) o [ i - 2 ] = arguments [ i ] ;
const r = o [ 0 ] , a = o [ 1 ] , s = t . getOption ( "grouping" ) , l = a + 1 ;
2024-11-12 16:42:22 +01:00
if ( s ) {
2024-11-18 19:59:19 +01:00
const u = t . getOption ( "columns" ) , c = Math . ceil ( ( a + 1 ) / u ) ;
2024-11-12 16:42:22 +01:00
r . setAttribute ( "data-order" , c )
} else r . setAttribute ( "data-order" , l ) ;
t . on ( "destory" , ( function ( ) {
r . removeAttribute ( "data-order" )
} ) )
} , function columns ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = arguments . length , o = new Array ( n > 2 ? n - 2 : 0 ) ;
let i = 2 ;
for ( ; i < n ; i ++ ) o [ i - 2 ] = arguments [ i ] ;
const r = o [ 0 ] , a = t . getOption ( "columns" ) , s = parseFloat ( ( 1 / a * 100 ) . toFixed ( 2 ) ) ;
2024-11-12 16:42:22 +01:00
r . style . setProperty ( "flex" , "0 0 " . concat ( s , "%" ) ) , t . on ( "destory" , ( function ( ) {
r . style . removeProperty ( "flex" )
} ) )
} , function preview ( t , e ) {
if ( t . getOption ( "preview" ) ) {
2024-11-18 19:59:19 +01:00
const n = t . getOption ( "preview.edge" ) ;
2024-11-12 16:42:22 +01:00
e . style . setProperty ( "padding" , "0 " . concat ( n , "px" ) ) , t . on ( "destory" , ( function ( ) {
e . style . removeProperty ( "padding" )
} ) )
}
} , function spacing ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = arguments . length , o = new Array ( n > 2 ? n - 2 : 0 ) ;
let i = 2 ;
for ( ; i < n ; i ++ ) o [ i - 2 ] = arguments [ i ] ;
const r = o [ 0 ] , a = Math . floor ( t . getOption ( "spacing" ) / 2 ) ;
2024-11-12 16:42:22 +01:00
r . style . setProperty ( "padding" , "0px " . concat ( a , "px" ) ) , t . on ( "destory" , ( function ( ) {
r . style . removeProperty ( "padding" )
} ) )
} , function align ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = t . getOption ( "align" ) ;
2024-11-12 16:42:22 +01:00
"center" === n ? e . style . setProperty ( "align-items" , "center" ) : "bottom" === n && e . style . setProperty ( "align-items" , "flex-end" ) , t . on ( "destory" , ( function ( ) {
e . style . removeProperty ( "align-items" )
} ) )
} , function touch ( t , e ) {
if ( t . getOption ( "touch" ) ) {
! function init ( ) {
2024-11-18 19:59:19 +01:00
const n = t . getOption ( "touch.threshold" ) , o = t . getOption ( "touch.duration" ) , i = t . adaptEvent ( e ) ,
2024-11-12 16:42:22 +01:00
r = { x : 0 , y : 0 , time : 0 } ;
i . on ( "touchstart" , ( function ( t ) {
t . preventDefault ( ) ;
2024-11-18 19:59:19 +01:00
const e = t . changedTouches [ 0 ] ;
2024-11-12 16:42:22 +01:00
r . x = e . pageX , r . y = e . pageY , r . time = ( new Date ) . getTime ( )
} ) ) , i . on ( "touchmove" , ( function ( t ) {
t . preventDefault ( )
} ) ) , i . on ( "touchend" , ( function ( e ) {
e . preventDefault ( ) ;
2024-11-18 19:59:19 +01:00
const i = e . changedTouches [ 0 ] , a = ( new Date ) . getTime ( ) - r . time , s = Math . abs ( i . pageX - r . x ) ;
2024-11-12 16:42:22 +01:00
if ( ! ( a > o || s < n ) ) {
2024-11-18 19:59:19 +01:00
const l = i . pageX > r . x ? ">" : "<" ;
2024-11-12 16:42:22 +01:00
t . slideTo ( l )
}
} ) )
} ( )
}
} , function clone ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = arguments . length , o = new Array ( n > 2 ? n - 2 : 0 ) ;
let r = 2 ;
for ( ; r < n ; r ++ ) o [ r - 2 ] = arguments [ r ] ;
const a = o [ 0 ] , s = o [ 1 ] , l = t . getOption ( "columns" ) , u = t . getOption ( "preview" ) , c = t . getOption ( "loop" ) ;
2024-11-12 16:42:22 +01:00
if ( u || c ) {
2024-11-18 19:59:19 +01:00
const p = t . getItemCount ( ) , d = t . getItems ( ) , f = l , h = a . cloneNode ( ! 0 ) ;
let v = null , m = ! 1 ;
2024-11-12 16:42:22 +01:00
h . classList . add ( i ) , s < f && ( e . appendChild ( h ) , m = ! 0 ) , s >= p - f && ( m ? ( ( v = a . cloneNode ( ! 0 ) ) . classList . add ( i ) , e . insertBefore ( v , d [ 0 ] ) ) : e . insertBefore ( h , d [ 0 ] ) ) , t . on ( "destory" , ( function ( ) {
h . remove ( ) , v && v . remove ( )
} ) )
}
} , function slide ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = arguments . length , o = new Array ( n > 2 ? n - 2 : 0 ) ;
let i = 2 ;
for ( ; i < n ; i ++ ) o [ i - 2 ] = arguments [ i ] ;
const r = o [ 0 ] , a = o [ 1 ] , s = t . getOption ( "grouping" ) , l = t . getOption ( "preview" ) ,
2024-11-12 16:42:22 +01:00
u = t . getOption ( "duration" ) , c = t . getOption ( "columns" ) , p = t . getOption ( "loop" ) ,
2024-11-18 19:59:19 +01:00
d = t . getItems ( ) [ 0 ] . offsetWidth , f = t . getPage ( ) , h = p || l , v = f . maximum ( ) ;
let m = f . calculate ( r , ! 1 ) ;
const g = m < 1 || m > v ;
let y = 0 ;
2024-11-12 16:42:22 +01:00
! p && g || ( y = s ? d * ( 0 - ( h ? 0 : - 1 ) - m ) * c : d * ( 1 - ( h ? c : 0 ) - m ) , t . emit ( "slide.start" ) , t . go ( "transition" , a ) , t . go ( "transform" , y ) , t . updatePosition ( m ) , g ? queue ( ( function ( ) {
m = f . calculate ( r , g ) , y = s ? d * ( 0 - m ) * c : d * ( 1 - c - m ) , t . go ( "transition" , "stop" ) , t . go ( "transform" , y ) , t . updatePosition ( m ) , t . emit ( "slide.end" )
} ) , u + 10 ) : t . emit ( "slide.end" ) )
} , function loop ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = t . getOption ( "loop" ) , o = t . getOption ( "grouping" ) ;
2024-11-12 16:42:22 +01:00
if ( n && o ) {
2024-11-18 19:59:19 +01:00
const i = t . getItems ( ) , r = t . getOption ( "columns" ) , a = t . getItemCount ( ) , s = i [ i . length - 1 ] ,
2024-11-12 16:42:22 +01:00
l = r - a % r , u = [ ] ;
if ( l !== r && 1 !== r ) {
2024-11-18 19:59:19 +01:00
for ( let c = 1 ; c <= l ; c += 1 ) {
const p = s . cloneNode ( ! 0 ) ;
2024-11-12 16:42:22 +01:00
p . classList . add ( "sliderm__slide--empty" ) , p . innerHTML = "" , e . appendChild ( p ) , u . push ( p )
}
t . updateCurrentItems ( ) , t . on ( "destory" , ( function ( ) {
u . forEach ( ( function ( t ) {
t . remove ( )
} ) )
} ) )
}
}
} , function init ( e ) {
2024-11-18 19:59:19 +01:00
const n = e . getOption ( "duration" ) , o = e . getRoot ( ) ;
2024-11-12 16:42:22 +01:00
o . classList . add ( t ) , o . classList . remove ( "" . concat ( t , "--initialized" ) ) , o . classList . add ( "" . concat ( t , "--initialize" ) ) , e . on ( "initialized" , ( function ( ) {
queue ( ( function ( ) {
o . classList . remove ( "" . concat ( t , "--initialize" ) ) , o . classList . add ( "" . concat ( t , "--initialized" ) )
} ) , n + 50 )
} ) )
} ] , d = [ function pagination ( t ) {
2024-11-18 19:59:19 +01:00
let e , i , r ;
const a = function click ( e ) {
2024-11-12 16:42:22 +01:00
if ( o === e . target . className ) {
2024-11-18 19:59:19 +01:00
const n = Array . prototype . indexOf . call ( i . childNodes , e . target ) + 1 ;
2024-11-12 16:42:22 +01:00
t . slideTo ( n )
}
2024-11-18 19:59:19 +01:00
} ;
let s = function mark ( ) {
const e = t . getPosition ( ) , o = findDom ( t . getRoot ( ) , "." . concat ( n ) ) . children ;
2024-11-12 16:42:22 +01:00
Array . from ( o ) . forEach ( ( function ( t , n ) {
2024-11-18 19:59:19 +01:00
const o = n + 1 ;
2024-11-12 16:42:22 +01:00
t . removeAttribute ( "data-active" ) , o === e && t . setAttribute ( "data-active" , ! 0 )
} ) )
2024-11-18 19:59:19 +01:00
} ;
const l = function destory ( ) {
2024-11-12 16:42:22 +01:00
r . off ( "click" , a ) , t . off ( "slide.end" , s ) , i . remove ( )
} , u = function init ( ) {
! function render ( ) {
2024-11-18 19:59:19 +01:00
const a = setDom ( "div" , n ) ;
2024-11-12 16:42:22 +01:00
e = t . getPage ( ) . maximum ( ) ;
2024-11-18 19:59:19 +01:00
for ( let s = 0 ; s < e ; s += 1 ) {
const l = setDom ( "div" , o ) ;
2024-11-12 16:42:22 +01:00
0 === s && l . setAttribute ( "data-active" , ! 0 ) , a . append ( l )
}
i = a , r = t . adaptEvent ( i ) , t . getRoot ( ) . append ( i )
} ( ) , function listen ( ) {
r . on ( "click" , a ) , t . on ( "slide.end" , s )
} ( )
} ;
t . on ( "destory" , l ) , t . on ( "breakpoint.changed" , ( function ( ) {
l ( ) , u ( )
} ) ) , u ( )
} , function spinner ( t ) {
! function init ( ) {
2024-11-18 19:59:19 +01:00
const e = t . getOption ( "spinner.color" ) , n = setDom ( "div" , "sliderm__spinner" ) ;
2024-11-12 16:42:22 +01:00
n . style . setProperty ( "color" , e ) , t . getRoot ( ) . append ( n ) , t . on ( "destory" , ( function ( ) {
n . remove ( )
} ) )
} ( )
} , function arrow ( t ) {
! function init ( ) {
for ( var e = [ s , r , a , u , l , c ] , n = setDom ( "div" , "sliderm__button--previous" ) , o = setDom ( "div" , "sliderm__button--next" ) , i = t . adaptEvent ( n ) , p = t . adaptEvent ( o ) , d = null , f = null , h = 0 ; h < e . length ; h += 1 ) {
2024-11-18 19:59:19 +01:00
let v = e [ h ] . name , m = e [ h ] ( t . getOption ( "arrow." . concat ( v ) ) ) ;
2024-11-12 16:42:22 +01:00
null !== m && ( "bold" === v ? ( d = setDom ( "span" , "sliderm__icon-left--" . concat ( m ) ) , f = setDom ( "span" , "sliderm__icon-right--" . concat ( m ) ) ) : "shape" === v ? ( n . classList . add ( "sliderm__button--" . concat ( m ) ) , o . classList . add ( "sliderm__button--" . concat ( m ) ) ) : ( "bgColor" === v ? v = "background-color" : "size" === v && ( v = "font-size" , m = "" . concat ( m , "px" ) ) , n . style . setProperty ( v , m ) , o . style . setProperty ( v , m ) ) )
}
n . append ( d ) , o . append ( f ) , t . getRoot ( ) . append ( n ) , t . getRoot ( ) . append ( o ) , i . on ( "click" , ( function ( ) {
t . slideTo ( "<" )
} ) ) , p . on ( "click" , ( function ( ) {
t . slideTo ( ">" )
} ) ) , t . on ( "destory" , ( function ( ) {
n . remove ( ) , o . remove ( )
} ) )
} ( )
} ] ;
function _defineProperties ( t , e ) {
2024-11-18 19:59:19 +01:00
for ( let n = 0 ; n < e . length ; n ++ ) {
const o = e [ n ] ;
2024-11-12 16:42:22 +01:00
o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( t , o . key , o )
}
}
var f = function ( ) {
function EventDispatcher ( ) {
! function _classCallCheck ( t , e ) {
if ( ! ( t instanceof e ) ) throw new TypeError ( "Cannot call a class as a function" )
} ( this , EventDispatcher ) , this . events = { }
}
return function _createClass ( t , e , n ) {
return e && _defineProperties ( t . prototype , e ) , n && _defineProperties ( t , n ) , Object . defineProperty ( t , "prototype" , { writable : ! 1 } ) , t
} ( EventDispatcher , [ {
key : "on" , value : function on ( t , e ) {
Object . prototype . hasOwnProperty . call ( this . events , t ) || ( this . events [ t ] = [ ] ) , this . events [ t ] . push ( e )
}
} , {
key : "off" , value : function off ( t , e ) {
2024-11-18 19:59:19 +01:00
const n = this ;
2024-11-12 16:42:22 +01:00
void 0 === e ? delete this . events [ t ] : this . events [ t ] . forEach ( ( function ( o , i ) {
o === e && n . events [ t ] . splice ( i , 1 )
} ) )
}
} , {
key : "emit" , value : function emit ( t ) {
for ( var e = arguments . length , n = new Array ( e > 1 ? e - 1 : 0 ) , o = 1 ; o < e ; o ++ ) n [ o - 1 ] = arguments [ o ] ;
void 0 !== this . events [ t ] && Array . isArray ( this . events [ t ] ) && this . events [ t ] . forEach ( ( function ( t ) {
t . apply ( void 0 , n )
} ) )
}
} , {
key : "destory" , value : function destory ( ) {
delete this . events
}
} ] ) , EventDispatcher
} ( ) ;
function event _adapter _defineProperties ( t , e ) {
2024-11-18 19:59:19 +01:00
for ( let n = 0 ; n < e . length ; n ++ ) {
const o = e [ n ] ;
2024-11-12 16:42:22 +01:00
o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( t , o . key , o )
}
}
var h = function ( ) {
function EventAdapter ( t ) {
! function event _adapter _classCallCheck ( t , e ) {
if ( ! ( t instanceof e ) ) throw new TypeError ( "Cannot call a class as a function" )
} ( this , EventAdapter ) , this . target = t , this . events = { }
}
return function event _adapter _createClass ( t , e , n ) {
return e && event _adapter _defineProperties ( t . prototype , e ) , n && event _adapter _defineProperties ( t , n ) , Object . defineProperty ( t , "prototype" , { writable : ! 1 } ) , t
} ( EventAdapter , [ {
key : "on" , value : function on ( t , e ) {
this . events [ t ] = e , this . target . addEventListener ( t , this . events [ t ] )
}
} , {
key : "off" , value : function off ( t ) {
this . target . removeEventListener ( t , this . events [ t ] )
}
} , {
key : "emit" , value : function emit ( t ) {
void 0 !== this . events [ t ] && this . target . dispatchEvent ( new Event ( t ) )
}
} , {
key : "destory" , value : function destory ( ) {
2024-11-18 19:59:19 +01:00
const t = Object . keys ( this . events ) ;
let e = 0 ;
for ( ; e < t . length ; e += 1 ) this . off ( t [ e ] ) ;
2024-11-12 16:42:22 +01:00
delete this . events
}
} , {
key : "mock" , value : function mock ( t , e ) {
void 0 !== this . events [ t ] && this . events [ t ] ( e )
}
} ] ) , EventAdapter
} ( ) ;
function error ( t ) {
console . error ( "[Sliderm] " . concat ( t ) )
}
const v = {
arrow : ! 0 ,
pagination : ! 0 ,
spinner : ! 0 ,
grouping : ! 1 ,
loop : ! 0 ,
preview : ! 1 ,
breakpoint : ! 0 ,
touch : ! 0 ,
autoplay : ! 1 ,
columns : 4 ,
duration : 1e3 ,
spacing : 10 ,
align : "center" ,
extensions : [ ] ,
_arrow : { color : "#ffffff" , bgColor : "#000000" , opacity : . 5 , size : 16 , shape : "circle" , bold : 2 } ,
_preview : { edge : 40 } ,
_spinner : { color : "#1cbbb4" } ,
_breakpoint : { columns : { 4 : ! 1 , 3 : 960 , 2 : 768 , 1 : 420 } } ,
_touch : { threshold : 10 , duration : 300 } ,
_autoplay : { direction : "right" , duration : 5e3 }
} ;
function page _defineProperties ( t , e ) {
2024-11-18 19:59:19 +01:00
for ( let n = 0 ; n < e . length ; n ++ ) {
const o = e [ n ] ;
2024-11-12 16:42:22 +01:00
o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( t , o . key , o )
}
}
var m = function ( ) {
function Page ( t ) {
! function page _classCallCheck ( t , e ) {
if ( ! ( t instanceof e ) ) throw new TypeError ( "Cannot call a class as a function" )
} ( this , Page ) , this . sliderm = t
}
return function page _createClass ( t , e , n ) {
return e && page _defineProperties ( t . prototype , e ) , n && page _defineProperties ( t , n ) , Object . defineProperty ( t , "prototype" , { writable : ! 1 } ) , t
} ( Page , [ {
key : "calculate" , value : function calculate ( ) {
2024-11-18 19:59:19 +01:00
const t = arguments . length , e = new Array ( t ) ;
let n = 0 ;
for ( ; n < t ; n ++ ) e [ n ] = arguments [ n ] ;
const o = e [ 0 ] , i = e [ 1 ] , r = this . sliderm . getOption ( "columns" ) ,
2024-11-12 16:42:22 +01:00
a = this . sliderm . getOption ( "grouping" ) , s = this . sliderm . getItemCount ( ) ,
2024-11-18 19:59:19 +01:00
l = this . sliderm . getGroupCount ( ) , u = this . sliderm . getPosition ( ) , c = a ? l : s ;
let p = u , d = 0 ;
2024-11-12 16:42:22 +01:00
if ( a ) {
2024-11-18 19:59:19 +01:00
const f = Math . ceil ( u * r / r ) ;
2024-11-12 16:42:22 +01:00
p = f
}
return "number" == typeof o ? d = o : ">" === o ? ( d = p + 1 ) > c && i && ( d = 1 ) : "<" === o && ( d = p - 1 ) <= 0 && i && ( d = c ) , d
}
} , {
key : "maximum" , value : function maximum ( ) {
2024-11-18 19:59:19 +01:00
const t = this . sliderm . getOption ( "loop" ) , e = this . sliderm . getOption ( "preview" ) ,
2024-11-12 16:42:22 +01:00
n = this . sliderm . getOption ( "grouping" ) , o = this . sliderm . getOption ( "columns" ) , i = t || e ;
return n ? this . sliderm . getGroupCount ( ) : i ? this . sliderm . getItemCount ( ) : this . sliderm . getItemCount ( ) - o + 1
}
} ] ) , Page
} ( ) ;
function _toConsumableArray ( t ) {
return function _arrayWithoutHoles ( t ) {
if ( Array . isArray ( t ) ) return _arrayLikeToArray ( t )
} ( t ) || function _iterableToArray ( t ) {
if ( "undefined" != typeof Symbol && null != t [ Symbol . iterator ] || null != t [ "@@iterator" ] ) return Array . from ( t )
} ( t ) || _unsupportedIterableToArray ( t ) || function _nonIterableSpread ( ) {
throw new TypeError ( "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." )
} ( )
}
function _slicedToArray ( t , e ) {
return function _arrayWithHoles ( t ) {
if ( Array . isArray ( t ) ) return t
} ( t ) || function _iterableToArrayLimit ( t , e ) {
2024-11-18 19:59:19 +01:00
let n = null == t ? null : "undefined" != typeof Symbol && t [ Symbol . iterator ] || t [ "@@iterator" ] ;
2024-11-12 16:42:22 +01:00
if ( null == n ) return ;
2024-11-18 19:59:19 +01:00
let o , i ;
const r = [ ] ;
let a = ! 0 , s = ! 1 ;
2024-11-12 16:42:22 +01:00
try {
for ( n = n . call ( t ) ; ! ( a = ( o = n . next ( ) ) . done ) && ( r . push ( o . value ) , ! e || r . length !== e ) ; a = ! 0 ) ;
} catch ( t ) {
s = ! 0 , i = t
} finally {
try {
a || null == n . return || n . return ( )
} finally {
if ( s ) throw i
}
}
return r
} ( t , e ) || _unsupportedIterableToArray ( t , e ) || function _nonIterableRest ( ) {
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 _unsupportedIterableToArray ( t , e ) {
if ( t ) {
if ( "string" == typeof t ) return _arrayLikeToArray ( t , e ) ;
2024-11-18 19:59:19 +01:00
let n = Object . prototype . toString . call ( t ) . slice ( 8 , - 1 ) ;
2024-11-12 16:42:22 +01:00
return "Object" === n && t . constructor && ( n = t . constructor . name ) , "Map" === n || "Set" === n ? Array . from ( t ) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ . test ( n ) ? _arrayLikeToArray ( t , e ) : void 0
}
}
function _arrayLikeToArray ( t , e ) {
( null == e || e > t . length ) && ( e = t . length ) ;
for ( var n = 0 , o = new Array ( e ) ; n < e ; n ++ ) o [ n ] = t [ n ] ;
return o
}
function sliderm _defineProperties ( t , e ) {
2024-11-18 19:59:19 +01:00
for ( let n = 0 ; n < e . length ; n ++ ) {
const o = e [ n ] ;
2024-11-12 16:42:22 +01:00
o . enumerable = o . enumerable || ! 1 , o . configurable = ! 0 , "value" in o && ( o . writable = ! 0 ) , Object . defineProperty ( t , o . key , o )
}
}
function _classPrivateMethodInitSpec ( t , e ) {
! function _checkPrivateRedeclaration ( t , e ) {
if ( e . has ( t ) ) throw new TypeError ( "Cannot initialize the same private elements twice on an object" )
} ( t , e ) , e . add ( t )
}
function _classPrivateMethodGet ( t , e , n ) {
if ( ! e . has ( t ) ) throw new TypeError ( "attempted to get private field on non-instance" ) ;
return n
}
var g = new WeakSet , y = new WeakSet , _ = new WeakSet , b = new WeakSet , P = new WeakSet , w = function ( ) {
function Sliderm ( t , n ) {
! function sliderm _classCallCheck ( t , e ) {
if ( ! ( t instanceof e ) ) throw new TypeError ( "Cannot call a class as a function" )
} ( this , Sliderm ) , _classPrivateMethodInitSpec ( this , P ) , _classPrivateMethodInitSpec ( this , b ) , _classPrivateMethodInitSpec ( this , _ ) , _classPrivateMethodInitSpec ( this , y ) , _classPrivateMethodInitSpec ( this , g ) ;
2024-11-18 19:59:19 +01:00
const o = getDom ( t ) ;
2024-11-12 16:42:22 +01:00
o ? ( this . options = Object . assign ( v , n ) , this . event = new f , this . page = new m ( this ) , this . root = o , this . initialized = ! 1 , this . domEvents = [ ] , this . itemCount = 0 , this . position = 1 , this . modules = { } , this . slider = findDom ( this . root , "." . concat ( e ) ) , this . items = [ ] , _classPrivateMethodGet ( this , g , _initialize2 ) . call ( this ) ) : error ( 'The DOM "' . concat ( t , '" is invalid.' ) )
}
return function sliderm _createClass ( t , e , n ) {
return e && sliderm _defineProperties ( t . prototype , e ) , n && sliderm _defineProperties ( t , n ) , Object . defineProperty ( t , "prototype" , { writable : ! 1 } ) , t
} ( Sliderm , [ {
key : "adaptEvent" , value : function adaptEvent ( t ) {
2024-11-18 19:59:19 +01:00
const e = new h ( t ) ;
2024-11-12 16:42:22 +01:00
return this . domEvents . push ( e ) , e
}
} , {
key : "getPage" , value : function getPage ( ) {
return this . page
}
} , {
key : "getRoot" , value : function getRoot ( ) {
return this . root
}
} , {
key : "getItemCount" , value : function getItemCount ( ) {
return this . itemCount
}
} , {
key : "getGroupCount" , value : function getGroupCount ( ) {
return this . groupCount
}
} , {
key : "getItems" , value : function getItems ( ) {
return this . items
}
} , {
key : "getPosition" , value : function getPosition ( ) {
return this . position
}
} , {
key : "updatePosition" , value : function updatePosition ( t ) {
this . position = t
}
} , {
key : "updateCurrentItems" , value : function updateCurrentItems ( ) {
return ! this . initialized && ( _classPrivateMethodGet ( this , _ , _updateItems2 ) . call ( this ) , _classPrivateMethodGet ( this , b , _updateGroupCount2 ) . call ( this ) , ! 0 )
}
} , {
key : "getOption" , value : function getOption ( t ) {
2024-11-18 19:59:19 +01:00
const e = arguments . length > 1 && void 0 !== arguments [ 1 ] ? arguments [ 1 ] : null ,
2024-11-12 16:42:22 +01:00
n = void 0 !== this . options [ t ] ? this . options [ t ] : e ;
if ( t . includes ( "." ) ) try {
2024-11-18 19:59:19 +01:00
const o = t . split ( "." ) , i = _slicedToArray ( o , 2 ) , r = i [ 0 ] , a = i [ 1 ] ;
2024-11-12 16:42:22 +01:00
return this . options [ "_" . concat ( r ) ] [ a ]
} catch ( t ) {
return e
}
return n
}
} , {
key : "updateOption" , value : function updateOption ( t , e ) {
if ( t . includes ( "." ) ) try {
2024-11-18 19:59:19 +01:00
const n = _slicedToArray ( t . split ( "." ) , 2 ) , o = n [ 0 ] , i = n [ 1 ] ;
2024-11-12 16:42:22 +01:00
this . options [ "_" . concat ( o ) ] [ i ] = e
} catch ( t ) {
} else this . options [ t ] = e
}
} , {
key : "slideTo" , value : function slideTo ( t ) {
this . go ( "slide" , t )
}
} , {
key : "go" , value : function go ( t ) {
2024-11-18 19:59:19 +01:00
let e ;
2024-11-12 16:42:22 +01:00
if ( void 0 !== this . modules [ t ] ) {
for ( var n = arguments . length , o = new Array ( n > 1 ? n - 1 : 0 ) , i = 1 ; i < n ; i ++ ) o [ i - 1 ] = arguments [ i ] ;
( e = this . modules ) [ t ] . apply ( e , [ this , this . slider ] . concat ( o ) )
} else error ( "Invalid module name: " . concat ( t ) )
}
} , {
key : "on" , value : function on ( t , e ) {
this . event . on ( t , e )
}
} , {
key : "off" , value : function off ( t , e ) {
this . event . off ( t , e )
}
} , {
key : "emit" , value : function emit ( t ) {
for ( var e , n = arguments . length , o = new Array ( n > 1 ? n - 1 : 0 ) , i = 1 ; i < n ; i ++ ) o [ i - 1 ] = arguments [ i ] ;
2024-11-18 19:59:19 +01:00
const r = [ this ] . concat ( o ) ;
2024-11-12 16:42:22 +01:00
( e = this . event ) . emit . apply ( e , [ t ] . concat ( _toConsumableArray ( r ) ) )
}
} , {
key : "destory" , value : function destory ( ) {
this . event . emit ( "destory" ) , this . event . destory ( ) , this . domEvents . forEach ( ( function ( t ) {
t . destory ( )
} ) )
}
} ] ) , Sliderm
} ( ) ;
function _initialize2 ( ) {
2024-11-18 19:59:19 +01:00
const t = this ;
2024-11-12 16:42:22 +01:00
this . emit ( "initialize" ) , _classPrivateMethodGet ( this , _ , _updateItems2 ) . call ( this ) , _classPrivateMethodGet ( this , b , _updateGroupCount2 ) . call ( this ) , _classPrivateMethodGet ( this , P , _beforeMountExtensions2 ) . call ( this ) , _classPrivateMethodGet ( this , y , _mountExtensions2 ) . call ( this ) , this . go ( "init" ) , this . go ( "breakpoint" ) , this . go ( "loop" ) , this . go ( "align" ) , this . go ( "touch" ) , this . go ( "preview" ) , this . go ( "autoplay" ) , this . items . forEach ( ( function ( e , n ) {
t . go ( "columns" , e ) , t . go ( "spacing" , e ) , t . go ( "grouping" , e , n ) , t . go ( "clone" , e , n )
} ) ) , this . slideTo ( 1 ) , this . initialized = ! 0 , this . emit ( "initialized" )
}
function _mountExtensions2 ( ) {
2024-11-18 19:59:19 +01:00
for ( let t = 0 ; t < p . length ; t += 1 ) "function" == typeof p [ t ] && ( this . modules [ p [ t ] . name ] = p [ t ] ) ;
for ( let e = 0 ; e < d . length ; e += 1 ) "function" == typeof d [ e ] && this . getOption ( d [ e ] . name ) && d [ e ] ( this )
2024-11-12 16:42:22 +01:00
}
function _updateItems2 ( ) {
this . items = Array . from ( findDom ( this . root , "." . concat ( e ) ) . children ) , this . itemCount = this . items . length
}
function _updateGroupCount2 ( ) {
2024-11-18 19:59:19 +01:00
const t = this . getOption ( "columns" ) ;
2024-11-12 16:42:22 +01:00
this . groupCount = Math . ceil ( this . itemCount / t )
}
function _beforeMountExtensions2 ( ) {
2024-11-18 19:59:19 +01:00
for ( let t = 0 ; t < this . options . extensions . length ; t += 1 ) {
const e = this . options . extensions [ t ] . name ;
2024-11-12 16:42:22 +01:00
if ( "" !== e ) {
2024-11-18 19:59:19 +01:00
const n = this . options . extensions [ t ] ;
2024-11-12 16:42:22 +01:00
void 0 === this . options [ e ] ? p . push ( n ) : d . push ( n )
}
}
}
window . Sliderm = w
} ) ( )
} ) ( ) ;