import{ay as e,aL as t,aK as l,aD as s,aA as a,aw as o,e as i,aY as n,az as r,ax as d,aC as c,aB as u,k as m,aT as p,i as h,aG as _,E as f,aQ as b,B as y,at as g,aE as v,aF as w,ar as k,aO as x,U as $,aj as C,av as V,g as S,aI as A,aH as F,b2 as P,b3 as T,a4 as R,a6 as O,L as B,ac as D,aJ as M}from"./vendor-element-plus.js?ver=3.1.0";import{T as j,E as L,u as I}from"./Tagger.js?ver=3.1.0";import{F as z}from"./Filterer.js?ver=3.1.0";import{c as U,L as q,o as E,P as Y,K as W,a as N,w as H,Q as G,as as J,bG as K,bH as Q,bI as Z,b as X,d as ee,R as te,bF as le,r as se,O as ae,n as oe,F as ie,bJ as ne,aR as re,aB as de,a1 as ce}from"./vendor.js?ver=3.1.0";import{_ as ue,I as me,a as pe,T as he}from"./fc-bits-ui.js?ver=3.1.0";import{F as _e}from"./Filterer2.js?ver=3.1.0";import{s as fe}from"./data_config.js?ver=3.1.0";import{S as be}from"./Searcher.js?ver=3.1.0";import{P as ye}from"./PaginationBar.js?ver=3.1.0";import{D as ge}from"./DataTable.js?ver=3.1.0";import{F as ve}from"./FloatingBulkActionShell.js?ver=3.1.0";import{C as we}from"./Confirm.js?ver=3.1.0";import{O as ke}from"./_OptionSelector.js?ver=3.1.0";import xe from"./v3app/src/Modules/Contacts/Filter/FilterPopover.js?ver=3.1.0";import $e from"./v3app/src/Modules/Contacts/Filter/ActiveFiltersBar.js?ver=3.1.0";import{_ as Ce,E as Ve}from"./fc-bits.js?ver=3.1.0";import{I as Se}from"./_IntlTelInput.js?ver=3.1.0";import{B as Ae}from"./Badge.js?ver=3.1.0";import{g as Fe,a as Pe}from"./relations.js?ver=3.1.0";import{c as Te}from"./clipboard.js?ver=3.1.0";const Re={key:0,class:"el-form-item__error"};const Oe=ue({name:"Error",props:["error"]},[["render",function(e,t,l,s,a,o){return l.error?(E(),U("span",Re,Y(l.error),1)):q("",!0)}]]);const Be=ue({name:"CompanySelector",props:["modelValue","field"],emits:["update:modelValue"],data(){return{model:this.modelValue,results:[],loading:!1,doing_ajax:!1}},watch:{model(e){this.$emit("update:modelValue",e)}},methods:{fetchOptions(e){if(this.hasPermission("fcrm_manage_contact_cats"))return!this.doing_ajax&&void(window.fc_all_company_cache?this.results=window.fc_all_company_cache:(this.loading=!0,this.doing_ajax=!0,this.$get("companies/search",{search:e,values:this.model}).then(e=>{this.results=e.results,e.has_more||(window.fc_all_company_cache=e.results,this.field.cacheable=!0)}).catch(e=>{this.handleError(e)}).finally(()=>{this.loading=!1,this.doing_ajax=!1})))}},mounted(){this.fetchOptions("")}},[["render",function(s,a,o,i,n,r){const d=t,c=l,u=e;return W((E(),N(c,{modelValue:n.model,"onUpdate:modelValue":a[0]||(a[0]=e=>n.model=e),multiple:o.field.is_multiple,filterable:"",remote:!o.field.cacheable,clearable:o.field.clearable,disabled:o.field.disabled,"reserve-keyword":"",size:o.field.size,placeholder:o.field.placeholder||s.$t("Please enter a keyword"),"remote-method":r.fetchOptions},{default:H(()=>[(E(!0),U(G,null,J(n.results,e=>(E(),N(d,{key:e.id,label:e.name,value:e.id},null,8,["label","value"]))),128))],void 0),_:1},8,["modelValue","multiple","remote","clearable","disabled","size","placeholder","remote-method"])),[[u,n.loading]])}]]),De={key:0,class:"fcrm_date_parts_picker"},Me={class:"fcrm_date_picker_month"};const je=ue({name:"DateDropDownPicker",props:["modelValue"],emits:["update:modelValue"],data(){return{appReady:!1,dateParts:{day:"",month:"",year:""},months:[{label:this.$t("January"),value:"01"},{label:this.$t("February"),value:"02"},{label:this.$t("March"),value:"03"},{label:this.$t("April"),value:"04"},{label:this.$t("May"),value:"05"},{label:this.$t("June"),value:"06"},{label:this.$t("July"),value:"07"},{label:this.$t("August"),value:"08"},{label:this.$t("September"),value:"09"},{label:this.$t("October"),value:"10"},{label:this.$t("November"),value:"11"},{label:this.$t("December"),value:"12"}],days:[],years:[]}},watch:{dateParts:{handler(){this.appReady&&this.pushDate()},deep:!0}},methods:{initDateParts(){if(this.modelValue){const e=window.dayjs?window.dayjs(this.modelValue):this.$dayjs(this.modelValue);this.dateParts.day=e.format("DD"),this.dateParts.month=e.format("MM"),this.dateParts.year=e.format("YYYY")}this.$nextTick(()=>{this.appReady=!0})},range:K,pushDate(){const{day:e,month:t,year:l}=this.dateParts;if(e&&t&&l){const s=(window.dayjs||this.$dayjs)(`${l}-${t}-${e}`);if(!s.isValid())return void this.$emit("update:modelValue","");this.$emit("update:modelValue",s.format("YYYY-MM-DD"))}else this.$emit("update:modelValue","")}},mounted(){this.days=Q(K(1,32),e=>Z(e,2,"0")),this.years=K((new Date).getFullYear(),1899),this.initDateParts()}},[["render",function(e,s,a,o,i,n){const r=t,d=l;return i.appReady?(E(),U("div",De,[X("div",null,[ee(d,{clearable:"",modelValue:i.dateParts.day,"onUpdate:modelValue":s[0]||(s[0]=e=>i.dateParts.day=e),placeholder:e.$t("Day")},{default:H(()=>[(E(!0),U(G,null,J(i.days,e=>(E(),N(r,{key:e,label:e,value:e},null,8,["label","value"]))),128))],void 0),_:1},8,["modelValue","placeholder"]),W(X("p",null,Y(e.$t("Day")),513),[[te,i.dateParts.day]])]),X("div",Me,[ee(d,{clearable:"",modelValue:i.dateParts.month,"onUpdate:modelValue":s[1]||(s[1]=e=>i.dateParts.month=e),placeholder:e.$t("Month")},{default:H(()=>[(E(!0),U(G,null,J(i.months,e=>(E(),N(r,{key:e.value,label:e.label,value:e.value},null,8,["label","value"]))),128))],void 0),_:1},8,["modelValue","placeholder"]),W(X("p",null,Y(e.$t("Month")),513),[[te,i.dateParts.month]])]),X("div",null,[ee(d,{clearable:"",filterable:"",modelValue:i.dateParts.year,"onUpdate:modelValue":s[2]||(s[2]=e=>i.dateParts.year=e),placeholder:e.$t("Year")},{default:H(()=>[(E(!0),U(G,null,J(i.years,e=>(E(),N(r,{key:e,label:e,value:e},null,8,["label","value"]))),128))],void 0),_:1},8,["modelValue","placeholder"]),W(X("p",null,Y(e.$t("Year")),513),[[te,i.dateParts.year]])])])):q("",!0)}]]),Le=le(()=>Ce(()=>import("./v3app/src/Modules/Profile/Parts/_CustomFields.js?ver=3.1.0"),[],import.meta.url)),Ie={key:0,class:"fcrm_address_block"},ze=["innerHTML"],Ue=["innerHTML"],qe={class:"fcrm_identifier_section"},Ee={class:"fcrm_section_heading"},Ye={class:"fcrm_identifier_content"},We={class:"fcrm_identifier_row"},Ne={key:0,class:"fcrm_identifier_field"},He={key:1,class:"fcrm_identifier_field"},Ge={class:"fcrm_identifier_field_full"};const Je=ue({name:"Form",components:{Error:Oe,CustomFields:Le,CompanySelector:Be,OptionSelector:ke,DateDropDownPicker:je,IntlTelInput:Se},props:{subscriber:{required:!0,type:Object},errors:{required:!0,type:Object},listId:{default:null},tagId:{default:null},company_id:{default:null}},data(){return{show_address:!1,show_custom_data:!1,countries:window.fcAdmin.countries,name_prefixes:window.fcAdmin.contact_prefixes,phoneValue:"",phoneIsValid:!0,options:{statuses:this.appVars.available_contact_statuses,contact_types:this.appVars.available_contact_types,custom_fields:this.appVars.available_custom_fields}}},watch:{"subscriber.phone":{handler(e){this.phoneValue=e||""},immediate:!0},phoneValue(e){this.subscriber.phone=e||""}},methods:{disabledDate:e=>e.getTime()>=Date.now(),onPhoneValidate(e){this.phoneIsValid=!e||!!e.valid,e&&e.number?this.subscriber.phone=e.number:this.subscriber.phone=this.phoneValue||""},onPhoneBlur(){this.subscriber.phone||(this.subscriber.phone=this.phoneValue||"")}}},[["render",function(e,c,u,m,p,h){const _=t,f=l,b=o,y=a,g=s,v=i,w=se("error"),k=se("IntlTelInput"),x=n,$=se("company-selector"),C=r,V=se("custom-fields"),S=se("option-selector"),A=d;return E(),N(A,{class:"fcrm_add_contact_form","label-position":"top","label-width":"100px"},{default:H(()=>[ee(g,{gutter:20},{default:H(()=>[ee(y,{md:8,sm:24,xs:24},{default:H(()=>[ee(b,{class:"fcrm_prefix_select",label:e.$t("Prefix")},{default:H(()=>[ee(f,{modelValue:u.subscriber.prefix,"onUpdate:modelValue":c[0]||(c[0]=e=>u.subscriber.prefix=e),placeholder:e.$t("Select Prefix"),clearable:""},{default:H(()=>[(E(!0),U(G,null,J(p.name_prefixes,e=>(E(),N(_,{key:e,label:e,value:e},null,8,["label","value"]))),128))],void 0,!0),_:1},8,["modelValue","placeholder"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1})],void 0,!0),_:1}),ee(g,{gutter:20},{default:H(()=>[ee(y,{md:12,sm:24,xs:24},{default:H(()=>[ee(b,{label:e.$t("First Name")},{default:H(()=>[ee(v,{modelValue:u.subscriber.first_name,"onUpdate:modelValue":c[1]||(c[1]=e=>u.subscriber.first_name=e),placeholder:e.$t("e.g. John"),clearable:"",autocomplete:"off"},null,8,["modelValue","placeholder"]),ee(w,{error:u.errors.get("first_name")},null,8,["error"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),ee(y,{md:12,sm:24,xs:24},{default:H(()=>[ee(b,{label:e.$t("Last Name")},{default:H(()=>[ee(v,{modelValue:u.subscriber.last_name,"onUpdate:modelValue":c[2]||(c[2]=e=>u.subscriber.last_name=e),placeholder:e.$t("e.g. Doe"),clearable:"",autocomplete:"off"},null,8,["modelValue","placeholder"]),ee(w,{error:u.errors.get("last_name")},null,8,["error"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1})],void 0,!0),_:1}),ee(g,{gutter:20},{default:H(()=>[ee(y,{md:12,sm:24,xs:24},{default:H(()=>[ee(b,{label:e.$t("Email"),class:"fcrm_is-required"},{default:H(()=>[ee(v,{modelValue:u.subscriber.email,"onUpdate:modelValue":c[3]||(c[3]=e=>u.subscriber.email=e),placeholder:e.$t("you@example.com"),clearable:"",autocomplete:"off",type:"email"},null,8,["modelValue","placeholder"]),ee(w,{error:u.errors.get("email")},null,8,["error"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),ee(y,{md:12,sm:24,xs:24},{default:H(()=>[ee(b,{label:e.$t("Phone")},{default:H(()=>[ee(k,{modelValue:p.phoneValue,"onUpdate:modelValue":c[4]||(c[4]=e=>p.phoneValue=e),placeholder:e.$t("+155555555"),onValidate:h.onPhoneValidate,onBlur:h.onPhoneBlur,class:"fcrm_phone_input"},null,8,["modelValue","placeholder","onValidate","onBlur"]),p.phoneIsValid?q("",!0):(E(),N(w,{key:0,error:e.$t("Invalid phone number")},null,8,["error"]))],void 0,!0),_:1},8,["label"])],void 0,!0),_:1})],void 0,!0),_:1}),ee(g,{gutter:20},{default:H(()=>[ee(y,{md:12,sm:24,xs:24},{default:H(()=>[ee(b,{label:e.$t("Date of Birth")},{default:H(()=>[ee(x,{type:"date",format:"DD/MM/YYYY","value-format":"YYYY-MM-DD","disabled-date":h.disabledDate,placeholder:e.$t("DD/MM/YYYY"),editable:!1,modelValue:u.subscriber.date_of_birth,"onUpdate:modelValue":c[5]||(c[5]=e=>u.subscriber.date_of_birth=e),style:{width:"100%"}},null,8,["disabled-date","placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),e.has_company_module&&!u.company_id?(E(),N(y,{key:0,md:12,sm:24,xs:24},{default:H(()=>[ee(b,{label:e.$t("Company / Business")},{default:H(()=>[ee($,{field:{is_multiple:!1,creatable:!0},modelValue:u.subscriber.company_id,"onUpdate:modelValue":c[6]||(c[6]=e=>u.subscriber.company_id=e)},null,8,["modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1})):q("",!0)],void 0,!0),_:1}),ee(b,null,{default:H(()=>[ee(C,{modelValue:p.show_address,"onUpdate:modelValue":c[7]||(c[7]=e=>p.show_address=e)},{default:H(()=>[ae(Y(e.$t("Add Address Info")),1)],void 0,!0),_:1},8,["modelValue"])],void 0,!0),_:1}),p.show_address?(E(),U("div",Ie,[ee(g,{gutter:20},{default:H(()=>[ee(y,{md:12},{default:H(()=>[ee(b,{label:e.$t("Address Line 1")},{default:H(()=>[ee(v,{placeholder:e.$t("Enter street address"),autocomplete:"new-password",modelValue:u.subscriber.address_line_1,"onUpdate:modelValue":c[8]||(c[8]=e=>u.subscriber.address_line_1=e)},null,8,["placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),ee(y,{md:12},{default:H(()=>[ee(b,{label:e.$t("Address Line 2 (Optional)")},{default:H(()=>[ee(v,{placeholder:e.$t("Enter apartment, suite, unit"),autocomplete:"new-password",modelValue:u.subscriber.address_line_2,"onUpdate:modelValue":c[9]||(c[9]=e=>u.subscriber.address_line_2=e)},null,8,["placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),ee(y,{md:12},{default:H(()=>[ee(b,{label:e.$t("City")},{default:H(()=>[ee(v,{placeholder:e.$t("Enter city"),autocomplete:"new-password",modelValue:u.subscriber.city,"onUpdate:modelValue":c[10]||(c[10]=e=>u.subscriber.city=e)},null,8,["placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),ee(y,{md:12},{default:H(()=>[ee(b,{label:e.$t("State")},{default:H(()=>[ee(v,{placeholder:e.$t("Enter state / province"),autocomplete:"new-password",modelValue:u.subscriber.state,"onUpdate:modelValue":c[11]||(c[11]=e=>u.subscriber.state=e)},null,8,["placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),ee(y,{md:12},{default:H(()=>[ee(b,{label:e.$t("Postal Code")},{default:H(()=>[ee(v,{placeholder:e.$t("Enter postal code"),autocomplete:"new-password",modelValue:u.subscriber.postal_code,"onUpdate:modelValue":c[12]||(c[12]=e=>u.subscriber.postal_code=e)},null,8,["placeholder","modelValue"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1}),ee(y,{md:12},{default:H(()=>[ee(b,{label:e.$t("Country")},{default:H(()=>[ee(f,{modelValue:u.subscriber.country,"onUpdate:modelValue":c[13]||(c[13]=e=>u.subscriber.country=e),clearable:"",filterable:"",autocomplete:"off",placeholder:e.$t("Select Country"),class:"fcrm_el-select-multiple"},{label:H(({label:e})=>[X("span",{innerHTML:e},null,8,ze)]),default:H(()=>[(E(!0),U(G,null,J(p.countries,e=>(E(),N(_,{key:e.code,value:e.code,label:e.title},{default:H(()=>[X("span",{innerHTML:e.title},null,8,Ue)],void 0,!0),_:2},1032,["value","label"]))),128))],void 0,!0),_:1},8,["modelValue","placeholder"])],void 0,!0),_:1},8,["label"])],void 0,!0),_:1})],void 0,!0),_:1})])):q("",!0),p.options.custom_fields.length?(E(),N(b,{key:1},{default:H(()=>[ee(C,{modelValue:p.show_custom_data,"onUpdate:modelValue":c[14]||(c[14]=e=>p.show_custom_data=e)},{default:H(()=>[ae(Y(e.$t("Add Custom Data")),1)],void 0,!0),_:1},8,["modelValue"])],void 0,!0),_:1})):q("",!0),p.show_custom_data?(E(),N(V,{key:2,subscriber:u.subscriber,custom_fields:p.options.custom_fields},null,8,["subscriber","custom_fields"])):q("",!0),X("section",qe,[X("div",Ee,Y(e.$t("Identifiers")),1),X("div",Ye,[X("div",We,[u.listId?q("",!0):(E(),U("div",Ne,[ee(b,{label:e.$t("Lists")},{default:H(()=>[ee(S,{modelValue:u.subscriber.lists,"onUpdate:modelValue":c[15]||(c[15]=e=>u.subscriber.lists=e),field:{placeholder:e.$t("Select Lists"),is_multiple:!0,creatable:!0,option_key:"lists"}},null,8,["modelValue","field"])],void 0,!0),_:1},8,["label"])])),u.tagId?q("",!0):(E(),U("div",He,[ee(b,{label:e.$t("Tags")},{default:H(()=>[ee(S,{modelValue:u.subscriber.tags,"onUpdate:modelValue":c[16]||(c[16]=e=>u.subscriber.tags=e),field:{placeholder:e.$t("Select Tags"),is_multiple:!0,creatable:!0,option_key:"tags"}},null,8,["modelValue","field"])],void 0,!0),_:1},8,["label"])]))]),X("div",Ge,[ee(b,{label:e.$t("Customer Status"),class:"fcrm_is-required"},{default:H(()=>[ee(f,{modelValue:u.subscriber.status,"onUpdate:modelValue":c[17]||(c[17]=e=>u.subscriber.status=e),placeholder:e.$t("Select Status")},{default:H(()=>[(E(!0),U(G,null,J(p.options.statuses,t=>(E(),N(_,{key:t.id,label:e.ucFirst(t.title),value:t.id},null,8,["label","value"]))),128))],void 0,!0),_:1},8,["modelValue","placeholder"]),ee(w,{error:u.errors.get("status")},null,8,["error"])],void 0,!0),_:1},8,["label"])])])]),"pending"===u.subscriber.status?(E(),N(g,{key:3},{default:H(()=>[ee(y,null,{default:H(()=>[ee(C,{modelValue:u.subscriber.double_optin,"onUpdate:modelValue":c[18]||(c[18]=e=>u.subscriber.double_optin=e)},{default:H(()=>[ae(Y(e.$t("Enable Double-Optin Email Confirmation")),1)],void 0,!0),_:1},8,["modelValue"])],void 0,!0),_:1})],void 0,!0),_:1})):q("",!0)],void 0),_:1})}]]),Ke={style:{margin:"0 -10px",display:"block"}};const Qe={class:"fcrm_contact_form_handler"},Ze={class:"fcrm_add_contact_footer"},Xe={class:"fcrm_add_contact_footer_link"},et={class:"fcrm_add_contact_footer_actions"};const tt=ue({name:"ContactFormHandler",props:["listId","tagId","company_id","form_class"],emits:["cancel","created"],components:{SkeletonLoading:ue({name:"SkeletonLoading"},[["render",function(e,t,l,s,o,i){const n=c,r=a,d=u;return E(),N(d,{animated:"",style:{"margin-top":"50px"}},{template:H(()=>[X("div",Ke,[ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:4},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:8},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:12},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:12},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:12},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:4},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:4},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:4},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:12},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:24},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:24},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:8},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:8},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1}),ee(r,{style:{padding:"0 10px","margin-bottom":"22px"},span:8},{default:H(()=>[ee(n,{variant:"text",style:{height:"40px"}})],void 0,!0),_:1})])]),_:1})}]]),Forma:Je},data(){return{exist:!1,errors:new Ve,subscriber:this.fresh(),creating:!1}},methods:{fresh:()=>({first_name:null,last_name:null,email:null,phone:"",date_of_birth:"",status:"subscribed",address_line_1:"",address_line_2:"",city:"",state:"",postal_code:"",country:"",tags:[],lists:[],custom_values:{},double_optin:!1}),save(e=!1){if(this.errors.clear(),!this.subscriber.email)return void this.$notify.error({message:this.$t("Email field is required"),offset:19});const t={...this.subscriber};this.listId&&(t.lists=[this.listId]),this.tagId&&(t.tags=[this.tagId]),this.company_id&&(t.company_id=this.company_id),this.creating=!0,this.$post("subscribers",t).then(t=>{this.$notify.success({title:this.$t("Great!"),message:t.message,offset:19}),this.$emit("created",t.contact,e)}).catch(e=>{this.errors.record(e),e.subscriber&&(this.exist=e.subscriber)}).finally(()=>{this.creating=!1}),this.subscriber=this.fresh()},cancel(){this.$emit("cancel")}}},[["render",function(e,t,l,s,a,o){const i=se("SkeletonLoading"),n=se("forma"),r=m;return E(),U("div",Qe,[a.creating?(E(),N(i,{key:0,class:"fcrm_p_20"})):(E(),N(n,{key:1,"list-id":l.listId,"tag-id":l.tagId,errors:a.errors,subscriber:a.subscriber,company_id:l.company_id,class:oe(l.form_class)},null,8,["list-id","tag-id","errors","subscriber","company_id","class"])),X("div",Ze,[X("div",Xe,[ee(r,{link:"",onClick:t[0]||(t[0]=e=>o.save(!0))},{default:H(()=>[ae(Y(e.$t("Create & Add Another")),1)],void 0),_:1})]),X("div",et,[ee(r,{onClick:t[1]||(t[1]=e=>o.cancel())},{default:H(()=>[ae(Y(e.$t("Cancel")),1)],void 0),_:1}),ee(r,{type:"primary",onClick:t[2]||(t[2]=e=>o.save())},{default:H(()=>[ae(Y(e.$t("Create Contact")),1)],void 0),_:1})])])])}]]),lt={name:"Adder",components:{FormHandler:tt},props:{visible:Boolean,listId:[String,Number],tagId:[String,Number],options:{type:Object,default:null}},emits:["close","fetch"],data(){return{showing:this.visible,direction:"rtl"}},watch:{visible(e){this.showing=e}},methods:{handleCreated(e,t){!0===t?(this.showing=!0,this.$emit("fetch")):(this.showing=!1,this.$router.push({name:"subscriber",params:{id:e.id}}),this.$emit("close"))},handleCancel(){this.showing=!1,this.$emit("close")}},mounted(){window.fcAdmin&&window.fcAdmin.is_rtl&&(this.direction="ltr")}},st={key:0,class:"fcrm_company_drawer_content"};const at=ue(lt,[["render",function(e,t,l,s,a,o){const i=se("form-handler"),n=p;return E(),N(n,{class:"fcrm_company_info_drawer",size:"820","append-to-body":!0,modelValue:a.showing,"onUpdate:modelValue":t[0]||(t[0]=e=>a.showing=e),"with-header":!0,direction:a.direction,title:e.$t("Add New Contact")},{default:H(()=>[a.showing?(E(),U("div",st,[ee(i,{onCreated:o.handleCreated,onCancel:o.handleCancel,listId:l.listId,tagId:l.tagId,form_class:"fcrm_p_20"},null,8,["onCreated","onCancel","listId","tagId"])])):q("",!0)],void 0),_:1},8,["modelValue","direction","title"])}]]),ot={name:"Filters",components:{Filterer:z},emits:["filter","search"],props:{type:{required:!0},options:{required:!0,type:Array},selected:{required:!0},count:{required:!0,type:Number},noMatch:{required:!0,type:Boolean}},data:()=>({query:null,placement:"bottom-start"}),computed:{selection:{get(){return this.selected},set(e){this.$emit("filter",e)}},parsedOptions(){let e=[];return"statuses"!=this.type?this.each(this.options,t=>{e.push({id:parseInt(t.id),title:t.title,slug:t.slug})}):e=this.options,e}},methods:{search(){this.$emit("search",this.query&&this.query.toLowerCase())},deselect(e){const t=this.selection.indexOf(e.slug);this.selection.splice(t,1),this.$emit("filter",this.selection)}},mounted(){this.appVars.is_rtl&&(this.placement="bottom-end")}},it={class:"fcrm_fluentcrm-filterer"},nt={key:0,class:"fcrm_fluentcrm-meta"};const rt=ue(ot,[["render",function(e,t,l,s,a,o){const n=se("ArrowDown"),d=f,c=m,u=i,p=h,y=r,g=_,v=se("filterer"),w=b;return E(),U("div",it,[ee(v,{placement:a.placement,filter_type:l.type,class:oe({"fcrm_fluentcrm-filtered":o.selection.length})},{header:H(()=>[ee(c,{plain:"",size:"small"},{default:H(()=>[ae(Y(e.$t("Filtered by"))+" "+Y(e.ucFirst(e.trans(l.type)))+" ",1),ee(d,{class:"el-icon--right"},{default:H(()=>[ee(n)],void 0,!0),_:1})],void 0,!0),_:1})]),items:H(()=>[ee(p,{class:"fcrm_fluentcrm-filter-option fcrm_dropdown-search-item fcrm_no-hover"},{default:H(()=>[ee(u,{size:"small",modelValue:a.query,"onUpdate:modelValue":t[0]||(t[0]=e=>a.query=e),placeholder:e.$t("Search..."),onInput:o.search,class:"fcrm_input"},null,8,["modelValue","placeholder","onInput"])],void 0,!0),_:1}),ee(p,{class:"fcrm_fluentcrm-filter-option fcrm_dropdown-items-label"},{default:H(()=>[ae(Y(e.$t("Choose an option:")),1)],void 0,!0),_:1}),ee(g,{modelValue:o.selection,"onUpdate:modelValue":t[1]||(t[1]=e=>o.selection=e),class:"fcrm_fluentcrm-filter-options fcrm_checkbox_group"},{default:H(()=>[(E(!0),U(G,null,J(o.parsedOptions,e=>(E(),N(y,{key:e.id,value:e.id,class:"el-dropdown-menu__item fcrm_checkbox"},{default:H(()=>[ae(Y(e.title),1)],void 0,!0),_:2},1032,["value"]))),128))],void 0,!0),_:1},8,["modelValue"]),l.noMatch?(E(),N(p,{key:0,class:"fcrm_fluentcrm-filter-option"},{default:H(()=>[X("p",null,Y(e.$t("No items found")),1)],void 0,!0),_:1})):q("",!0)]),_:1},8,["placement","filter_type","class"]),o.selection.length?(E(),U("div",nt,[(E(!0),U(G,null,J(o.parsedOptions,e=>(E(),U(G,{key:e.id},[-1!=l.selected.indexOf(e.id)?(E(),N(w,{key:0,closable:"",onClose:t=>o.deselect(e)},{default:H(()=>[ae(Y(e.title),1)],void 0),_:2},1032,["onClose"])):q("",!0)],64))),128))])):q("",!0)])}]]),dt={class:"fcrm_filter-manager"},ct={style:{padding:"10px","text-align":"center"}};const ut=ue({name:"Manager",props:["type","matched","options","selected","selection","subscribers","selectionCount","total_match"],emits:["filter"],data(){return{placement:"bottom-start",new_payload:!1,filterLabel:this.$t("Filters.instruction")}},components:{Editor:L,Filters:rt},mixins:[j],methods:{filter(e){this.$emit("filter",this.payload(e))},updatePayLoad(e){this.new_payload=e},pushPayload(){this.new_payload?(this.subscribe(this.new_payload),setTimeout(()=>{this.new_payload=!1},500)):this.$notify.error(this.$t("No changes found"))}},mounted(){this.appVars.is_rtl&&(this.placement="bottom-end")}},[["render",function(e,t,l,s,a,o){const i=m,n=se("editor"),r=se("filters");return E(),U("div",dt,[l.selection?(E(),N(n,{key:0,type:l.type,options:e.choices,noMatch:e.noMatch,matched:l.matched,selectionCount:l.selectionCount,onSearch:e.search,onSubscribe:o.updatePayLoad,placement:a.placement},{footer:H(()=>[X("div",ct,[ee(i,{disabled:!a.new_payload,onClick:t[0]||(t[0]=e=>o.pushPayload()),style:{width:"100%"},type:"success",size:"small"},{default:H(()=>[ae(Y(e.$t("Confirm")),1)],void 0,!0),_:1},8,["disabled"])])]),_:1},8,["type","options","noMatch","matched","selectionCount","onSearch","onSubscribe","placement"])):(E(),N(r,{key:1,type:l.type,options:e.choices,noMatch:e.noMatch,selected:l.selected,count:l.total_match,onSearch:e.search,onFilter:o.filter,add_label:a.filterLabel},null,8,["type","options","noMatch","selected","count","onSearch","onFilter","add_label"]))])}]]),mt={class:"icon"},pt={class:"fcrm_checkbox_group_label"};const ht=ue({name:"ColumnToggler",components:{Icons:me,Filterer:_e,Setting:y},props:{placement:{type:String,default:"bottom-start"}},emits:["input","update:modelValue","dataChanged"],data:()=>({selection:[],subscriberColumns:fe}),computed:{columnGroups(){this.has_company_module&&(window.fc_primary_company_pushed||(fe.push({label:this.$t("Primary Company"),value:"primary_company",position:4}),window.fc_primary_company_pushed=!0),window.fc_companies_pushed||(fe.push({label:this.$t("Companies"),value:"companies",position:4}),window.fc_companies_pushed=!0));let e=fe;"yes"!==this.appVars.sms_enabled&&(e=fe.filter(e=>"sms_status"!==e.value));const t=[{slug:"subscriber",label:this.$t("Primary Fields"),fields:e}];this.appVars.commerce_provider&&t.push({slug:"commerce",label:this.$t("Commerce Fields"),fields:[{label:this.$t("Lifetime Value"),value:"commerce.total_order_value",position:1},{label:this.$t("Purchase Count"),value:"commerce.total_order_count",position:2},{label:this.$t("Customer Since"),value:"commerce.first_order_date",position:3},{label:this.$t("Last Purchase Date"),value:"commerce.last_order_date",position:3}]});const l=[];return this.each(this.appVars.contact_custom_fields,(e,t)=>{l.push({label:e.label,value:e.slug,position:t+10})}),l.length&&t.push({slug:"custom_fields",label:this.$t("Custom Fields"),fields:l}),t}},methods:{init(){const e=this.storage.get("columns");e?(this.selection=e,this.fire()):(this.selection=["tags","lists","status"],this.save())},save(){var e;this.storage.set("columns",this.selection),null==(e=this.$refs.filterer)||e.hide(),this.fire()},fire(){this.$emit("input",this.selection),this.$emit("update:modelValue",this.selection),setTimeout(()=>{this.$emit("dataChanged",this.selection)},400)}},mounted(){this.init()}},[["render",function(e,t,l,s,a,o){const i=se("Icons"),n=m,d=r,c=_,u=h,p=se("filterer");return E(),N(p,{ref:"filterer",placement:l.placement},{header:H(()=>[ee(n,{size:"small",class:"small only-icon-btn"},{default:H(()=>[X("span",mt,[ee(i,{"icon-name":"column"})])],void 0,!0),_:1})]),items:H(()=>[ee(c,{modelValue:a.selection,"onUpdate:modelValue":t[0]||(t[0]=e=>a.selection=e),class:"fcrm_filter-options fcrm_checkbox_group fcrm_column_toggler_checks"},{default:H(()=>[(E(!0),U(G,null,J(o.columnGroups,(e,t)=>(E(),U(G,{key:t},[X("div",pt,Y(e.label),1),(E(!0),U(G,null,J(e.fields,(e,l)=>(E(),U("div",{key:t+" "+l,class:"el-dropdown-menu__item"},[ee(d,{value:e.value,class:"fcrm_checkbox"},{default:H(()=>[ae(Y(e.label),1)],void 0,!0),_:2},1032,["value"])]))),128))],64))),128))],void 0,!0),_:1},8,["modelValue"])]),footer:H(()=>[ee(u,{class:"fcrm_no-hover"},{default:H(()=>[ee(n,{type:"primary",size:"small",style:{width:"100%"},onClick:o.save},{default:H(()=>[ie(e.$slots,"btn-label",{},()=>[ae(Y(e.$t("Save")),1)])],void 0,!0),_:3},8,["onClick"])],void 0,!0),_:3})]),_:3},8,["placement"])}]]);const _t=ue({name:"PropertyChanger",components:{Filterer:z,ArrowDown:g},props:["options","label","prop_key","selectedSubscribers"],emits:["fetch"],data:()=>({selected_item:""}),methods:{save(){this.changeSubscribersProperty({type:this.prop_key,value:this.selected_item})},changeSubscribersProperty(e){const{type:t,value:l}=e;l?(this.loading=!0,this.$put("subscribers/subscribers-property",{property:t,value:l,subscribers:this.selectedSubscribers.map(e=>e.id)}).then(e=>{this.$notify.success(e.message),this.$emit("fetch")}).catch(e=>{console.log(e)}).finally(()=>{this.loading=!1})):this.$notify.error(this.$t("Pro_Please_saof"))}}},[["render",function(e,t,l,s,a,o){const i=se("ArrowDown"),n=f,r=m,d=h,c=w,u=v,p=se("filterer");return E(),N(p,{placement:"bottom-start"},{header:H(()=>[ee(r,{plain:"",size:"small"},{default:H(()=>[ae(Y(e.$t("Change"))+" "+Y(l.label)+" ",1),ie(e.$slots,"icon",{},()=>[ee(n,null,{default:H(()=>[ee(i)],void 0,!0),_:1})])],void 0,!0),_:3})]),items:H(()=>[ee(d,{class:"fcrm_filter-option fcrm_no-hover"},{default:H(()=>[ae(Y(e.$t("Choose New"))+" "+Y(l.label)+": ",1)],void 0,!0),_:1}),ee(u,{class:"fcrm_checkable_block",modelValue:a.selected_item,"onUpdate:modelValue":t[0]||(t[0]=e=>a.selected_item=e)},{default:H(()=>[(E(!0),U(G,null,J(l.options,e=>(E(),N(c,{key:e.id,value:e.id},{default:H(()=>[ae(Y(e.title),1)],void 0,!0),_:2},1032,["value"]))),128))],void 0,!0),_:1},8,["modelValue"])]),footer:H(()=>[ee(d,{class:"fcrm_no-hover"},{default:H(()=>[ee(r,{type:"primary",size:"small",style:{width:"100%"},onClick:o.save},{default:H(()=>[ie(e.$slots,"btn-label",{},()=>[ae(Y(e.$t("Change"))+" "+Y(l.label),1)])],void 0,!0),_:3},8,["onClick"])],void 0,!0),_:3})]),_:3})}]]),ft={class:"fcrm_bulk_contact_custom_fields"},bt={key:0,class:"fcrm_contact_popover_header fcrm_custom_field_form"},yt={class:"fcrm_popover_header"},gt={class:"fcrm_field_label"},vt={key:1,class:"fcrm_contact_popover_body fcrm_popover_body_flex_direction_column"},wt={class:"fcrm_popover_actions"};const kt={class:"fcrm_bulk_action_inline"},xt={class:"fcrm_bulk_wrap"},$t={class:"fcrm_bulk_item"},Ct={class:"icon"},Vt={class:"icon"},St={key:0,style:{padding:"10px"}},At={class:"icon"},Ft={class:"icon"},Pt={class:"icon"},Tt={key:0,style:{padding:"10px"}},Rt={class:"icon"},Ot={class:"icon"},Bt={key:0,class:"fcrm_bulk_navs"},Dt={key:0},Mt={key:1},jt={key:0,class:"fcrm_bulk_processing_wrap"},Lt={class:"fcrm_bulk_processing--title"},It={class:"fcrm_secondary_text font-regular fcrm_mb_16 fcrm_bulk_processing--description"},zt={class:"fcrm_bulk_processing--bar d-flex items-center gap-4 fcrm_mb_6"},Ut={class:"fcrm_secondary_text small fcrm_bulk_processing--count"};const qt=ue({name:"BulkContactActions",props:["selectedSubscribers","options","pagination","theme_mode"],emits:["refetch"],components:{BulkContactCustomField:ue({name:"BulkContactCustomField",components:{ArrowLeft:k},props:["options","showPopover","theme_mode"],emits:["closePopover","openPopover","updateCustomField"],data:()=>({customFieldType:"",formattedCustomFields:{},updating:!1,localShowPopover:!1}),watch:{showPopover(e){this.localShowPopover=e},localShowPopover(e){e?this.$emit("openPopover"):this.$emit("closePopover")},customFieldType(e){e&&(this.localShowPopover=!0)}},methods:{formatFields(){this.customFieldsList.forEach(e=>{"select-multi"===e.type||"checkbox"==e.type?this.formattedCustomFields[e.slug]=[]:this.formattedCustomFields[e.slug]=""})},handleCustomFieldBulk(){const e=this.selectedField,t=this.formattedCustomFields[e.slug];this.updating=!0,this.$emit("updateCustomField",{key:e.slug,type:e.type,value:t})},handleBack(){this.localShowPopover=!1,this.customFieldType=""}},computed:{contactPopoverClass(){return`fcrm_contact_popover ${"dark"===this.theme_mode?"fcrm-force-light":"fcrm-dark"}`},bulkSelectPopperClass(){return"dark"===this.theme_mode?"fcrm-force-light":"fcrm-dark"},bulkSelectWordbreakPopperClass(){return"dark"===this.theme_mode?"fcrm-force-light":""},customFieldsList(){return this.options.custom_fields||[]},selectedField(){return this.customFieldsList.find(e=>e.slug===this.customFieldType)}},mounted(){this.formatFields()}},[["render",function(s,a,o,d,c,u){const p=se("ArrowLeft"),h=f,b=m,y=t,g=l,k=i,$=w,C=v,V=r,S=_,A=n,F=x,P=e;return E(),U("div",ft,[ee(F,{visible:c.localShowPopover,"onUpdate:visible":a[7]||(a[7]=e=>c.localShowPopover=e),placement:"bottom",width:300,trigger:"manual","popper-class":u.contactPopoverClass,effect:"dark"},{reference:H(()=>[ee(g,{filterable:"",size:"small",class:"fcrm_bulk_select",placeholder:s.$t("Select Field"),effect:"dark","popper-class":u.bulkSelectPopperClass,modelValue:c.customFieldType,"onUpdate:modelValue":a[6]||(a[6]=e=>c.customFieldType=e),ref:"customFieldSelect"},{default:H(()=>[(E(!0),U(G,null,J(u.customFieldsList,(e,t)=>(E(),N(y,{key:t,value:e.slug,label:e.label},null,8,["value","label"]))),128))],void 0,!0),_:1},8,["placeholder","popper-class","modelValue"])]),default:H(()=>[u.selectedField?(E(),U("div",bt,[X("div",yt,[ee(b,{size:"small",text:"",onClick:u.handleBack,class:"fcrm_back_button"},{default:H(()=>[ee(h,null,{default:H(()=>[ee(p)],void 0,!0),_:1})],void 0,!0),_:1},8,["onClick"]),X("span",gt,Y(u.selectedField.label),1)])])):q("",!0),u.selectedField?(E(),U("div",vt,["select-one"===u.selectedField.type||"select-multi"==u.selectedField.type?(E(),N(g,{key:0,placeholder:s.$t("Select")+" "+u.selectedField.label,clearable:"",filterable:"",effect:"dark","popper-class":u.bulkSelectWordbreakPopperClass,modelValue:c.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":a[0]||(a[0]=e=>c.formattedCustomFields[u.selectedField.slug]=e),multiple:"select-multi"==u.selectedField.type,class:"fcrm_full_width",size:"small",teleported:!1},{default:H(()=>[(E(!0),U(G,null,J(u.selectedField.options,e=>(E(),N(y,{key:e,value:e,label:e},null,8,["value","label"]))),128))],void 0,!0),_:1},8,["placeholder","popper-class","modelValue","multiple"])):"text"==u.selectedField.type||"number"==u.selectedField.type||"textarea"==u.selectedField.type?(E(),N(k,{key:1,placeholder:u.selectedField.label,size:"small",type:u.selectedField.type,modelValue:c.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":a[1]||(a[1]=e=>c.formattedCustomFields[u.selectedField.slug]=e),class:"fcrm_full_width"},null,8,["placeholder","type","modelValue"])):"radio"==u.selectedField.type?(E(),N(C,{key:2,modelValue:c.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":a[2]||(a[2]=e=>c.formattedCustomFields[u.selectedField.slug]=e),size:"small"},{default:H(()=>[(E(!0),U(G,null,J(u.selectedField.options,e=>(E(),N($,{key:e,value:e,label:e,size:"large",class:"fcrm-radio"},null,8,["value","label"]))),128))],void 0,!0),_:1},8,["modelValue"])):"checkbox"==u.selectedField.type?(E(),N(S,{key:3,modelValue:c.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":a[3]||(a[3]=e=>c.formattedCustomFields[u.selectedField.slug]=e),class:"fcrm_checkbox_group",size:"small"},{default:H(()=>[(E(!0),U(G,null,J(u.selectedField.options,e=>(E(),N(V,{key:e,size:"large",value:e,class:"fcrm_checkbox"},{default:H(()=>[ae(Y(e),1)],void 0,!0),_:2},1032,["value"]))),128))],void 0,!0),_:1},8,["modelValue"])):"date"==u.selectedField.type?(E(),N(A,{key:4,"value-format":"YYYY-MM-DD",modelValue:c.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":a[4]||(a[4]=e=>c.formattedCustomFields[u.selectedField.slug]=e),type:"date",size:"large",class:"fcrm_full_width",teleported:!1,placeholder:s.$t("Pick a date")},null,8,["modelValue","placeholder"])):"date_time"==u.selectedField.type?(E(),N(A,{key:5,"value-format":"YYYY-MM-DD HH:mm:ss",modelValue:c.formattedCustomFields[u.selectedField.slug],"onUpdate:modelValue":a[5]||(a[5]=e=>c.formattedCustomFields[u.selectedField.slug]=e),type:"datetime",size:"large",style:{width:"100%"},teleported:!1,class:"fcrm_full_width",placeholder:s.$t("Pick a date and time")},null,8,["modelValue","placeholder"])):(E(),U(G,{key:6},[ae(Y(u.selectedField),1)],64)),X("div",wt,[W((E(),N(b,{disabled:c.updating,onClick:u.handleCustomFieldBulk},{default:H(()=>[X("span",null,Y(s.$t("Update")),1)],void 0,!0),_:1},8,["disabled","onClick"])),[[P,c.updating]])])])):q("",!0)],void 0),_:1},8,["visible","popper-class"])])}]]),Confirm:we,OptionSelector:ke,Check:C,Loading:$},data(){return{delete_confirm_message:""+this.$t("Are you sure to delete?")+"
"+this.$t("delete_all_contacts_notice"),double_optin_confirm_message:""+this.$t("Are you sure to send double optin?")+"
"+this.$t("send_double_optin_contacts_notice"),actions:{},select_job:{action_name:"",selected_options:[]},doing_action:!1,select_status:"",allSelected:!1,processCount:0,processingAllBulk:!1,currentAllActionLastContactId:0,custom_field:{},showCustomFieldPopover:!1}},watch:{"select_job.action_name":{handler(){this.select_job.selected_options=[],this.select_status=""},deep:!0}},computed:{bulkSelectPopperClass(){return"dark"===this.theme_mode?"fcrm-force-light":"fcrm-dark"},bulkSelectWordbreakPopperClass(){return"dark"===this.theme_mode?"fcrm_select_options_wordbreak fcrm-force-light":"fcrm_select_options_wordbreak fcrm-dark"},currentAction(){return!!this.select_job.action_name&&this.actions[this.select_job.action_name]},canSelectAll(){return this.pagination&&this.selectedSubscribers.length{this.resetAllBulkProgressState(),this.processingAllBulk=!0,this.processAllBulk()}).catch(()=>{this.allSelected=!1})},async doBulkAction(){const e=[];if(this.each(this.selectedSubscribers,t=>{e.push(t.id)}),!e.length)return this.$notify.error(this.$t("Please select subscribers first")),!1;this.doing_action=!0;const t=ne(e,100),l={action_name:this.select_job.action_name,action_options:this.select_job.selected_options,new_status:this.select_status,custom_field:this.custom_field};for(let s=0;s{s===t.length-1&&(this.$emit("refetch"),this.$notify.success(e.message))}).catch(e=>{this.handleError(e)});this.doing_action=!1},repeatBulkAction(e,t){return t.subscriber_ids=e,this.processCount+=e.length,this.$post("subscribers/do-bulk-action",t)},processAllBulk(e){const t={is_all:"yes",action_name:this.select_job.action_name,action_options:this.select_job.selected_options,new_status:this.select_status,last_id:this.currentAllActionLastContactId,per_page:400,contact_query:window.fcrm_sub_params};this.$post("subscribers/do-bulk-action",t).then(t=>{this.processCount+=parseInt(t.completed_contacts),t.is_completed?(this.processingAllBulk=!1,this.resetAllBulkProgressState(),this.$emit("refetch"),this.$notify.success(t.message),e&&e()):(this.currentAllActionLastContactId=t.last_contact_id,this.$nextTick(()=>{this.processAllBulk(e)}))}).catch(e=>{this.processingAllBulk=!1,this.resetAllBulkProgressState(),this.handleError(e)})},resetAllBulkProgressState(){this.processCount=0,this.currentAllActionLastContactId=0},updateCustomFieldValue(e){this.custom_field=e,this.showCustomFieldPopover=!1,this.handleBulkActionRoute()}},mounted(){this.actions={add_to_tags:{label:this.$t("Add To Tags"),options:this.options.tags},add_to_lists:{label:this.$t("Add To Lists"),options:this.options.lists},remove_from_tags:{label:this.$t("Remove From Tags"),options:this.options.tags},remove_from_lists:{label:this.$t("Remove From Lists"),options:this.options.lists},change_contact_status:{label:this.$t("Change Contact Status"),statuses:this.options.statuses},change_contact_type:{label:this.$t("Change Contact Type"),custom_options:this.appVars.contact_types,btn_text:this.$t("Change Contact Type"),is_multiple:!1},add_to_email_sequence:{label:this.$t("Add To Email Sequence")},add_to_automation:{label:this.$t("Add To Automation Funnel")}},this.appVars.custom_contact_bulk_actions&&this.appVars.custom_contact_bulk_actions.length&&this.each(this.appVars.custom_contact_bulk_actions,e=>{this.actions[e.action_name]||(this.actions[e.action_name]=e)}),this.has_company_module&&(this.actions.add_to_company={label:this.$t("Add To Company")},this.actions.remove_from_company={label:this.$t("Remove From Company")}),this.actions.send_double_optin={label:this.$t("Send Double Optin To Pending Contacts")},this.actions.update_custom_fields={label:this.$t("Update Custom Fields")},this.actions.delete_contacts={label:this.$t("Delete Contacts")}}},[["render",function(s,a,o,i,n,r){const d=t,c=l,u=se("Check"),p=f,h=m,_=se("Delete"),b=se("confirm"),y=se("option-selector"),g=se("BulkContactCustomField"),v=se("Loading"),w=V,k=S,x=e;return E(),U("div",kt,[X("div",xt,[X("div",$t,[X("label",null,Y(s.$t("Select Action")),1),ee(c,{clearable:"",filterable:"",size:"small",class:"fcrm_bulk_select",placeholder:s.$t("Select Action"),"popper-class":r.bulkSelectPopperClass,effect:"dark",modelValue:n.select_job.action_name,"onUpdate:modelValue":a[0]||(a[0]=e=>n.select_job.action_name=e)},{default:H(()=>[(E(!0),U(G,null,J(n.actions,(e,t)=>(E(),N(d,{key:t,value:t,label:e.label},null,8,["value","label"]))),128))],void 0),_:1},8,["placeholder","popper-class","modelValue"])]),r.currentAction&&r.currentAction.options?(E(),U(G,{key:0},[ee(c,{filterable:"",clearable:"",multiple:"","collapse-tags":"","max-collapse-tags":2,size:"small",class:"fcrm_bulk_select",placeholder:s.$t("Select"),"popper-class":r.bulkSelectWordbreakPopperClass,effect:"dark",modelValue:n.select_job.selected_options,"onUpdate:modelValue":a[1]||(a[1]=e=>n.select_job.selected_options=e)},{default:H(()=>[(E(!0),U(G,null,J(r.currentAction.options,e=>(E(),N(d,{key:e.id,value:e.id,label:e.title},null,8,["value","label"]))),128))],void 0),_:1},8,["placeholder","popper-class","modelValue"]),W((E(),N(h,{disabled:n.doing_action||!n.select_job.selected_options.length,onClick:a[2]||(a[2]=e=>r.handleBulkActionRoute()),type:"primary",size:"small"},{default:H(()=>[X("span",Ct,[ee(p,null,{default:H(()=>[ee(u)],void 0,!0),_:1})]),ae(" "+Y(s.$t("Confirm")),1)],void 0),_:1},8,["disabled"])),[[x,n.doing_action]])],64)):"change_contact_status"==n.select_job.action_name?(E(),U(G,{key:1},[ee(c,{filterable:"",clearable:"",size:"small",class:"fcrm_bulk_select",placeholder:s.$t("Select"),"popper-class":r.bulkSelectPopperClass,effect:"dark",modelValue:n.select_status,"onUpdate:modelValue":a[3]||(a[3]=e=>n.select_status=e)},{default:H(()=>[(E(!0),U(G,null,J(r.currentAction.statuses,e=>(E(),N(d,{key:e.id,value:e.id,label:e.title},null,8,["value","label"]))),128))],void 0),_:1},8,["placeholder","popper-class","modelValue"]),W((E(),N(h,{disabled:n.doing_action||!n.select_status,onClick:a[4]||(a[4]=e=>r.handleBulkActionRoute()),type:"primary",size:"small"},{default:H(()=>[X("span",Vt,[ee(p,null,{default:H(()=>[ee(u)],void 0,!0),_:1})]),ae(" "+Y(s.$t("Confirm")),1)],void 0),_:1},8,["disabled"])),[[x,n.doing_action]])],64)):"delete_contacts"==n.select_job.action_name?(E(),N(b,{key:2,placement:"top-start",message:n.delete_confirm_message,onYes:a[5]||(a[5]=e=>r.handleBulkActionRoute())},{reference:H(()=>[W((E(),N(h,{disabled:n.doing_action,size:"small",type:"danger",plain:""},{default:H(()=>[ee(p,null,{default:H(()=>[ee(_)],void 0,!0),_:1}),ae(" "+Y(s.$t("Delete Selected")),1)],void 0,!0),_:1},8,["disabled"])),[[x,n.doing_action]])]),_:1},8,["message"])):"send_double_optin"==n.select_job.action_name?(E(),N(b,{key:3,placement:"top-start",message:n.double_optin_confirm_message,onYes:a[6]||(a[6]=e=>r.handleBulkActionRoute())},{reference:H(()=>[W((E(),N(h,{disabled:n.doing_action,size:"small"},{default:H(()=>[ee(p,{class:"fcrm_bulk_confirm_icon"},{default:H(()=>[ee(u)],void 0,!0),_:1}),ae(" "+Y(s.$t("Send Double Opt-In")),1)],void 0,!0),_:1},8,["disabled"])),[[x,n.doing_action]])]),_:1},8,["message"])):"add_to_email_sequence"==n.select_job.action_name?(E(),U(G,{key:4},[s.has_campaign_pro?(E(),U(G,{key:1},[ee(y,{modelValue:n.select_status,"onUpdate:modelValue":a[7]||(a[7]=e=>n.select_status=e),field:{option_key:"email_sequences",clearable:!0,size:"small"},effect:"dark",popper_class:r.bulkSelectPopperClass,class:"fcrm_bulk_select"},null,8,["modelValue","popper_class"]),ee(b,{placement:"top-start",width:230,message:s.$t("Add_Contacts_To_Email_Sequence_Confirm_Message"),onYes:a[8]||(a[8]=e=>r.handleBulkActionRoute())},{reference:H(()=>[W((E(),N(h,{disabled:n.doing_action||!n.select_status,type:"primary",size:"small"},{default:H(()=>[X("span",At,[ee(p,null,{default:H(()=>[ee(u)],void 0,!0),_:1})]),ae(" "+Y(s.$t("Confirm")),1)],void 0,!0),_:1},8,["disabled"])),[[x,n.doing_action]])]),_:1},8,["message"])],64)):(E(),U("span",St,Y(s.$t("Require FluentCRM Pro")),1))],64)):"add_to_company"==n.select_job.action_name?(E(),U(G,{key:5},[ee(y,{modelValue:n.select_status,"onUpdate:modelValue":a[9]||(a[9]=e=>n.select_status=e),field:{option_key:"companies",clearable:!0,size:"small"},effect:"dark",popper_class:r.bulkSelectPopperClass,class:"fcrm_bulk_select"},null,8,["modelValue","popper_class"]),ee(b,{placement:"top-start",width:230,message:s.$t("Add_Contacts_To_Company_Confirm_Message"),onYes:a[10]||(a[10]=e=>r.handleBulkActionRoute())},{reference:H(()=>[W((E(),N(h,{disabled:n.doing_action||!n.select_status,size:"small",type:"primary"},{default:H(()=>[X("span",Ft,[ee(p,null,{default:H(()=>[ee(u)],void 0,!0),_:1})]),ae(" "+Y(s.$t("Confirm")),1)],void 0,!0),_:1},8,["disabled"])),[[x,n.doing_action]])]),_:1},8,["message"])],64)):"remove_from_company"==n.select_job.action_name?(E(),U(G,{key:6},[ee(y,{modelValue:n.select_status,"onUpdate:modelValue":a[11]||(a[11]=e=>n.select_status=e),field:{option_key:"companies",clearable:!0,size:"small"},effect:"dark",popper_class:r.bulkSelectPopperClass,class:"fcrm_bulk_select"},null,8,["modelValue","popper_class"]),ee(b,{placement:"top-start",width:230,message:s.$t("Remove_Contacts_From_Company_Confirm_Message"),onYes:a[12]||(a[12]=e=>r.handleBulkActionRoute())},{reference:H(()=>[W((E(),N(h,{disabled:n.doing_action||!n.select_status,type:"primary",size:"small"},{default:H(()=>[X("span",Pt,[ee(p,null,{default:H(()=>[ee(u)],void 0,!0),_:1})]),ae(" "+Y(s.$t("Confirm")),1)],void 0,!0),_:1},8,["disabled"])),[[x,n.doing_action]])]),_:1},8,["message"])],64)):"add_to_automation"==n.select_job.action_name?(E(),U(G,{key:7},[s.has_campaign_pro?(E(),U(G,{key:1},[ee(y,{modelValue:n.select_status,"onUpdate:modelValue":a[13]||(a[13]=e=>n.select_status=e),field:{option_key:"automation_funnels",clearable:!0,size:"small"},effect:"dark",popper_class:r.bulkSelectPopperClass,class:"fcrm_bulk_select"},null,8,["modelValue","popper_class"]),ee(b,{placement:"top-start",width:230,message:s.$t("Add_Contacts_To_Automation_Confirm_Message"),onYes:a[14]||(a[14]=e=>r.handleBulkActionRoute())},{reference:H(()=>[W((E(),N(h,{disabled:n.doing_action||!n.select_status,type:"primary",size:"small"},{default:H(()=>[X("span",Rt,[ee(p,null,{default:H(()=>[ee(u)],void 0,!0),_:1})]),ae(" "+Y(s.$t("Confirm")),1)],void 0,!0),_:1},8,["disabled"])),[[x,n.doing_action]])]),_:1},8,["message"])],64)):(E(),U("span",Tt,Y(s.$t("Require FluentCRM Pro")),1))],64)):"update_custom_fields"==n.select_job.action_name?(E(),N(g,{key:8,options:o.options,theme_mode:o.theme_mode,showPopover:n.showCustomFieldPopover,onUpdateCustomField:r.updateCustomFieldValue,onOpenPopover:a[15]||(a[15]=e=>n.showCustomFieldPopover=!0),onClosePopover:a[16]||(a[16]=e=>n.showCustomFieldPopover=!1)},null,8,["options","theme_mode","showPopover","onUpdateCustomField"])):r.currentAction&&r.currentAction.custom_options?(E(),U(G,{key:9},[ee(c,{filterable:"",clearable:"",size:"small",multiple:r.currentAction.is_multiple,"collapse-tags":r.currentAction.is_multiple,"max-collapse-tags":r.currentAction.is_multiple?2:void 0,class:"fcrm_bulk_select",placeholder:s.$t("Select"),"popper-class":r.bulkSelectPopperClass,effect:"dark",modelValue:n.select_status,"onUpdate:modelValue":a[17]||(a[17]=e=>n.select_status=e)},{default:H(()=>[(E(!0),U(G,null,J(r.currentAction.custom_options,(e,t)=>(E(),N(d,{key:t,value:t,label:e},null,8,["value","label"]))),128))],void 0),_:1},8,["multiple","collapse-tags","max-collapse-tags","placeholder","popper-class","modelValue"]),W((E(),N(h,{disabled:n.doing_action||!n.select_status,onClick:a[18]||(a[18]=e=>r.handleBulkActionRoute()),type:"primary",size:"small"},{default:H(()=>[X("span",Ot,[ee(p,null,{default:H(()=>[ee(u)],void 0,!0),_:1})]),ae(" "+Y(s.$t("Confirm")),1)],void 0),_:1},8,["disabled"])),[[x,n.doing_action]])],64)):q("",!0)]),r.canSelectAll?(E(),U("div",Bt,[n.allSelected?(E(),U("p",Dt,[ae(Y(s.$t("All %s contacts selected.",s.formatMoney(o.pagination.total)))+" ",1),ee(h,{size:"small",text:"",onClick:a[19]||(a[19]=e=>n.allSelected=!1)},{default:H(()=>[ae(Y(s.$t("Select only this page")),1)],void 0),_:1})])):(E(),U("p",Mt,[ae(Y(s.$t("%s contacts selected.",s.formatMoney(this.selectedSubscribers.length)))+" ",1),ee(h,{size:"small",text:"",onClick:a[20]||(a[20]=e=>n.allSelected=!0)},{default:H(()=>[ae(Y(s.$t("Select all %s contacts",s.formatMoney(o.pagination.total))),1)],void 0),_:1})]))])):q("",!0),ee(k,{modelValue:n.processingAllBulk,"onUpdate:modelValue":a[21]||(a[21]=e=>n.processingAllBulk=e),width:"450px","append-to-body":!0,"close-on-click-modal":!1,"modal-class":"fcrm_bulk_processing_dialog"},{default:H(()=>[n.processingAllBulk?(E(),U("div",jt,[X("h3",Lt,[ae(Y(s.$t("Action:"))+" "+Y(r.currentAction.label)+" ",1),ee(p,{class:"spin"},{default:H(()=>[ee(v)],void 0,!0),_:1})]),X("div",It,Y(s.$t("Please do not close this window while processing this bulk action")),1),X("div",zt,[ee(w,{striped:"","striped-flow":"","text-inside":!1,"stroke-width":8,percentage:parseInt(n.processCount/o.pagination.total*100)},null,8,["percentage"])]),X("div",Ut,Y(s.$t("Processing %s of %s contacts",s.formatMoney(n.processCount),s.formatMoney(o.pagination.total))),1)])):q("",!0)],void 0),_:1},8,["modelValue"])])}]]),Et={name:"ContactsLoader",props:{columns:{type:Array,default:()=>[]},hasCompanyModule:{type:Boolean,default:!1},hasCommerceFields:{type:Boolean,default:!1},custom_fields:{type:Array,default:()=>[]},showSelection:{type:Boolean,default:!0},segmentColumnWidths:{type:Object,default:()=>({})},segmentColumnMinWidth:{type:Number,default:300},compactView:{type:Boolean,default:!1}},data:()=>({skeletonRows:[{id:1},{id:2},{id:3},{id:4},{id:5},{id:6},{id:7},{id:8},{id:9},{id:10}]})},Yt={class:"fcrm_contact_cell fcrm_contact_cell--skeleton"},Wt={style:{flex:"1",display:"flex","flex-direction":"column",gap:"0"}},Nt={class:"fcrm_pills fcrm_pills--skeleton"},Ht={class:"fcrm_pills fcrm_pills--skeleton"},Gt={class:"fcrm_company_cell fcrm_company_cell--skeleton"},Jt={class:"fcrm_datetime_cell--skeleton"},Kt={class:"fcrm_datetime_cell--skeleton"},Qt={class:"fcrm_datetime_cell--skeleton"};function Zt(e){if(null==e)return"";try{return(new Intl.NumberFormat).format(Number(e))}catch(t){return String(e)}}const Xt={class:"fcrm_horizontal_filter_actions"},el={class:"fcrm_empty_state"},tl={class:"fcrm_empty_state_text"},ll=["title","src","alt"],sl={class:"fcrm_contact_info"},al={class:"fcrm_contact_name"},ol={class:"fcrm_contact_email"},il={class:"d-flex gap-4 flex-wrap"},nl=["title"],rl={class:"fcrm_badge fcrm_segment_more_badge"},dl={key:1},cl={class:"d-flex gap-4 flex-wrap"},ul={class:"fcrm_badge fcrm_segment_more_badge"},ml={key:1},pl={key:0,class:"fcrm_company_photo"},hl=["src"],_l={style:{flex:"1"}},fl={key:1},bl={key:0},yl={key:1},gl={key:0},vl={key:1},wl={key:0},kl={key:1},xl=["title"],$l={key:1},Cl={key:0},Vl=["title"],Sl=["title"],Al=["title"],Fl={class:"icon"},Pl={key:0,class:"fcrm_selection_count_text"},Tl={class:"fcrm_selection_count_number"},Rl={class:"fcrm_selection_count_text"};const Ol=ue({name:"ContactsTable",components:{Badge:Ae,ContactsLoader:ue(Et,[["render",function(e,t,l,s,a,o){const i=c,n=u,r=A,d=F;return E(),N(d,{class:oe(["fcrm_contacts_table fcrm_contacts_table--skeleton",{"fcrm_contacts_table--compact":l.compactView}]),data:a.skeletonRows,style:{width:"100%"},stripe:""},{default:H(()=>[l.showSelection?(E(),N(r,{key:0,width:"40"},{default:H(()=>[ee(n,{animated:!0,style:{width:"16px"}},{template:H(()=>[ee(i,{variant:"rect",style:{width:"16px",height:"16px","border-radius":"2px"}})]),_:1})]),_:1})):q("",!0),ee(r,{label:e.$t("Contact"),"min-width":"300"},{default:H(()=>[X("div",Yt,[ee(n,{animated:!0,style:{width:"36px",display:"flex",gap:"12px","flex-direction":"unset"}},{template:H(()=>[ee(i,{variant:"circle",style:{width:"36px",height:"36px",flex:"none"}}),X("div",Wt,[ee(i,{variant:"text",style:{flex:"1",height:"14px"}}),ee(i,{variant:"text",style:{width:"50%",height:"14px"}})])]),_:1})])]),_:1},8,["label"]),-1!=l.columns.indexOf("prefix")?(E(),N(r,{key:1,label:e.$t("Prefix"),"min-width":"70"},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"40px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("first_name")?(E(),N(r,{key:2,label:e.$t("First Name"),"min-width":"140"},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("last_name")?(E(),N(r,{key:3,label:e.$t("Last Name"),"min-width":"140"},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("lists")?(E(),N(r,{key:4,label:e.$t("Lists"),width:l.segmentColumnWidths.lists,"min-width":l.segmentColumnMinWidth},{default:H(()=>[X("div",Nt,[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"button",style:{width:"50px",height:"22px","border-radius":"11px"}}),ee(i,{variant:"button",style:{width:"60px",height:"22px","border-radius":"11px"}})]),_:1})])]),_:1},8,["label","width","min-width"])):q("",!0),-1!=l.columns.indexOf("tags")?(E(),N(r,{key:5,label:e.$t("Tags"),width:l.segmentColumnWidths.tags,"min-width":l.segmentColumnMinWidth},{default:H(()=>[X("div",Ht,[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"button",style:{width:"55px",height:"22px","border-radius":"11px"}}),ee(i,{variant:"button",style:{width:"65px",height:"22px","border-radius":"11px"}})]),_:1})])]),_:1},8,["label","width","min-width"])):q("",!0),l.hasCompanyModule&&-1!=l.columns.indexOf("companies")?(E(),N(r,{key:6,"min-width":"230",label:e.$t("Companies")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"120px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),l.hasCompanyModule&&-1!=l.columns.indexOf("primary_company")?(E(),N(r,{key:7,"min-width":"220",label:e.$t("Primary Company")},{default:H(()=>[X("div",Gt,[ee(n,{animated:!0,style:{width:"28px"}},{template:H(()=>[ee(i,{variant:"circle",style:{width:"28px",height:"28px"}})]),_:1}),ee(n,{animated:!0,style:{"margin-left":"8px"}},{template:H(()=>[ee(i,{variant:"text",style:{width:"100px",height:"14px"}})]),_:1})])]),_:1},8,["label"])):q("",!0),l.hasCommerceFields?(E(),U(G,{key:8},[-1!=l.columns.indexOf("commerce.total_order_value")?(E(),N(r,{key:0,"min-width":"120",label:e.$t("Lifetime Value")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"60px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("commerce.total_order_count")?(E(),N(r,{key:1,"min-width":"120",label:e.$t("Order Count")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"40px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("commerce.first_order_date")?(E(),N(r,{key:2,"min-width":"180",label:e.$t("Customer Since")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"100px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("commerce.last_order_date")?(E(),N(r,{key:3,"min-width":"180",label:e.$t("Last order")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0)],64)):q("",!0),-1!=l.columns.indexOf("phone")?(E(),N(r,{key:9,"min-width":"120",label:e.$t("Phone")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"90px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("date_of_birth")?(E(),N(r,{key:10,"min-width":"120",label:e.$t("Date of Birth")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("address_line_1")?(E(),N(r,{key:11,"min-width":"160",label:e.$t("Address Line 1")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"120px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("address_line_2")?(E(),N(r,{key:12,"min-width":"160",label:e.$t("Address Line 2")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"120px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("city")?(E(),N(r,{key:13,"min-width":"120",label:e.$t("City")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"70px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("state")?(E(),N(r,{key:14,"min-width":"120",label:e.$t("State")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"60px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("postal_code")?(E(),N(r,{key:15,"min-width":"120",label:e.$t("Zip Code")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"50px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("country")?(E(),N(r,{key:16,"min-width":"120",label:e.$t("Country")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("contact_type")?(E(),N(r,{key:17,width:"150",label:e.$t("Type")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"60px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("status")?(E(),N(r,{key:18,width:"150",label:e.$t("Status")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"button",style:{width:"70px",height:"24px","border-radius":"4px"}})]),_:1})]),_:1},8,["label"])):q("",!0),(E(!0),U(G,null,J(l.custom_fields,e=>(E(),N(r,{width:"200",key:e.slug,label:e.label},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"100px",height:"14px"}})]),_:1})]),_:1},8,["label"]))),128)),-1!=l.columns.indexOf("source")?(E(),N(r,{key:19,"min-width":"150",label:e.$t("Source")},{default:H(()=>[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"70px",height:"14px"}})]),_:1})]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("last_activity")?(E(),N(r,{key:20,"min-width":"190",label:e.$t("Last Activity")},{default:H(()=>[X("div",Jt,[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})])]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("created_at")?(E(),N(r,{key:21,"min-width":"190",label:e.$t("Date Added")},{default:H(()=>[X("div",Kt,[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})])]),_:1},8,["label"])):q("",!0),-1!=l.columns.indexOf("updated_at")?(E(),N(r,{key:22,"min-width":"190",label:e.$t("Last Changed")},{default:H(()=>[X("div",Qt,[ee(n,{animated:!0},{template:H(()=>[ee(i,{variant:"text",style:{width:"80px",height:"14px"}})]),_:1})])]),_:1},8,["label"])):q("",!0)],void 0),_:1},8,["class","data"])}]]),Toggler:ht,Manager:ut,Searcher:be,PropertyChanger:_t,PaginationBar:ye,DataTable:ge,FloatingBulkActionShell:ve,BulkContactActions:qt,FilterPopover:xe,ActiveFiltersBar:$e,Adder:at,CopyDocument:D,Plus:B,ArrowDown:g,Delete:O,Download:R,Fold:T,Expand:P,Icons:me},props:["subscribers","always_searchbar","show_skeleton","is_loading","query_data","pagination","options","ui_config","fire_ready_fetch","filter_type"],emits:["export-selected","fetch"],data:()=>({selection:!1,selectedSubscribers:[],selectionCount:0,matched_tags:[],matched_lists:[],matched_statuses:[],columns:[],hasCustomFields:!1,hasCommerceFields:!1,countries:window.fcAdmin.countries,copiedText:{id:"",title:""},pageSizes:[10,20,50,80,100,120,150],localPerPage:10,segmentColumnMinWidth:300,segmentColumnWidths:{lists:void 0,tags:void 0},compactView:!1,compactRelationLimit:2,showSearcher:!1,showAdder:!1,selectedBulkAction:null,allSelected:!1,current_mode:"system"===he.getCurrentTheme()?he.getSystemTheme():he.getCurrentTheme()}),computed:{totalPages(){const e=Number(this.pagination&&this.pagination.per_page)||Number(this.localPerPage)||10,t=Number(this.pagination&&this.pagination.total)||0;return Math.max(1,Math.ceil(t/e))},custom_fields(){const e=this.appVars.contact_custom_fields;return e?e.filter(e=>-1!==this.columns.indexOf(e.slug)):[]},paginationPageSizes(){var e;return"subscribers"===(null==(e=this.$route)?void 0:e.name)?[10,20,50,100,150,300,600]:[]},canSelectAll(){if(!this.pagination||!this.pagination.per_page||!this.pagination.total)return!1;const e="subscribers"===this.$route.name,t=this.selectedSubscribers.length===this.pagination.per_page,l=this.selectedSubscribers.length0&&e.length!==this.pagination.per_page&&(this.allSelected=!1,this.$refs.bulkActionsRef&&(this.$refs.bulkActionsRef.allSelected=!1));const t={},l={};e.forEach(e=>{e.tags.forEach(e=>this.match(e,t)),e.lists.forEach(e=>this.match(e,l))}),this.selectionCount=e.length,this.matched_tags=t,this.matched_lists=l},match(e,t){t[e.slug]?t[e.slug]++:t[e.slug]=1},handleSortable(e){"descending"===e.order?(this.query_data.sort_by=e.prop,this.query_data.sort_type="DESC"):(this.query_data.sort_by=e.prop,this.query_data.sort_type="ASC"),this.fetch()},statusClass(e){switch((e||"").toString().toLowerCase()){case"subscribed":return"fcrm_badge--success";case"unsubscribed":default:return"fcrm_badge--neutral";case"pending":return"fcrm_badge--away";case"transactional":return"fcrm_badge--feature";case"bounced":return"fcrm_badge--info";case"complained":return"fcrm_badge--warning";case"spammed":return"fcrm_badge--error"}},subscribe({type:e,payload:t}){const{attach:l,detach:s}=t;this.loading=!0;const a={type:e,attach:l,detach:s,subscribers:this.selectedSubscribers.map(e=>e.id)};this.$post("subscribers/sync-segments",a).then(t=>{t.subscribers.forEach(e=>{const t=this.subscribers.findIndex(t=>t.id===e.id);-1!==t&&this.subscribers.splice(t,1,e),this.$refs.subscribersTable.toggleRowSelection(this.subscribers[t])});const l=`selected_${e}`;if(this[l]&&this[l].length&&s&&s.length){const t=this[l].filter(e=>s.includes(e));t.length&&this.filter({type:e,payload:t})}this.loading=!1,this.$notify.success({title:this.$t("Great!"),message:t.message,offset:19})})},maybeReFetch(){let e=!1;if(!this.hasCommerceFields&&this.appVars.commerce_provider){this.columns.filter(e=>0===e.indexOf("commerce.")).length&&(e=!0,this.hasCommerceFields=!0,this.query_data.has_commerce=!0)}-1!==this.columns.indexOf("primary_company")&&(this.query_data.primary_company=!0,e=!0),!this.hasCustomFields&&this.custom_fields.length&&(this.query_data.custom_fields=!0,this.hasCustomFields=!0,e=!0),e&&this.fetch()},filter({type:e,payload:t}){return this.query_data[e]=t,this.pagination.current_page=1,this.fetch()},search(e,t){this.options[e]=t},listeners(){this.addAction("search-subscribers","fluentcrm",e=>{this.query_data.search=e,this.pagination.current_page=1,this.fetch()}),this.addAction("loading","fluentcrm",e=>{this.loading=e})},countryName(e){return function(e,t=[]){const l=t.find(t=>t.code===e);return l?l.title:""}(e,this.countries)},copyText(e,t){if(this.copiedText.id=t,!e)return void(this.copiedText.title=this.$t("Nothing to copy"));const l=Te(e);this.copiedText.title=l?this.$t("Copied"):this.$t("Failed to copy")},handleFilterApply(e){this.query_data.lists=e.lists||[],this.query_data.tags=e.tags||[],this.query_data.statuses=e.statuses||[],this.query_data.sms_statuses=e.sms_statuses||[],this.pagination.current_page=1,this.fetch()},handleFilterBarChange(e){this.query_data.lists=e.lists||[],this.query_data.tags=e.tags||[],this.query_data.statuses=e.statuses||[],this.query_data.sms_statuses=e.sms_statuses||[],void 0!==e.search&&(this.query_data.search=e.search),this.pagination.current_page=1,this.fetch()},handleOpenFilter(e){this.$nextTick(()=>{var t,l;null==(l=null==(t=this.$refs.filterPopoverRef)?void 0:t.openFilterCategory)||l.call(t,e)})},handleAdderFetch(){this.showAdder=!1,this.fetch()},handleDeleteSelected(){this.selectedBulkAction="delete_contacts",this.$nextTick(()=>{this.$refs.bulkActionsRef&&(this.$refs.bulkActionsRef.select_job.action_name="delete_contacts",this.$refs.bulkActionsRef.handleBulkActionRoute())})},handleExportSelected(){this.$emit("export-selected",{subscribers:this.selectedSubscribers,allSelected:this.allSelected,query_data:this.query_data})},handleSelectAll(){this.canSelectAll&&(this.$refs.subscribersTable&&this.subscribers&&this.subscribers.length>0&&this.subscribers.forEach(e=>{this.$refs.subscribersTable.toggleRowSelection(e,!0)}),this.allSelected=!0,this.$nextTick(()=>{this.$refs.bulkActionsRef&&(this.$refs.bulkActionsRef.allSelected=!0,this.$refs.bulkActionsRef.$forceUpdate())}))},handleSelectOnlyThisPage(){this.allSelected=!1,this.$refs.bulkActionsRef&&(this.$refs.bulkActionsRef.allSelected=!1,this.$refs.bulkActionsRef.$forceUpdate())},handleDeselectAll(){this.$refs.subscribersTable&&this.$refs.subscribersTable.clearSelection(),this.selection=!1,this.selectedSubscribers=[],this.selectedBulkAction=null,this.allSelected=!1,this.$refs.bulkActionsRef&&(this.$refs.bulkActionsRef.allSelected=!1,this.$refs.bulkActionsRef.select_job.action_name="",this.$refs.bulkActionsRef.select_job.selected_options=[],this.$refs.bulkActionsRef.select_status="")},handleBulkActionRefetch(){I().invalidateCache(),this.selectedBulkAction=null,this.fetch()},formatMoney:Zt,getStoredSegmentColumnWidths(){const e=this.storage.get("contact_segment_column_widths",{}),t={};return["lists","tags"].forEach(l=>{const s=parseInt(e[l],10);s&&(t[l]=Math.max(s,this.segmentColumnMinWidth))}),t},initializeSegmentColumnWidths(){const e=this.getStoredSegmentColumnWidths();this.segmentColumnWidths={lists:e.lists,tags:e.tags}},initializeCompactView(){this.compactView="yes"===this.storage.get("contact_compact_table_view","no")},setCompactView(e){this.compactView=!!e,this.storage.set("contact_compact_table_view",this.compactView?"yes":"no"),this.$nextTick(()=>{var e;null==(e=this.$refs.subscribersTable)||e.doLayout()})},toggleCompactView(){this.setCompactView(!this.compactView)},handleColumnResize(e,t,l){if(!l||-1===["lists","tags"].indexOf(l.property))return;const s=Math.max(parseInt(e,10)||this.segmentColumnMinWidth,this.segmentColumnMinWidth);this.segmentColumnWidths={...this.segmentColumnWidths,[l.property]:s},this.storage.set("contact_segment_column_widths",this.segmentColumnWidths)},resetTablePreferences(){this.storage.remove("contact_segment_column_widths"),this.storage.remove("contact_compact_table_view"),this.segmentColumnWidths={lists:void 0,tags:void 0},this.compactView=!1,this.$nextTick(()=>{var e;null==(e=this.$refs.subscribersTable)||e.doLayout()}),this.$notify.success({title:this.$t("Done"),message:this.$t("Table preferences have been reset"),offset:19})},initializePerPage(){const e=parseInt(this.storage.get("contact_perpage",10))||10;this.pagination&&this.pagination.per_page?this.localPerPage=this.pagination.per_page:(this.localPerPage=e,this.pagination&&(this.pagination.per_page=e))}},watch:{"pagination.per_page":{handler(e){e&&e!==this.localPerPage&&(this.localPerPage=e)},immediate:!0},pagination:{handler(e){e&&e.per_page&&e.per_page!==this.localPerPage&&(this.localPerPage=e.per_page)},deep:!0,immediate:!0}},created(){this.initializePerPage(),this.initializeSegmentColumnWidths(),this.initializeCompactView()},mounted(){this.initializePerPage(),this.listeners(),this.onThemeChanged=e=>{var t;this.current_mode=(null==(t=e.detail)?void 0:t.effective)||he.getCurrentTheme()},window.addEventListener(pe,this.onThemeChanged),this.syncAllSelectedInterval=setInterval(()=>{this.$refs.bulkActionsRef&&this.$refs.bulkActionsRef.allSelected!==this.allSelected&&(this.allSelected=this.$refs.bulkActionsRef.allSelected)},100)},beforeUnmount(){this.syncAllSelectedInterval&&clearInterval(this.syncAllSelectedInterval),this.onThemeChanged&&window.removeEventListener(pe,this.onThemeChanged)}},[["render",function(e,t,l,s,a,o){const i=se("searcher"),n=se("filter-popover"),r=se("toggler"),d=se("Expand"),c=se("Fold"),u=f,p=m,h=M,_=se("active-filters-bar"),b=se("ContactsLoader"),y=se("icons"),g=A,v=se("CopyDocument"),w=se("router-link"),k=se("Badge"),x=F,$=se("pagination-bar"),C=se("data-table"),V=se("bulk-contact-actions"),S=se("Icons"),P=se("floating-bulk-action-shell");return E(),U("div",{class:oe([{fcrm_has_selections:a.selectedSubscribers.length},"fcrm_company_contacts_wrap"]),style:{position:"relative"}},[ee(C,{"has-selection":!1},re({"header-left":H(()=>[ee(i,{disabled:"advanced"==l.filter_type,modelValue:l.query_data.search,"onUpdate:modelValue":t[0]||(t[0]=e=>l.query_data.search=e)},null,8,["disabled","modelValue"])]),"header-actions":H(()=>[ie(e.$slots,"before_search_box"),ee(n,{ref:"filterPopoverRef",disabled:"advanced"===l.filter_type,options:{lists:l.ui_config.show_list?l.options.lists:[],tags:l.ui_config.show_tag?l.options.tags:[],statuses:l.options.statuses,sms_statuses:l.options.sms_statuses},"selected-filters":l.query_data,onApply:o.handleFilterApply},null,8,["disabled","options","selected-filters","onApply"]),X("div",Xt,[ee(r,{onDataChanged:t[1]||(t[1]=e=>o.maybeReFetch()),modelValue:a.columns,"onUpdate:modelValue":t[2]||(t[2]=e=>a.columns=e)},null,8,["modelValue"]),ee(h,{placement:"bottom",content:a.compactView?e.$t("Default View"):e.$t("Compact View")},{default:H(()=>[ee(p,{size:"small",class:oe(["small only-icon-btn fcrm_compact_view_toggle",{"is-active":a.compactView}]),"aria-label":a.compactView?e.$t("Default View"):e.$t("Compact Compact View"),onClick:o.toggleCompactView},{default:H(()=>[ee(u,null,{default:H(()=>[a.compactView?(E(),N(d,{key:0})):(E(),N(c,{key:1}))],void 0,!0),_:1})],void 0,!0),_:1},8,["class","aria-label","onClick"])],void 0,!0),_:1},8,["content"])]),ie(e.$slots,"after_search_box")]),"active-filters":H(()=>["advanced"!==l.filter_type?(E(),N(_,{key:0,"selected-filters":l.query_data,options:{lists:l.ui_config.show_list?l.options.lists:[],tags:l.ui_config.show_tag?l.options.tags:[],statuses:l.options.statuses,sms_statuses:l.options.sms_statuses},onFilterChange:o.handleFilterBarChange,onOpenFilter:o.handleOpenFilter,plus_filter_icon:!0},null,8,["selected-filters","options","onFilterChange","onOpenFilter"])):q("",!0)]),table:H(()=>[ie(e.$slots,"before_contacts_table"),l.show_skeleton?(E(),N(b,{key:0,columns:a.columns,"has-company-module":e.has_company_module,hasCommerceFields:a.hasCommerceFields,custom_fields:o.custom_fields,showSelection:e.hasPermission("fcrm_manage_contacts"),segmentColumnWidths:a.segmentColumnWidths,segmentColumnMinWidth:a.segmentColumnMinWidth,compactView:a.compactView},null,8,["columns","has-company-module","hasCommerceFields","custom_fields","showSelection","segmentColumnWidths","segmentColumnMinWidth","compactView"])):(E(),N(x,{key:1,class:oe(["fcrm_contacts_table",{"fcrm_contacts_table--compact":a.compactView}]),"default-sort":{prop:l.query_data.sort_by,order:"DESC"==l.query_data.sort_type?"descending":"ascending"},data:l.subscribers,border:"",id:"fluentcrm-subscribers-table",onSelectionChange:o.onSelection,style:{width:"100%"},stripe:"",onSortChange:o.handleSortable,onHeaderDragend:o.handleColumnResize,ref:"subscribersTable"},{empty:H(()=>[X("div",el,[ee(y,{"icon-name":"common-empty-state"}),X("div",tl,[X("span",null,Y(e.$t("Please create a contact to view")),1)])])]),default:H(()=>[e.hasPermission("fcrm_manage_contacts")?(E(),N(g,{key:0,type:"selection",width:"50"})):q("",!0),ee(g,{label:e.$t("Contact"),"min-width":"300",property:"first_name",sortable:"custom"},{default:H(t=>[ee(w,{class:"fcrm_contact_cell",to:{name:"subscriber",params:{id:t.row.id}}},{default:H(()=>[X("img",{title:e.$t("Contact ID:")+" "+t.row.id,class:"fcrm_contact_photo",src:t.row.photo,alt:t.row.full_name},null,8,ll),X("div",sl,[X("div",al,Y(t.row.full_name),1),X("div",ol,[ae(Y(t.row.email)+" ",1),ee(h,{placement:"top",content:a.copiedText.id==t.row.id?a.copiedText.title:e.$t("Copy Email")},{default:H(()=>[ee(u,{class:"fcrm_copy-text",role:"button",tabindex:"0","aria-label":e.$t("Copy Email"),onClick:ce(e=>o.copyText(t.row.email,t.row.id),["stop","prevent"]),onKeydown:[de(ce(e=>o.copyText(t.row.email,t.row.id),["prevent","stop"]),["enter"]),de(ce(e=>o.copyText(t.row.email,t.row.id),["prevent","stop"]),["space"])]},{default:H(()=>[ee(v)],void 0,!0),_:1},8,["aria-label","onClick","onKeydown"])],void 0,!0),_:2},1032,["content"])])])],void 0,!0),_:2},1032,["to"])]),_:1},8,["label"]),-1!=a.columns.indexOf("prefix")?(E(),N(g,{key:1,label:e.$t("Prefix"),"min-width":"70",property:"prefix"},{default:H(e=>[ae(Y(e.row.prefix),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("first_name")?(E(),N(g,{key:2,label:e.$t("First Name"),"min-width":"140",property:"first_name",sortable:"custom"},{default:H(e=>[ae(Y(e.row.first_name),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("last_name")?(E(),N(g,{key:3,label:e.$t("Last Name"),"min-width":"140",property:"last_name",sortable:"custom"},{default:H(e=>[ae(Y(e.row.last_name),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("lists")?(E(),N(g,{key:4,label:e.$t("Lists"),property:"lists",width:a.segmentColumnWidths.lists,"min-width":a.segmentColumnMinWidth,sortable:!1},{default:H(e=>[X("div",il,[o.getRelationsArray(e.row,"lists").length?(E(),U(G,{key:0},[(E(!0),U(G,null,J(o.visibleRelations(e.row,"lists"),e=>(E(),U("span",{key:e,class:"fcrm_badge"},[X("span",{title:e},Y(e),9,nl)]))),128)),o.hiddenRelations(e.row,"lists").length?(E(),N(h,{key:0,placement:"top",content:o.hiddenRelationsTooltip(e.row,"lists")},{default:H(()=>[X("span",rl,Y(o.moreRelationsLabel(e.row,"lists")),1)],void 0,!0),_:2},1032,["content"])):q("",!0)],64)):(E(),U("span",dl,"--"))])]),_:1},8,["label","width","min-width"])):q("",!0),-1!=a.columns.indexOf("tags")?(E(),N(g,{key:5,label:e.$t("Tags"),property:"tags",width:a.segmentColumnWidths.tags,"min-width":a.segmentColumnMinWidth},{default:H(e=>[X("div",cl,[o.getRelationsArray(e.row,"tags").length?(E(),U(G,{key:0},[(E(!0),U(G,null,J(o.visibleRelations(e.row,"tags"),e=>(E(),U("span",{key:e,class:"fcrm_badge"},Y(e),1))),128)),o.hiddenRelations(e.row,"tags").length?(E(),N(h,{key:0,placement:"top",content:o.hiddenRelationsTooltip(e.row,"tags")},{default:H(()=>[X("span",ul,Y(o.moreRelationsLabel(e.row,"tags")),1)],void 0,!0),_:2},1032,["content"])):q("",!0)],64)):(E(),U("span",ml,"--"))])]),_:1},8,["label","width","min-width"])):q("",!0),-1!=a.columns.indexOf("status")?(E(),N(g,{key:6,label:e.$t("Status"),width:"150",property:"status",sortable:"custom"},{default:H(e=>[ee(k,{type:e.row.status},null,8,["type"])]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("sms_status")&&"yes"===e.appVars.sms_enabled?(E(),N(g,{key:7,label:e.$t("SMS Status"),width:"150",property:"sms_status",sortable:"custom"},{default:H(e=>[ee(k,{type:e.row.sms_status},null,8,["type"])]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("phone")?(E(),N(g,{key:8,"min-width":"120",label:e.$t("Phone"),property:"phone"},{default:H(t=>[ae(Y(t.row.phone)+" ",1),t.row.phone?(E(),N(h,{key:0,class:"fcrm_item",effect:"dark",placement:"top",content:a.copiedText.id==t.row.id?a.copiedText.title:e.$t("Copy Phone Number")},{default:H(()=>[ee(u,{class:"fcrm_copy-text",role:"button",tabindex:"0","aria-label":e.$t("Copy Phone Number"),onClick:ce(e=>o.copyText(t.row.phone,t.row.id),["stop"]),onKeydown:[de(ce(e=>o.copyText(t.row.phone,t.row.id),["stop"]),["enter"]),de(ce(e=>o.copyText(t.row.phone,t.row.id),["prevent","stop"]),["space"])]},{default:H(()=>[ee(v)],void 0,!0),_:1},8,["aria-label","onClick","onKeydown"])],void 0,!0),_:2},1032,["content"])):q("",!0)]),_:1},8,["label"])):q("",!0),e.has_company_module&&-1!=a.columns.indexOf("companies")?(E(),N(g,{key:9,"min-width":"230",label:e.$t("Companies"),property:"companies"},{default:H(e=>[X("span",null,Y(o.getRelations(e.row,"companies")),1)]),_:1},8,["label"])):q("",!0),e.has_company_module&&-1!=a.columns.indexOf("primary_company")?(E(),N(g,{key:10,"min-width":"220",label:e.$t("Primary Company")},{default:H(e=>[e.row.company?(E(),N(w,{key:0,to:{name:"view_company",params:{company_id:e.row.company_id}},class:"fcrm_company_cell fcrm_photo_text"},{default:H(()=>[e.row.company.logo?(E(),U("span",pl,[X("img",{src:e.row.company.logo},null,8,hl)])):q("",!0),X("span",_l,Y(e.row.company.name),1)],void 0,!0),_:2},1032,["to"])):(E(),U("span",fl,"--"))]),_:1},8,["label"])):q("",!0),a.hasCommerceFields?(E(),U(G,{key:11},[-1!=a.columns.indexOf("commerce.total_order_value")?(E(),N(g,{key:0,"min-width":"120",label:e.$t("Lifetime Value"),property:"commerce_by_provider.total_order_value"},{default:H(t=>[t.row.commerce_by_provider?(E(),U("span",bl,Y(e.appVars.commerce_currency_sign)+Y(t.row.commerce_by_provider.total_order_value||"-"),1)):(E(),U("span",yl,"-"))]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("commerce.total_order_count")?(E(),N(g,{key:1,"min-width":"120",label:e.$t("Order Count"),property:"commerce_by_provider.total_order_count"},{default:H(e=>[e.row.commerce_by_provider?(E(),U("span",gl,Y(e.row.commerce_by_provider.total_order_count||"-"),1)):(E(),U("span",vl,"-"))]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("commerce.first_order_date")?(E(),N(g,{key:2,"min-width":"180",label:e.$t("Customer Since"),property:"commerce_by_provider.first_order_date"},{default:H(t=>[t.row.commerce_by_provider&&t.row.commerce_by_provider.first_order_date?(E(),U("span",wl,Y(e.nsDateFormat(t.row.commerce_by_provider.first_order_date)),1)):(E(),U("span",kl,"-"))]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("commerce.last_order_date")?(E(),N(g,{key:3,"min-width":"180",label:e.$t("Last order"),property:"commerce_by_provider.last_order_date"},{default:H(t=>[t.row.commerce_by_provider&&t.row.commerce_by_provider.last_order_date?(E(),U("span",{key:0,title:t.row.commerce_by_provider.last_order_date},Y(e.nsHumanDiffTime(t.row.commerce_by_provider.last_order_date)),9,xl)):(E(),U("span",$l,"-"))]),_:1},8,["label"])):q("",!0)],64)):q("",!0),-1!=a.columns.indexOf("date_of_birth")?(E(),N(g,{key:12,"min-width":"120",label:e.$t("Date of Birth"),property:"date_of_birth"},{default:H(e=>[ae(Y("0000-00-00"!==e.row.date_of_birth?e.row.date_of_birth:"-"),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("address_line_1")?(E(),N(g,{key:13,"min-width":"160",label:e.$t("Address Line 1"),property:"address_line_1",sortable:"custom"},{default:H(e=>[ae(Y(e.row.address_line_1),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("address_line_2")?(E(),N(g,{key:14,"min-width":"160",label:e.$t("Address Line 2"),property:"address_line_2",sortable:"custom"},{default:H(e=>[ae(Y(e.row.address_line_2),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("city")?(E(),N(g,{key:15,"min-width":"120",label:e.$t("City"),property:"city",sortable:"custom"},{default:H(e=>[ae(Y(e.row.city),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("state")?(E(),N(g,{key:16,"min-width":"120",label:e.$t("State"),property:"state",sortable:"custom"},{default:H(e=>[ae(Y(e.row.state),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("postal_code")?(E(),N(g,{key:17,"min-width":"120",label:e.$t("Zip Code"),property:"postal_code",sortable:"custom"},{default:H(e=>[ae(Y(e.row.postal_code),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("country")?(E(),N(g,{key:18,"min-width":"120",label:e.$t("Country"),property:"country",sortable:"custom"},{default:H(e=>[ae(Y(o.countryName(e.row.country)),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("contact_type")?(E(),N(g,{key:19,label:e.$t("Type"),width:"150",property:"contact_type",sortable:"custom"},{default:H(t=>[ae(Y(e.ucWords(e.trans(t.row.contact_type))),1)]),_:1},8,["label"])):q("",!0),(E(!0),U(G,null,J(o.custom_fields,e=>(E(),N(g,{width:"200",key:e.slug,label:e.label},{default:H(t=>[ae(Y(o.formatCellValue(t.row.custom_fields,e.slug)),1)]),_:2},1032,["label"]))),128)),-1!=a.columns.indexOf("source")?(E(),N(g,{key:20,"min-width":"150",label:e.$t("Source"),property:"source"},{default:H(e=>[ae(Y(e.row.source),1)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("last_activity")?(E(),N(g,{key:21,prop:"last_activity",label:e.$t("Last Activity"),"min-width":"190",property:"last_activity",sortable:"custom"},{default:H(t=>[t.row.last_activity?(E(),U("span",Cl,[X("span",{title:t.row.last_activity},Y(e.nsHumanDiffTime(t.row.last_activity)),9,Vl)])):q("",!0)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("created_at")?(E(),N(g,{key:22,label:e.$t("Date Added"),"min-width":"190",property:"created_at",sortable:"custom"},{default:H(t=>[t.row.created_at?(E(),U("span",{key:0,class:"fcrm_secondary_text",title:t.row.created_at},Y(e.nsHumanDiffTime(t.row.created_at)),9,Sl)):q("",!0)]),_:1},8,["label"])):q("",!0),-1!=a.columns.indexOf("updated_at")?(E(),N(g,{key:23,label:e.$t("Last Changed"),"min-width":"190",property:"updated_at",sortable:"custom"},{default:H(t=>[t.row.updated_at?(E(),U("span",{key:0,class:"fcrm_secondary_text",title:t.row.updated_at},Y(e.nsHumanDiffTime(t.row.updated_at)),9,Al)):q("",!0)]),_:1},8,["label"])):q("",!0)],void 0,!0),_:1},8,["class","default-sort","data","onSelectionChange","onSortChange","onHeaderDragend"]))]),_:2},[l.show_skeleton?void 0:{name:"pagination",fn:H(()=>[ee($,{pagination:l.pagination,hide_on_single:!1,page_sizes:o.paginationPageSizes,"wrapper-class":["fcrm-contacts-pagination","fcrm-contacts-pagination-bar"],onFetch:o.fetch},null,8,["pagination","page_sizes","onFetch"])]),key:"0"}]),1024),ee(P,{visible:a.selection,"theme-mode":a.current_mode,"selected-count":a.selectedSubscribers.length,"selected-label":e.$t("selected"),"show-select-all":o.canSelectAll&&!o.isAllSelected,"show-select-only-page":o.canSelectAll&&o.isAllSelected,"select-all-label":e.$t("Select All %s",o.formatMoney(l.pagination.total)),"select-only-page-label":e.$t("Select only this page"),"deselect-label":e.$t("Deselect"),onSelectAll:o.handleSelectAll,onSelectOnlyPage:o.handleSelectOnlyThisPage,onDeselect:o.handleDeselectAll},{actions:H(()=>[ee(V,{ref:"bulkActionsRef",onRefetch:o.handleBulkActionRefetch,pagination:l.pagination,selectedSubscribers:a.selectedSubscribers,options:l.options,theme_mode:a.current_mode},null,8,["onRefetch","pagination","selectedSubscribers","options","theme_mode"]),ee(p,{size:"small",onClick:o.handleExportSelected},{default:H(()=>[X("span",Fl,[ee(S,{"icon-name":"export"})]),ae(" "+Y(e.$t("Export")),1)],void 0,!0),_:1},8,["onClick"])]),count:H(()=>[o.isAllSelected?(E(),U("span",Pl,Y(e.$t("All %s selected",o.formatMoney(l.pagination.total))),1)):(E(),U(G,{key:1},[X("span",Tl,Y(a.selectedSubscribers.length),1),X("span",Rl,Y(e.$t("selected")),1)],64))]),_:1},8,["visible","theme-mode","selected-count","selected-label","show-select-all","show-select-only-page","select-all-label","select-only-page-label","deselect-label","onSelectAll","onSelectOnlyPage","onDeselect"])],2)}]]);export{at as A,Ol as C,tt as F,Zt as f};