import{P as t,aB as e,bj as s,bi as i,aJ as n,aQ as a,aO as o}from"../../../../vendor-element-plus.js?ver=3.1.10";import{c6 as l,aQ as r,W as c,X as d,ab as u,a5 as f,Z as _,aa as p,J as h,az as m,Y as b,a0 as y,a9 as g,a8 as v}from"../../../../vendor.js?ver=3.1.10";import{_ as $}from"../../../../fc-bits-ui.js?ver=3.1.10";const k={key:0,class:"fc_loading"},w={key:1,style:{padding:"10px 15px"},class:"fc_individual_progress"},z={style:{"margin-bottom":"15px"}},I={class:"fluentcrm_clickable"};const L=$({name:"LazyIndividualProgress",props:["subscriber_id","funnel"],data:()=>({funnel_subscriber:{},sequences:[],loading:!0,isLoaded:!1,MoreFilledIcon:t}),computed:{keyedMetrics(){return this.isLoaded?l(this.funnel_subscriber.metrics,"sequence_id"):{}},timelines(){if(!this.isLoaded)return[];let t=this.$t("Entrance (%s)",this.funnel.title);"pending"===this.funnel_subscriber.status?t+=this.$t("_In_Wfdoc"):"waiting"===this.funnel_subscriber.status&&(t+=this.$t("_In_Wfna"));const e=[{content:t,timestamp:this.nsHumanDiffTime(this.funnel_subscriber.created_at),size:"large",type:"primary",icon:this.MoreFilledIcon}];let s=!1;return this.each(this.sequences,(t,i)=>{const n=this.keyedMetrics[t.id]||{};let a=t.title;"pending"===a?a+=this.$t("_In_Wfdc"):"waiting"===a&&(a+=this.$t("_In_Wfna")),"conditional"==t.type&&(s=t);let o="";if(t.condition_type){o="fc_path_"+t.condition_type,s&&(o="fc_"+s.action_name+" "+o);let e=this.$t("Condition:")+" "+t.condition_type;if("funnel_ab_testing"==s.action_name){const s="yes"==t.condition_type?this.$t("B"):this.$t("A");e=this.$t("Path: ")+s,o+="_"+s}a+=" ( "+e+" )"}n.status||(o+=" fc_timeline_empty"),e.push({content:a,status:n.status,notes:n.notes,timestamp:this.nsHumanDiffTime(n.created_at),color:this.getTimelineColor(n),wrapper_class:o})}),e}},methods:{getTimelineColor:t=>t.status&&"completed"===t.status?"#0bbd87":"",fetchData(){this.loading=!0,this.$get(`funnels/${this.funnel.id}/subscribers/${this.subscriber_id}`).then(t=>{this.funnel_subscriber=t.funnel_subscriber,this.sequences=t.sequences}).catch(t=>{this.handleError(t)}).finally(()=>{this.loading=!1,this.isLoaded=!0})},maybeFetchData(){this.isLoaded||this.fetchData()}}},[["render",function(t,l,$,L,D,q){const W=e,j=a,x=n,C=i,F=s,M=r("router-link"),T=o;return c(),d("div",null,[u(T,{placement:"right",onShow:l[0]||(l[0]=t=>q.maybeFetchData()),width:"400","popper-class":"fc_individual_progress_popover",trigger:"click"},{reference:f(()=>[_("span",I,p($.funnel.title),1)]),default:f(()=>[_("div",null,[D.loading?(c(),d("div",k,[u(W,{loading:!0,rows:3})])):D.isLoaded?(c(),d("div",w,[_("div",z,p(t.$t("Current Status:"))+" "+p(D.funnel_subscriber.status),1),u(F,null,{default:f(()=>[(c(!0),d(h,null,m(q.timelines,(t,e)=>(c(),b(C,{key:e,class:y(t.wrapper_class),icon:t.icon,type:t.type,color:t.color,size:t.size,timestamp:t.timestamp},{default:f(()=>[g(p(t.content)+" ",1),_("template",null,[t.notes?(c(),b(x,{key:0,class:"item",effect:"dark",content:t.notes,placement:"top-start"},{default:f(()=>[u(j,{size:"small",type:"info"},{default:f(()=>[g(p(t.status),1)],void 0,!0),_:2},1024)],void 0,!0),_:2},1032,["content"])):t.status?(c(),b(j,{key:1,size:"small",type:"info"},{default:f(()=>[g(p(t.status),1)],void 0,!0),_:2},1024)):v("",!0)])],void 0,!0),_:2},1032,["class","icon","type","color","size","timestamp"]))),128))],void 0,!0),_:1}),u(M,{to:{name:"edit_funnel",params:{funnel_id:this.funnel.id}}},{default:f(()=>[g(p(t.$t("View Automation Steps")),1)],void 0,!0),_:1},8,["to"])])):v("",!0)])],void 0),_:1})])}]]);export{L as default};
