
/*
	* LayerSlider Add-On: Replicator Layer Effect
	*
	* (c) 2011-2025 George Krupa, John Gera & Kreatura Media
	*
	* LayerSlider home:		https://layerslider.com/
	* Licensing:			https://layerslider.com/licensing/
*/



;(function(a){window._layerSlider.plugins.replicator=function(b,c){var d=this,e=window._lsData;d.pluginData={name:"Replicator Add-On for LayerSlider",key:"replicator",version:"1.1",requiredLSVersion:"8.1.0",authorName:"Kreatura",releaseDate:"2025. 12. 02."},d.pluginDefaults={eventNamespace:"rep"},d.state={initialized:!1},d.init=function(){d.extendLayerSlider(),d.state.initialized=!0},d.$effectLayers=a(),d.settings={clones:4,delay:50,fadeMethod:"linear",minOpacity:.1,maxOpacity:.5,offsetX:-5,offsetY:-5,filter:!1,blendMode:!1,parallaxLevelStep:1,parallaxDurationStep:0,reverseParallax:!1,scaleStep:0,rotationStep:0,widthStep:0,heightStep:0,reverseOrder:!1},d.extendLayerSlider=function(){var e=function(a){if("number"==typeof a)return"px";if("string"==typeof a){var b=a.match(/(sw|sh|lw|lh)/i);if(b)return b[1];if(-1<a.indexOf("px"))return"px"}return"px"},f=function(a){return"string"==typeof a?a.replace(/(?:sw|sh|lw|lh|px)/g,"").replace(/\s+/g,"").trim():a};b.plugins.addFunction("initSlidesBefore",d.pluginData.key,function(){d.$effectLayers=b.plugins.getLayersByEffect(d.pluginData.key),d.$effectLayers.each(function(c,e){var f,g,h=a(e),j={randomValues:{}},k=Math.random().toString(36).substr(2,9),l=a.extend(!0,{},d.settings,h.data(d.pluginData.key)),m=a(),n=h.attr("data-ls")||"",o=h[0].style,p=parseFloat(b.functions.getDataProp(n,"parallaxlevel")),q=parseFloat(b.functions.getDataProp(n,"scalex"))||1,r=parseFloat(b.functions.getDataProp(n,"scaley"))||1,s=parseFloat(b.functions.getDataProp(n,"rotation"))||0,t=b.functions.getDataProp(n,"parallax")||!1,u=b.functions.getDataProp(n,"transitionin"),v=parseFloat(b.functions.getDataProp(n,"delayin"))||0,w=!1;if(l.scaleStep=a.trim(l.scaleStep)||0,l.rotationStep=a.trim(l.rotationStep)||0,l.widthStep=a.trim(l.widthStep)||0,l.heightStep=a.trim(l.heightStep)||0,h.data("cloneData",j),"false"===u&&(n=b.functions.updateDataProp(n,"transitionin","true"),n=b.functions.updateDataProp(n,"durationin","0"),h.attr("data-ls",n)),h.data(d.pluginData.key,l),isNaN(p)&&(p=10),l.clones=j.clones=Math.min(l.clones,50),0>l.delay&&(w=v+Math.abs(l.delay)*l.clones,n=b.functions.updateDataProp(n,"delayin",w),h.attr("data-ls",n)),h.attr({"le-uid":k,"ls-rep-master":""}),t&&l.reverseParallax&&l.parallaxLevelStep&&(n=b.functions.updateDataProp(n,"parallaxlevel",p+(0-l.clones)*l.parallaxLevelStep),h.attr("data-ls",n)),t){var x=parseFloat(b.functions.getDataProp(n,"parallaxdurationmove"));x=isNaN(x)?1500:x}var y=!1;b.functions.getDataProp(n,"scalex")===b.functions.getDataProp(n,"scaley")&&(y=!0);var z=o.width,A=o.height,B=null,C=null;z&&(-1===z.indexOf("%")?(B=parseFloat(z),B=isNaN(B)?null:B):B=z),A&&(-1===A.indexOf("%")?(C=parseFloat(A),C=isNaN(C)?null:C):C=A);for(var D=l.clones;0<D;D--){if(f=h.clone().attr("ls-rep-clone",D).addClass("ls-clone"),f.data(d.pluginData.key,a.extend({},l)),n=w?b.functions.updateDataProp(n,"delayin",w-D*Math.abs(l.delay)):b.functions.updateDataProp(n,"delayin",v+D*l.delay),f.attr("data-ls",n),l.minOpacity=Math.max(parseFloat(l.minOpacity),.001),l.maxOpacity=Math.min(parseFloat(l.maxOpacity),1),g=l.maxOpacity?parseFloat(d.calculateOpacity(D,l.clones,l).toFixed(3)):parseFloat(d.calculateOpacity(D,l.clones+1,l).toFixed(3)),f.data("repOpacity",g),a.isNumeric(o.zIndex)){var E=parseInt(o.zIndex);f.css({zIndex:l.reverseOrder?E+D:E-D})}if(l.scaleStep){var F,G;a.isNumeric(l.scaleStep)?(F=q+D*l.scaleStep,G=r+D*l.scaleStep):(F=b.functions.convert.randomProperties(l.scaleStep,"scaleX",d.pluginData.key,!1,j),G=y?F:b.functions.convert.randomProperties(l.scaleStep,"scaleY",d.pluginData.key,!1,j)),n=b.functions.updateDataProp(n,"scaleX",F),n=b.functions.updateDataProp(n,"scaleY",G),f.attr("data-ls",n)}if(l.rotationStep){var H;H=a.isNumeric(l.rotationStep)?s+D*l.rotationStep:b.functions.convert.randomProperties(l.rotationStep,"rotation",d.pluginData.key,!1,j),n=b.functions.updateDataProp(n,"rotation",H),f.attr("data-ls",n)}if(t){if(l.parallaxLevelStep){var I,J=l.clones-D;I=l.reverseParallax?p+(0-J)*l.parallaxLevelStep:p+D*l.parallaxLevelStep,n=b.functions.updateDataProp(n,"parallaxlevel",I),f.attr("data-ls",n)}if(l.parallaxDurationStep){var K=Math.max(0,x+D*l.parallaxDurationStep);n=b.functions.updateDataProp(n,"parallaxdurationmove",K),f.attr("data-ls",n)}}var L=h.css("filter")||"none";f.css({filter:l.filter||L}),l.widthStep&&(a.isNumeric(B)?f.css({width:Math.max(0,B+D*l.widthStep)}):"string"==typeof B&&-1!==B.indexOf("%")&&f.css({width:Math.max(0,parseInt(B)+D*l.widthStep)+"%"})),l.heightStep&&(a.isNumeric(C)?f.css({height:Math.max(0,C+D*l.heightStep)}):"string"==typeof C&&-1!==C.indexOf("%")&&f.css({height:Math.max(0,parseInt(C)+D*l.heightStep)+"%"})),f.attr("le-uid",k),m=l.reverseOrder?a(f).add(m):m.add(f)}var M=h.parent().is("a")?h.parent():h;m[l.reverseOrder?"insertAfter":"insertBefore"](M)})}),b.plugins.addFunction("wrapLayerEnd",d.pluginData.key,function(a){if(a.$layer.is("[ls-rep-clone]")){var c=a.$layer,e=c.data(b.defaults.init.dataKey),f=c.data(d.pluginData.key),h=f.reverseOrder?f.clones:1;f.autoHide&&(e.out.startAt="transitioninend+0"),f.reverseOrder&&parseInt(c.attr("ls-rep-clone"))===h&&g(c.attr("le-uid"))}else a.$layer.is("[ls-rep-master]")&&g(a.$layer.attr("le-uid"))});var g=function(f){var g=c.find("[le-uid=\""+f+"\"][ls-rep-master]"),h=g.data(b.defaults.init.dataKey),i=c.find("[le-uid=\""+f+"\"][ls-rep-clone]"),j=h.elements.$outerWrapper.css("mix-blend-mode")||"normal";h.clones=i.length,i.each(function(){var c=a(this),f=c.data(b.defaults.init.dataKey),g=c.data(d.pluginData.key);f.layerData=h,f.elements.$outerWrapper.css({opacity:c.data("repOpacity")||1,"mix-blend-mode":g.blendMode||j}),g.offsetX=/\d/.test(g.offsetX)?g.offsetX:-5,g.offsetY=/\d/.test(g.offsetY)?g.offsetY:-5,g.offset={x:{type:-1===g.offsetX.indexOf(b.defaults.init.staggerSplitChar)&&-1===g.offsetX.indexOf(b.defaults.init.rangeSplitChar)?"indexed":"random",value:0,unit:e(g.offsetX)},y:{type:-1===g.offsetY.indexOf(b.defaults.init.staggerSplitChar)&&-1===g.offsetY.indexOf(b.defaults.init.rangeSplitChar)?"indexed":"random",value:0,unit:e(g.offsetY)}}})};b.plugins.addFunction("createTimelineBeforeAdd",d.pluginData.key,function(c){$clones=b.layers.get(c+", in, notactive, clone"),$clones.each(function(){var c=a(this),e=c.data(b.defaults.init.dataKey),g=e.layerData,i=c.data(d.pluginData.key);i.offset.x.value=a.isNumeric(i.offsetX)?parseInt(i.offsetX):b.functions.convert.randomProperties(f(i.offsetX),"x",d.pluginData.key,c,g,!0),i.offset.y.value=a.isNumeric(i.offsetY)?parseInt(i.offsetY):b.functions.convert.randomProperties(f(i.offsetY),"y",d.pluginData.key,c,g,!0),h({$layer:c,layerStyle:e.responsive},!0)})});var h=function(a,c){var e,f,g=a.$layer,h=g.data(b.defaults.init.dataKey),i=g.data(d.pluginData.key),j=parseInt(g.attr("ls-rep-clone")),k=j,l=j,m={sw:b.slider.width/100,sh:b.slider.height/100,lw:a.layerStyle.outerWidth/100,lh:a.layerStyle.outerHeight/100,px:b.resize.ratio};"fixed"!==h.settings.position&&"fixedx"!==h.settings.position&&(m.sw=b.slider.initial.width*b.resize.ratio/100),"fixed"!==h.settings.position&&"fixedy"!==h.settings.position&&(m.sh=b.slider.initial.height*b.resize.ratio/100),"random"===i.offset.x.type&&(k=1),"random"===i.offset.y.type&&(l=1),e=a.layerStyle.left+i.offset.x.value*m[i.offset.x.unit]*k,f=a.layerStyle.top+i.offset.y.value*m[i.offset.y.unit]*l,h.elements.$outerStyleWrapper.css({left:e,top:f}),c?(h.settings.wrapperData.responsive.left=e,h.settings.wrapperData.responsive.top=f):(a.layerStyle.left=e,a.layerStyle.top=f,a.wrapperStyle.left=e,a.wrapperStyle.top=f)};b.plugins.addFunction("beforeResizeSingleLayerSmartBG",d.pluginData.key,function(a,b){!b&&a.$layer.is("[ls-rep-clone]")&&h(a)})},d.calculateOpacity=function(a,b,c){if(1>=b)return c.maxOpacity||1;var d;switch(c.fadeMethod){case"linear":d=(b-a)/(b-1);break;case"sinusoidal":d=Math.sin((b-(a-1))/b*(Math.PI/2));break;case"exponential":d=Math.pow((b-(a-1))/b,2);}return c.minOpacity+((c.maxOpacity||1)-c.minOpacity)*d}}})(jQuery,void 0);