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



;(function(a){window._layerSlider.plugins.borderize=function(b){var c=this,d=window._lsData;c.pluginData={name:"Borderize Add-On for LayerSlider",key:"borderize",version:"1.1",requiredLSVersion:"8.1.0",authorName:"Kreatura",releaseDate:"2025. 12. 02."},c.pluginDefaults={eventNamespace:"br"},c.state={initialized:!1},c.init=function(){c.extendLayerSlider(),c.state.initialized=!0},c.$effectLayers=a(),c.settings={sides:"all",startAt:"transitioninend",delay:0,duration:1500,size:5,easing:"linear",placement:"o",offset:0,mode:"seq",direction:"cw",color:null},c.extendLayerSlider=function(){b.plugins.addFunction("initSlidesBefore",c.pluginData.key,function(){c.$effectLayers=b.plugins.getLayersByEffect(c.pluginData.key),c.$effectLayers.each(function(b,d){a(d).data(c.pluginData.key,a.extend(!0,{},c.settings,a(d).data(c.pluginData.key)))})}),b.plugins.addFunction("wrapLayerEnd",c.pluginData.key,function(b){var d=b.$layer,e=b.layerData;if(c.$effectLayers.is(d)){var f=d.data(c.pluginData.key),g=a("<ls-borderize-wrapper></ls-borderize-wrapper>"),h=a("<ls-border class=\"ls-border-l\"></ls-border><ls-border class=\"ls-border-r\"></ls-border><ls-border class=\"ls-border-t\"></ls-border><ls-border class=\"ls-border-b\"></ls-border>");f.color&&"currentcolor"!==f.color.toLowerCase()||(f.color=d.css("color")),g.css({"--ls-border-size":f.size+"px","--ls-offset":f.offset+"px",color:f.color,filter:f.filter||"none","mix-blend-mode":f.blendMode||"normal"}).attr({"data-ls-sides":f.sides,"data-ls-placement":f.placement,"data-ls-direction":f.direction}),e.in.enabled||(e.in.enabled=!0,e.in.duration=0),e.settings.recalculateTimeline=!0,e.elements.$innerWrapper.append(g.append(h))}}),b.plugins.addFunction("afterResizeSingleLayer",c.pluginData.key,function(a){var d=a.$layer,e=d.data(c.pluginData.key);c.$effectLayers.is(d)&&d.siblings("ls-borderize-wrapper").css({"--ls-border-size":Math.max(1,Math.round(e.size*b.resize.ratio))+"px","--ls-offset":Math.round(e.offset*b.resize.ratio)+"px"})}),b.plugins.addFunction("addLayersInBeforeTL",c.pluginData.key,function(a){var d=a.$layer,e=a.layerData;if(c.$effectLayers.is(d)){var f,g,h,j,k=d.data(c.pluginData.key),l=e.elements.$innerWrapper.find(".ls-border-l"),m=e.elements.$innerWrapper.find(".ls-border-r"),n=e.elements.$innerWrapper.find(".ls-border-t"),o=e.elements.$innerWrapper.find(".ls-border-b"),p=k.duration/1e3,q=Math.max(k.delay,0)/1e3,r=0,s=new b.gsap.TimelineMax({paused:!0}),t="ccw"===k.direction?["top","left","bottom","right"]:["top","right","bottom","left"];switch(k.sides){case"all":j=2*(e.original.width+e.original.height),"seq"===k.mode?(g=p*(e.original.width/j),h=p*(e.original.height/j)):f=p/4;break;case"h":f=p/2;break;case"v":f=p/2;break;default:f=p;}for(var u={top:{el:n[0],axis:"X",condition:["all","h","t"],duration:g||f},right:{el:m[0],axis:"Y",condition:["all","v","r"],duration:h||f},bottom:{el:o[0],axis:"X",condition:["all","h","b"],duration:g||f},left:{el:l[0],axis:"Y",condition:["all","v","l"],duration:h||f}},r=0,v=0;v<t.length;v++){var w=t[v],x=u[w];-1!==x.condition.indexOf(k.sides)&&(s.fromTo(x.el,x.duration,{css:{["scale"+x.axis]:0}},{css:{["scale"+x.axis]:1},ease:b.gsap.Linear.easeNone},r),"seq"===k.mode&&(r+=x.duration))}var y=q;"transitioninend"===k.startAt&&(y+=e.timelines._in.duration()||e.in.duration),e.timelines._in.add(b.gsap.TweenMax.fromTo(s,p,{progress:0},{progress:1,ease:b.functions.convert.easing(k.easing)}),y),e.timeline.transitioninend=Math.max(e.timeline.transitioninend,e.timeline.transitioninstart+e.in.duration,e.timeline[k.startAt]+q+p)}})}}})(jQuery,void 0);