1import{_ as ke,O as xe,$ as Ce,a8 as be,a0 as Ie,o as _e,y as Le,z as Se,k as Te,q as Be,m as a,b as t,e as Ne,c as i,g as x,D as Me,t as k,f as p,x as D,d as De,I as Fe,F,B as z,w as Q,a9 as ze,a2 as Ve,v as Ee,h as Ue,r as c,l as g,aa as Ae}from"./index-CZs8E7p5.js";import{A as We}from"./AppLayout-DHFYS5he.js";import"./logowordsheavy4-BCh2U6rL.js";import"./AppLayout.vue_vue_type_style_index_0_scoped_6bb66ba6_lang-CSNqNX5X.js";import"./SkeletonList-Cspu2ZsC.js";/* empty css */import"./ContrastChip-cbqOPU6N.js";/* empty css */import"./upgrade.helpers-Dv8NCAvC.js";import"./team-helpers-7rg_xhCn.js";const $e={class:"import-screen"},Pe={class:"add-header"},Oe={class:"add-header-left"},Re={class:"add-header-right"},je={class:"import-body"},He={key:0,class:"linkedin-import-banner"},Ke={width:"20",height:"20",viewBox:"0 0 24 24",fill:"#0077b5","aria-hidden":"true",style:{"flex-shrink":"0"}},qe={key:1,class:"linkedin-detected-pill"},Ye={key:2,class:"import-intro"},Xe={key:3,class:"import-intro-links"},Ge={key:5,class:"import-file-preview"},Je={class:"import-file-row"},Qe={class:"import-file-info"},Ze={class:"import-file-name"},et={class:"import-file-meta"},tt={key:6,class:"import-mapping"},ot={class:"import-mapping-rows"},nt={class:"import-mapping-col"},st=["onUpdate:modelValue"],at=["value"],it={key:7,class:"import-mode"},lt=["checked"],rt={class:"import-mode-option-body"},ut={key:0,class:"import-mode-option-details"},dt=["checked"],pt={class:"import-mode-option-body"},ct={key:0,class:"import-mode-option-details"},mt={key:8,class:"import-summary"},vt={key:9,class:"import-tags"},ft={key:0,class:"import-tags-pills"},ht=["onClick"],gt={class:"import-tags-search"},yt={key:0,class:"import-tags-dropdown"},wt=["onMousedown"],kt={key:0,width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},xt={key:1},Ct={key:2},bt="https://s3.amazonaws.com/helpscout.net/docs/assets/5c06841a04286304a71cf7bf/attachments/5cd2ea9a2c7d3a177d6e8000/Contacts_CSV_Example.csv",It="https://support.contactsplus.com/hc/en-us/articles/4407223195547-Importing-Exporting-and-Sharing-Contacts",_t="https://support.contactsplus.com/hc/en-us/articles/4407464475291-Sync-Sources-and-Settings",Lt={__name:"ImportView",setup(St){const P=Te(),O=Be(),S=xe(),T=Ce(),y=be(),Z=Ie(),v=g(()=>O.params.teamId||null),n=c("upload"),m=c(null),B=c(!1),C=c(!1),V=c(null),_=c([]),N=c([]),f=c("Import"),h=c([]),b=c(""),E=c(!1),M=c(!1);let R=null;_e(()=>{y.loadPersonalTags()});const j=g(()=>O.query.source==="linkedin"),H=c(!1),U=c(!1),ee=g(()=>j.value&&!H.value);function te(o){const e=o.map(r=>r.toLowerCase().replace(/[-_ ]/g,""));return["firstname","lastname","company","position"].every(r=>e.some(s=>s.includes(r)))}const oe=["Skip","First Name","Last Name","Full Name","Email","Phone","Company","Title","Address","Website","Birthday","Notes","Tags","LinkedIn Connected"];function K(o){const e=(o||"").toLowerCase().replace(/[-_ ]/g,"");return e.includes("firstname")||e.includes("givenname")||e==="first"?"First Name":e.includes("lastname")||e.includes("familyname")||e==="last"?"Last Name":e.includes("fullname")||e.includes("displayname")||e==="name"?"Full Name":e.includes("email")||e.includes("mail")?"Email":e.includes("phone")||e.includes("tel")||e.includes("mobile")||e.includes("cell")?"Phone":e.includes("company")||e.includes("org")||e.includes("organization")?"Company":e.includes("title")||e.includes("jobtitle")||e.includes("position")?"Title":e.includes("address")||e.includes("street")||e.includes("city")?"Address":e.includes("website")||e.includes("url")||e.includes("web")?"Website":e.includes("birthday")||e.includes("birth")||e.includes("dob")?"Birthday":e.includes("note")||e.includes("comment")?"Notes":e.includes("tag")||e.includes("group")||e.includes("label")?"Tags":e.includes("connectedon")||e==="connected"?"LinkedIn Connected":"Skip"}function ne(o){return o<1024?o+" B":o<1024*1024?(o/1024).toFixed(1)+" KB":(o/(1024*1024)).toFixed(1)+" MB"}const se=g(()=>m.value?ne(m.value.size):""),ae=g(()=>{if(!m.value)return!1;const o=m.value.name.toLowerCase();return o.endsWith(".csv")||o.endsWith(".xlsx")||o.endsWith(".xls")}),q=g(()=>C.value?!1:n.value==="upload"||n.value==="preview"||n.value==="mapping"?!!m.value:n.value==="import-type"?!!f.value:n.value==="add-tags"||n.value==="success"),ie=g(()=>C.value?"Importing...":n.value==="success"?"Done":n.value==="add-tags"?"Import":"Next"),Y=g(()=>{const o=y.personalTags||{};return Object.entries(o).map(([e,r])=>({id:e,name:r})).sort((e,r)=>e.name.localeCompare(r.name))}),A=g(()=>{const o=b.value.trim().toLowerCase(),e=new Set(h.value.map(l=>l.id)),r=Y.value.filter(l=>!e.has(l.id)&&(!o||l.name.toLowerCase().includes(o))),s=Y.value.some(l=>l.name.toLowerCase()===o),d=h.value.some(l=>l.name.toLowerCase()===o);return o&&!s&&!d&&r.push({id:"new-personal-tag",name:b.value.trim(),isNew:!0}),r});function le(o){o.preventDefault(),B.value=!0}function re(){B.value=!1}function ue(o){o.preventDefault(),B.value=!1;const e=o.dataTransfer.files[0];e&&X(e)}function de(o){const e=o.target.files[0];e&&X(e)}async function X(o){const e=o.name.toLowerCase();if(!e.endsWith(".csv")&&!e.endsWith(".xlsx")&&!e.endsWith(".xls")&&!e.endsWith(".vcf")&&!e.endsWith(".vcard")){S.addToast({type:"error",text:"Unsupported file format",duration:2});return}if(m.value=o,n.value="preview",ae.value&&e.endsWith(".csv"))try{const s=(await o.text()).split(` 2`);let d=0,l=-1;for(let u=0;u<Math.min(s.length,10);u++){const I=s[u].trim();if(!I)continue;const L=I.split(",").map($=>$.trim().replace(/^"|"$/g,""));if(L.length<2)continue;const W=L.filter($=>K($)!=="Skip").length;W>=2&&W>l&&(l=W,d=u)}if(d>0){const u=s.slice(d).join(` 3`);m.value=new File([u],o.name,{type:o.type})}const w=s[d].split(",").map(u=>u.trim().replace(/^"|"$/g,""));_.value=w,N.value=w.map(u=>K(u)),U.value=te(w),n.value="mapping"}catch{}}function pe(){m.value=null,_.value=[],N.value=[],U.value=!1,n.value="upload",V.value&&(V.value.value="")}
3async function ce(){if(!m.value||C.value)return;C.value=!0;const o=h.value.filter(e=>e.id&&e.id!=="new-personal-tag").map(e=>e.id);try{let e;if(v.value)e=await T.importTeamFiles(v.value,[m.value],o);else{const r=await T.importFiles([m.value],f.value,o);e=r==null?void 0:r.every(s=>s.status==="ok")}e&&(n.value="success",T.loadAddressBooks(),v.value?y.loadTeamContacts({teamId:v.value,refresh:!0}):y.loadContacts({refresh:!0}))}catch{}finally{C.value=!1}}function me(){clearTimeout(R),E.value=!0}function ve(){R=setTimeout(()=>{E.value=!1},150)}async function G(o){var s,d;if(!o||h.value.find(l=>l.id!=="new-personal-tag"&&l.id===o.id||l.name.toLowerCase()===o.name.toLowerCase()))return;if(!(o.id==="new-personal-tag"||!!o.isNew)){h.value.push({id:o.id,name:o.name,isNew:!1}),b.value="";return}if(!M.value){M.value=!0;try{const{status:l,body:w}=await Ae({tagName:o.name});if(l===200&&w){const u=((s=w.tags)==null?void 0:s[0])||((d=w.data)==null?void 0:d[0])||w,I=u==null?void 0:u.id,L=(u==null?void 0:u.name)||o.name;I?(y.personalTags={...y.personalTags,[I]:L},h.value.push({id:I,name:L,isNew:!1}),b.value=""):S.addToast({type:"error",text:`Failed to create tag "${o.name}"`,duration:3})}else S.addToast({type:"error",text:`Failed to create tag "${o.name}"`,duration:3})}catch{S.addToast({type:"error",text:`Failed to create tag "${o.name}"`,duration:3})}finally{M.value=!1}}}function fe(o){h.value=h.value.filter(e=>!(e.name===o.name&&e.id===o.id))}function he(){if(M.value)return;const o=A.value;o.length>0&&G(o[0])}const J=g(()=>v.value?`/teams/${v.value}/contacts`:"/contacts");async function ge(){if(C.value)return;if(n.value==="success"){T.loadAddressBooks(),v.value?y.loadTeamContacts({teamId:v.value,refresh:!0}):y.loadContacts({refresh:!0}),P.push(J.value);return}const o=v.value?"add-tags":"import-type";if(n.value==="upload"||n.value==="preview"||n.value==="mapping"){n.value=o;return}if(n.value==="import-type"){n.value="add-tags";return}if(n.value==="add-tags"){await ce();return}}function ye(){if(n.value==="add-tags"){n.value=v.value?_.value.length?"mapping":"preview":"import-type";return}if(n.value==="import-type"){n.value=_.value.length?"mapping":"preview";return}}function we(){P.push(J.value)}return(o,e)=>(a(),Le(We,{"hide-header":!0,"hide-tab-bar":!0},{default:Se(()=>{var r;return[t("div",$e,[t("div",Pe,[t("div",Oe,[t("button",{class:"import-hamburger","aria-label":"Menu",onClick:e[0]||(e[0]=s=>Ne(Z).openMobileNav())},[...e[5]||(e[5]=[t("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[t("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),t("line",{x1:"3",y1:"18",x2:"21",y2:"18"})],-1)])]),n.value==="import-type"||n.value==="add-tags"?(a(),i("button",{key:0,class:"btn-cancel",onClick:ye},[...e[6]||(e[6]=[t("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},[t("polyline",{points:"15 18 9 12 15 6"})],-1),x(" Back ",-1)])])):(a(),i("button",{key:1,class:"btn-cancel",onClick:we},"Cancel"))]),e[7]||(e[7]=t("h2",null,"Import Contacts",-1)),t("div",Re,[t("button",{class:"btn-save",style:Me({opacity:q.value?1:.4,pointerEvents:q.value?"auto":"none"}),onClick:ge},k(ie.value),5)])]),t("div",je,[ee.value?(a(),i("div",He,[(a(),i("svg",Ke,[...e[8]||(e[8]=[t("path",{d:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"},null,-1)])])),e[9]||(e[9]=t("span",{class:"linkedin-import-banner__text"},[t("strong",null,"Importing from LinkedIn"),x(" â Drop your Connections.csv here â we'll auto-map LinkedIn's columns for you. ")],-1)),t("button",{class:"linkedin-import-banner__close",type:"button","aria-label":"Dismiss",onClick:e[1]||(e[1]=s=>H.value=!0)},"Ã")])):p("",!0),U.value?(a(),i("div",qe,[...e[10]||(e[10]=[t("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"
3currentColor","aria-hidden":"true"},[t("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"})],-1),x(" LinkedIn Connections.csv detected â columns auto-mapped ",-1)])])):p("",!0),n.value==="upload"||n.value==="preview"||n.value==="mapping"?(a(),i("p",Ye," Upload a file to import your contacts. We'll help you map the columns to the right fields. ")):p("",!0),(n.value==="upload"||n.value==="preview"||n.value==="mapping")&&!j.value?(a(),i("p",Xe,[t("a",{href:bt,class:"import-link",download:""},"Download a .csv template"),e[11]||(e[11]=x(" with supported header names. LinkedIn is not supported â ",-1)),t("a",{href:It,class:"import-link",target:"_blank",rel:"noopener"},"Learn More"),e[12]||(e[12]=x(". ",-1))])):p("",!0),n.value==="upload"?(a(),i("div",{key:4,class:D(["import-dropzone",{dragover:B.value}]),onDragover:le,onDragleave:re,onDrop:ue},[t("input",{ref_key:"fileInput",ref:V,type:"file",accept:".csv,.xlsx,.xls,.vcf,.vcard",onChange:de},null,544),e[13]||(e[13]=t("div",{class:"import-dropzone-icon"},[t("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[t("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),t("polyline",{points:"17 8 12 3 7 8"}),t("line",{x1:"12",y1:"3",x2:"12",y2:"15"})])],-1)),e[14]||(e[14]=t("div",{class:"import-dropzone-title"},"Drop file here or tap to browse",-1)),e[15]||(e[15]=t("div",{class:"import-dropzone-sub"},"Maximum file size: 10 MB",-1)),e[16]||(e[16]=t("div",{class:"import-formats"},[t("span",{class:"import-format-badge csv"},"CSV"),t("span",{class:"import-format-badge excel"},"XLSX"),t("span",{class:"import-format-badge vcard"},"vCard")],-1))],34)):p("",!0),n.value==="preview"||n.value==="mapping"?(a(),i("div",Ge,[t("div",Je,[e[17]||(e[17]=t("div",{class:"import-file-icon"},[t("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[t("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),t("polyline",{points:"14 2 14 8 20 8"})])],-1)),t("div",Qe,[t("div",Ze,k((r=m.value)==null?void 0:r.name),1),t("div",et,k(se.value),1)]),t("button",{class:"import-file-remove",onClick:pe},[De(Fe,{name:"close",size:16})])])])):p("",!0),n.value==="mapping"?(a(),i("div",tt,[e[19]||(e[19]=t("div",{class:"import-mapping-title"},"Detected Columns",-1)),e[20]||(e[20]=t("div",{class:"import-mapping-sub"},"We auto-detect each column based on its header.",-1)),t("div",ot,[(a(!0),i(F,null,z(_.value,(s,d)=>(a(),i("div",{key:d,class:"import-mapping-row"},[t("span",nt,k(s),1),e[18]||(e[18]=t("span",{class:"import-mapping-arrow"},[t("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[t("line",{x1:"5",y1:"12",x2:"19",y2:"12"}),t("polyline",{points:"12 5 19 12 12 19"})])],-1)),Q(t("select",{"onUpdate:modelValue":l=>N.value[d]=l,class:"import-mapping-select",disabled:"","aria-readonly":"true",title:"Auto-detected from the column header"},[(a(),i(F,null,z(oe,l=>t("option",{key:l,value:l},k(l),9,at)),64))],8,st),[[ze,N.value[d]]])]))),128))])])):p("",!0),n.value==="import-type"?(a(),i("div",it,[e[26]||(e[26]=t("div",{class:"import-mode-heading"},"Import Your Contacts",-1)),e[27]||(e[27]=t("div",{class:"import-mode-sub"},"Choose how new and existing contacts should be handled.",-1)),t("label",{class:D(["import-mode-option",{"import-mode-option--selected":f.value==="Import"}])},[t("input",{type:"radio",name:"import-mode",value:"Import",checked:f.value==="Import",onChange:e[2]||(e[2]=s=>f.value="Import")},null,40,lt),t("div",rt,[e[22]||(e[22]=t("div",{class:"import-mode-option-head"},[t("span",{class:"import-mode-option-label"},"Add All Contacts"),t("span",{class:"import-mode-option-rec"},"(Recommended)")],-1)),f.value==="Import"?(a(),i("ul",ut,[...e[21]||(e[21]=[t("li",null,"New contacts will be added",-1),t("li",null,"Existing contacts will be updated",-1),t("li",null,"Duplicate contacts will be merged",-1)])])):p("",!0)])],2),t("label",{class:D(["import-mode-option",{"import-mode-option--selected":f.value==="Update"}])},[t("input",{type:"radio",name:"import-mode",value:"Update",checked:f.value==="Update",onCh
3ange:e[3]||(e[3]=s=>f.value="Update")},null,40,dt),t("div",pt,[e[24]||(e[24]=t("div",{class:"import-mode-option-head"},[t("span",{class:"import-mode-option-label"},"Only Update Existing Contacts")],-1)),f.value==="Update"?(a(),i("ul",ct,[...e[23]||(e[23]=[t("li",null,"No new contacts will be added",-1),t("li",null,"Only existing contacts will be updated",-1)])])):p("",!0)])],2),t("div",{class:"import-mode-help"},[e[25]||(e[25]=x(" Not sure which option is best? ",-1)),t("a",{href:_t,class:"import-link",target:"_blank",rel:"noopener"},"Learn More")])])):p("",!0),n.value==="success"?(a(),i("div",mt,[...e[28]||(e[28]=[t("div",{class:"import-summary-icon"},[t("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[t("polyline",{points:"20 6 9 17 4 12"})])],-1),t("div",{class:"import-summary-title"},"Contacts Imported",-1),t("div",{class:"import-summary-sub"},"Your new contacts are ready to view",-1)])])):p("",!0),n.value==="add-tags"?(a(),i("div",vt,[e[31]||(e[31]=t("div",{class:"import-mode-heading"},"Add tags (optional)",-1)),e[32]||(e[32]=t("div",{class:"import-mode-sub"},"Tag imported contacts to organize them. You can skip this step.",-1)),h.value.length?(a(),i("div",ft,[(a(!0),i(F,null,z(h.value,s=>(a(),i("span",{key:s.id,class:"import-tag-pill"},[x(k(s.name)+" ",1),t("button",{type:"button",class:"import-tag-pill-remove",onClick:d=>fe(s),"aria-label":"Remove tag"},[...e[29]||(e[29]=[t("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round"},[t("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])],8,ht)]))),128))])):p("",!0),t("div",gt,[Q(t("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>b.value=s),type:"text",class:"import-tags-search-input",placeholder:"Search tags or type a new tag name",onFocus:me,onBlur:ve,onKeyup:Ve(he,["enter"])},null,544),[[Ee,b.value]]),E.value&&A.value.length?(a(),i("div",yt,[(a(!0),i(F,null,z(A.value,s=>(a(),i("div",{key:s.id+":"+s.name,class:D(["import-tag-suggestion",{"import-tag-suggestion--new":s.isNew}]),onMousedown:Ue(d=>G(s),["prevent"])},[s.isNew?(a(),i("svg",kt,[...e[30]||(e[30]=[t("line",{x1:"12",y1:"5",x2:"12",y2:"19"},null,-1),t("line",{x1:"5",y1:"12",x2:"19",y2:"12"},null,-1)])])):p("",!0),s.isNew?(a(),i("span",xt,'Create tag "'+k(s.name)+'"',1)):(a(),i("span",Ct,k(s.name),1))],42,wt))),128))])):p("",!0)])])):p("",!0)])])]}),_:1}))}},At=ke(Lt,[["__scopeId","data-v-fdab2c9d"]]);export{At as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.