(()=>{var t={4579:(t,e,i)=>{var s=i(9859);t.exports=Backbone.Collection.extend({distribute_traffic:function(t){if(!(this.length<=1)){var e=parseInt((100-t.get("traffic"))/(this.length-1));this.each((function(i){i.get(i.idAttribute)!==t.get(t.idAttribute)&&i.set("traffic",e)}),this);var i=(100-t.get("traffic"))%(this.length-1);if(i){var s=this.last();s.get(s.idAttribute)===t.get(t.idAttribute)?this.first().set("traffic",e+i):s.set("traffic",e+i)}}},split_traffic:function(t,e){var i=parseInt(e/(this.length-1));this.each((function(e){e.get(e.idAttribute)!==t.get(t.idAttribute)&&e.set("traffic",e.get("traffic")+i)}),this);var s=parseInt(e%(this.length-1));if(s){var a=this.last();if(a.get(a.idAttribute)===t.get(t.idAttribute)){var n=this.first();n.set("traffic",n.get("traffic")+s)}else a.set("traffic",a.get("traffic")+s)}},save_distributed_traffic:function(){var t=new s;this.each((function(e){t.set(e.get(e.idAttribute),e.get("traffic"))}),this),t.save()},equalize_traffic:function(){var t=parseInt(100/this.length),e=100%this.length;this.each((function(e){e.set("traffic",t)})),this.findWhere({is_control:!0}).set("traffic",t+e)},allocate_traffic:function(t,e){this.each((function(i){if(i.get(i.idAttribute)!==t.get(t.idAttribute)){var s=parseInt(i.get("traffic"))+e;s<0?(e=s,s=0):s>100?(e=s-100,s=100):e=0,i.set("traffic",s)}}),this)}})},4788:(t,e,i)=>{var s=i(4579),a=i(9859);t.exports=s.extend({model:i(5979),save_distributed_traffic:function(){var t=new a;this.each((function(e){t.set(e.get("variation_id"),e.get("traffic"))}),this),t.save()}})},1173:(t,e,i)=>{var s=i(4579);t.exports=s.extend({model:i(2837)})},586:(t,e,i)=>{function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}var a=i(2927);t.exports=a.extend({className:"tvd-input-field",template:TVE_Dash.tpl("util/edit-title"),events:{"keyup input":"keyup","change input":function(){var t=this.input.val().trim();return t?(this.model.set("post_title",t),!1):(this.input.addClass("tvd-invalid"),!1)},"blur input":function(){this.model.trigger("thrive-ab-title-no-change")}},initialize:function(t){var e=!0;t||(e=!1),"object"!==s(t)&&(e=!1),"object"===s(t)&&void 0===t.el&&(e=!1),e?this.render():console.log("Error: invalid arguments for edit title control")},keyup:function(t){27===t.which&&this.model.trigger("thrive-ab-title-no-change")},render:function(){return this.$el.html(this.template({item:this.model})),this.input=this.$("input"),this},focus:function(){this.input.focus().select()}})},8993:(t,e,i)=>{var s=Backbone.View,a=i(4678).extend({defaults:function(){return{post_id:"",post_title:""}},validate:function(t){var e=[];return t.post_title&&t.post_id||e.push(this.validation_error("post_title","Page not selected")),e.length?e:void 0}}),n=s.extend({className:"tvd-input-field thrive-ab-page-search",template:TVE_Dash.tpl("util/page-search"),initialize:function(t){t&&t.model||(this.model=new a),this.goal_pages=t.goal_pages,this.on("select",this.select),this.on("save-page",this.save_page)},render:function(){return this.$el.html(this.template({item:this.model})),TVE_Dash.data_binder(this),this.$autocomplete=this.$(".page-search"),this.$autocomplete.on("input",_.bind((function(){this.model.set({post_id:null}),this.$(".thrive-ab-edit-page").attr("href","javascript:void(0)").addClass("tvd-btn-flat-secondary"),this.$(".thrive-ab-preview-page").attr("href","javascript:void(0)").addClass("tvd-btn-flat-secondary")}),this)),this.bind(),this},select:function(t){this.$(".thrive-ab-edit-page").attr("href",t.edit_url).removeClass("tvd-btn-flat-secondary").show(),this.$(".thrive-ab-preview-page").attr("href",t.url).removeClass("tvd-btn-flat-secondary").show()},save_page:function(t){var e=this,i={title:t.title};TVE_Dash.showLoader(),ThriveAB.ajax.do("add_new_page","post",i).done((function(t){e.model.set({post_id:t.post.ID,post_title:t.post.post_title}),e.select({edit_url:t.post.edit_url,url:t.post.guid}),TVE_Dash.hideLoader()}))},bind:function(){var t=this;this.$autocomplete.autocomplete({appendTo:this.$el,minLength:2,delay:300,source:function(e,i){var s;t.goal_pages?(s=Object.keys(t.goal_pages)).push(ThriveAB.page.ID):s=[ThriveAB.page.ID];var a={q:e.term,exclude_id:s};ThriveAB.ajax.do("post_search","post",a).done((function(t){t.push({title:e.term,label:e.term,type:"Create New Page",value:e.term}),i(t)})),e.term},select:function(e,i){return t.$autocomplete.val(i.item.title),t.model.set({post_id:i.item.id,post_title:i.item.title}),i.item.id&&t.trigger("select",i.item),!1}}),this.$autocomplete.data("ui-autocomplete")._renderItem=function(e,i){var s,a=jQuery("
  • ");return void 0===i.id&&(a.addClass("ui-not-found"),a.click((function(){t.trigger("save-page",i)}))),s="Create New Page"===i.type?''+i.label+''+i.type+"":''+i.label+''+i.type+"",a.append(s).appendTo(e),a}}});t.exports={model:a,view:n}},3283:(t,e,i)=>{var s=i(2927);t.exports=s.extend({initialize:function(){s.prototype.initialize.apply(this,arguments),this.$("input").attr("data-value",this.model.get("traffic")),this.listenTo(this.model,"change:traffic",(function(t,e){this.$("input").val(e),this.$("input").attr("data-value",e)})),1===this.model.collection.length&&this.disable()},on_change:function(t){return this.model.collection.save_distributed_traffic(),!1},on_input:function(t){var e=t.target.value;e.length<=0&&(t.target.value=0),(isNaN(parseInt(e))||parseInt(e)>100)&&(e=e.substring(0,e.length-1)),isNaN(parseInt(e))&&(e=0),t.target.value=parseInt(e);var i=parseInt(t.target.dataset.value)-e;return i=parseInt(i),this.set_traffic(parseInt(t.target.value),i),!1},set_traffic:function(t,e){var i=parseInt(t);isNaN(i)&&(i=0),i<0&&(i=0),i>100&&(i=100),this.model.set("traffic",i),this.model.collection.allocate_traffic(this.model,e)},enable:function(){this.$("input").removeAttr("disabled")},disable:function(){this.$("input").attr("disabled","disabled")}})},451:t=>{t.exports=TVE_Dash.views.Modal.extend({template:TVE_Dash.tpl("modals/html-archive"),events:{"click .tvd-modal-submit":"submit"},initialize:function(t){TVE_Dash.views.Modal.prototype.initialize.apply(this,arguments),this.$el.addClass("tvd-red")},render:function(){return TVE_Dash.views.Modal.prototype.render.apply(this,arguments),this.$(".tvd-modal-close").addClass("tvd-white-text"),this},submit:function(){if("function"!=typeof this.data.submit)throw new Error("Submit data not implemented");this.data.submit.apply(this,arguments),this.close()}})},5690:t=>{t.exports=TVE_Dash.views.Modal.extend({template:TVE_Dash.tpl("modals/html-change-automatic-winner"),events:{"click .tvd-modal-submit":"submit"},afterInitialize:function(t){TVE_Dash.views.Modal.prototype.afterInitialize.apply(this,arguments),this.listenTo(this.model,"change:auto_win_enabled",this.toggle_settings_input)},afterRender:function(){TVE_Dash.views.Modal.prototype.afterRender.apply(this,arguments),TVE_Dash.data_binder(this),this.toggle_settings_input()},toggle_settings_input:function(){var t=this.$("#auto-win-settings input"),e=this.model.get("auto_win_enabled");if(this.$("#auto-win-enabled").prop("checked",1==e),t.length)if(1==e)t.removeAttr("disabled");else{var i=this.model.defaults();delete i.id,this.model.set(i),t.attr("disabled","disabled")}},submit:function(){this.model.isValid({step:"winner_settings"})&&this.model.save({save_test_settings:!0},{success:_.bind((function(){this.close()}),this),error:_.bind((function(){this.close()}),this)})}})},6054:t=>{t.exports=TVE_Dash.views.Modal.extend({template:TVE_Dash.tpl("modals/html-delete"),events:{"click .tvd-modal-submit":"submit"},initialize:function(t){TVE_Dash.views.Modal.prototype.initialize.apply(this,arguments),this.$el.addClass("tvd-red")},render:function(){return TVE_Dash.views.Modal.prototype.render.apply(this,arguments),this.$(".tvd-modal-close").addClass("tvd-white-text"),this},submit:function(){if("function"!=typeof this.data.submit)throw new Error("Submit data not implemented");this.data.submit.apply(this,arguments),this.close()}})},1786:t=>{t.exports=TVE_Dash.views.Modal.extend({initialize:function(t){"monetary"===this.model.get("type")&&"sendowl"===this.model.get("goal_pages")?this.template=TVE_Dash.tpl("modals/goal/sendowl"):this.template=TVE_Dash.tpl("modals/goal/"+this.model.get("type")),TVE_Dash.views.Modal.prototype.initialize.apply(this,arguments)},render:function(){var t;return TVE_Dash.views.Modal.prototype.render.apply(this,arguments),"monetary"===this.model.get("type")?t=TVE_Dash.tpl("modals/goal/revenue-row"):"visits"===this.model.get("type")&&(t=TVE_Dash.tpl("modals/goal/page-row")),t&&this.collection.each((function(e){this.$(".thrive-ap-goal-pages").append(t({model:e}))}),this),this}})},5606:(t,e,i)=>{var s=i(9009),a=i(4710),n=i(9296);t.exports=TVE_Dash.views.ModalSteps.extend({className:"tvd-modal tvd-modal-fixed-footer",template:TVE_Dash.tpl("modals/html-test"),events:function(){return _.extend(TVE_Dash.views.ModalSteps.prototype.events,{"click .tvd-modal-submit":"submit","click .thrive-ab-goal":function(t){if(t.currentTarget.classList.contains("thrive-ab-disabled"))return!1;this.$(".thrive-ab-goal").removeClass("thrive-ab-selected"),t.currentTarget.classList.add("thrive-ab-selected"),jQuery(".tvd-modal-content").animate({scrollTop:jQuery("#thrive-ab-goal-settings").offset().top},500),this.model.set("type",t.currentTarget.dataset.goal)}})},initialize:function(t){TVE_Dash.views.ModalSteps.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:type",this.render_goal_settings),this.listenTo(this.model,"change:auto_win_enabled",this.toggle_settings_input)},afterRender:function(){TVE_Dash.views.ModalSteps.prototype.afterRender.apply(this,arguments),TVE_Dash.data_binder(this),this.toggle_settings_input(),this.model.get("items").where({has_form:!1}).length},gotoStep:function(t){TVE_Dash.views.ModalSteps.prototype.gotoStep.apply(this,arguments);var e=this.$step.find(".tvd-tab");return e.length&&(e.addClass("tvd-disabled"),jQuery(e[t]).removeClass("tvd-disabled").find("a").first().trigger("click")),this},beforeNext:function(){return this.model.isValid({step:this.currentStep})},toggle_settings_input:function(){!0===this.model.get("auto_win_enabled")?this.$("#auto-win-settings").show():(this.model.set(this.model.defaults()),this.$("#auto-win-settings").hide())},render_goal_settings:function(){var t={model:this.model};switch(delete this.model.attributes.service,this.goal_settings_view&&this.goal_settings_view.remove(),this.model.get("type")){case"monetary":this.goal_settings_view=new a(t);break;case"visits":this.goal_settings_view=new n(t);break;case"optins":this.goal_settings_view=new s(t)}this.$("#thrive-ab-goal-settings").html(this.goal_settings_view.render().$el)},submit:function(){if(!this.model.isValid())return!1;TVE_Dash.showLoader(!0),this.model.save(null,{success:_.bind((function(){location.href=ThriveAB.page.edit_link}),this),error:_.bind((function(){TVE_Dash.hideLoader(),TVE_Dash.err("Test could not be saved")}))})}})},2208:t=>{t.exports=TVE_Dash.views.Modal.extend({events:{"click .tvd-modal-submit":function(){TVE_Dash.showLoader(!0),location.reload()}},template:TVE_Dash.tpl("modals/variation-winner"),afterInitialize:function(){this.model.set("label",TVE_Dash.sprintf(ThriveAB.t.variation_winner,this.model.get("title"))),this.$el.addClass("thrive-ab-set-winner")}})},2457:(t,e,i)=>{var s=i(5609),a=i(2208);t.exports=TVE_Dash.views.Modal.extend({template:TVE_Dash.tpl("modals/html-winner"),afterInitialize:function(){return this.model.on("winner_selected",(function(t,e){this.close(),TVE_Dash.modal(a,{model:e,title:"",no_close:!0,dismissible:!1})}),this),this},afterRender:function(){var t="modals/winner/test/item/"+this.model.get("type"),e=new s({model:this.model,collection:this.collection,item_template_name:t});e.template=TVE_Dash.tpl("modals/winner/test/"+this.model.get("type")),this.$("#test-view").html(e.render().$el)}})},4678:t=>{var e;e=jQuery,t.exports=Backbone.Model.extend({idAttribute:"ID",defaults:function(){return{ID:""}},url:function(){var t=ThriveAB.ajax.get_url(this.get_action()+"&"+this.get_route());return e.isNumeric(this.get("ID"))&&(t+="&ID="+this.get("ID")),t},get_action:function(){return"action="+ThriveAB.ajax.controller_action},get_route:function(){return"route=no_route"},validation_error:function(t,e,i){return{field:t,message:e,callback:i}}})},8606:(t,e,i)=>{var s=i(4678);t.exports=s.extend({defaults:function(){return _.extend(s.prototype.defaults(),{ID:0,title:"",x_axis:[],y_axis:""})},get_route:function(){return"route=report"}})},5979:(t,e,i)=>{var s=i(4678);t.exports=s.extend({idAttribute:"id",defaults:function(){return{id:"",revenue:0}},get_route:function(){return"route=testitem"},validate:function(t,e){var i=[];if(e.test instanceof Backbone.Model){var s=e.test.get("type"),a="validate_"+s;s&&"function"==typeof this[a]&&(i=this[a](t,e))}return i.length?i:void 0},validate_monetary:function(t,e){var i=[];return isNaN(parseFloat(t.revenue))&&i.push(this.validation_error("revenue","invalid revenue")),i},validate_visits:function(t,e){return[]}})},6665:(t,e,i)=>{var s=i(4678),a=i(1173),n=(i(5979),i(4788));t.exports=s.extend({idAttribute:"id",defaults:function(){var t=this.get("items");return _.extend({},{id:"",auto_win_enabled:0,auto_win_min_conversions:t&&t.length?100*(t.length-1):100,auto_win_min_duration:14,auto_win_chance_original:95})},get_route:function(){return"route=tests"},initialize:function(t){if(!t.items)throw new Error("Test model must have items defined");if(t.items instanceof a){var e=[];t.items.each((function(t,i){e.push({variation_id:t.get("ID"),title:t.get("post_title"),is_control:!0===t.get("is_control"),has_form:t.get("has_form")})})),this.set("items",new n(e))}else t.items.length&&this.set("items",new n(t.items))},parse:function(t){t.items&&(t.items=new n(t.items))},validate:function(t,e){var i=[];if(void 0!==e.step)return(i=_.union(i,this["validate_step_"+e.step].apply(this,arguments))).length?i:void 0;if(!t.type)return i.push(this.validation_error("type","",(function(){TVE_Dash.err("Select type")}))),i;var s=t.type,a="validate_"+s;return"function"==typeof this[a]?i=this[a](t,e):i.length?i:void 0},validate_monetary:function(t,e){var i=[];return t.service||t.save_test_settings||i.push(this.validation_error("service","",(function(){TVE_Dash.err(ThriveAB.t.select_measurement_option)}))),"visit_page"!==t.service||t.goal_pages&&0!==Object.keys(t.goal_pages).length||i.push(this.validation_error("goal_page","",(function(){TVE_Dash.err(ThriveAB.t.select_thank_you_page)}))),i.length?i:void 0},validate_visits:function(t,e){var i=[];return t.goal_pages&&0!==Object.keys(t.goal_pages).length||i.push(this.validation_error("goal_page","",(function(){TVE_Dash.err(ThriveAB.t.select_goal_page)}))),i.length?i:void 0},validate_optins:function(t,e){var i=[];return i.length?i:void 0},validate_step_winner_settings:function(t,e){var i={auto_win_min_conversions:t.auto_win_min_conversions,auto_win_min_duration:t.auto_win_min_duration,auto_win_chance_original:t.auto_win_chance_original};return this._validate_fields(i)},_validate_fields:function(t){var e=[];if(_.each(t,(function(t,i){"function"==typeof this["validate_"+i]&&(e=_.union(e,this["validate_"+i](t)))}),this),e.length)return e},validate_step_0:function(t,e){var i={title:t.title,auto_win_min_conversions:t.auto_win_min_conversions,auto_win_min_duration:t.auto_win_min_duration,auto_win_chance_original:t.auto_win_chance_original};return this._validate_fields(i)},validate_title:function(t){return t?[]:[this.validation_error("title",ThriveAB.t.invalid_test_title)]},validate_auto_win_min_conversions:function(t){return isNaN(parseInt(t))?[this.validation_error("auto_win_min_conversions",ThriveAB.t.not_number_min_win_conversions)]:parseInt(t)<=0?[this.validation_error("auto_win_min_conversions",ThriveAB.t.greater_zero_min_win_conversions)]:[]},validate_auto_win_min_duration:function(t){return isNaN(parseInt(t))||parseInt(t)<=0?[this.validation_error("auto_win_min_duration",ThriveAB.t.invalid_auto_win_min_duration)]:[]},validate_auto_win_chance_original:function(t){return isNaN(parseInt(t))||parseInt(t)<=0||parseInt(t)>100?[this.validation_error("auto_win_chance_original",ThriveAB.t.invalid_auto_win_chance_original)]:[]},search_page_label:function(){var t="Search Page",e=this.get("type");return"monetary"===e?t="Thank you page":"visits"===e&&(t="Goal page"),t}})},9859:(t,e,i)=>{var s=i(4678);t.exports=s.extend({get_route:function(){return"route=traffic"}})},2837:(t,e,i)=>{var s=i(4678);t.exports=s.extend({defaults:function(){return _.extend(s.prototype.defaults(),{is_control:!1,traffic:0})},get_route:function(){return"route=variations"}})},6557:(t,e,i)=>{var s,a=i(1161),n=i(1173),r=i(9999),o=i(6665);s=jQuery,t.exports=Backbone.Router.extend({view:null,$el:s("#tab-dashboard-wrapper"),routes:{"dashboard(/:action)":"dashboard","test(/:id)":"reports"},dashboard:function(t){this.view&&this.view.remove(),"undefined"!=typeof ThriveAB?(this.view=new r({el:this.$el,model:new Backbone.Model(ThriveAB.page),collection:new n(ThriveAB.variations),archived:new n(ThriveAB.archived)}),"start-test"===t&&this.view.$("#thrive-ab-start-test").trigger("click"),this.check_license()):console.log("Thrive Optimize have not localized required data !")},reports:function(t){this.view&&this.view.remove();var e=new o(t?ThriveAB.running_test:ThriveAB.current_test);this.view=new a({el:this.$el,model:e}),this.check_license()},check_license:function(){ThriveAB.license.gp&&ThriveAB.license.show_lightbox?TVE_Dash.modal(TVE_Dash.views.LicenseModal,{model:{title:"Thrive Optimize",license_class:"grace-period",product_class:"tab",license_link:ThriveAB.license.link,grace_time:ThriveAB.license.grace_time},className:"tvd-modal tvd-license-modal tvd-modal-grace-period",width:"950px","max-width":"950px"}):ThriveAB.license.exp&&!ThriveAB.license.gp&&(TVE_Dash.modal(TVE_Dash.views.LicenseModal,{model:{title:"Thrive Optimize",license_class:"expired",product_class:"tab",license_link:ThriveAB.license.link},className:"tvd-modal tvd-license-modal tvd-modal-expired",no_close:!0,width:"950px",dismissible:!1,"max-width":"950px"}),s("#tab-admin-dashboard-wrapper").replaceWith(s("#tab-admin-dashboard-wrapper").clone()))}})},6663:t=>{var e;e=jQuery,t.exports={ajax:{get_url:function(t){var e=-1!==this.url.indexOf("?")?"&":"?";return t&&t.length?(t=t.replace(/^(\?|&)/,""),t+="&nonce="+this.nonce,this.url+e+t):this.url+e+"_nonce="+this.nonce},data:function(t,e,i,s){return{url:this.url,dataType:void 0===s?"json":s,type:e||"get",data:_.extend({action:this.action,custom:t,nonce:this.nonce},i||{}),error:function(t,e,i){if("function"!=typeof t.tcb_error||!1!==t.tcb_error.apply(t,arguments))if(TVE_Dash.hideLoader(),t.responseText)try{var s=JSON.parse(t.responseText);TVE_Dash.err(s.message)}catch(e){TVE_Dash.err(t.responseText)}else i=i?"Unexpected error: "+(t.status?t.status+": ":"")+i:"An unexpected error occurred. "+(t.status?" (Status code: "+t.status+")":""),TVE_Dash.err(i)}}},do:function(t,i,s,a){return e.ajax(this.data(t,i,s,a))}}}},6435:(t,e,i)=>{var s=i(2927),a=i(6054);t.exports=s.extend({className:"tvd-col tvd-l3 tvd-m6",template:TVE_Dash.tpl("html-archived-variation-card"),initialize:function(t){s.prototype.initialize.apply(this,t),this.published_variations=t.published_variations,this.archived_variations=t.archived_variations},delete:function(){return TVE_Dash.modal(a,{submit:_.bind((function(){this.remove(),this.model.destroy()}),this),model:this.model,btn_yes_txt:ThriveAB.t.delete_title,btn_no_txt:ThriveAB.t.cancel,title:ThriveAB.t.delete_variation,description:TVE_Dash.sprintf(ThriveAB.t.about_to_delete,this.model.get("post_title"))}),!1},restore:function(){var t=this;this.model.set("action","publish"),TVE_Dash.showLoader(),this.model.save(null,{success:function(e){e.collection=t.published_variations,t.published_variations.add(e),t.published_variations.equalize_traffic(),t.published_variations.save_distributed_traffic(),t.remove(),t.archived_variations.remove(e),TVE_Dash.success(ThriveAB.t.variation_added,1e3)},error:function(){TVE_Dash.err(ThriveAB.t.add_variation_error)},complete:function(){TVE_Dash.hideLoader()}})},render:function(){this.$el.html(this.template({item:this.model}))}})},2927:t=>{t.exports=Backbone.View.extend({events:{"click .click":"_call","input .input":"_call","change .change":"_call","mousedown .mousedown":"_call","mouseenter .mouseenter":"_call","mouseup .mouseup":"_call","keyup .keyup-enter":"_keyup_enter"},initialize:function(){this.render()},_call:function(t){if(t.currentTarget.disabled||t.currentTarget.classList.contains("tve-disabled"))return!1;var e=t.currentTarget.getAttribute("data-fn-"+t.type)||t.currentTarget.getAttribute("data-fn");if(e&&"__return_false"===e)return t.stopPropagation(),t.preventDefault(),!1;if("function"==typeof this[e])return this[e].call(this,t,t.currentTarget);if(e&&0===e.indexOf("f:")){for(var i=TVE,s=e.split(":")[1].split("."),a=window;i&&s.length;)a=i,i=i[s.shift()];if("function"==typeof i)return i.call(a,t)}},render:function(){}})},6332:t=>{t.exports=Backbone.Model.extend({defaults:function(){return{id:"",title:"",renderTo:"",type:"line",suffix:"",data:[]}},initialize:function(){var t=this.get("title"),e=this.get("type"),i=this.get("renderTo");this.chart=this.dochart(t,e,i)},empty:function(){for(;this.chart.series.length>0;)this.chart.series[0].remove(!0)},redraw:function(){var t=this.get("title"),e=this.get("data"),i=this.get("x_axis"),s=this.get("y_axis"),a=[],n=this.get("x_axis").length;for(var r in e){a.push(e[r].id);var o=this.chart.get(e[r].id);o?o.setData(e[r].data):this.chart.addSeries(e[r],!1,!1)}for(r=0;r13?Math.ceil(n/13):1}),this.chart.setTitle({text:t}),this.chart.yAxis[0].axisTitle&&this.chart.yAxis[0].axisTitle.attr({text:s}),this.chart.redraw(),this.chart.hideLoading()},showLoading:function(){this.chart.showLoading()},hideLoading:function(){this.chart.hideLoading()},dochart:function(t,e,i){var s=this;return new Highcharts.Chart({chart:{type:e,renderTo:i,style:{fontFamily:"Open Sans,sans-serif"}},colors:ThriveAB.chart_colors,yAxis:{allowDecimals:!1,title:{text:"Engagements"},min:0},xAxis:{id:"time_interval"},credits:{enabled:!1},title:{text:t},tooltip:{shared:!1,useHTML:!0,formatter:function(){return"scatter"!=this.series.type&&this.x+"
    "+this.series.name+": "+this.y+""+s.get("suffix")}},plotOptions:{series:{dataLabels:{shape:"callout",backgroundColor:"rgba(0, 0, 0, 0.75)",style:{color:"#FFFFFF",textShadow:"none"}},events:{legendItemClick:function(){"scatter"==this.type&&(this.visible?jQuery(".highcharts-data-labels").hide():jQuery(".highcharts-data-labels").show())}}}}})}})},9999:(t,e,i)=>{var s=i(2927),a=i(6730),n=i(6435),r=i(6665),o=i(2837),l=i(5606);t.exports=s.extend({template:TVE_Dash.tpl("dashboard/dashboard"),initialize:function(t){this.archived=t.archived,s.prototype.initialize.apply(this,arguments),this.listenTo(this.collection,"add",(function(t){this.render_variation(t),this.render_action_button(),this.toggle_traffic_control()})),this.listenTo(this.collection,"remove",(function(t){this.render_action_button(),this.toggle_traffic_control()})),this.listenTo(this.archived,"add",(function(t){this.render_archived_variation(t)}))},render_action_button:function(){this.$("#thrive-ab-start-test").toggleClass("top-hide-action",this.collection.length<2),this.$(".thrive-ab-display-archived-container").toggleClass("hide",this.archived.length<1)},render:function(){this.$el.html(this.template()),this.$list=this.$("#thrive-ab-card-list"),this.$archived_list=this.$("#thrive-ab-card-list-archived"),this.render_action_button(),this.collection.each((function(t,e,i){this.render_variation(t)}),this),this.archived.each((function(t,e,i){this.render_archived_variation(t)}),this)},render_archived_variation:function(t){var e=new n({model:t,archived_variations:this.archived,published_variations:this.collection});this.$archived_list.append(e.$el)},render_variation:function(t){var e=new a({model:t,archived_variations:this.archived,published_variations:this.collection}),i=this.$list.find("> .tvd-col").last();i.remove(),this.$list.append(e.$el),this.$list.append(i)},display_archived:function(){this.$archived_list.toggle(),this.$(".thrive-ab-display-archived").toggleClass("active")},add_new_variation:function(){var t=parseInt(100/(this.collection.length+1)),e=new o({post_parent:this.model.get("ID"),post_title:TVE_Dash.sprintf(ThriveAB.t.variation_no,this.collection.length+1),traffic:t});TVE_Dash.showLoader(),e.save(null,{success:_.bind((function(t){this.collection.add(t),t.collection.distribute_traffic(t),t.collection.save_distributed_traffic(),TVE_Dash.success(ThriveAB.t.variation_added,1e3)}),this),error:function(){TVE_Dash.err(ThriveAB.t.add_variation_error)},complete:_.bind((function(){TVE_Dash.hideLoader()}),this)})},start_test:function(){var t=new r({page_id:ThriveAB.page.ID,items:this.collection});return TVE_Dash.modal(l,{model:t,"max-width":"80%"}),!1},toggle_traffic_control:function(){1===this.collection.length?this.$(".thrive-ab-card-footer input").attr("disabled","disabled"):this.$(".thrive-ab-card-footer input").removeAttr("disabled")},equalize_traffic:function(){return this.collection.equalize_traffic(),this.collection.save_distributed_traffic(),!1}})},8784:(t,e,i)=>{var s=i(2927),a=i(8993);t.exports=s.extend({className:"test-item-form tvd-col tvd-s12",template:TVE_Dash.tpl("goals/page"),type:null,events:{"click .thrive-ab-remove-page":"remove_page"},initialize:function(t){t.test&&t.test instanceof Backbone.Model&&(this.test=t.test),this.model.set("type",this.test.get("type")),this.page_search_view=new a.view({model:this.model,goal_pages:this.test.get("goal_pages")}),this.page_search_view.test=this.test,this.goal_pages=this.test.get("goal_pages"),this.goal_pages||(this.goal_pages={}),this.listenTo(this.model,"change:revenue",this.onRevenueChange),this.listenTo(this.model,"change:post_id",this.onPostChange)},onPostChange:function(){null!=this.model.get("post_id")&&(this.goal_pages[this.model.get("post_id")]={post_id:this.model.get("post_id"),post_title:this.model.get("post_title"),revenue:this.model.get("revenue")},this.test.set("goal_pages",this.goal_pages))},onRevenueChange:function(){this.model.get("post_id")&&this.onPostChange()},render:function(){return this.$el.html(this.template({item:this.page_search_view.model,test:this.test})),setTimeout(_.bind((function(){TVE_Dash.materialize(this.$el)}),this),0),TVE_Dash.data_binder(this),this.$(".page-search").html(this.page_search_view.render().$el),this},remove_page:function(){delete this.goal_pages[this.model.get("post_id")],this.test.set("goal_pages",this.goal_pages),this.$el.unbind(),this.remove()}})},4710:(t,e,i)=>{function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}var a,n=i(5531);a=jQuery,t.exports=n.extend({template:TVE_Dash.tpl("goals/monetary-settings"),events:function(){var t=n.prototype.events.apply(this,arguments);return _.extend(t,{"change #thrive-ab-monetary-services":"on_service_change"})},render:function(){return this.$el.html(this.template({item:this.model})),this.$(".thrive-ab-monetary-service").hide(),this.init_services(),this.render_goal_pages(),this},on_service_change:function(t){var e=this.$(".thrive-ab-monetary-service"),i=t.currentTarget.value;e.hide(),this.model.set("service",i),i.length<=0||e.closest("#"+i).css("display","block")},init_services:function(){if(!(void 0===ThriveAB.monetary_services||ThriveAB.monetary_services.length<=0)){var t=this.$("#thrive-ab-monetary-services"),e=Object.keys(ThriveAB.monetary_services);_.each(ThriveAB.monetary_services,(function(e,i){var n=a("