((i,e,t,l)=>{"use strict";({init(){i.on("builder_load_module_partial",(e=>{for(let t=i.selectWithParent("[data-cid]",e),l=t.length-1;l>-1;--l)this.setStyles(t[l].dataset.cid)})),i.on("tb_editing_row_setting tb_editing_column_setting tb_editing_subrow_setting",(i=>{i.querySelector("#tb_options_setting").appendChild(ThemifyConstructor.create(this.getOptions())),e.isVisual&&this.bindLiveStyling(i)}))},getOptions:()=>[{type:"group",label:"infinitebg",display:"accordion",wrap_class:"tb_group_element_image tb_infinite_bg_wrap",options:[{id:"row_scrolling_background",type:"radio",label:"infinitebg",options:[{value:"",name:"dis"},{value:"bg-scroll-horizontally",name:"scrlhr"},{value:"bg-scroll-vertically",name:"scrlvr"}],help:"infinitebgh",wrap_class:"tb_compact_radios"},{id:"row_scrolling_background_speed",type:"range",increment:.1,label:"scrlspeed",after:"sec"},{id:"row_scrolling_background_width",type:"number",label:"bgw",after:"px",help:"bgwh"},{id:"row_scrolling_background_height",type:"number",label:"bgh",after:"px",help:"bghh"}]}],setStyles(i){const t=e.Registry.get(i);if(t&&"module"!==t.type){const e=t.get("styling");if(e?.row_scrolling_background&&"disable"!==e.row_scrolling_background&&e.background_image&&("image"===e.background_type||void 0===e.background_type)){this.removeInfiniteBg(i);const l=this.getStyle(e.row_scrolling_background,i,t.type,e.row_scrolling_background_speed,e.row_scrolling_background_width,e.row_scrolling_background_height);null!==l&&t.el.insertAdjacentHTML("afterbegin",l)}}},getStyle(i,e,t,n,s,r){let o=null;return""!==i&&(s||r)&&(o="bg-scroll-horizontally"===i?l.horizontal:l.vertical,n||(n=l.speed),o=o.replace(/\#unique_id\#/gi,e).replace(/\#speed\#/gi,n+"s"),o="bg-scroll-horizontally"===i?o.replace(/\#width\#/gi,s):o.replace(/\#height\#/gi,r),o='<style id="themify_builder_infinite_bg-'+e+'">div.module_'+t+".tb_"+e+o+"</style>"),o},removeInfiniteBg(i){t.tfId("themify_builder_infinite_bg-"+i)?.remove()},bindLiveStyling(t){let l=this,n=t.tfClass("tb_infinite_bg_wrap")[0],s=function(){const i=e.activeModel.id,t=this.querySelector("input:checked").value||"",n=this.querySelector("#row_scrolling_background_speed").value,s=this.querySelector("#row_scrolling_background_width").value,r=this.querySelector("#row_scrolling_background_height").value,o=l.getStyle(t,i,e.activeModel.type,n,s,r);l.removeInfiniteBg(i),null!==o&&e.activeModel.el.insertAdjacentHTML("afterbegin",o)},r=i=>{"background_image"===i.target.id&&"desktop"===e.activeBreakPoint&&s.call(n)};n&&(n.tfOn("change keyup",s,{passive:!0}),t.tfOn("change",r,{passive:!0}),i.on("themify_builder_lightbox_close",(()=>{n.tfOff("change keyup",s,{passive:!0}),t.tfOff("change",r,{passive:!0}),n=t=l=null}),!0))}}).init()})(Themify,tb_app,document,themifyBuilder.infiniteBgVars);