Repository URL to install this package:
|
Version:
3.7.1 ▾
|
var CTFrontendBuilder=angular.module("CTFrontendBuilder",[angularDragula(angular),"ngAnimate","ui.codemirror","dndLists","CTCommonDirectives"]),iframeScope,isChrome=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor);CTFrontendBuilder.controller("MainController",["$scope","$parentScope","$http","$timeout","$window","ctScopeService","$sce",function($scope,$parentScope,$http,$timeout,$window,ctScopeService,$sce){iframeScope=$scope,ctScopeService.store("scope",$scope),$scope.log=!1,$scope.dynamicListActions={actions:[],editOn:[]},$scope.dynamicSpanCycleIDs=[],$scope.dynamicListTextChanged=null,$scope.repeaterIsRendering=!1,$scope.dynamicListTrees={trees:[],forcleanup:[],runOnLoad:{},runMainOnLoad:[]},$scope.parentRepeaterHasACF=!1,$scope.afterComponentsBuiltSignal=null,$scope.afterComponentsAddedSignal=null,$scope.recycleIDs=[],$scope.dynamicListOptions={},$scope.dynamicListActivatedIndex=null,$scope.tempcache={cache:null},$scope.contentEditableData={original:null,beingEdited:null},$scope.rebuildDOMforRepeater=function(repeaterID){if(!1===$scope.repeaterIsRendering){$scope.repeaterIsRendering=!0;var repeater=$scope.getComponentById(repeaterID),container=angular.element("<div>");container.addClass("rebuildDOMContainer"),$scope.rebuildDOM(repeaterID,!1,container),repeater.hide(),container.hide(),container.insertAfter(repeater);var temp=angular.element('<div style="position:relative;"></div>').html(repeater.html());temp.children(".oxy_repeater_original").hide(),temp.append('<div class="oxygen-widget-overlay"><i class="fa fa-cog fa-2x fa-spin"></i></div>'),temp.insertAfter(repeater),$scope.$on("oxy-dynamic-list-"+repeaterID,function(){temp.remove(),repeater.replaceWith(container.children()),container.remove(),$scope.repeaterIsRendering=!1})}},$scope.updateParentRepeater=function(id){var component=$scope.getComponentById(id);if(!component)return!1;var oxyList=component.closest(".oxy-dynamic-list");0<oxyList.length&&!oxyList.hasClass("oxy-dynamic-list-edit")&&$scope.updateRepeaterQuery(parseInt(oxyList.attr("ng-attr-component-id")))},$scope.updateRepeaterQuery=function(id){void 0===id&&(id=$scope.component.active.id);for(var repeater=$scope.getComponentById(id),loopdone=!1;!loopdone&&repeater&&0<repeater.length;){var parentRepeater=repeater.parent().closest(".oxy-dynamic-list");if(parentRepeater.length<1){var repeaterID=parseInt(repeater.attr("ng-attr-component-id"));$scope.rebuildDOMforRepeater(repeaterID),loopdone=!0}else repeater=parentRepeater}},$scope.fixShortcodes=CtBuilderAjax.fixShortcodes,$scope.fixShortcodesFound=!1,$scope.latestParent=0,$scope.dynamicListAction=function(instanceId,componentID,doit,virtualTreeItem,data){void 0===instanceId?(instanceId=$scope.component.active.id,$scope.dynamicListActions.actions[instanceId].action(instanceId,0,!0)):$scope.dynamicListActions.actions[instanceId].action(instanceId,componentID,doit,virtualTreeItem,data)},$scope.isInnerContent=!1,$scope.selectAncestors=[],$scope.sidebarEditFriendlyName=!1,$scope.isDesiableDraggable=!1,$scope.currentActiveFolder="",$scope.currentActiveStylesheetFolder="",$scope.styleFolderSelected=!1,$scope.isChrome=isChrome,$scope.reusableEditLinks={},$scope.outerTemplateData={},$scope.cache=[],$scope.iconFilter={},$scope.component={active:{id:0,name:"root",state:"original",parent:{id:null,name:""}},id:1,options:{0:{original:{},media:{original:{}}}}},$scope.addDynamicContent=function(holder,content){iframeScope.addComponent(holder);var newComponent={id:$scope.component.id,name:"ct_span"};$scope.applyComponentDefaultOptions(newComponent.id,"ct_span"),iframeScope.setOptionModel("ct_content",'<span id="ct-placeholder-'+newComponent.id+'"></span>'),$scope.findComponentItem($scope.componentsTree.children,$scope.component.active.id,$scope.insertComponentToTree,newComponent),$scope.component.options[newComponent.id].model.ct_content=content,$scope.setOption(newComponent.id,"ct_span","ct_content"),$scope.rebuildDOM(newComponent.id)},$scope.init=function(){$parentScope.$emit("iframe-scope",$scope),$parentScope.$apply(),$scope.oxygenGradientColorsToArray(iframeScope.classes),$scope.oxygenGradientColorsToArray(iframeScope.customSelectors),$scope.loadComponentsTree($scope.builderInit),$scope.getWebFontsList(),$scope.updateGlobalSettingsCSS(),$scope.loadSVGIconSets(),$parentScope.builderElement=jQuery("#ct-builder"),$parentScope.setupUI(),angular.element(document).ready(function(){angular.element("body").on("keyup",function(e){angular.element(e.target).attr("contenteditable")&&e.stopPropagation()})}),$parentScope.$apply(),$scope.setupPageLeaveProtection(),$scope.setupJSErrorNotice(),$parentScope.adjustViewportContainer(),$scope.initMedia(),$scope.outputPageSettingsCSS(),$scope.updateScriptsSettings(),$scope.isInnerContent=jQuery("body").hasClass("ct_inner"),$scope.ajaxVar=CtBuilderAjax,$scope.getComponentsListFromSource("composite-elements-0","composite-elements",function(){}),$parentScope.$emit("iframe-init",$scope),$parentScope.$apply(),$scope.initDynamicShortcodeData()},$scope.oxygenGradientColorsToArray=function(selector){if(selector instanceof Object)for(key in selector)if(selector.hasOwnProperty(key))if("colors"==key&&selector[key]instanceof Object){var newArray=[];for(nkey in selector[key])newArray.push(selector[key][nkey]);selector[key]=newArray}else $scope.oxygenGradientColorsToArray(selector[key])},$scope.initDynamicShortcodeData=function(){$scope.dynamicShortcodePHP={name:"PHP Function Return value",data:"phpfunction",properties:[{name:"Function Name",data:"function",type:"text"},{name:"Function Arguments (separated by comma)",data:"arguments",type:"text"}]},$scope.dynamicShortcodesCFOptions={name:"Custom Field/Meta Options",data:"meta",properties:[{name:"Key",data:"key",type:"select",options:_.object(_.map(CtBuilderAjax.oxygenMetaKeys,function(item){return[item,item]}))},{name:"custom",data:"key",type:"text"}]},$scope.dynamicShortcodesContentMode=[{name:"Post",children:[{name:"Title",data:"title",properties:[{name:"Link",data:"link",type:"checkbox",value:"permalink"}]},{name:"Content",data:"content"},{name:"Excerpt",data:"excerpt"},{name:"Date",data:"date",properties:[{name:"Format",data:"format",type:"text"}]},{name:"Categories, Tags, Taxonomies",data:"terms",properties:[{name:"Taxonomy",data:"taxonomy",type:"select",options:_.object(_.map(CtBuilderAjax.taxonomies,function(item){return[item,item]}))},{name:"Separator",data:"separator",type:"text"}]},$scope.dynamicShortcodesCFOptions,{name:"Comments Number",data:"comments_number",properties:[{name:"No Comments",data:"zero",type:"text"},{name:"One Comment",data:"one",type:"text"},{name:"Multiple Comments (% is replaced by the number of comments)",data:"more",type:"text"},{name:"Link",data:"link",type:"checkbox",value:"comments_link"}]}]},{name:"Featured Image",children:[{name:"Title",data:"featured_image_title"},{name:"Caption",data:"featured_image_caption"},{name:"Alt",data:"featured_image_alt"}]},{name:"Author",children:[{name:"Display Name",data:"author",properties:[{name:"Link",data:"link",type:"select",options:{None:"none","Author Website URL":"author_website_url","Author Posts URL":"author_posts_url"},nullVal:"none"}]},{name:"Bio",data:"author_bio"},{name:"Meta / Custom Field",data:"author_meta",properties:[{name:"Meta Key",data:"key",type:"text"}]}]},{name:"Current User",children:[{name:"Display Name",data:"user",properties:[{name:"Link",data:"link",type:"checkbox",value:"user_website_url"}]},{name:"Bio",data:"user_bio"},{name:"Meta / Custom Field",data:"user_meta",properties:[{name:"Meta Key",data:"key",type:"text"}]}]},{name:"Blog Info",children:[{name:"Site Title",data:"bloginfo",append:"show='name'"},{name:"Site Tagline",data:"bloginfo",append:"show='description'"},{name:"Other",data:"bloginfo",properties:[{name:"Show",data:"show",type:"select",options:{WPURL:"wpurl",URL:"url","Admin e-mail":"admin_email",Charset:"charset",Version:"version","HTML Type":"html_type","Text Direction":"text_direction",Language:"language","Stylesheet URL":"stylesheet_url","Stylesheet Directory":"stylesheet_directory","Template URL":"template_url","Pingback URL":"pingback_url","Atom URL":"atom_url","RDF URL":"rdf_url","RSS URL":"rss_url","RSS2 URL":"rss2_url","Comments Atom URL":"comments_atom_url","Comments RSS2 URL":"comments_rss2_url"}}]}]},{name:"Archive",children:[{name:"Archive Title",data:"archive_title"},{name:"Archive Description",data:"archive_description"}]},{name:"Advanced",children:[$scope.dynamicShortcodePHP]}],$scope.dynamicShortcodesCustomFieldMode=[{name:"Post",children:[{name:"Meta / Custom Field",data:"meta",properties:[{name:"Meta Key",data:"key",type:"select",options:_.object(_.map(CtBuilderAjax.oxygenMetaKeys,function(item){return[item,item]}))},{name:"custom",data:"key",type:"text"}]}]},{name:"Author",children:[{name:"Meta / Custom Field",data:"author_meta",properties:[{name:"Meta Key",data:"key",type:"text"}]}]},{name:"Current User",children:[{name:"Meta / Custom Field",data:"user_meta",properties:[{name:"Meta Key",data:"key",type:"text"}]}]},{name:"Advanced",children:[$scope.dynamicShortcodePHP]}],$scope.dynamicShortcodesLinkMode=[{name:"Post",children:[{name:"Permalink",data:"permalink"},{name:"Comments Link",data:"comments_link"},{name:"Meta / Custom Field",data:"meta",properties:[{name:"Meta Key",data:"key",type:"select",options:_.object(_.map(CtBuilderAjax.oxygenMetaKeys,function(item){return[item,item]}))},{name:"custom",data:"key",type:"text"}]}]},{name:"Featured Image",children:[{name:"Featured Image URL",data:"featured_image"}]},{name:"Author",children:[{name:"Author Website URL",data:"author_website_url"},{name:"Author Posts URL",data:"author_posts_url"},{name:"Meta / Custom Field",data:"author_meta",properties:[{name:"Meta Key",data:"key",type:"text"}]}]},{name:"Current User",children:[{name:"User Website URL",data:"user_website_url"},{name:"Meta / Custom Field",data:"user_meta",properties:[{name:"Meta Key",data:"key",type:"text"}]}]},{name:"Advanced",children:[$scope.dynamicShortcodePHP]}],$scope.dynamicShortcodesImageMode=[{name:"Post",children:[{name:"Featured Image",data:"featured_image",properties:[{name:"Size",data:"size",type:"select",options:{Thumbnail:"thumbnail",Medium:"medium","Medium Large":"medium_large",Large:"large"},change:"scope.dynamicDataModel.width = ''; scope.dynamicDataModel.height = ''"},{name:"or",type:"label"},{name:"Width",data:"width",type:"text",helper:!0,change:"scope.dynamicDataModel.size = scope.dynamicDataModel.width+'x'+scope.dynamicDataModel.height"},{name:"Height",data:"height",type:"text",helper:!0,change:"scope.dynamicDataModel.size = scope.dynamicDataModel.width+'x'+scope.dynamicDataModel.height"},{type:"break"},{name:"Default",data:"default",type:"text"}]},{name:"Meta / Custom Field",data:"meta",properties:[{name:"Meta Key",data:"key",type:"select",options:_.object(_.map(CtBuilderAjax.oxygenMetaKeys,function(item){return[item,item]}))},{name:"custom",data:"key",type:"text"}]}]},{name:"Author",children:[{name:"Author Pic",data:"author_pic",properties:[{name:"Size",data:"size",type:"select",options:{400:"400",200:"200"}}]},{name:"Meta / Custom Field",data:"author_meta",properties:[{name:"Meta Key",data:"key",type:"text"}]}]},{name:"User",children:[{name:"User Pic",data:"user_pic",properties:[{name:"Size",data:"size",type:"select",options:{Default:"Default",200:"200"},nullval:"Default"}]},{name:"Meta / Custom Field",data:"user_meta",properties:[{name:"Meta Key",data:"key",type:"text"}]}]},{name:"Advanced",children:[$scope.dynamicShortcodePHP]}];for(var i=custom_dynamic_data.data.length-1;0<=i;i--){var modeArray,parent,custom_dyn_data=custom_dynamic_data.data[i];switch(custom_dyn_data.mode.toLowerCase()){case"content":modeArray=$scope.dynamicShortcodesContentMode;break;case"custom-field":modeArray=$scope.dynamicShortcodesCustomFieldMode;break;case"link":modeArray=$scope.dynamicShortcodesLinkMode;break;case"image":modeArray=$scope.dynamicShortcodesImageMode}modeArray.some(function(el){return el.name==custom_dyn_data.position})?parent=modeArray[modeArray.map(function(e){return e.name}).indexOf(custom_dyn_data.position)]:(parent={name:custom_dyn_data.position,children:[]},modeArray.push(parent)),custom_dyn_data.data="custom_"+custom_dyn_data.data,parent.children.push(custom_dyn_data)}},$scope.setEndOfContenteditable=function(contentEditableElement){var range,selection;document.createRange?((range=document.createRange()).selectNodeContents(contentEditableElement),(selection=window.getSelection()).removeAllRanges(),selection.addRange(range),range.collapse(!1)):document.selection&&((range=document.body.createTextRange()).moveToElementText(contentEditableElement),range.collapse(!1),range.select())},$scope.insertAtCursor=function(text){var sel,range;text=text.replace(/\"/gi,"'"),window.getSelection?(sel=window.getSelection()).getRangeAt&&sel.rangeCount&&((range=sel.getRangeAt(0)).deleteContents(),range.insertNode(document.createTextNode(text))):document.selection&&document.selection.createRange&&(document.selection.createRange().text=text),angular.element(window.getSelection().focusNode).trigger("input")},$scope.insertShortcodeToMapAddress=function(text){text=text.replace(/\"/gi,"'");var id=$scope.component.active.id;$scope.setOptionModel("map_address",text,id),$scope.parseMapShortcode(id)},$scope.parseMapShortcode=function(id){void 0===id&&(id=$scope.component.active.id);var map_address=$scope.getOption("map_address",id);$scope.applyShortcodeResults(id,map_address,function(contents){var iframe=$scope.getComponentById(id).find("iframe");0<iframe.length&&iframe.attr("src",iframe.attr("src").replace(/q=[^\&]*/,"q="+contents.trim()))})},$scope.insertShortcodeToBackground=function(text){text=text.replace(/\"/gi,"'");var id=$scope.component.active.id;$scope.setOptionModel("background-image",text,id);var oxyList=$scope.getComponentById(id).closest(".oxy-dynamic-list");0<oxyList.length&&!oxyList.hasClass("oxy-dynamic-list-edit")&&$scope.updateRepeaterQuery(parseInt(oxyList.attr("ng-attr-component-id")))},$scope.parseBackgroundShortcode=function(id){void 0===id&&(id=$scope.component.active.id);var background=$scope.getOption("background",id);$scope.applyShortcodeResults(id,background,function(contents){var component=$scope.findComponentItem($scope.componentsTree.children,id,$scope.getComponentItem),classes=component.options.classes,element=$scope.getComponentById(id);if($scope.isEditing("class")&&(!component.options.original||!component.options.original.background)){var foundActiveClass=!1,propertyTrumped=!1;_.each(classes,function(item){foundActiveClass||item!==$scope.currentClass?foundActiveClass&&iframeScope.classes[item].original.background&&(propertyTrumped=!0):foundActiveClass=!0}),propertyTrumped||element.css("background-image","url("+contents.trim()+")")}$scope.isEditing("id")&&element.css("background-image","url("+contents.trim()+")")})},$scope.insertShortcodeToImageAlt=function(text){text=text.replace(/\"/gi,"'");var id=$scope.component.active.id;$scope.setOptionModel("alt",text,id)},$scope.insertShortcodeToUrl=function(text){text=text.replace(/\"/gi,"'");var id=$scope.component.active.id;$scope.setOptionModel("url",text,id)},$scope.insertShortcodeToSrc=function(text){text=text.replace(/\"/gi,"'");var id=$scope.component.active.id;$scope.setOptionModel("src",text,id)},$scope.insertDynamicDataShortcode=function(text,optionName){text=text.replace(/\"/gi,"'");var id=$scope.component.active.id;$scope.setOptionModel(optionName,text,id)},$scope.insertShortcodeToImage=function(text){var id=$scope.component.active.id;text=text.replace(/\"/gi,"'"),$scope.setOptionModel("src",text,id);var timeout=$timeout(function(){$scope.parseImageShortcode(),$timeout.cancel(timeout)},0,!1),oxyList=$scope.getComponentById(id).closest(".oxy-dynamic-list");0<oxyList.length&&!oxyList.hasClass("oxy-dynamic-list-edit")&&$scope.updateRepeaterQuery(parseInt(oxyList.attr("ng-attr-component-id")))},$scope.parseImageShortcode=function(id){void 0===id&&(id=$scope.component.active.id);var src=$scope.getOption("src",id);$scope.applyShortcodeResults(id,src,function(contents){$scope.getComponentById(id).attr("src",contents.trim())})},$scope.applyShortcodeResults=function(id,attribute,callback,param){var matches=[],matchCount=0,replacer=function(shortcode,contents){matchCount++,attribute=attribute.replace(shortcode,contents),matchCount==matches.length&&(contents||(contents=""),callback(contents,param))};for(key in matches=attribute.match(/\[oxygen[^\]]*\]/gi)){var shortcode_data={original:{full_shortcode:matches[key].trim()}};$scope.renderShortcode(id,"ct_shortcode",replacer,shortcode_data)}},$scope.getYoutubeVimeoEmbedUrl=function(url){if(void 0===url||""===url.trim())return url;var matches=url.match(/(youtube\.com|youtu\.be|vimeo\.com)\/(watch\?v\=)?(.*)/);return matches[1]&&matches[3]&&-1===matches[3].indexOf("/")?"youtube.com"==matches[1]||"youtu.be"==matches[1]?(1<matches[3].split("&").length&&(matches[3]=matches[3].split("&")[0]),"https://www.youtube.com/embed/"+matches[3]):"vimeo.com"==matches[1]?"https://player.vimeo.com/video/"+matches[3]:void 0:url},$scope.buildingOxygenTreeCounter=0,$scope.buildComponentsFromTree=function(componentsTree,id,reorder,domNode,primaryIndex,forceZeroIndex){if($scope.log,0==id){var element=$scope.getComponentById(id,domNode);return element.empty(),element=null,$scope.buildComponentsFromTree($scope.componentsTree.children,null,null,domNode),!1}var stopBuilding=!1,builtinOffset=0;angular.forEach(componentsTree,function(item,index){if(!stopBuilding){item.options.oxy_builtin&&builtinOffset++;var key=item.id;if(id){if(key!=id)return item.children&&$scope.buildComponentsFromTree(item.children,id,reorder,domNode,primaryIndex,forceZeroIndex),!1;reorder||domNode||$scope.removeComponentFromDOM(id),stopBuilding=!0}$scope.applyComponentDefaultOptions(key,item.name,item),$scope.applyComponentSavedOptions(key,item),item.options.classes&&($scope.componentsClasses[key]=angular.copy(item.options.classes)),$scope.applyModelOptions(key,item.name),"oxy_dynamic_list"==item.name&&void 0===$scope.dynamicListActions.actions[item.id]&&($scope.dynamicListActions.actions[item.id]={});var type="";item.options.ct_shortcode&&(type="shortcode"),item.options.ct_widget&&(type="widget"),item.options.ct_data&&(type="data"),item.options.ct_sidebar&&(type="sidebar"),item.options.ct_nav_menu&&(type="nav_menu"),item.options.oxy_builtin&&(type="builtin"),$scope.fixShortcodes&&void 0!==$scope.latestParent&&$scope.latestParent!==item.options.ct_parent&&(console.log(item.name+" #"+item.id+" parentID changed from: "+item.options.ct_parent+" to: "+$scope.latestParent),item.options.ct_parent=$scope.latestParent,$scope.fixShortcodesFound=!0);var componentParent=$scope.getComponentById(item.options.ct_parent,domNode),componentTemplate=$scope.getComponentTemplate(item.name,key,type,!!domNode&&parseInt(domNode.attr("data-for-id")));if(1e5<item.id&&(componentTemplate=componentTemplate.replace(/\s?[^\=\s]*\=\"[^\"]*\"/g,function(match,contents,offset,s){return 0!==match.indexOf(" ng-mouse")?match:""})),"ct_columns"==item.name&&item.children&&($scope.columns[item.id]=item.children.length),"builtin"==type){var builtInWrap=$scope.getBuiltInWrap(componentParent);$scope.cleanInsert(componentTemplate,builtInWrap,index,primaryIndex)}else if("ct_reusable"==item.name){var viewId=item.options.view_id,componentId=item.options.ct_id,innerWrap=$scope.getInnerWrap(componentParent);$scope.cleanInsert(componentTemplate,innerWrap,index-builtinOffset,primaryIndex),$scope.loadPostData($scope.addReusableContent,viewId,componentId)}else if("ct_span"==item.name||"ct_link_text"==item.name&&(!componentParent[0]||componentParent[0].attributes.contenteditable)){var noPlaceholders=!0;if(componentParent)0<componentParent.find('[id^="ct-placeholder"]').length&&(noPlaceholders=!1);if(componentParent[0]&&!componentParent[0].attributes.contenteditable&&noPlaceholders)$scope.cleanInsert(componentTemplate,componentParent,index-builtinOffset,primaryIndex);else var timeout=$timeout(function(){var placeholderID=1e5<=(placeholderID=2e5<=item.id?item.id-2e5:item.id)?placeholderID-1e5:placeholderID;$scope.cleanReplace("ct-placeholder-"+placeholderID,componentTemplate,domNode),$timeout.cancel(timeout)},0,!1)}else{if("ct_link"==item.name&&componentParent[0]&&componentParent[0].attributes.contenteditable){timeout=$timeout(function(){var placeholderID=1e5<=(placeholderID=2e5<=item.id?item.id-2e5:item.id)?placeholderID-1e5:placeholderID;$scope.cleanReplace("ct-placeholder-"+placeholderID,componentTemplate,domNode),$scope.rebuildDOM(item.children[0].id),parseInt(item.id)>$scope.component.id&&parseInt(item.id)<1e5&&($scope.component.id=parseInt(key)),parseInt(item.id)==$scope.component.id&&$scope.component.id++,$timeout.cancel(timeout)},0,!1);return}innerWrap=$scope.getInnerWrap(componentParent);$scope.cleanInsert(componentTemplate,innerWrap,forceZeroIndex?0:index-builtinOffset,primaryIndex)}if("ct_separator"==item.name&&($scope.separatorAdded=!0),"ct_inner_content"==item.name&&(1e5<=parseInt(key)?$scope.innerContentRoot=item:$scope.innerContentAdded=!0),parseInt(key)>$scope.component.id&&parseInt(key)<1e5&&($scope.component.id=parseInt(key)),"ct_image"==item.name){var src=$scope.getOption("src",item.id),image_type=$scope.getOption("image_type",item.id);-1<src.indexOf("[oxygen")&&2!=image_type&&setTimeout(function(){$scope.parseImageShortcode(item.id)},0)}if("oxy_map"==item.name)-1<$scope.getOption("map_address",item.id).indexOf("[oxygen")&&setTimeout(function(){$scope.parseMapShortcode(item.id)},0);if("ct_modal"==item.name&&"undefined"!=typeof AOS&&void 0===window.refreshAOSTimeout&&(window.refreshAOSTimeout=setTimeout(function(){AOS.refreshHard()},2e3)),"ct_video"==item.name&&setTimeout(function(){$scope.setOption(item.id,item.name,"src"),$scope.$apply()},10),$scope.updateComponentCacheStyles(key,function(){$scope.cache.idCSS="",Object.keys($scope.cache.idStyles).map(function(key,index){$scope.cache.idCSS+=$scope.cache.idStyles[key]}),$scope.outputCSSStylesAfterWait("id",$scope.cache.idCSS)},!!domNode&&!domNode.hasClass("rebuildDOMContainer")),item.children){var oldParent=$scope.latestParent;$scope.latestParent=item.id;function buildOxygenTreeChild(counter){var parentComponent=$scope.getComponentById(item.id,domNode);parentComponent?parentComponent.hasClass("oxy-ajax-loading")&&300<=counter?$scope.showNoticeModal("<div>AJAX Timeout Error. Please contact support</div>"):parentComponent.hasClass("oxy-ajax-loading")&&counter<300?function(counter){counter++,setTimeout(function(){buildOxygenTreeChild(counter)},100)}(counter):($scope.buildingOxygenTreeCounter--,$scope.adjustResizeBox(),$scope.buildComponentsFromTree(item.children,null,reorder,domNode)):console.log("ID "+item.id+" element is not present on the page")}$scope.buildingOxygenTreeCounter++,buildOxygenTreeChild(0),$scope.latestParent=oldParent}}}),$scope.afterComponentsBuiltSignal&&clearTimeout($scope.afterComponentsBuiltSignal),$scope.afterComponentsBuiltSignal=setTimeout(function(){for(;0<$scope.dynamicListTrees.runMainOnLoad.length;)$scope.dynamicListAction($scope.dynamicListTrees.runMainOnLoad.pop(),0,!0)},500)},$scope.waitOxygenTreeTimeout=function(callback){setTimeout(function(){$scope.waitOxygenTree(callback)},100)},$scope.waitOxygenTree=function(callback){0<$scope.buildingOxygenTreeCounter?$scope.waitOxygenTreeTimeout(callback):callback()},$scope.getActiveComponent=function(){return $scope.log&&console.log("getActiveComponent()"),$scope.getComponentById($scope.component.active.id)},$scope.setCurrentStylesheetFolder=function(id){if(0<($scope.stylesheetToEdit.parent=id)){var parent=_.findWhere($scope.styleSheets,{id:id});$scope.currentActiveStylesheetFolder=parent?parent.name:""}else $scope.currentActiveStylesheetFolder="";$scope.$apply()},$scope.setCurrentSelectorFolder=function(value){var selector;selector=$scope.isEditing("class")?$scope.classes[$scope.currentClass]:$scope.selectedStyleSet?$scope.styleSets[$scope.selectedStyleSet]:$scope.customSelectors[$scope.selectorToEdit],""!==value?selector.parent=value:delete selector.parent,selector.parent?$scope.currentActiveFolder=selector.parent:$scope.currentActiveFolder="",$scope.$apply(),$scope.classesCached=!1,$scope.outputCSSOptions()},$scope.getComponentById=function(id,domNode){var component;if($scope.log&&console.log("getComponentById()",id),domNode){if((component=domNode.find('[ng-attr-component-id="'+id+'"]')).length<1)return domNode}else(!(component=angular.element('[ng-attr-component-id="'+id+'"]:not([disabled="disabled"])'))||component.length<1)&&(component=angular.element("#ct-placeholder-"+id));return!(!component||0==component.length)&&component},$scope.removeActiveComponent=function(){return $scope.removeComponentWithUndo($scope.component.active.id,$scope.component.active.name,$scope.component.active.parent.id)},$scope.isEmptyComponent=function(id){return void 0===id&&(id=$scope.component.active.id),!!$scope.getComponentById(id).is(":empty")},$scope.setEditableFriendlyName=function(id){$scope.editableFriendlyName=id;var element=angular.element('[ng-attr-node-id="'+$scope.component.active.id+'"] span.ct-nicename'),item=$scope.findComponentItem($scope.componentsTree.children,$scope.component.active.id,$scope.getComponentItem),trimmedText=$scope.component.options[$scope.component.active.id].nicename.replace(/ /g,"").replace(/[^a-zA-Z0-9 ]/g,"");""===trimmedText&&void 0!==element.data("defaulttext")&&""!==element.data("defaulttext").trim()&&(trimmedText=element.data("defaulttext")),item.options.nicename=trimmedText,$scope.component.options[$scope.component.active.id].nicename=trimmedText,0<id&&jQuery(".ct-more-options-expanded",parent.document).removeClass("ct-more-options-expanded")},$scope.updateFriendlyName=function(id){$scope.findComponentItem($scope.componentsTree.children,id,$scope.updateComponentNiceName)},$scope.updateComponentNiceName=function(id,item){item.options.nicename=$scope.component.options[id].nicename},$scope.loadComponentNiceName=function(id,item){item.options.nicename&&($scope.component.options[id].nicename=item.options.nicename)},$scope.removeComponentWithUndo=function(id,name,parentId){if($parentScope.disableContentEdit(),"oxy_header_left"==name||"oxy_header_center"==name||"oxy_header_right"==name)return!1;if("ct_div_block"==name&&"oxy_dynamic_list"==$scope.component.options[parentId].name)return alert("This div is essential to the working of the repeater."),!1;if("oxy_header_row"==name){var header_row=$scope.getComponentById(id);if(0===jQuery(header_row).siblings(".oxy-header-row").length&&($scope.activateComponent(parentId),"oxy_header"==$scope.component.options[$scope.component.active.id].name&&$scope.removeActiveComponent()))return!0}var retVal=$scope.removeComponentById(id,name,parentId);"ct_slide"==name&&($scope.rebuildDOM(parentId),$scope.titleBarsVisibility("hidden","hidden"));var parent=$scope.findComponentItem($scope.componentsTree.children,parentId,$scope.getComponentItem);return!parent.children&&$scope.isAJAXElement(parent.name)?($scope.rebuildDOM(parentId),$scope.undoRebuildParentID=parentId):$scope.undoRebuildParentID=!1,$scope.rebuildDOMChangeParent(parentId),retVal},$scope.undoDelete=function(){if($scope.findComponentItem($scope.componentsTree.children,$scope.componentInsertId,$scope.pasteComponentToTree),$scope.undoRebuildParentID)$scope.rebuildDOM($scope.undoRebuildParentID);else if("ct_span"==$scope.removedComponentName)$scope.component.options[$scope.componentInsertId].model.ct_content=$scope.removedComponentParentContent,$scope.component.options[$scope.componentInsertId].original.ct_content=$scope.removedComponentParentContent,$scope.setOption($scope.componentInsertId,"","ct_content"),$scope.rebuildDOM($scope.componentInsertId);else{$scope.rebuildDOM($scope.removedComponentId);var oxyList=$scope.getComponentById($scope.removedComponentId).closest(".oxy-dynamic-list");0<oxyList.length&&$scope.updateRepeaterQuery(parseInt(oxyList.attr("ng-attr-component-id")))}$scope.updateDOMTreeNavigator($scope.removedComponentId),$scope.outputCSSOptions($scope.removedComponentId),$scope.adjustResizeBox(),$scope.cancelDeleteUndo()},$scope.cancelDeleteUndo=function(id,name){$scope.idToInsert=-1,$scope.hideNoticeModal()},$scope.showNoticeModal=function(noticeContent,noticeClass){$scope.noticeModalVisible=!0,$scope.noticeClass=void 0===noticeClass?"ct-warning":noticeClass;var noticeContentContainer=window.parent.document.getElementById("ct-notice-content");noticeContentContainer=angular.element(noticeContentContainer),angular.element(document).injector().invoke(function($compile){noticeContentContainer.html($compile(noticeContent)($scope))})},$scope.hideNoticeModal=function(){var noticeContentContainer=window.parent.document.getElementById("ct-notice-content");angular.element(noticeContentContainer).html(""),$scope.noticeModalVisible=!1},$scope.removeComponentById=function(id,name,parentId){if($scope.log&&console.log("removeComponentById()",id,name,parentId),0===id)return!1;$scope.switchState("original"),$scope.componentInsertId=parentId,$scope.removedComponentId=id,$scope.removedComponentName=name;var oxyList=$scope.getComponentById(id).parent().closest(".oxy-dynamic-list");if($scope.findParentComponentItem($scope.componentsTree,id,$scope.updateCurrentActiveParent),"ct_column"==name||"ct_div_block"==name&&$scope.isActiveParent("ct_new_columns"))$scope.removeColumn(id);else{$scope.findParentComponentItem($scope.componentsTree,id,$scope.cutComponentFromTree);var component=$scope.getComponentById(id);if(!component)return;if($scope.newComponentKey=component.index(),$scope.removeComponentFromDOM(id),"ct_span"==name){var parent=$scope.getComponentById(parentId);$scope.removedComponentParentContent=$scope.component.options[parentId].original.ct_content,$scope.component.options[parentId].model.ct_content=parent[0].innerHTML,$scope.component.options[parentId].original.ct_content=parent[0].innerHTML,$scope.setOption(parentId,"","ct_content"),$scope.rebuildDOM(parentId)}"ct_slide"==name&&$scope.rebuildDOM($scope.component.active.id),$scope.removeDOMTreeNavigatorNode(id)}return"ct_separator"==name&&($scope.separatorAdded=!1),"ct_inner_content"==name&&($scope.innerContentAdded=!1),$scope.component.active.parent.id<1e5?$scope.activateComponent($scope.component.active.parent.id,$scope.component.active.parent.name):$scope.activateComponent(0,"root"),$scope.deleteCSSStyles("css-code-"+id),$scope.removeComponentCacheStyles(id),$scope.contentEditingEnabled=!1,$scope.linkEditingEnabled=!1,$scope.unsavedChanges(),0<oxyList.length&&!oxyList.hasClass("oxy-dynamic-list-edit")&&"span"!=name&&$scope.updateRepeaterQuery(parseInt(oxyList.attr("ng-attr-component-id"))),!0},$scope.isComponentContain=function(name,id){if($scope.component.options[id].name==name)return!0;var component=$scope.findComponentItem($scope.componentsTree.children,id,$scope.getComponentItem);return!!$scope.findComponentByName(component.children,name,$scope.getComponentItem)},$scope.duplicateComponent=function(id,name,parentId){void 0===id&&(id=$scope.component.active.id),void 0===name&&(name=$scope.component.active.name),void 0===parentId&&(parentId=$scope.component.active.parent.id);var innerContentExists=!1;"ct_inner_content"===$scope.component.active.name&&(innerContentExists=!0);var component=$scope.findComponentItem($scope.componentsTree.children,id,$scope.getComponentItem);if($scope.findComponentByName(component.children,"ct_inner_content",$scope.getComponentItem)&&(innerContentExists=!0),innerContentExists)alert("You cannot add more than one Inner Content component to a template.");else if($scope.isComponentContain("oxy-product-tabs",id))$scope.showNoticeModal("<div>You cannot add more than one Product Tabs element</div>");else if("oxy_dynamic_list"!=$scope.component.options[parentId].name){var newComponentId=$scope.component.id;void 0!==$scope.activeSelectors[id]&&!1===$scope.activeSelectors[id]&&($scope.activeSelectors[newComponentId]=!1),$scope.applyComponentDefaultOptions(newComponentId,$scope.component.active.name),$scope.findParentComponentItem($scope.componentsTree,id,$scope.copyComponentTreeNode),$scope.findComponentItem($scope.componentsTree.children,parentId,$scope.pasteComponentToTree),"ct_image"==name&&2==$scope.component.options[id].model.image_type&&""!=$scope.component.options[id].model.attachment_id&&void 0!==$scope.component.options[id].sizes&&($scope.component.options[newComponentId].sizes=$scope.component.options[id].sizes,$scope.component.options[newComponentId].size_labels=$scope.component.options[id].size_labels),"ct_modal"==name&&"2"==$scope.component.options[id].model.behavior&&$scope.setOptionModel("behavior","1",newComponentId);var oxyList=$scope.getComponentById(id).closest(".oxy-dynamic-list");0<oxyList.length&&!oxyList.hasClass("oxy-dynamic-list-edit")&&$scope.updateRepeaterQuery(parseInt(oxyList.attr("ng-attr-component-id"))),$scope.activateComponent($scope.componentBuffer.id,$scope.componentBuffer.name),"ct_slide"==name?($scope.rebuildDOM(parentId),$scope.titleBarsVisibility("hidden")):$scope.rebuildDOM(newComponentId),$scope.rebuildDOMChangeParent(parentId),$scope.updateDOMTreeNavigator(newComponentId),$scope.outputCSSOptions(newComponentId),$scope.justaddedcomponents=$scope.justaddedcomponents||[],$scope.justaddedcomponents.push(newComponentId),void 0!==$scope.activeSelectors[id]&&!1!==$scope.activeSelectors[id]&&$scope.setCurrentClass($scope.activeSelectors[id],!0),$scope.cancelDeleteUndo()}else alert("A repeater cannot contain more than one child element")},$scope.activateModalComponent=function(id,$event){angular.element($event.target).hasClass("oxy-modal-backdrop")&&$scope.activateComponent(id,"ct_modal")},$scope.insertModalCloseButton=function(){$scope.addComponent("ct_link_button"),$scope.setOptionModel("ct_content","Close (Double-click to edit button text)"),$scope.addClassToComponent($scope.component.active.id,"oxy-close-modal")},$scope.enterChoosingSelectorMode=function(option){jQuery("body").addClass("choosing-selector"),$scope.choosingSelectorEnabled=!0,$scope.choosingSelectorOption=option},$scope.exitChoosingSelectorMode=function(){jQuery("body").removeClass("choosing-selector"),$scope.choosingSelectorEnabled=!1,$parentScope.exitChoosingSelectorMode()},$scope.activateComponent=function(id,componentName,$event){var repeater;0==$parentScope.showLeftSidebar&&0==$parentScope.showButtonFlashing&&($parentScope.showButtonFlashing=!0,$timeout(function(){$parentScope.showButtonFlashing=!1},2500));var component=$scope.getComponentById(id);if(angular.element(".oxy-list-child-active").removeClass("oxy-list-child-active"),component&&0<component.length){for(repeater=component.parent().closest(".oxy-dynamic-list"),$scope.parentRepeaterHasACF=!1;repeater&&0<repeater.length;)repeater=$scope.component.options[parseInt(repeater.attr("ng-attr-component-id"))].original.use_acf_repeater&&"false"!==$scope.component.options[parseInt(repeater.attr("ng-attr-component-id"))].original.use_acf_repeater?($scope.parentRepeaterHasACF=$scope.component.options[parseInt(repeater.attr("ng-attr-component-id"))].original.acf_repeater,!1):repeater.parent().closest(".oxy-dynamic-list");(repeater=component.parents(".oxy-dynamic-list")).each(function(e){angular.element(this).addClass("oxy-list-child-active")})}if($scope.log&&console.log("activateComponent()",id,componentName),void 0!==$scope.choosingSelectorEnabled&&1==$scope.choosingSelectorEnabled&&void 0!==componentName)return"ct_modal"==$scope.component.active.name&&($scope.setOptionModel($scope.choosingSelectorOption,"#"+$scope.component.options[id].selector),$event.stopPropagation()),$scope.exitChoosingSelectorMode(),!1;if("ct_modal"!=$scope.component.active.name&&void 0!==$scope.choosingSelectorEnabled&&1==$scope.choosingSelectorEnabled&&$scope.exitChoosingSelectorMode(),$scope.selectedNodeType=!1,$scope.currentPresetKey=!1,$scope.selectorDetector.mode&&(-1<["ct_widget","ct_code_block","ct_shortcode","oxy_posts_grid","oxy_rich_text","oxy_gallery","oxy_nav_menu","oxy_comments","oxy_comment_form","oxy_login_form","oxy_search_form","ct_sidebar","ct_inner_content"].indexOf(componentName)||$scope.hasOxyDataInside(id))&&$scope.componentSelector.id==id)return!($scope.selectorDetector.bubble=!0);if(0<id&&$scope.selectorDetector.mode&&$scope.selectorDetector.bubble)return!1;if("ct_selector"!=componentName&&$parentScope.disableSelectorDetectorMode&&$parentScope.disableSelectorDetectorMode(),void 0===componentName&&(componentName=$scope.component.options[id]&&$scope.component.options[id].name||""),"ct_widget"==componentName)var timeout=$timeout(function(){$scope.renderWidget(id,!0),$timeout.cancel(timeout)},0,!1);if(0==$scope.buildingOxygenTreeCounter&&void 0!==$scope.componentsTemplates&&$scope.componentsTemplates[componentName]&&$scope.loadControlsWithAJAX(componentName),$scope.stylesheetToEdit=!1,$parentScope.actionTabs.styleSheet=!1,void 0!==$event&&(angular.element(document).trigger($event.type),$event.stopPropagation()),"ct_svg_icon"===componentName||"ct_fancy_icon"===componentName){var currenticonid=$scope.component.options[id].model["icon-id"];$scope.iconFilter.title="",angular.forEach($scope.SVGSets,function(SVGSet,index){0===currenticonid.indexOf(index.split(" ").join(""))&&($scope.currentSVGSet=index,angular.forEach(SVGSet.defs.symbol,function(symbol){symbol["@attributes"].id===currenticonid.replace(index.split(" ").join(""),"")&&($scope.iconFilter.title=symbol.title)}))})}if(id==$scope.component.active.id)return $scope.adjustResizeBox(),!1;$scope.checkComponentClasses(id),void 0!==$event&&jQuery("body").trigger("click.wpcolorpicker"),-1!==id&&($scope.componentSelector.id=id),0==id&&($scope.component.active.parent={}),$scope.selectorDetector.modePause=!1,jQuery(".ct-more-options-expanded",parent.document).removeClass("ct-more-options-expanded");timeout=$timeout(function(){jQuery(".ct-highlight","#ct-builder").removeClass("ct-highlight"),$timeout.cancel(timeout)},300,!1);var previousNavElement=angular.element('[ng-attr-node-id="'+$scope.component.active.id+'"]');if(previousNavElement.find("span.ct-nicename.ct-nicename-editing").length&&$timeout(function(){previousNavElement.find("span.ct-nicename.ct-nicename-editing").trigger("blur")},0),$scope.updateBreadcrumbs(id),$scope.selectedDragElementDNDType=componentName,$event&&!jQuery($event.currentTarget).hasClass("ct-dom-tree-node-anchor")&&$scope.highlightDOMNode(id),$event&&jQuery($event.currentTarget).hasClass("ct-dom-tree-node-anchor")&&jQuery($event.currentTarget).parents(".ct-sortable-tabs").length){var tab=jQuery($scope.getComponentById(id)).closest(".oxy-tabs-wrapper > div");if(tab.length)tab.trigger("click");else{var tabsContentsTab=jQuery($scope.getComponentById(id)).closest(".oxy-tabs-contents-wrapper > div"),index=tabsContentsTab.index(),tabsSelector=tabsContentsTab.closest(".oxy-tabs-contents-wrapper").attr("data-oxy-tabs-wrapper");jQuery("#"+tabsSelector).children(".oxy-tabs-wrapper > div").eq(index).trigger("click")}}if($scope.parentScope.activeForEditBgLayer=!1,$scope.parentScope.styleTabAdvance=!1,$parentScope.disableContentEdit(),$parentScope.disableSelectable(),$parentScope.closeAllTabs(["advancedSettings"]),$parentScope.closeTabs(["oxy_posts_grid","dynamicList","slider","navMenu","gallery","oxy_testimonial","oxy_icon_box","oxy_progress_bar","oxy_pricing_box","oxy_superbox","effects","oxy_header"]),$parentScope.closeTabs(CtBuilderAjax.componentsWithTabs),$parentScope.tabs.slider=[],$parentScope.tabs.navMenu=[],$scope.previouslyActiveId=$scope.component.active.id,$scope.previouslyActiveParentId=$scope.component.active.parent.id,$scope.component.active.id=id,$scope.component.active.name=componentName,0<id&&($scope.switchEditToId(),$scope.findParentComponentItem($scope.componentsTree,id,$scope.updateCurrentActiveParent)),"oxy_header_left"!=componentName&&"oxy_header_center"!=componentName&&"oxy_header_right"!=componentName){if($scope.previouslyActiveParentId===$scope.component.active.parent.id?$scope.hideTitleBars(!0,!1):$scope.hideTitleBars(!0,!0),$scope.showComponentsList=!1,$scope.linkEditingEnabled=!1,$parentScope.toggleSidebar(!0),$scope.applyModelOptions(),$scope.outputCSSOptions($scope.previouslyActiveId),$parentScope.checkTabs(),"ct_data_custom_field"==componentName)timeout=$timeout(function(){$parentScope.updateMetaDropdown(),$timeout.cancel(timeout)},300,!1);if("ct_image"==componentName&&2==$scope.component.options[$scope.component.active.id].model.image_type&&""!=$scope.component.options[$scope.component.active.id].model.attachment_id&&void 0===$scope.component.options[$scope.component.active.id].sizes&&void 0===$scope.component.options[$scope.component.active.id].sizes_requested){$scope.component.options[$scope.component.active.id].sizes_requested=!0;component=$scope.component.active.id;$scope.loadAttachmentSizes($scope.component.options[$scope.component.active.id].model.attachment_id,function(data){$scope.component.options[component].sizes=data,$scope.component.options[component].size_labels=Object.keys(data)})}}else $scope.activateComponent($scope.component.active.parent.id,"oxy_header_row")},$scope.updateBreadcrumbs=function(id){var item,parent=id,counter=0;for($scope.selectAncestors=[];0<parent&&counter<100;)counter++,item=$scope.findComponentItem($scope.componentsTree.children,parent,$scope.getComponentItem),$scope.selectAncestors.push({id:parent===id?0:parent,name:$scope.calcDefaultComponentTitle(item,!0),tag:item.name}),parent=item.options.ct_parent;1<$scope.selectAncestors.length&&$scope.selectAncestors.reverse()},$scope.adjustResizeBox=function(){if($parentScope.actionTabs.contentEditing)return!1;$scope.log&&(console.log("adjustResizeBox()"),$scope.functionStart("adjustResizeBox()"));var resizeBox=jQuery("#oxygen-resize-box"),timeout=$timeout(function(){var id=$scope.component.active.id,parentId=$scope.component.active.parent.id,name=$scope.component.active.name,component=$scope.getComponentById(id);if(id&&(0===parseInt($scope.component.options[id].model.conditionspreview)||1===parseInt($scope.component.options[id].model.conditionspreview)&&!1===$scope.component.options[id].model.globalConditionsResult))return resizeBox.hide(),!1;if(id<=0||"ct_paragraph"==name||"ct_ul"==name||"ct_li"==name||"ct_selector"==name||"ct_reusable"==name)return resizeBox.hide(),!1;if(component=$scope.getComponentById(id)){if(component.attr("contenteditable")&&"false"!==component.attr("contenteditable")||resizeBox.show(),jQuery(".rb").hide(),!component)return $timeout.cancel(timeout),$scope.functionEnd("adjustResizeBox()"),!1;var parent=$scope.getComponentById(parentId),offset=component.offset(),height=component.outerHeight(),iframeHeight=$parentScope.artificialViewport.outerHeight(),width=component.outerWidth(),bodyWidth=jQuery("body").outerWidth(),parentOffset=parent.offset(),parentHeight=parent.outerHeight(),parentWidth=parent.outerWidth();"ct_section"==name&&(2,component=jQuery(".ct-inner-wrap",component));component.outerHeight(!0),component.outerWidth(!0);var minHeight=parseInt(height)<30?parseInt(height)/3:10,minWidth=parseInt(width)<30?parseInt(width)/3:10,marginTop=parseInt(component.css("margin-top"))>minHeight?parseInt(component.css("margin-top")):minHeight,marginRight=parseInt(component.css("margin-right"))>minWidth?parseInt(component.css("margin-right")):minWidth,marginBottom=parseInt(component.css("margin-bottom"))>minHeight?parseInt(component.css("margin-bottom")):minHeight,marginLeft=parseInt(component.css("margin-left"))>minWidth?parseInt(component.css("margin-left")):minWidth,paddingTop=parseInt(component.css("padding-top"))>minHeight?parseInt(component.css("padding-top")):minHeight,paddingRight=parseInt(component.css("padding-right"))>minWidth?parseInt(component.css("padding-right")):minWidth,paddingBottom=parseInt(component.css("padding-bottom"))>minHeight?parseInt(component.css("padding-bottom")):minHeight,paddingLeft=parseInt(component.css("padding-left"))>minWidth?parseInt(component.css("padding-left")):minWidth;$parentScope.isActiveName("ct_section")||($scope.rbMarginTop.css({display:"block",width:width-1,top:offset.top-marginTop,left:offset.left-1,height:marginTop}),$scope.rbMarginBottom.css({display:"block",width:width-1,top:offset.top+height,left:offset.left-1,height:marginBottom}),$parentScope.isActiveName("ct_headline")||$parentScope.isActiveName("ct_text_block")||(bodyWidth-width-parseInt(component.css("margin-right"))>minWidth&&$scope.rbMarginLeft.css({display:"block",width:marginLeft,top:offset.top-1,left:offset.left-marginLeft,height:height}),bodyWidth-width-parseInt(component.css("margin-left"))>minWidth&&$scope.rbMarginRight.css({display:"block",width:marginRight,top:offset.top-1,left:offset.left+width,height:height}))),$parentScope.isActiveName("oxy_nav_menu")||$parentScope.isActiveName("ct_slide")||$parentScope.isActiveName("ct_headline")||$parentScope.isActiveName("ct_text_block")||$parentScope.isActiveName("ct_link_text")||$parentScope.isActiveName("ct_image")||$parentScope.isActiveName("ct_svg_icon")||$parentScope.isActiveName("ct_fancy_icon")||($scope.rbPaddingTop.css({display:"block",width:width,top:offset.top,left:offset.left,height:paddingTop}),$scope.rbPaddingBottom.css({display:"block",width:width,top:offset.top+height-paddingBottom,left:offset.left,height:paddingBottom}),$parentScope.isActiveName("ct_section")||($scope.rbPaddingLeft.css({display:"block",width:paddingLeft,top:offset.top+paddingTop,left:offset.left,height:height-paddingTop-paddingBottom}),$scope.rbPaddingRight.css({display:"block",width:paddingRight,top:offset.top+paddingTop,left:offset.left+width-paddingRight,height:height-paddingTop-paddingBottom})));var innerWrapMargin=0;"ct_section"==name&&(innerWrapMargin=parseFloat(component.css("marginLeft")));var outlineOffset=parseFloat(component.css("outlineOffset")),outlineWidth=parseFloat(component.css("outlineWidth")),parentOutlineOffset=parseFloat(parent.css("outlineOffset")),parentOutlineWidth=parseFloat(parent.css("outlineWidth"));if(30<=offset.top?$scope.rbTitleBar.css({display:"",top:offset.top-outlineOffset-$scope.rbTitleBar.height(),left:offset.left-outlineOffset+innerWrapMargin-outlineWidth}):$scope.rbTitleBar.css({display:"",top:offset.top+outlineOffset+outlineWidth+height,left:offset.left-outlineOffset+innerWrapMargin-outlineWidth}),iframeHeight-60<height&&$scope.rbTitleBar.css({top:offset.top+outlineOffset+height-$scope.rbTitleBar.height()}),"true"!=$scope.globalSettings.indicateParents||$parentScope.isActiveParentName("ct_inner_content")||$parentScope.isActiveParentName("oxy_header_left")||$parentScope.isActiveParentName("oxy_header_center")||$parentScope.isActiveParentName("oxy_header_right"))$scope.rbParentTitleBar.hide();else if(0<parentId){$scope.rbParentTitleBar.css({display:""});var left=parentOffset.left+parentWidth+parentOutlineOffset+parentOutlineWidth-$scope.rbParentTitleBar.width();left+$scope.rbParentTitleBar.width()>bodyWidth&&(left=bodyWidth-$scope.rbParentTitleBar.width()),$scope.rbParentTitleBar.css({top:parentOffset.top+parentHeight+parentOutlineOffset+parentOutlineWidth,left:left}),iframeHeight-60<parentHeight&&$scope.rbParentTitleBar.css({top:parentOffset.top+parentHeight+parentOutlineOffset-$scope.rbParentTitleBar.height()})}else $scope.rbParentTitleBar.hide();$timeout.cancel(timeout),$scope.functionEnd("adjustResizeBox()")}},100,!1)},$scope.hideResizeBox=function(timeout){jQuery("#oxygen-resize-box").hide(timeout)},$scope.hideTitleBars=function(titleBar,parentTitleBar){!0===titleBar&&$scope.rbTitleBar.hide(),!0===parentTitleBar&&$scope.rbParentTitleBar.hide()},$scope.titleBarsVisibility=function(titleBar,parentTitleBar){titleBar&&$scope.rbTitleBar.css("visibility",titleBar),parentTitleBar&&$scope.rbParentTitleBar.css("visibility",parentTitleBar)},$scope.checkResizeBoxOptions=function(optionName){-1<["margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left"].indexOf(optionName)&&(jQuery("#rb-"+optionName).addClass("rb-currently-editing"),clearTimeout($scope.resizeBoxTimeout),$scope.resizeBoxTimeout=setTimeout(function(){jQuery("#rb-"+optionName).removeClass("rb-currently-editing")},400))},$scope.updateCurrentActiveParent=function(key,item){$scope.component.active.parent.id=item.id,$scope.component.active.parent.name=item.name},$scope.disableElementDraggable=function(val){$scope.isDesiableDraggable=val},$scope.getDragDisabledState=function(){return $scope.isDesiableDraggable},$scope.isActiveParent=function(name){return $scope.component.active.parent.name==name},$scope.getDNDAllowedTypes=function(componentName){switch(allowedTypes=[],componentName){case"ct-builder":allowedTypes=["ct_section","ct_div_block","ct_nestable_shortcode","ct_new_columns","ct_reusable","ct_link","ct_slider","oxy_header","ct_inner_content","oxy_dynamic_list"];break;case"ct_section":allowedTypes=["ct_headline","ct_image","ct_text_block","oxy_rich_text","ct_link_text","ct_svg_icon","ct_div_block","ct_nestable_shortcode","ct_new_columns","ct_data_comment_form","ct_video","ct_link_button","ct_fancy_icon","ct_reusable","ct_shortcode","ct_widget","ct_code_block","ct_link","ct_slider","oxy_social_icons","oxy_nav_menu","oxy_map","oxy_soundcloud","oxy_posts_grid","oxy_comments","oxy_comment_form","ct_inner_content","oxy_testimonial","oxy_icon_box","oxy_progress_bar","oxy_pricing_box","oxy_tabs","oxy_tabs_contents","oxy_superbox","oxy_login_form","oxy_search_form","oxy_toggle","oxy_gallery","oxy_dynamic_list"];break;case"ct_div_block":case"ct_nestable_shortcode":case"ct_inner_content":case"oxy_toggle":allowedTypes=["ct_headline","ct_image","ct_text_block","oxy_rich_text","ct_link_text","ct_svg_icon","ct_section","ct_div_block","ct_nestable_shortcode","ct_new_columns","ct_data_comment_form","ct_video","ct_link_button","ct_fancy_icon","ct_reusable","ct_shortcode","ct_widget","ct_code_block","ct_link","ct_slider","oxy_social_icons","oxy_nav_menu","oxy_map","oxy_header","oxy_soundcloud","oxy_posts_grid","oxy_comments","oxy_comment_form","ct_inner_content","oxy_testimonial","oxy_icon_box","oxy_progress_bar","oxy_pricing_box","oxy_tabs","oxy_tabs_contents","oxy_superbox","oxy_login_form","oxy_search_form","oxy_toggle","oxy_gallery","oxy_dynamic_list"];break;case"oxy_icon_box":case"oxy_pricing_box":allowedTypes=["ct_headline","ct_image","ct_text_block","oxy_rich_text","ct_link_text","ct_svg_icon","ct_div_block","ct_nestable_shortcode","ct_data_comment_form","ct_video","ct_link_button","ct_fancy_icon","ct_reusable","ct_shortcode","ct_widget","ct_code_block","ct_link","oxy_social_icons","oxy_nav_menu","oxy_map","oxy_soundcloud","oxy_posts_grid","oxy_comments","oxy_comment_form","ct_inner_content","oxy_testimonial",,"oxy_progress_bar","oxy_tabs","oxy_tabs_contents","oxy_superbox","oxy_login_form","oxy_search_form","oxy_toggle","oxy_gallery","oxy_dynamic_list"];break;case"oxy_header":allowedTypes=["oxy_header_row"];break;case"oxy_header_right":case"oxy_header_center":case"oxy_header_left":allowedTypes=["ct_headline","ct_image","ct_text_block","oxy_rich_text","ct_link_text","ct_svg_icon","ct_div_block","ct_nestable_shortcode","ct_new_columns","ct_data_comment_form","ct_video","ct_link_button","ct_fancy_icon","ct_reusable","ct_shortcode","ct_widget","ct_code_block","ct_link","ct_slider","oxy_social_icons","oxy_nav_menu","oxy_testimonial","oxy_icon_box","oxy_progress_bar","oxy_pricing_box","oxy_tabs","oxy_tabs_contents","oxy_superbox","oxy_toggle","oxy_dynamic_list"];break;case"ct_slide":allowedTypes=["ct_headline","ct_image","ct_text_block","oxy_rich_text","ct_link_text","ct_svg_icon","ct_div_block","ct_nestable_shortcode","ct_new_columns","ct_data_comment_form","ct_video","ct_link_button","ct_fancy_icon","ct_reusable","ct_shortcode","ct_widget","ct_code_block","ct_link","oxy_social_icons","oxy_nav_menu","oxy_map","oxy_soundcloud","oxy_posts_grid","oxy_comments","oxy_comment_form","ct_inner_content","oxy_testimonial","oxy_icon_box","oxy_progress_bar","oxy_pricing_box","oxy_tabs","oxy_tabs_contents","oxy_superbox","oxy_login_form","oxy_search_form","oxy_toggle","oxy_gallery","oxy_dynamic_list"];break;case"ct_link":allowedTypes=["ct_headline","ct_image","ct_text_block","oxy_rich_text","ct_link_text","ct_svg_icon","ct_section","ct_div_block","ct_nestable_shortcode","ct_new_columns","ct_data_comment_form","ct_video","ct_link_button","ct_fancy_icon","ct_reusable","ct_shortcode","ct_widget","ct_code_block","ct_inner_content","oxy_superbox","oxy_login_form","oxy_search_form","oxy_toggle","oxy_gallery"];break;case"ct_new_columns":allowedTypes=["ct_div_block","ct_nestable_shortcode"];break;case"oxy_tabs":allowedTypes=["oxy_tab"];break;case"oxy_tabs_contents":allowedTypes=["oxy_tab_content"];break;case"oxy_tab":case"oxy_tab_content":allowedTypes=["ct_headline","ct_image","ct_text_block","oxy_rich_text","ct_link_text","ct_svg_icon","ct_section","ct_div_block","ct_nestable_shortcode","ct_new_columns","ct_data_comment_form","ct_video","ct_link_button","ct_fancy_icon","ct_reusable","ct_shortcode","ct_widget","ct_code_block","ct_link","ct_slider","oxy_social_icons","oxy_nav_menu","oxy_map","oxy_header","oxy_soundcloud","oxy_posts_grid","oxy_comments","oxy_comment_form","ct_inner_content","oxy_testimonial","oxy_icon_box","oxy_progress_bar","oxy_pricing_box","oxy_superbox","oxy_login_form","oxy_search_form","oxy_toggle","oxy_gallery","oxy_dynamic_list"]}switch(componentName){case"ct_section":case"ct_div_block":case"ct_nestable_shortcode":case"ct_inner_content":case"oxy_toggle":case"oxy_icon_box":case"oxy_pricing_box":case"oxy_header_right":case"oxy_header_center":case"oxy_header_left":case"ct_slide":case"ct_link":case"oxy_tab":case"oxy_tab_content":for(var key in $scope.componentsTemplates)$scope.componentsTemplates.hasOwnProperty(key)&&allowedTypes.push(key)}return allowedTypes},$scope.trustedVideoSource=function(id){var source=$scope.component.options[id].model.embed_src;return source&&0!==source.length?$scope.trustedSource(source):$scope.trustedSource("https://www.youtube.com/embed/qgcX0y1Nzhs")},$scope.trustedSource=function(source){return $sce.trustAsResourceUrl(source)},$scope.trustedHTML=function(content){return $sce.trustAsHtml(content)},$scope.getCustomElementAttributes=function(){},$scope.getComponentTemplate=function(componentName,id,type,domNodeFor,parent_id){$scope.log&&console.log("getComponentTemplate()",componentName,id,type);var activateAttr='ng-mousedown="activateComponent('+id+", '"+componentName+"', $event);\" ";"true"!=CtBuilderAjax.userEditOnly||$scope.isElementEnabledForUser(componentName)||"ct_code_block"!==componentName||(activateAttr="");var options=activateAttr+'ng-attr-component-id="'+id+"\" ctevalconditions ng-class=\"{'ct_hidden_by_conditional_logic': component.options["+id+"]['model']['globalConditionsResult'] === false, 'ct-active' : parentScope.isActiveId("+id+"),'ct-active-parent' : parentScope.isActiveParentId("+id+")&&globalSettings.indicateParents=='true'"+("oxy_dynamic_list"==componentName?",'oxy_list_render_single oxy-dynamic-list-edit':component.options["+id+"]['model']['listrendertype']":"")+'}" id="{{component.options['+id+"].selector}}\" data-aos-enabled=\"{{getOption('aos-enable',"+id+')}}"data-aos-duration="'+$scope.getOption("aos-duration",id)+'"data-aos-easing="'+$scope.getOption("aos-easing",id)+'"data-aos-offset="'+$scope.getOption("aos-offset",id)+'"data-aos-delay="'+$scope.getOption("aos-delay",id)+'"data-aos-anchor="'+$scope.getOption("aos-anchor",id)+'"data-aos-anchor-placement="'+$scope.getOption("aos-anchor-placement",id)+'"data-aos-once="'+$scope.getOption("aos-once",id)+'"';if(classes='class="{{getComponentsClasses('+id+", '"+componentName+"')}}"+("data"===type?" ct-data-component":"")+'" ',template="",dndListAttr='dnd-list="" dnd-allowed-types="getDNDAllowedTypes(\''+componentName+"')\" dnd-type=\"'"+componentName+"'\" dnd-dragover=\"dragoverCallback('{{component.options["+id+"].selector}}', event, external, type)\" ",dndListAttrHorizontal='dnd-horizontal-list="isHorizontal" ',dndDisableIf="",$scope.isChrome||(dndDisableIf='dnd-disable-if="getDragDisabledState()" '),dndDraggableAttr='dnd-draggable="" '+dndDisableIf+'dnd-effect-allowed="move" dnd-type="\''+componentName+'\'" dnd-dragstart="dragstartCallback('+id+",'{{component.options["+id+'].selector}}\', event)" dnd-dragend="dragendCallback('+id+", '"+componentName+"', event)\" ","true"===$scope.getOption("aos-enable",id)){var dataAOS=$scope.getOption("aos-type",id)||$scope.pageSettingsMeta.aos.type||$scope.pageSettings.aos.type||iframeScope.globalSettings.aos.type;dataAOS&&(options+='data-aos="'+dataAOS+'"')}if("ct_reusable"==componentName&&(dndDraggableAttr='dnd-draggable="" '+dndDisableIf+'dnd-effect-allowed="move" dnd-type="\'{{component.options['+id+'].dndtype}}\'" dnd-dragstart="dragstartCallback('+id+",'{{component.options["+id+'].selector}}\', event)" dnd-dragend="dragendCallback('+id+", '"+componentName+"', event)\" "),1e5<=id&&"ct_inner_content"!=componentName&&(dndListAttr="",dndListAttrHorizontal="",dndDraggableAttr=""),"true"!=CtBuilderAjax.userCanFullAccess&&"true"!=CtBuilderAjax.userCanDragNDrop&&(dndListAttr="",dndListAttrHorizontal="",dndDraggableAttr=""),"ct_inner_content"==componentName&&id<1e5&&CtBuilderAjax.oxyTemplate&&(dndListAttr="",dndListAttrHorizontal=""),"ct_inner_content"!=componentName||CtBuilderAjax.oxyTemplate||(dndDraggableAttr=""),"builtin"==type&&(dndDraggableAttr=""),"ct_toolset_view"==componentName&&(type="shortcode"),"shortcode"!=type&&"widget"!=type&&"sidebar"!=type&&"nav_menu"!=type&&"data"!=type)switch(componentName){case"ct_section":var tag=$scope.component.options[id].model.tag,pseOpen=pseClose="";classes='class="ct-section {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template=pseOpen+"<"+tag+' is-nestable="true" '+options+classes+dndDraggableAttr+'><div class="oxy-video-container"><video autoplay loop playsinline muted><source ng-src="{{trustedSource(component.options['+id+'][\'model\'][\'video_background\'])}}"></video><div class="oxy-video-overlay"></div></div><div class="ct-section-inner-wrap ct-inner-wrap" '+dndListAttr+dndListAttrHorizontal+"></div></"+tag+">"+pseClose;break;case"ct_modal":classes='class="ct-modal {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<div class="oxy-modal-backdrop {{ component.options['+id+"]['model']['modal_position'] }} {{getGlobalConditionsClass("+id+")}}\" ng-style=\"{'background-color': getGlobalColorValue(component.options["+id+"]['model']['backdrop-color']) }\" ng-class=\"{live: component.options["+id+"]['model']['behavior'] == 2, hidden: component.options["+id+"]['model']['behavior'] == 3}\" ng-click=\"activateModalComponent("+id+', $event)"> <div is-nestable="true" '+options+classes+"></div></div>";break;case"ct_columns":classes='class="ct-columns {{getComponentsClasse('+id+", '"+componentName+"')}}\" ",template="<div "+options+classes+'><div class="ct-columns-inner-wrap ct-inner-wrap" ng-class="checkEmptyColumns('+id+')"></div></div>';break;case"ct_column":classes='class="ct-column {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<div is-nestable="true" '+options+classes+"></div>";break;case"ct_headline":var tag=$scope.component.options[id].model.tag;template="<"+tag+' contenteditable="false" ng-model="component.options['+id+'][\'model\'].ct_content" ng-model-options="{ debounce: 10 }" '+options+classes+dndDraggableAttr+"></"+tag+">";break;case"ct_image":var ngsrc='ng-src="{{component.options['+id+"]['model'].image_type != 2 ? component.options["+id+"]['model'].src : component.options["+id+"]['model'].attachment_url }}\" ";-1<$scope.component.options[id].model.src.indexOf("[oxygen")&&2!=$scope.component.options[id].model.image_type&&(ngsrc=""),template="<img "+ngsrc+options+classes+dndDraggableAttr+" oxyimageonload/>";break;case"ct_video":template="<div "+options+classes+dndDraggableAttr+">",template+='<div ng-if="component.options['+id+"]['model']['use-custom'] !== '1'\" class=\"oxygen-vsb-responsive-video-wrapper\"><iframe ng-src=\"{{trustedVideoSource("+id+')}}" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>',template+='<div ng-if="component.options['+id+"]['model']['use-custom'] === '1'\" class=\"oxygen-vsb-responsive-video-wrapper oxygen-vsb-responsive-video-wrapper-custom\" ng-bind-html=\"trustedHTML(component.options["+id+"]['model']['custom-code'])\"></div>",template+="</div>";break;case"ct_text_block":var tag=$scope.component.options[id].model.tag;template="<"+tag+' contenteditable="false" ng-model="component.options['+id+'][\'model\'].ct_content" ng-model-options="{ debounce: 10 }" '+options+classes+dndDraggableAttr+"></"+tag+">";break;case"ct_paragraph":template='<div ng-attr-paragraph="true" contenteditable="false" ng-model="component.options['+id+'][\'model\'].ct_content" ng-model-options="{ debounce: 10 }" '+options+classes+"></div>";break;case"ct_div_block":var tag=$scope.component.options[id].model.tag;template="<"+tag+' is-nestable="true" '+options+classes+dndDraggableAttr+dndListAttr+dndListAttrHorizontal+"></"+tag+">";break;case"ct_nestable_shortcode":classes='class="ct-nestable-shortcode {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<div ctrendernestableshortcode ct-nestable-shortcode-model="component.options['+id+'][\'model\'].wrapping_shortcode" is-nestable="true" '+options+classes+dndDraggableAttr+dndListAttr+dndListAttrHorizontal+"></div>";break;case"ct_new_columns":template="<div "+options+classes+dndListAttr+dndListAttrHorizontal+dndDraggableAttr+"></div>";break;case"ct_ul":template='<ul is-nestable="true" '+options+classes+"></ul>";break;case"ct_li":template='<li contenteditable="false" ng-model="component.options['+id+'][\'model\'].ct_content" ng-model-options="{ debounce: 10 }"'+options+classes+"></li>";break;case"ct_span":var item=$scope.findComponentItem(domNodeFor?$scope.dynamicListTrees.trees[domNodeFor]:$scope.componentsTree.children,id,$scope.getComponentItem),parent=$scope.findComponentItem(domNodeFor?$scope.dynamicListTrees.trees[domNodeFor]:$scope.componentsTree.children,item.options.ct_parent,$scope.getComponentItem),oxyContent=!1,matches=item.options.ct_content.match(/\[oxygen[^\]]*\]/i);matches&&(oxyContent=matches[0]),!oxyContent||"ct_headline"!==parent.name&&"ct_text_block"!==parent.name&&"ct_paragraph"!==parent.name&&"ct_li"!==parent.name&&"ct_link_text"!==parent.name&&"oxy_icon_box"!==parent.name&&"oxy_testimonial"!==parent.name&&"ct_link_button"!==parent.name?template='<span ng-attr-span="true" contenteditable="false" ng-model="component.options['+id+'][\'model\'].ct_content" ng-model-options="{ debounce: 10 }" '+options+classes+"></span>":(classes='class="ct-contains-oxy {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<span ng-attr-span="true" '+(domNodeFor?"":"ctrenderoxyshortcode")+' ng-model="component.options['+id+'][\'model\'].ct_content" ng-model-options="{ debounce: 10 }" ng-attr-component-id="'+id+"\" ng-class=\"{'ct-active' : parentScope.isActiveId("+id+"),'ct-active-parent' : parentScope.isActiveParentId("+id+")&&globalSettings.indicateParents=='true'}\" id=\"{{component.options["+id+'].selector}}" '+classes+"></span>");break;case"ct_link_text":case"ct_link_button":template='<a href="{{component.options['+id+'][\'model\'].url}}" contenteditable="false" ng-model="component.options['+id+'][\'model\'].ct_content" ng-model-options="{ debounce: 10 }" '+options+classes+dndDraggableAttr+"></a>";break;case"ct_link":template='<a href="{{component.options['+id+"]['model'].url}}\" "+options+classes+dndDraggableAttr+dndListAttr+dndListAttrHorizontal+'id="{{component.options['+id+'].selector}}" is-nestable="true" ng-attr-component-id="'+id+'"></a>';break;case"ct_svg_icon":classes='class="svg_wrapper {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template="<div "+options+classes+dndDraggableAttr+'><svg><use xlink:href="" ng-href="{{\'#\'+component.options['+id+"]['model']['icon-id']}}\"></use></svg></div>";break;case"ct_fancy_icon":classes='class="svg_wrapper {{getComponentsClasses('+id+", '"+componentName+"')}}\" ";var iconId=$scope.component.options[id].model["icon-id"];template="<div "+options+classes+dndDraggableAttr+'><svg id="svg-{{component.options['+id+'].selector}}"><use xlink:href="" ng-href="{{\'#\'+component.options['+id+"]['model']['icon-id']}}\"></use></svg></div>";break;case"ct_reusable":template="<div "+options+classes+dndDraggableAttr+"></div>";break;case"ct_separator":template="<div "+options+classes+"></div>";break;case"ct_code_block":var tag=$scope.component.options[id].model.tag;template="<"+tag+" "+options+classes+dndDraggableAttr+"></"+tag+">";var timeout=$timeout(function(){$scope.applyCodeBlock(id,!1),$timeout.cancel(timeout)},0,!1);break;case"ct_inner_content":var tag=$scope.component.options[id].model.tag,workArea="";if(1e5<=id&&(workArea=" ct-inner-content-workarea "),classes='class="ct-inner-content'+workArea+" {{getComponentsClasses("+id+", '"+componentName+"')}}\" ",template="<"+tag+' is-nestable="true" ng-mousedown="activateComponent('+id+", '"+componentName+'\', $event);" ng-attr-component-id="'+id+"\" ng-class=\"{'ct-active' : parentScope.isActiveId("+id+')}" id="{{component.options['+id+'].selector}}" '+classes+dndDraggableAttr+dndListAttr+"></"+tag+">",id<1e5)var timeout=$timeout(function(){($scope.template.postsList||$scope.template.termsList)&&$scope.renderInnerContent(id,componentName),$timeout.cancel(timeout)},0,!1);break;case"oxy_header":classes='class="oxy-header-wrapper {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template="<header "+options+classes+dndDraggableAttr+dndListAttr+"></header>";break;case"oxy_header_row":classes='class="oxy-header-row {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template="<div "+options+classes+dndDraggableAttr+' dnd-disable-if="isLastRow('+id+')"><div class="oxy-header-container ct-inner-wrap" ng-class="checkEmptyHeaderRow('+id+')"></div></div>';break;case"oxy_header_left":case"oxy_header_center":case"oxy_header_right":template="<div "+dndListAttr+'is-nestable="true" ng-attr-component-id="'+id+'" id="{{component.options['+id+"].selector}}\" ng-class=\"{'ct-active':parentScope.isActiveId("+id+"),'ct-active-parent':parentScope.isActiveParentId("+id+")&&globalSettings.indicateParents=='true'}\" "+classes+"></div>";break;case"ct_slider":classes='class="ct-slider {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<div is-nestable="true" '+options+classes+dndDraggableAttr+'><div class="oxygen-unslider-container" oxygen-slider="true"><ul></ul></div></div>';break;case"ct_slide":template='<li><div is-nestable="true" '+options+classes+dndListAttr+dndListAttrHorizontal+"></div></li>";break;case"oxy_map":template="<div "+options+classes+dndDraggableAttr+'><iframe ng-src="{{getMapURL('+id+')}}" frameborder=0></iframe></div>';break;case"oxy_social_icons":var html="";for(var key in $scope.socialIcons.networks)if($scope.socialIcons.networks.hasOwnProperty(key)){var network=$scope.socialIcons.networks[key];$scope.component.options[id].model["icon-"+network]&&(html+="<a href='' class='oxy-social-icons-"+network+'\'><svg><use xlink:href="" ng-href="#oxy-social-icons-icon-'+network+"{{component.options["+id+"]['model']['icon-style']=='blank'?'-blank':''}}\"></use></svg></a>")}template="<div "+options+classes+dndDraggableAttr+">"+html+"</div>";break;case"oxy_soundcloud":template="<div "+options+classes+dndDraggableAttr+'><iframe width="100%" height="{{component.options['+id+"]['model']['height']+component.options["+id+"]['model']['height-unit']}}\" ng-src=\"{{getSoundCloudURL("+id+')}}" frameborder=0></iframe></div>';break;case"oxy_dynamic_list":classes='class="oxy-dynamic-list {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<div is-nestable="true" ctdynamiclist dynamic-actions="dynamicListActions" dynamic-list-options="dynamicListOptions" '+options+classes+dndDraggableAttr+"></div>";break;case"oxy_posts_grid":template='<div class="ct-component oxy-easy-posts oxy-posts-grid {{getGlobalConditionsClass('+id+')}}" '+options+dndDraggableAttr+"></div>";var timeout=$timeout(function(){$scope.renderComponentWithAJAX("oxy_render_easy_posts",id),$timeout.cancel(timeout)},0,!1);break;case"oxy_comments":template="<div "+options+classes+dndDraggableAttr+"></div>";var timeout=$timeout(function(){$scope.renderComponentWithAJAX("oxy_render_comments_list",id),$timeout.cancel(timeout)},0,!1);break;case"oxy_comment_form":template="<div "+options+classes+dndDraggableAttr+"></div>";var timeout=$timeout(function(){$scope.renderComponentWithAJAX("oxy_render_comment_form",id),$timeout.cancel(timeout)},0,!1);break;case"oxy_login_form":template="<div "+options+classes+dndDraggableAttr+"></div>";var timeout=$timeout(function(){$scope.renderComponentWithAJAX("oxy_render_login_form",id),$timeout.cancel(timeout)},0,!1);break;case"oxy_search_form":template="<div "+options+classes+dndDraggableAttr+"></div>";var timeout=$timeout(function(){$scope.renderComponentWithAJAX("oxy_render_search_form",id),$timeout.cancel(timeout)},0,!1);break;case"oxy_gallery":template="<div "+options+classes+dndDraggableAttr+"></div>";var timeout=$timeout(function(){$scope.renderComponentWithAJAX("oxy_render_gallery",id),$timeout.cancel(timeout)},0,!1);break;case"oxy_rich_text":var tag=$scope.component.options[id].model.tag;template="<"+tag+' ng-dblclick="parentScope.openTinyMCEDialog()"'+options+classes+dndDraggableAttr+'ng-bind-html="trustedHTML(component.options['+id+"]['model']['ct_content'])\"></"+tag+">";break;case"oxy_testimonial":template="<div "+options+classes+dndDraggableAttr+'><div class="oxy-testimonial-photo-wrap"><img class="oxy-testimonial-photo" ng-src="{{component.options['+id+'][\'model\'].testimonial_photo}}" oxyimageonload/></div><div class="oxy-testimonial-content-wrap"><div class="oxy-testimonial-text" contenteditable="false" data-optionname="testimonial_text" ng-model="component.options['+id+'][\'model\'].testimonial_text" ng-model-options="{ debounce: 10 }" ></div><div class="oxy-testimonial-author-wrap"><div class="oxy-testimonial-author" contenteditable="false" data-optionname="testimonial_author" ng-model="component.options['+id+'][\'model\'].testimonial_author" ng-model-options="{ debounce: 10 }" ></div><div class="oxy-testimonial-author-info" contenteditable="false" data-optionname="testimonial_author_info" ng-model="component.options['+id+'][\'model\'].testimonial_author_info" ng-model-options="{ debounce: 10 }" ></div></div></div></div>';break;case"oxy_icon_box":classes='class="oxy-icon-box {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<div is-nestable="true" '+options+classes+dndDraggableAttr+dndListAttr+dndListAttrHorizontal+'><div class="oxy-icon-box-icon oxy-builtin-container"></div><div class="oxy-icon-box-content"><h2 class="oxy-icon-box-heading" contenteditable="false" data-optionname="icon_box_heading" ng-model="component.options['+id+'][\'model\'].icon_box_heading" ng-model-options="{ debounce: 10 }" ></h2><p class="oxy-icon-box-text" contenteditable="false" data-optionname="icon_box_text" ng-model="component.options['+id+'][\'model\'].icon_box_text" ng-model-options="{ debounce: 10 }" ></p><div '+dndListAttr+dndListAttrHorizontal+'class="oxy-icon-box-link ct-inner-wrap"></div></div></div>';break;case"oxy_progress_bar":template="<div "+options+classes+dndDraggableAttr+'><div class="oxy-progress-bar-background"><div class="oxy-progress-bar-progress-wrap"><div class="oxy-progress-bar-progress"><div class="oxy-progress-bar-overlay-text" contenteditable="false" data-optionname="progress_bar_left_text" ng-model="component.options['+id+'][\'model\'].progress_bar_left_text" ng-model-options="{ debounce: 10 }"></div><div class="oxy-progress-bar-overlay-percent" contenteditable="false" data-optionname="progress_bar_right_text" ng-model="component.options['+id+'][\'model\'].progress_bar_right_text" ng-model-options="{ debounce: 10 }"></div></div></div></div></div>';break;case"oxy_pricing_box":classes='class="oxy-pricing-box {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<div is-nestable="true"'+options+classes+dndDraggableAttr+dndListAttr+dndListAttrHorizontal+"><div class='oxy-pricing-box-graphic oxy-pricing-box-section oxy-builtin-container' ng-show='component.options["+id+']["model"].pricing_box_include_graphic=="yes"\'></div><div class=\'oxy-pricing-box-title oxy-pricing-box-section\'><div class="oxy-pricing-box-title-title" contenteditable="false" data-optionname="pricing_box_package_title" ng-model="component.options['+id+'][\'model\'].pricing_box_package_title" ng-model-options="{ debounce: 10 }"></div><div class="oxy-pricing-box-title-subtitle" contenteditable="false" data-optionname="pricing_box_package_subtitle" ng-model="component.options['+id+'][\'model\'].pricing_box_package_subtitle" ng-model-options="{ debounce: 10 }"></div></div><div ng-if="component.options['+id+'][\'model\'].pricing_box_include_features!=\'no\'" class="oxy-pricing-box-content oxy-pricing-box-section" contenteditable="false" data-optionname="pricing_box_content" ng-model="component.options['+id+'][\'model\'].pricing_box_content" ng-model-options="{ debounce: 10 }"></div><div class=\'oxy-pricing-box-price oxy-pricing-box-section\'><span class="oxy-pricing-box-sale-price" contenteditable="false" data-optionname="pricing_box_package_regular" ng-model="component.options['+id+"]['model'].pricing_box_package_regular\" ng-model-options=\"{ debounce: 10 }\"></span><span class='oxy-pricing-box-amount'><span class='oxy-pricing-box-currency'>{{component.options["+id+"]['model'].pricing_box_price_amount_currency}}</span><span class='oxy-pricing-box-amount-main'>{{component.options["+id+"]['model'].pricing_box_price_amount_main}}</span><span class='oxy-pricing-box-amount-decimal'>{{component.options["+id+"]['model'].pricing_box_price_amount_decimal}}</span></span><span class='oxy-pricing-box-term'><span class='oxy-pricing-box-amount-term'>{{component.options["+id+"]['model'].pricing_box_price_amount_term}}</span></span></div><div class=\"oxy-pricing-box-cta oxy-pricing-box-section ct-inner-wrap\"></div></div>";break;case"oxy_tabs":classes='class="oxy-tabs-wrapper {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<div is-nestable="true" '+options+classes+dndDraggableAttr+dndListAttr+dndListAttrHorizontal+'data-oxy-tabs-active-tab-class="{{component.options['+id+"]['model'].active_tab_class}}\"data-oxy-tabs-contents-wrapper=\"{{component.options["+id+"]['model'].tabs_contents_wrapper}}\"></div>";break;case"oxy_tabs_contents":classes='class="oxy-tabs-contents-wrapper {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<div is-nestable="true" '+options+classes+dndDraggableAttr+dndListAttr+dndListAttrHorizontal+'data-oxy-tabs-wrapper="{{component.options['+id+"]['model'].tabs_wrapper}}\"></div>";break;case"oxy_tab":case"oxy_tab_content":template='<div is-nestable="true" '+options+classes+dndDraggableAttr+dndListAttr+dndListAttrHorizontal+"></div>";break;case"oxy_superbox":template="<div "+options+classes+dndDraggableAttr+dndListAttr+dndListAttrHorizontal+'><div class="oxy-superbox-wrap oxy-builtin-container"></div></div>';break;case"oxy_toggle":classes='class="oxy-toggle {{getComponentsClasses('+id+", '"+componentName+"')}}\" ",template='<div is-nestable="true" '+options+classes+dndDraggableAttr+dndListAttr+dndListAttrHorizontal+'data-oxy-toggle-active-class="{{component.options['+id+"]['model'].toggle_active_class}}\"data-oxy-toggle-target=\"{{component.options["+id+"]['model'].toggle_target}}\"data-oxy-toggle-initial-state=\"{{component.options["+id+'][\'model\'].toggle_init_state}}"><div class="oxy-expand-collapse-icon" href="#"></div><div class="oxy-toggle-content ct-inner-wrap"></div></div>';break;default:var componentTemplate="No template found",nestable="",html=js="",componentClass="",attrs="";if(void 0!==$scope.componentsTemplates&&$scope.componentsTemplates[componentName]){if(componentTemplate=$scope.componentsTemplates[componentName],"true"==componentTemplate.nestable&&(nestable='is-nestable="true" '),void 0===$scope.component.options[id].model.renderedHTML&&componentTemplate.phpCallback)var timeout=$timeout(function(){$scope.renderComponentWithAJAX("oxy_render_"+componentName,id),$timeout.cancel(timeout)},0,!1);else html=$scope.parseAPIOptions(void 0!==$scope.component.options[id].model.renderedHTML?$scope.component.options[id].model.renderedHTML:componentTemplate.html,id);if(void 0!==componentTemplate.js&&componentTemplate.js)var timeout=$timeout(function(){var js=$scope.replaceComponentOptions(componentTemplate.js,id);try{eval(js)}catch(err){$scope.showNoticeModal("<div>Error in "+componentName+" inline JS code. See console for more details.</div>"),$scope.$apply(),console.log(js),console.error(err)}$timeout.cancel(timeout)},500,!1);void 0!==componentTemplate.class&&componentTemplate.class&&(componentClass=componentTemplate.class),html=html.replace(/OXY_EDITABLE\([^)]+\)/g,function(match){match=/\(([^)]+)\)/.exec(match);return option=match[1].split("|"),'contenteditable="false" data-optionname="'+option[0]+'" ng-model="component.options['+id+"]['model']['"+option[0]+"']\""}),componentTemplate.rebuildOnDOMChange&&(attrs+=" data-rebuild-on-dom-change")}var tag=$scope.component.options[id].model.html_tag||componentTemplate.HTMLTag;$scope.isRepeaterGeneratedElement(id)||(componentClass+=" oxy-ajax-loading "),classes='class="'+componentClass+" {{getComponentsClasses("+id+", '"+componentName+"')}}\" ",template="<"+tag+" "+nestable+options+classes+dndDraggableAttr+attrs+">"+html+"</"+tag+">"+js}else if("shortcode"==type){var tag=$scope.component.options[id].model.tag;template="<"+tag+" "+options+classes+dndDraggableAttr+"></"+tag+">";var timeout=$timeout(function(){$scope.renderShortcode(id,componentName),$timeout.cancel(timeout)},0,!1)}else if("widget"==type){template="<div "+options+classes+dndDraggableAttr+"></div>";var timeout=$timeout(function(){$scope.renderWidget(id),$timeout.cancel(timeout)},0,!1)}else if("nav_menu"==type){template="<nav "+dndDraggableAttr+options+classes+"></nav>";var timeout=$timeout(function(){$scope.renderNavMenu(id),$timeout.cancel(timeout)},0,!1)}else if("data"==type){var tag=$scope.component.options[id].model.tag;switch(componentName){case"ct_data_featured_image":case"ct_data_author_avatar":template='<img ng-src="{{component.options['+id+"]['model'].src}}\""+options+classes+dndDraggableAttr+"/>";break;default:template="<"+tag+" "+options+classes+dndDraggableAttr+"></"+tag+">"}var timeout=$timeout(function(){$scope.renderDataComponent(id,componentName),$timeout.cancel(timeout)},0,!1)}else if("sidebar"==type){template="<div "+options+classes+"></div>";var timeout=$timeout(function(){$scope.renderSidebar(id),$timeout.cancel(timeout)},0,!1)}if("ct_code_block"!=componentName)var timeout=$timeout(function(){$scope.applyComponentJS(id,componentName,!1),$timeout.cancel(timeout)},0,!1);var customAttributesTimeout=$timeout(function(){$scope.applyCustomAttributes(id),$timeout.cancel(customAttributesTimeout)},0,!1);return template},$scope.changeTag=function(type,id,name){null==id&&(id=$scope.component.active.id),null==name&&(name=$scope.component.active.name);var component=$scope.getComponentById(id),oxyList=component.closest(".oxy-dynamic-list");if(0<oxyList.length)$scope.updateRepeaterQuery(parseInt(oxyList.attr("ng-attr-component-id")));else if(0<component.children("span").length&&(type="rebuild"),"rebuild"!=type){var newComponent=$scope.getComponentTemplate(name,id,type),selector=$scope.component.options[id].selector;$scope.cleanReplace(selector,newComponent)}else $scope.rebuildDOM(id)},$scope.getInnerWrap=function(element){return element.hasClass?element.hasClass("ct-slider")?"UL"==(child=element.find(".oxygen-unslider-container > ul")).prop("tagName")?child:element:element.hasClass("ct-nestable-shortcode")?0<(child=element.children(".ct_nestable_element_wrap")).length?child:element:element.hasClass("oxy-icon-box")?(child=element.children(".oxy-icon-box-content").children(".ct-inner-wrap"))||element:element.hasClass("ct-columns")||element.hasClass("ct-section")||element.hasClass("oxy-header-row")||element.hasClass("oxy-pricing-box")||element.hasClass("oxy-toggle")?(child=element.children(".ct-inner-wrap"))||element:0<(child=element.find(".oxy-inner-content").first()).length&&child.closest("[ng-attr-component-id]").is(element)?child:element:element;var child},$scope.getBuiltInWrap=function(element){var child=element.find(".oxy-builtin-container");return child||element},$scope.getMapURL=function(id){return $scope.trustedSource("https://maps.google.com/maps?q="+encodeURI($scope.component.options[id].model.map_address)+"&t=m&z="+$scope.component.options[id].model.map_zoom+"&output=embed&iwloc=near&key="+CtBuilderAjax.googleMapsAPIKey)},$scope.getSoundCloudURL=function(id){return $scope.trustedSource("https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/"+encodeURI($scope.component.options[id].model.soundcloud_track_id)+"&color="+encodeURI($scope.component.options[id].model.soundcloud_color)+"&auto_play="+encodeURI($scope.component.options[id].model.soundcloud_auto_play)+"&hide_related="+encodeURI($scope.component.options[id].model.soundcloud_hide_related)+"&show_comments="+encodeURI($scope.component.options[id].model.soundcloud_show_comments)+"&show_user=true&show_reposts=false&show_teaser=true&visual=true")},$scope.wrapWithSpan=function(returnNode){var parentId=$scope.component.active.id,parentName=$scope.component.active.name,selection=$scope.getUserSelection(),node=document.createElement("span"),att=document.createAttribute("id"),parent=$scope.getActiveComponent();att.value="ct-placeholder-"+$scope.component.id,node.setAttributeNode(att),$scope.replaceUserSelection(node);var newComponent={id:$scope.component.id,name:"ct_span"};$scope.applyComponentDefaultOptions(newComponent.id,"ct_span"),$scope.findComponentItem($scope.componentsTree.children,$scope.component.active.id,$scope.insertComponentToTree,newComponent),$scope.component.options[newComponent.id].model.ct_content=selection,$scope.setOption(newComponent.id,"ct_span","ct_content"),$scope.component.options[parentId].model.ct_content=parent.html(),$scope.component.options[parentId].original.ct_content=parent.html(),$scope.setOption(parentId,parentName,"ct_content"),$scope.rebuildDOM(parentId);var timeout=$timeout(function(){$scope.activateComponent(newComponent.id,"ct_span"),$timeout.cancel(timeout)},0,!1);if(void 0!==returnNode)return node},$scope.wrapWithLink=function(){var sel=$scope.getUserSelection(),node=document.createElement("a");node.appendChild(document.createTextNode(sel));var url=prompt("Define link URL","http://");if(null!=url){var att=document.createAttribute("href");att.value=url,node.setAttributeNode(att)}$scope.replaceUserSelection(node)},$scope.getUserSelection=function(){var sel="";if(void 0!==window.getSelection){if((sel=window.getSelection()).rangeCount){for(var container=document.createElement("div"),i=0,len=sel.rangeCount;i<len;++i)container.appendChild(sel.getRangeAt(i).cloneContents());sel=container.innerHTML}}else void 0!==document.selection&&"Text"==document.selection.type&&(sel=document.selection.createRange().htmlText);return sel},$scope.replaceUserSelection=function(node){var range,html;window.getSelection&&window.getSelection().getRangeAt?((range=window.getSelection().getRangeAt(0)).deleteContents(),range.insertNode(node)):document.selection&&document.selection.createRange&&(range=document.selection.createRange(),html=3==node.nodeType?node.data:node.outerHTML,range.pasteHTML(html))},$scope.listToBeRemoved=function(toBeRemoved,componentsTree,id,collect){void 0===collect&&(collect=!1);var keepGoing=!0;angular.forEach(componentsTree,function(item,index){keepGoing&&(id&&item.id===parseInt(id)&&(toBeRemoved.splice(0,toBeRemoved.length),keepGoing=!(collect=!0)),collect&&toBeRemoved.push(item.id),item.children&&$scope.listToBeRemoved(toBeRemoved,item.children,id,collect))})},$scope.rebuildDOM=function(id,reorder,domNode){if($scope.log&&console.log("rebuildDOM()",id,reorder,domNode),void 0===id&&(id=0),$scope.functionStart("rebuildDOM"),!$scope.componentsTree.children)return $scope.functionEnd("rebuildDOM"),!1;if(reorder&&!domNode){var toBeRemoved=[];$scope.listToBeRemoved(toBeRemoved,$scope.componentsTree.children,id),angular.forEach(toBeRemoved.reverse(),function(itemid){$scope.removeComponentFromDOM(itemid)})}$scope.buildComponentsFromTree($scope.componentsTree.children,id,reorder,domNode,null,!!domNode);function waitOxygenTreeRebuild(counter){0<$scope.buildingOxygenTreeCounter&&counter<900?function(counter){counter++,setTimeout(function(){waitOxygenTreeRebuild(counter)},100)}(counter):$scope.component.id++,0<$scope.buildingOxygenTreeCounter&&900<=counter&&console.log("Tree building timeout. ID counter is not incremented.")}waitOxygenTreeRebuild(0),$scope.functionEnd("rebuildDOM")},$scope.rebuildDOMChangeParent=function(id){var component=$scope.getComponentById(id),componentToRebuild=jQuery(component).parents("[data-rebuild-on-dom-change]").last();if(0===componentToRebuild.length&&(componentToRebuild=jQuery(component).filter("[data-rebuild-on-dom-change]")),0<componentToRebuild.length)var timeout=$timeout(function(){var id=componentToRebuild[0].getAttribute("ng-attr-component-id");$scope.log&&console.log("rebuildDOMChangeParent()",id),$scope.rebuildDOM(id),$timeout.cancel(timeout)},0,!1)},$scope.removeComponentFromDOM=function(id){var component=$scope.getComponentById(id);if(!(component&&0<component.closest('[disabled="disabled"]').length)&&component){if(component.is(".ct-slide, .ct-slider"))var unslider=component.closest(".unslider");if(component.is(".ct-modal"))var modalBackdrop=component.closest(".oxy-modal-backdrop");component.scope().$destroy(),component.remove(),component=null,unslider&&(unslider.remove(),unslider=null),modalBackdrop&&(modalBackdrop.remove(),modalBackdrop=null)}},$scope.addPresetColumns=function(columnsWidths){var columnsId=$scope.component.active.id;$scope.getActiveComponent().html(""),$scope.updateColumnsOnAdd=!1,angular.forEach(columnsWidths,function(width){$scope.addComponent("ct_div_block"),$scope.setOptionModel("width",width.toString()),$scope.setOptionModel("width-unit","%"),$scope.component.active.id,$scope.activateComponent(columnsId,"ct_new_columns")}),$scope.updateColumnsOnAdd=!0,$scope.updateDOMTreeNavigator(columnsId)},$scope.addCustomFieldComponentWithParams=function(dynamicDataModel,dataitem){var shortcode='[oxygen data="'+dataitem.data+'"',finalVals={};_.each(dataitem.properties,function(property){dynamicDataModel.hasOwnProperty(property.data)&&void 0!==dynamicDataModel[property.data].trim&&""!==dynamicDataModel[property.data].trim()&&!property.helper&&dynamicDataModel[property.data]!==property.nullVal&&(finalVals[property.data]=dynamicDataModel[property.data])}),_.each(finalVals,function(property,key){property=property.replace(/'/g,"__SINGLE_QUOTE__"),shortcode+=" "+key+'="'+property+'"'}),dataitem.append&&(shortcode+=" "+dataitem.append),shortcode+="]",$scope.addComponent("ct_text_block"),iframeScope.setOptionModel("ct_content",shortcode);var content=iframeScope.getOption("ct_content"),idIncrement=0;content=content.replace(/\[oxygen[^\]]*\]/gi,function(match){var newComponent={id:iframeScope.component.id+idIncrement,name:"ct_span"};return idIncrement++,iframeScope.applyComponentDefaultOptions(newComponent.id,"ct_span"),iframeScope.findComponentItem(iframeScope.componentsTree.children,iframeScope.component.active.id,iframeScope.insertComponentToTree,newComponent),iframeScope.component.options[newComponent.id].model.ct_content=match,iframeScope.setOption(newComponent.id,"ct_span","ct_content"),'<span id="ct-placeholder-'+newComponent.id+'"></span>'}),iframeScope.setOptionModel("ct_content",content,iframeScope.component.active.id,iframeScope.component.active.name),$scope.parentScope.oxygenUIElement.find("#ctdynamicdata-popup").remove(),$scope.parentScope.oxygenUIElement.find(".oxy-dynamicdata-popup-background").remove()},$scope.addCustomFieldComponent=function(){$scope.dynamicDataModel={};angular.element(document).injector().invoke(function($compile){var compiledElement=$compile('<div class="oxy-dynamicdata-popup-background"></div><div id="ctdynamicdata-popup" class="oxygen-data-dialog"><div><div class="oxygen-data-dialog-data-picker"><ul><li><div ng-if="dynamicShortcodesCFOptions.properties" class="oxygen-data-dialog-options"><h1>{{dynamicShortcodesCFOptions.name}} Options</h1><div><div class="oxygen-control-wrapper" ng-repeat="property in dynamicShortcodesCFOptions.properties"><label ng-if="property.name&&property.type!==\'checkbox\'" class="oxygen-control-label"> {{property.name}} </label><div ng-if="property.type===\'select\'" class="oxygen-select oxygen-select-box-wrapper"><div class="oxygen-select-box"><div class="oxygen-select-box-current">{{dynamicDataModel[property.data]}}</div><div class="oxygen-select-box-dropdown"></div></div><div class="oxygen-select-box-options"><div ng-repeat="option in property.options" ng-click="dynamicDataModel[property.data]=option;applyChange(property)" class="oxygen-select-box-option">{{option}}</div></div></div><div class="oxygen-input" ng-if="property.type===\'text\'"><input type="text" ng-model="dynamicDataModel[property.data]" ng-change="applyChange(property)" ng-trim="false"/></div><label class="oxygen-checkbox" ng-if="property.type===\'checkbox\'" >{{property.name}}<input type="checkbox" ng-model="dynamicDataModel[property.data]" ng-true-value="\'{{property.value}}\'" ng-change="applyChange(property)" /><div class="oxygen-checkbox-checkbox" ng-class="{\'oxygen-checkbox-checkbox-active\':dynamicDataModel[property.data]==\'{{property.value}}\'}"></div><label><br ng-if="property.type===\'break\'" /></div class="oxygen-control-wrapper"></div><div class="oxygen-apply-button" ng-mousedown="addCustomFieldComponentWithParams(dynamicDataModel, dynamicShortcodesCFOptions)">Insert</div></div></li>')($scope);$scope.parentScope.oxygenUIElement.append(compiledElement),$scope.$apply()})},$scope.cleanInsert=function(element,parentElement,index,primaryIndex){angular.element(document).injector().invoke(function($compile){var newScope=$scope.$new(),compiledElement=$compile(element)(newScope);elementId=compiledElement.attr("ng-attr-component-id"),"undefined"!=typeof elementId&&$scope.component.options[elementId].model&&$scope.component.options[elementId].model.wrapping_start&&2<$scope.component.options[elementId].model.wrapping_start.length&&(compiledElement.html($scope.component.options[elementId].model.wrapping_start+$scope.component.options[elementId].model.wrapping_end),compiledElement.children().addClass("ct_nestable_element_wrap")),parentElement?$scope.insertAtIndex(compiledElement,parentElement,primaryIndex?primaryIndex+index:index):angular.element(element).replaceWith(compiledElement),angular.element(element).hasClass("removeOnInsert")&&parentElement.html(angular.element(element).html())})},$scope.cleanReplace=function(placeholderID,replacement,domNode){angular.element(document).injector().invoke(function($compile){var newScope=$scope.$new(),compiledReplacement=$compile(replacement)(newScope);(domNode?domNode.find("#"+placeholderID):angular.element("#"+placeholderID)).replaceWith(compiledReplacement)})},$scope.insertAtIndex=function(child,parent,index){0===index?parent.prepend(child):0<index?jQuery(">*:nth-child("+index+")",parent).after(child):parent.append(child)},$scope.hasOxyDataInside=function(id){return void 0===id&&(id=$scope.component.active.id),!!$scope.getComponentById(id)&&0<$scope.getComponentById(id).children("span.ct-contains-oxy").length},$scope.isElementEnabledForUser=function(name){return void 0===name&&(name=$scope.component.active.name),null!=$scope.userEnabledElements&&"function"==typeof $scope.userEnabledElements.indexOf&&-1<$scope.userEnabledElements.indexOf(name)},$scope.escapeHtml=function(text){var map={"&":"&","<":"<",">":">",'"':""","'":"'"};return text.replace(/[&<>"']/g,function(m){return map[m]})},$scope.addSlashes=function(str){return(str+"").replace(/[\\"']/g,"\\$&").replace(/\u0000/g,"\\0")},$scope.stripSlashes=function(str){return str.replace(/\\(.)/gm,"$1")},$scope.functionStart=function(name){!0===$scope.log&&console.time(name)},$scope.functionEnd=function(name){!0===$scope.log&&console.timeEnd(name)},$scope.setupPageLeaveProtection=function(){jQuery("#ct-builder").on("click","a",function(e){(jQuery(this).not("[href*='#']")||0===jQuery(this).parents(".oxygen-scroll-to-hash-links").length)&&e.preventDefault()}).on("submit","form",function(e){e.preventDefault()})},$scope.confirmOnPageExit=function(e){var message="There is unsaved changes.";return(e=e||window.event)&&(e.returnValue=message),message},$scope.unsavedChanges=function(){$scope.log&&console.log("unsavedChanges()"),null===window.onbeforeunload&&(window.onbeforeunload=$scope.confirmOnPageExit),jQuery("#ct-save-button").addClass("ct-unsaved-changes")},$scope.allSaved=function(){window.onbeforeunload=null,jQuery("#ct-save-button").removeClass("ct-unsaved-changes")},$scope.notSorted=function(obj){return obj?Object.keys(obj):[]},$scope.objectToArrayObject=function(obj){return obj?_.map(obj,function(item,key){return"object"==typeof item?Object.assign(item,{key:key}):item}):[]},$scope.isObjectEmpty=function(obj){if(obj)for(var prop in obj)if(obj.hasOwnProperty(prop))return!1;return!0},$scope.b64EncodeUnicode=function(str){return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,function(match,p1){return String.fromCharCode("0x"+p1)}))};var stripFormatting=function(e){var sel,range,me=this,oldContent=jQuery(me).html(),strippedPaste=jQuery("<div>").append(e.originalEvent.clipboardData.getData("Text").replace(/(?:\r\n|\r|\n)/g,"%%linebreak%%")).text();if(window.getSelection){if((sel=window.getSelection()).rangeCount){(range=sel.getRangeAt(0)).deleteContents();var node,nodes=strippedPaste.split("%%linebreak%%");for(var key in nodes)nodes.hasOwnProperty(key)&&(node=document.createTextNode(nodes[key]),range.insertNode(node),(range=range.cloneRange()).selectNodeContents(node),range.collapse(!1),sel.removeAllRanges(),sel.addRange(range),key<nodes.length-1&&(node=document.createElement("br"),range.insertNode(node),(range=range.cloneRange()).selectNode(node),range.collapse(!1),sel.removeAllRanges(),sel.addRange(range)))}}else document.selection&&document.selection.createRange&&((range=document.selection.createRange()).text=strippedPaste.split("%%linebreak%%").join(""));var undofunc=function(e){90===e.keyCode&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),jQuery(me).html(oldContent),jQuery(me).off("keydown",undofunc))};jQuery(me).on("keydown",undofunc),e.preventDefault()};jQuery("body").on("paste","[contenteditable]",stripFormatting);var applySceduled=!1;$scope.$watch(function(){applySceduled||(applySceduled=!0,$scope.$$postDigest(function(){applySceduled=!1,$scope.parentScope&&$scope.parentScope.safeApply()}))}),$scope.safeApply=function(){applySceduled=!0,"$apply"!=$scope.$root.$$phase&&"$digest"!=$scope.$root.$$phase&&$scope.$apply(),applySceduled=!1},$scope.addBodyClass=function(className){console.log(jQuery("body")),jQuery("body").addClass(className)},$scope.removeBodyClass=function(className){console.log(jQuery("body")),jQuery("body").removeClass(className)}}]),CTFrontendBuilder.factory("$parentScope",["$window",function($window){return $window.parent.angular.element($window.frameElement).scope()}]),CTFrontendBuilder.controller("BuilderController",["$controller","$scope","$parentScope","$http","$timeout","$window",function($controller,$scope,$parentScope,$http,$timeout,$window){$scope.parentScope=$parentScope;var locals={$scope:$scope,$parentScope:$parentScope,$http:$http,$timeout:$timeout};$controller("MainController",locals),$controller("ComponentsTree",locals),$controller("ComponentsStates",locals),$controller("ControllerNavigation",locals),$controller("ControllerColumns",locals),$controller("ControllerAJAX",locals),$controller("ControllerClasses",locals),$controller("ControllerOptions",locals),$controller("ControllerPresets",locals),$controller("ControllerConditions",locals),$controller("ControllerFonts",locals),$controller("ControllerCSS",locals),$controller("ControllerTemplates",locals),$controller("ControllerSVGIcons",locals),$controller("ControllerMediaQueries",locals),$controller("ControllerAPI",locals),$controller("ControllerDragnDropLists",locals),$controller("ControllerHeader",locals),$controller("ControllerUndoRedo",locals)}]);