PageSourceSearch

https://masssender.ai/assets/index.04513c8f.js

js masssender.ai collected 2026-10-05 12:36:10 UTC 54,557 bytes, 9 lines download raw bytes

1import{a as s}from"./vendor.8ad8d112.js";import{b as K,j as t,a as e,aP as Ue,Q as z,F as J,aQ as Oe,L as Ve,e as Z,aC as _e,a6 as Fe,aH as Ge,c as He,aL as fe,aD as Xe,A as Se}from"./index.ca05d714.js";import{C as Me}from"./Card.cb3c9e2e.js";import{T as se}from"./Textinput.9b8a0260.js";import{S as ne}from"./react-select.esm.cd6184fb.js";import"./jszip.min.4de9f59c.js";import"./FileSaver.min.88ee0759.js";import{m as $e,p as me}from"./paper.a87bc039.js";import{u as be}from"./usePsdLayers.94f340be.js";import{l as Ce}from"./placeholder.09d2ddcb.js";import{d as Ze}from"./database.02ef7f26.js";import{I as qe}from"./ImageModal.a51ee5f4.js";import{e as de,f as xe,K as Ke,g as Je,I as Qe,i as et,J as tt}from"./psd.cce0e3e5.js";import{C as st}from"./index.44f40f7e.js";import{P as at,R as rt}from"./ProgressBarLoader.7b2974f0.js";import{u as lt,M as ot,L as nt,H as ct}from"./MenuBar.7263c172.js";import{P as it}from"./PsdModal.41ed5cca.js";import{u as dt}from"./upload.008118ad.js";import{S as mt}from"./Table.81a421b1.js";import{$ as te}from"./tabs.78b2017a.js";import"./cleave-phone.us.edbc4839.js";import"./setPrototypeOf.a0b1958c.js";import"./extends.d141bdfd.js";import"./Google.a4da3f69.js";import"./_baseIteratee.c007b3c7.js";import"./ImagePickerModal.5f3b8419.js";import"./webfontloader.e66689cf.js";import"./browser.9400aa4a.js";import"./lodash.ab81ec0d.js";import"./Button.c4a90c81.js";import"./Transition.5d718ec5.js";import"./x.f54660f7.js";import"./createLucideIcon.5dd2c055.js";function ht({arrayContent:n,zipContent:g,projectName:L,selectedDatabase:A,setSelectedImage:m}){var x;const{user:y}=K(h=>h.auth),f=y.id,[u,F]=s.exports.useState(!1),p=async()=>{let h=L||"imessage";F(!0);try{let w=await Ue(g,h,f,A,n);F(!1),z.success("Message Sent Successfully!!",{autoClose:1e3})}catch(w){console.log(w),F(!1),z.success("Something went wrong, please try again!!",{autoClose:1e3})}};return t("div",{className:"block",children:[e("h2",{className:"text-2xl font-semibold mb-1 text-center",children:"Personalized iMessage Content Preview"}),e("p",{className:"mb-4 text-center",children:"Your Content Preview Before Saving !!"}),t("div",{className:"image-gallery grid xl:grid-cols-3 lg:grid-cols-3 sm:grid-cols-2 col-span-3 gap-2",children:[(x=n.slice(0,2))==null?void 0:x.map((h,w)=>t("div",{className:"block cursor-pointer imessage-gallery-popup",style:{backgroundImage:`url(${window.location.origin}/phone.png)`},children:[h.blogurl&&e("img",{className:"iimage",src:h.blogurl,alt:`Image ${w+1}`,onClick:()=>m(h.blogurl)}),e("span",{className:"text-sm imsg-text-popup text-left",children:h.body})]},`Final${w}`)),t("div",{className:"block cursor-pointer imessage-gallery-popup text-center relative",style:{backgroundImage:`url(${$e})`},children:[u?e("img",{className:"relative left-[30%] mt-20 w-20 h-20 flex items-center justify-center text-center ",src:me,alt:"Image paper"}):e("img",{className:"relative left-[30%] mt-20 w-20 h-20 flex items-center justify-center text-center ",src:me,alt:"Image paper"}),e("button",{onClick:p,className:"btn-success dark:bg-gray-500 mt-3 h-min w-[130px] text-sm font-normal px-5 py-2 rounded ",children:u?t("div",{className:"flex items-center",children:[" Saving... ",e("div",{className:"w-5 h-5 ml-2 roun
1ded-full animate-spin border-2 border-solid border-white-900 dark:border-slate-200 border-t-transparent"})," "]}):"Save To App"})]})]})]})}function ut({arrayContent:n,zipContent:g,projectName:L,selectedDatabase:A,handlePreviousStep:m,setSelectedImage:y}){var O;const{user:f}=K(a=>a.auth),u=f.id,[F,p]=s.exports.useState(!1),[x,h]=s.exports.useState(0),[w,$]=s.exports.useState(!1),[I,S]=s.exports.useState(""),R=()=>{if(x<n.length){const{to:a,body:c,mediaUrl:r}=n[x];let b=E(a,c,r);S(b),$(!0)}else z.success("Message Sent Successfully!!",{autoClose:1e3}),p(!1)},P=()=>{D(I)},W=()=>{N(),p(!1)},D=a=>{const c=document.createElement("a");c.href=a,c.target="_blank",document.body.appendChild(c),c.click(),document.body.removeChild(c),N()},N=()=>{$(!1),x<n.length-1&&(h(a=>a+1),R())},i=async()=>{p(!0),(await Oe(g,L||"batchwhatsapp",u)).status===200&&R()},v=()=>{$(!1),p(!1)},E=(a,c,r)=>{let b=`https://wa.me/${a}?text=${encodeURIComponent(c)}`;return r&&(b+=`%20${encodeURIComponent(r)}`),b};return t("div",{className:"block",children:[e("h2",{className:"text-2xl font-semibold mb-1 text-center",children:"Personalized WhatsApp Content Preview"}),e("p",{className:"mb-4 text-center",children:"Your Content Preview Before Saving !!"}),t("div",{className:"image-gallery grid xl:grid-cols-3 lg:grid-cols-3 sm: grid-cols-2 col-span-3 gap-2",children:[(O=n.slice(0,2))==null?void 0:O.map((a,c)=>t("div",{className:"block cursor-pointer imessage-gallery",style:{backgroundImage:`url(${window.location.origin}/phone.png)`},children:[a.blogurl&&e("img",{className:"iimage",src:a.blogurl,alt:`Image ${c+1}`,onClick:()=>y(a.blogurl)}),e("span",{className:"text-sm imsg-text text-left",children:a.body})]},`Final${c}`)),t("div",{className:"block cursor-pointer imessage-gallery text-center relative",style:{backgroundImage:`url(${$e})`},children:[F?e("img",{className:"relative left-[30%] mt-20 w-20 h-20 flex items-center justify-center text-center ",src:me,alt:"Image paper"}):e("img",{className:"relative left-[30%] mt-20 w-20 h-20 flex items-center justify-center text-center ",src:me,alt:"Image paper"}),e("button",{onClick:i,className:"btn-success dark:bg-gray-500 h-min w-[130px] text-sm font-normal px-2 py-2 rounded ",children:F?t("div",{className:"flex items-center",children:[" ","Saving..."," ",e("div",{className:"w-5 h-5 ml-2 roun
1ded-full animate-spin border-2 border-solid border-white-900 dark:border-slate-200 border-t-transparent"})," "]}):"Send Message"})]})]}),w&&e(J,{children:e("div",{className:"fixed inset-0 flex items-center justify-center bg-gray-800 bg-opacity-75 z-50",children:t("div",{className:"bg-white overflow-y-auto max-h-full rounded-lg p-8 max-w-full w-full custom-scrollbar",children:[e("span",{className:"cursor-pointer flex justify-end items-end",onClick:v,children:"X"}),e("h2",{className:"text-xl text-center font-bold mb-4",children:"Preview WhatsApp Message"}),t("div",{className:"mb-4 border text-center mx-auto w-full relative flex flex-col items-center",children:[n[x].blogurl&&e("img",{src:n[x].blogurl,alt:"Preview",className:"my-4 block max-w-full h-auto rounded w-[280px]"}),t("p",{className:"p-0",children:[e("strong",{children:"Phone Number:"})," ",n[x].to]}),t("p",{className:"p-0",children:[e("strong",{children:"Message Text:"})," ",n[x].body]})]}),t("div",{className:"flex justify-between mt-4",children:[e("button",{onClick:W,className:"bg-gray-300 hover:bg-gray-400 text-gray-800 text-sm font-medium py-2 px-4 rounded mr-2",children:"Skip"}),e("button",{onClick:P,className:"bg-blue-500 hover:bg-blue-600 text-white text-sm font-medium py-2 px-4 rounded",children:"Send & Next"})]})]})})})]})}const pt=({layers:n,databaseHeaders:g,onLayerMappingChange:L,generateiMessageBatchMethod:A,viewImages:m,zipContent:y,batchLoader:f,selectedDatabase:u,projectName:F,messageContent:p,handleMessageChange:x,setPhoneField:h,setMessageContent:w,arrayContent:$,selectedType:I})=>{const S=s.exports.useRef(null),[R,P]=s.exports.useState(p),[W,D]=s.exports.useState(0),[N,i]=be();if(!Array.isArray(n))return t("div",{className:"flex items-center",children:[e("span",{children:"Getting Layers..."}),e("div",{className:"ml-3 w-8 h-8 rounded-full animate-spin border-2 border-solid border-slate-900 dark:border-slate-200 border-t-transparent"})]});const v=N.filter(a=>a.text);s.exports.useEffect(()=>{P(p);const a=g.findIndex(c=>c.value==="Phone")!==-1?g.findIndex(c=>c.value==="Phone"):0;D(a),h(g[a])},[p]);const E=a=>{const c=p+a;w(c),P(c),S.current&&S.current.focus()}
1,O=g.findIndex(a=>a.value==="Phone")!==-1?g.findIndex(a=>a.value==="Phone"):0;return e(J,{children:m&&m.length>0?e("div",{className:"block text-center",children:I=="iMessage"?e(ht,{arrayContent:$,zipContent:y,projectName:F,selectedDatabase:u}):e(ut,{arrayContent:$,zipContent:y,projectName:F,selectedDatabase:u})}):t("div",{className:"relative sm:rounded-lg text-center",children:[t("div",{className:"grid xl:grid-cols-2 md:grid-cols-2 grid-cols-2 gap-2 h-full",children:[t("div",{className:"my-1 w-full",children:[e("label",{htmlFor:"Workflow",className:"text-left form-label text-sm my-1",children:"Selected Contact Group"}),e(se,{id:"formatter-pn",type:"text",placeholder:"List",disabled:!0,defaultValue:u})]}),t("div",{className:"my-1 w-full",children:[e("label",{htmlFor:"Workflow",className:"form-label text-sm text-left",children:"Phone Field"}),e(ne,{className:"react-select text-sm my-1 basic-single text-left",classNamePrefix:"select",defaultValue:g[O],name:"database",options:g,onChange:a=>h(a)})]})]}),t("div",{className:"my-2",children:[e("label",{htmlFor:"Workflow",className:"form-label my-1 text-sm text-left",children:"Available Variable Tags"}),e("div",{className:"flex flex-wrap gap-2 mb-2",children:g.map((a,c)=>c!==0&&e("span",{label:a.label,className:"bg-gray-500 text-white text-[10px] font-medium me-2 px-2.5 py-0.5 rounded-full dark:bg-white-900 dark:text-black-300 pill hover:cursor-pointer",onClick:()=>{var b;let r=`{${(b=a==null?void 0:a.label)==null?void 0:b.trim()}}`;E(r)},children:`{${a.label}}`},`badge${c}`))}),e("label",{htmlFor:"Workflow",className:"form-label my-1 text-sm text-left",children:" Message "}),e("textarea",{id:"formatter-pn",type:"text",className:"block p-2.5 w-full text-sm text-gray-900 bg-white-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Hi! {{First Name}}",value:R,onChange:x,ref:S,description:"You can use tags to create personal messages. Hi {Name}, Good Luck!!! ",rows:"6"})]}),e("label",{htmlFor:"Workflow",className:"text-left form-label text-sm my-3",children:"Layer Mapping With Your Contacts"}),t("table",{className:"w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 border",children:[e("thead",{className:"text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400",children:t("tr",{children:[e("th",{scope:"col",className:"px-6 py-4",children:"Text Layers"}),e("th",{scope:"col",className:"px-6 py-4"}),e("th",{scope:"col",className:"px-6 py-4",children:"Data Set Column"})]})}),e("tbody",{children:v.length>0?v.map((a,c)=>t("tr",{className:"bg-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600",children:[e("th",{scope:"row",className:"px-6 py-1.5 font-medium text-gray-900 whitespace-nowrap dark:text-white",children:a.name?a.name.substring(0,20):`Layer ${c}`}),e("td",{className:"px-6 py-1.5",children:"-------"}),e("td",{className:"px-6 py-1.5",children:e(ne,{className:"react-select text-md my-1 basic-single",classNamePrefix:"select",defaultValue:g[0],name:"database",menuPlacement:"auto",options:g,onChange:r=>L(a.id,r)})})]},`layer-${c}`)):e("tr",{children:e("td",{colSpan:"3",className:"px-6 py-1.5 text-center",children:"No text layers available"})})})]}),e("button",{text:"Create Batch",className:"btn-dark dark:bg-gray-500 h-min text-sm font-normal px-10 py-2 my-5",onClick:A,children:f?e("div",{className:"w-8 h-8 rounded-full animate-spin border-2 border-solid border-white dark:border-slate-200 border-t-transparent"}):`${I} Preview`})]})})},gt=({data:n,handleDatabaseChange:g,handlePreviousStep:L,setProjectName:A})=>{const m=(y,f)=>y.length<=f?y:y.slice(0,f)+"...";return t("div",{className:"block bg-white",children:[t("div",{className:"text-center",children:[e("h2",{className:"text-2xl font-semibold mb-1",children:" List For Personalized Message"}),e("p",{className:"mb-4",children:"Select Your List First!!"})]}),t("div",{className:"my-2 h-full",children:[t("label",{className:"mb-1 block",children:["Project Name ",e("span",{className:"text-danger-500",children:"*"})]}),e(se,{id:"formatter-pn",type:"text",placeholder:"Enter Project Name",onChange:y=>A(y.target.value),className:"border border-blue-300"})]}),t("div",{className:"sm:rounded-lg dark:bg-black-800 block mt-6",children:[t("div",{className:"mb-1 flex justify-between items-center",children:[t("span",{children:["Pickup Your Contact Group ",e("span",{className:"text-danger-500",children:"*"})]})," ",t("span",{children:[t(Ve,{to:"/add-contacts",className:"px-1 py-3 text-blue-400 rounded-lg focus:outline-none transition duration-300 ease-in-out flex items-center",children:[e(Z,{icon:"charm:plus",width:"16",height:"16"}),"Add New Group"]})," "]})]}),e("div",{className:"w-full text-left rtl:text-right grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 box-border",children:(n==null?void 0:n.length)>0?n==null?void 0:n.map((y,f)=>e("div",{className:"w-full hover:bg-gray-50 flex box-border items-center  dark:bg-gray-800 dark:border-gray-700 cursor-pointer",onClick:()=>g(y),children:e("div",{className:"border border-gray-200 w-full rounded-lg relative group",children:t("div",{className:"flex justify-between rounded-xl items-center px-4 py-2 bg-[#fff]",children:[e("img",{src:Ze,alt:"",className:"w-5 h-5 object-contain cursor-pointer"}),t("div",{className:"flex-grow ml-4 cursor-pointer",children:[e("span",{className:"text-black-800 dark:text-gray-400 text-sm font-bold uppercase my-auto truncate",title:name,children:m(y.label.split("|")[0],20)}),t("div",{className:"text-gray-500 text-sm",children:["List of Contacts: ",y.label.split("|")[1]]})]})]})})},f)):e("p",{className:"px-6 py-4 text-center m-auto",children:"No data available"})})]}),e("div",{className:"mt-5 text-right",children:e("button",{onClick:L,className:"btn-dark dark:bg-gray-500 h-min text-sm font-normal px-10 py-2 rounded",children:"Back"})})]})}
1,ft=540,xt=540,Le=ft*2,Ie=xt*2,bt=({psdUrl:n,layers:g,setLayers:L,toggleBatchModal:A,canvas:m,setCanvas:y})=>{const f=s.exports.useRef(null),u=s.exports.useRef(null),[F,p]=s.exports.useState(!0);s.exports.useState([]),s.exports.useState(0);const[x,h]=s.exports.useState({width:Le,height:Ie}),[w,$]=s.exports.useState({width:Le,height:Ie}),[I,S]=s.exports.useState(null),[R,P]=s.exports.useState("");s.exports.useState(1);const[W,D]=s.exports.useState(!1),[N,i]=s.exports.useState(null),[v,E]=be(),[O,a]=s.exports.useState(!0),[c,r]=s.exports.useState({type:"",width:0,height:0,left:0,top:0,fontFamily:"",fontSize:0,fill:"#000",src:"",bold:!1,italic:!1,underline:!1,leftalign:!1,rightalign:!1,centeralign:!1,justifyalign:!1});s.exports.useEffect(()=>{p(!0);const d=new st(f.current,{selection:!0,preserveObjectStacking:!0,allowTaint:!0,foreignObjectRendering:!0});y(d),u.current=d,$({width:d.getWidth(),height:d.getHeight()});const o=l=>V(l,d);d.on("mouse:wheel",o),(async()=>{try{Ke(n,d),j(d),p(!1)}catch(l){console.error("Error loading PSD:",l),p(!1)}})();const C=()=>{var _,G,Q,H;const l=d.getActiveObject();if(l){S(l);const he=Je(l.fill);let re=l.width.toFixed(2);l.width>1080&&(re=640),i("selected"),D(!0),r({type:l.type,width:re,height:l.height.toFixed(2),left:l.left.toFixed(2),top:l.top.toFixed(2),fontFamily:(l==null?void 0:l.fontFamily)||"Arial",fontSize:((_=l==null?void 0:l.fontSize)==null?void 0:_.toFixed(2))||12,fill:he||"#000",src:l.getSrc?l.getSrc():"",bold:l.fontweight!="normal",italic:l.fontStyle!="normal",underline:!!l.underline,strikethrough:!!l.linethrough,angle:l.angle,transform:"regular",align:"left",skew:l.skewX||0,letterSpacing:((G=l==null?void 0:l.charSpacing)==null?void 0:G.toFixed(1))||1,lineHeight:((Q=l==null?void 0:l.lineHeight)==null?void 0:Q.toFixed(1))||1,Shadow:"",opacity:((H=l==null?void 0:l.opacity)==null?void 0:H.toFixed(1))||1})}},U=l=>{f.current&&l.target.contains(f.current)&&m&&(d.discardActiveObject(),S(null),d.renderAll())};return d.on("selection:created",C),d.on("selection:updated",C),d.on("selection:cleared",()=>S(null)),d.on("object:scaling",ae),document.addEventListener("mousedown",U),()=>{d.off("selection:created",C),d.off("selection:updated",C),d.off("selection:cleared",()=>S(null)),d.off("mouse:wheel",o),document.removeEventListener("mousedown",U),d.dispose()}},[n]);const{undo:b,redo:B}=lt(u.current);s.exports.useEffect(()=>{E([])},[n]),s.exports.useEffect(()=>{const d=o=>{if(o.key==="Delete"&&I&&m){m.remove(I),S(null);const Y=v.filter(C=>C.id!=I.id);E(Y),m.renderAll()}};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}},[I,m]);const V=(d,o)=>{if(!o)return;const Y=d.e;if(Y.ctrlKey){Y.preventDefault();const C=50;let U=o.getWidth(),l=o.getHeight();Y.deltaY<0?(U+=C,l+=C):Y.deltaY>0&&(U-=C,l-=C,U=Math.max(540,U),l=Math.max(540,l));const _=U/o.getWidth(),G=l/o.getHeight();o.setWidth(U),o.setHeight(l),k(o,_,G),h({width:U,height:l}),o.renderAll()}},ae=d=>{const o=d.target,Y=o.width/o.height;if(d.transform.corner==="ml"||d.transform.corner==="mr"){const l=o.scaleX*o.width,_=l/Y;o.scaleX=l/o.width,o.scaleY=_/o.height}else if(d.transform.corner==="mt"||d.transform.corner==="mb"){const l=o.scaleY*o.height,_=l*Y;o.scaleX=_/o.width,o.scaleY=l/o.height}else{const l=Math.min(o.scaleX,o.scaleY);o.scaleX=l,o.scaleY=l}const C=.1;o.scaleX<C&&(o.scaleX=C),o.scaleY<C&&(o.scaleY=C);const U=10;o.scaleX>U&&(o.scaleX=U),o.scaleY>U&&(o.scaleY=U)},k=(d,o,Y)=>{d.getObjects().forEach(C=>{C.scaleX=(C.scaleX||1)*o,C.scaleY=(C.scaleY||1)*Y,C.left=(C.left||0)*o,C.top=(C.top||0)*Y,C.setCoords()})},j=d=>{const o=document.querySelector(".canvas-container"),Y=o?o.offsetWidth:window.innerWidth,C=o?o.offsetHeight:window.innerHeight;d.setWidth(540),d.setHeight(540),d.setZoom(.5),d.renderAll(),h({width:Y,height:C})};return t(J,{children:[F&&e("div",{className:"block justify-center bg-[#e2e7f0]",children:e(at,{})}),!F&&e(ot,{canvas:m,properties:c,setProperties:r,activeMenu:N,setActiveMenu:i,setIsSidebarOpen:D}),t("div",{className:`${F?"hidden":"mt-0 flex flex-1 flex-row rounded-sm"}`,children:[e("div",{className:"flex flex-shrink-0 flex-col bg-white border-r-[1.5px] border-gray-200 rounded-sm",children:e(Me,{bodyClass:"p-0 h-full text-left",className:"shadow-none rounded-1",children:e(nt,{layers:v,canvas:m,selectLayer:de,editLayer:xe,setImgBlog:P,handleUndo:b,handleRedo:B,setIsSidebarOpen:D,isSidebarOpen:W,activeMenu:N,setActiveMenu:i,canvasRef:f,setLoading:p,allTemplates:[],selectedLayer:I,properties:c,setProperties:r,setIsLayers:a})})}),t("div",{className:"flex-1 flex flex-col bg-[#e2e7f0]",children:[e("div",{className:"w-full",children:e(ct,{properties:c,setProperties:r,canvas:m,selectedLayer:I,setImgBlog:P,selectLayer:de,editLayer:xe,layers:g,handleUndo:b,handleRedo:B,setIsSidebarOpen:D,isSidebarOpen:W,activeMenu:N,setActiveMenu:i,toggleBatchModal:A,isLayers:O})}),t("div",{className:"canvas-rightbar flex flex-1 h-full",children:[e("div",{className:"flex-1 flex justify-center items-center bg-[#f6f7f8]",children:e("canvas",{ref:f,className:"w-full h-full"})}),e("div",{className:"w-[280px] bg-[#f6f7f8]",children:e(rt,{layers:v,canvas:m,selectLayer:de,editLayer:xe,selectedLayer:de,setLayers:E})})]})]})]})]})},yt=({layers:n,databaseHeaders:g,onLayerMappingChange:L,generateBatchMethod:A,viewImages:m,zipContent:y,batchLoader:f,selectedDatabase:u,projectName:F})=>{if(!Array.isArray(n))return t("div",{className:"flex items-center",children:[e("span",{children:"Getting Layers..."}),e("div",{className:"ml-3 w-8 h-8 rounded-full animate-spin border-2 border-solid border-slate-900 dark:border-slate-200 border-t-transparent"})]});const p=n.filter(x=>x.text);return e(J,{children:m&&m.length>0?t("div",{className:"block text-center",children:[e("div",{className:"mt-5",children:e("img",{src:m[0],alt:"Preview",className:"w-full mx-auto max-w-sm object-cover"})}),e("button",{className:"btn-dark dark:bg-gray-500 h-min text-sm font-normal px-10 py-2 my-5",onClick:()=>saveAs(y,"batch.zip"),children:"Download All"})]}):t("div",{className:"relative sm:rounded-lg text-center",children:[t("div",{className:"grid xl
1:grid-cols-2 md:grid-cols-2 grid-cols-2 gap-2 h-full",children:[t("div",{className:"my-1 w-full",children:[e("label",{htmlFor:"Workflow",className:"text-left form-label text-sm my-1",children:"Selected List"}),e(se,{id:"formatter-pn",type:"text",placeholder:"List",disabled:!0,defaultValue:u})]}),t("div",{className:"my-1 w-full",children:[e("label",{htmlFor:"Workflow",className:"text-left form-label text-sm my-1",children:"Project Name"}),e(se,{id:"formatter-pn",type:"text",placeholder:"List",disabled:!0,defaultValue:F})]})]}),e("label",{htmlFor:"Workflow",className:"text-left form-label text-sm my-3",children:"Layer Mapping With Your List"}),t("table",{className:"w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 border",children:[e("thead",{className:"text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400",children:t("tr",{children:[e("th",{scope:"col",className:"px-6 py-4",children:"Text Layers"}),e("th",{scope:"col",className:"px-6 py-4"}),e("th",{scope:"col",className:"px-6 py-4",children:"Data Set Column"})]})}),e("tbody",{children:p.length>0?p.map((x,h)=>t("tr",{className:"bg-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600",children:[e("th",{scope:"row",className:"px-6 py-1.5 font-medium text-gray-900 whitespace-nowrap dark:text-white",children:x.name?x.name.substring(0,20):`Layer ${h}`}),e("td",{className:"px-6 py-1.5",children:"-------"}),e("td",{className:"px-6 py-1.5",children:e(ne,{className:"react-select text-md my-1 basic-single",classNamePrefix:"select",defaultValue:g[0],name:"database",options:g,onChange:w=>L(x.id,w)})})]},`layer-${h}`)):e("tr",{children:e("td",{colSpan:"3",className:"px-6 py-1.5 text-center",children:"No text layers available"})})})]}),e("button",{text:"Create Batch",className:"btn-dark dark:bg-gray-500 h-min text-sm font-normal px-10 py-2 my-5",onClick:A,children:f?e("div",{className:"w-8 h-8 rounded-full animate-spin border-2 border-solid border-white dark:border-slate-200 border-t-transparent"}):"Create Batch"})]})})};function wt({arrayContent:n,zipContent:g,projectName:L,selectedDatabase:A,setSelectedImage:m}){var x;const{user:y}=K(h=>h.auth);y.id;const[f,u]=s.exports.useState(!1),F=async()=>{u(!0);try{const h=n.map(async w=>{await p(w.email,w.subject,w.body,w.imageUrl)});await Promise.all(h),z.success("All emails sent successfully!",{autoClose:1e3}),u(!1)}catch(h){console.error("Error sending batch emails: ",h),u(!1),z.error("Something went wrong while sending emails!",{autoClose:1e3})}};async function p(h,w,$,I){const S={email:h,subject:w,content:$,image:I};try{if(!(await fetch("https://nylostudioapi.sideline-cloud.com/send-email",{method:"POST",headers:{"Content-Type":"application/json",Accept:"text/html"},body:JSON.stringify(S)})).ok)throw new Error("Failed to send email.");console.log("Email sent successfully!")}catch(R){console.error("Error sending email: ",R)}}return t("div",{className:"block",children:[e("h2",{className:"text-2xl font-semibold mb-1 text-center",children:"Personalized Email Content Preview"}),e("p",{className:"mb-4 text-center",children:"Your Content Preview Before Saving !!"}),e("div",{className:"image-gallery grid xl:grid-cols-3 lg:grid-cols-3 sm:grid-cols-2 col-span-3 gap-2",children:(x=n.slice(0,3))==null?void 0:x.map((h,w)=>t("div",{className:"border rounded-lg shadow-lg overflow-hidden p-4 mb-6 text-left",children:[t("div",{className:"mb-2",children:[e("strong",{className:"text-gray-700",children:"To:"})," ",e("span",{className:"text-gray-900",children:h.email})]}),t("div",{className:"mb-2",children:[e("strong",{className:"text-gray-700",children:"Subject:"})," ",e("span",{className:"text-gray-900",children:h.subject})]}),t("div",{className:"mb-4",children:[e("strong",{className:"text-gray-700",children:"Body:"}),t("p",{className:"text-gray-700 mt-1",children:[h.body,"..."]})]}),h.imageUrl&&t("div",{className:"mb-4",children:[e("strong",{className:"text-gray-700",children:"Image:"}),e("img",{className:"w-full h-48 object-cover mt-2",src:h.imageUrl,alt:`Image ${w+1}`})]})]},`Final${w}`))}),e("div",{className:"block cursor-pointer text-center relative w-full ",children:e("button",{onClick:F,className:"btn-dark dark:bg-gray-500 mt-3 text-sm font-normal px-5 py-2 rounded ",children:f?t("div",{className:"flex items-center",children:[" Sending... ",e("div",{className:"w-5 h-5 ml-2 roun
1ded-full animate-spin border-2 border-solid border-white-900 dark:border-slate-200 border-t-transparent"})," "]}):"Send Email"})})]})}const Nt=({layers:n,databaseHeaders:g,onLayerMappingChange:L,generateBatchMethod:A,viewImages:m,zipContent:y,batchLoader:f,selectedDatabase:u,projectName:F,messageContent:p,handleMessageChange:x,setEmailField:h,setMessageContent:w,arrayContent:$,handleSubjectChange:I})=>{const S=s.exports.useRef(null),[R,P]=s.exports.useState(p);if(!Array.isArray(n))return t("div",{className:"flex items-center",children:[e("span",{children:"Getting Layers..."}),e("div",{className:"ml-3 w-8 h-8 rounded-full animate-spin border-2 border-solid border-slate-900 dark:border-slate-200 border-t-transparent"})]});const W=n.filter(N=>N.text);s.exports.useEffect(()=>{P(p)},[p]);const D=N=>{const i=p+N;w(i),P(i),S.current&&S.current.focus()};return e(J,{children:m&&m.length>0?e("div",{className:"block text-center",children:e(wt,{arrayContent:$,zipContent:y,projectName:F,selectedDatabase:u})}):t("div",{className:"relative sm:rounded-lg text-center",children:[t("div",{className:"grid xl:grid-cols-2 md:grid-cols-2 grid-cols-2 gap-2 h-full",children:[t("div",{className:"my-1 w-full",children:[e("label",{htmlFor:"Workflow",className:"text-left form-label text-sm my-1",children:"Selected List"}),e(se,{id:"formatter-pn",type:"text",placeholder:"List",disabled:!0,defaultValue:u})]}),t("div",{className:"my-1 w-full text-left ",children:[e("label",{htmlFor:"Workflow",className:"form-label text-sm text-left",children:"Email Field"}),e(ne,{className:"react-select text-sm my-1 basic-single text-left",classNamePrefix:"select",defaultValue:g[0],name:"database",options:g,onChange:N=>h(N)})]})]}),t("div",{className:"my-2 w-full",children:[e("label",{htmlFor:"Workflow",className:"form-label text-sm my-1 text-left",children:"Subject"}),e(se,{id:"email-subject",type:"text",placeholder:"Enter your subject",onChange:I})]}),t("div",{className:"my-2",children:[e("label",{htmlFor:"Workflow",className:"form-label my-1 text-sm text-left",children:"Dynamic Tags"}),e("div",{className:"flex flex-wrap gap-2 mb-2",children:g.map((N,i)=>e("span",{label:N.label,className:"bg-gray-500 text-white text-[10px] font-medium me-2 px-2.5 py-0.5 rounded-full dark:bg-white-900 dark:text-black-300 pill hover:cursor-pointer",onClick:()=>{var E;let v=`{${(E=N==null?void 0:N.label)==null?void 0:E.trim()}}`;D(v)},children:`{${N.label}}`},`badge${i}`))}),e("label",{htmlFor:"Workflow",className:"form-label my-1 text-sm text-left",children:" Message "}),e("textarea",{id:"formatter-pn",type:"text",className:"block p-2.5 w-full text-sm text-gray-900 bg-white-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Enter text message",value:R,onChange:x,ref:S,description:"You can use tags to create personal messages. Hi {Name}, Good Luck!!! ",rows:"6"})]}),e("label",{htmlFor:"Workflow",className:"text-left form-label text-sm my-3",children:"Layer Mapping With Your List"}),t("table",{className:"w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 border",children:[e("thead",{className:"text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400",children:t("tr",{children:[e("th",{scope:"col",className:"px-6 py-4",children:"Text Layers"}),e("th",{scope:"col",className:"px-6 py-4"}),e("th",{scope:"col",className:"px-6 py-4",children:"Data Set Column"})]})}),e("tbody",{children:W.length>0?W.map((N,i)=>t("tr",{className:"bg-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600",children:[e("th",{scope:"row",className:"px-6 py-1.5 font-medium text-gray-900 whitespace-nowrap dark:text-white",children:N.name?N.name.substring(0,20):`Layer ${i}`}),e("td",{className:"px-6 py-1.5",children:"-------"}),e("td",{className:"px-6 py-1.5",children:e(ne,{className:"react-select text-md my-1 basic-single",classNamePrefix:"select",defaultValue:g[0],name:"database",options:g,onChange:v=>L(N.id,v)})})]},`layer-${i}`)):e("tr",{children:e("td",{colSpan:"3",className:"px-6 py-1.5 text-center",children:"No text layers available"})})})]}),e("button",{text:"Create Batch",className:"btn-dark dark:bg-gray-500 h-min text-sm font-normal px-10 py-2 my-5",onClick:A,children:f?e("div",{className:"w-8 h-8 rounded-full animate-spin border-2 border-solid border-white dark:border-slate-200 border-t-transparent"}):"Preview Email Content"})]})})},vt=({folderName:n,setShowFolderImages:g,setSelectedImage:L,selectedImage:A})=>{const[m,y]=s.exports.useState([]),{user:f}=K(k=>k.auth),u=f.id,[F,p]=s.exports.useState(!1),[x,h]=s.exports.useState("grid"),{width:w,breakpoints:$}
1=_e(),[I,S]=s.exports.useState(!0),{projects:R}=K(k=>k.project),[P,W]=s.exports.useState(null),D=s.exports.useRef([]),N=k=>{W(P===k?null:k)},i=k=>{D.current.every(j=>j&&!j.contains(k.target))&&W(null)};s.exports.useEffect(()=>(document.addEventListener("mousedown",i),()=>{document.removeEventListener("mousedown",i)}),[]);const[v,E]=s.exports.useState(!1),[O,a]=s.exports.useState(),c=k=>{a(k),E(!0)},r=()=>{E(!1)};s.exports.useEffect(()=>{b()},[]);const b=async()=>{try{const k=await fetch(`https://0cte34sxp4.execute-api.us-east-1.amazonaws.com/files/prod?userId=${u}&folderName=${n}`,{method:"GET"});if(k.ok){const j=await k.json();y(j.files),S(!1)}else{const j=await k.json();z.error(j.message,{autoClose:2e3}),S(!1)}}catch(k){z.error(k.message,{autoClose:2e3}),S(!1)}},B=async(k,j)=>{p(!0);try{const d=await fetch(`https://gii39p06kd.execute-api.us-east-1.amazonaws.com/prod/upload?userId=${u}&filename=${k}&folderName=${j}`,{method:"DELETE"});if(d.ok){const o=await d.json();r(),z.success(o.message,{autoClose:2e3}),b(),p(!1)}else{const o=await d.json();z.error(o.message,{autoClose:2e3}),p(!1)}}catch(d){z.error(d.message,{autoClose:2e3}),p(!1)}},V=k=>{L(k)};return e(J,{children:I?e(Fe,{}):t("div",{children:[t("div",{className:"flex flex-wrap justify-between items-center mb-4",children:[t("div",{className:"flex items-center gap-2 ",children:[e(Z,{icon:"heroicons-arrow-left-circle",className:"w-8 h-8 hover:bg-black-200 cursor-pointer rounded-full ",onClick:()=>{g(!1),L(null)}}),e("h4",{className:"font-medium text-lg capitalize text-slate-900 inline-block ltr:pr-4 rtl:pl-4",children:n})]}),e("div",{className:`${w<$.md?"space-x-rb":""} md:flex md:space-x-4 md:justify-end items-center rtl:space-x-reverse`})]}),I&&x==="list"&&e(mt,{count:R==null?void 0:R.length}),e("div",{children:e("div",{className:"w-full text-left rtl:text-right flex flex-wrap box-border",children:m.length>0?m.map((k,j)=>e("div",{className:"w-full sm:w-1/2 md:w-1/3 lg:w-1/4 box-border p-3 dark:bg-gray-800 dark:border-gray-700 ",children:t("div",{className:`px-3 pt-3 pb-1 bg-white shadow-sm rounded-lg  ${A===`https://harlo-media.s3.us-east-1.amazonaws.com/${u}/${u}/${n}/${k.file_name}`?"border border-sky-500":""} `,children:[e("div",{children:e("img",{src:`https://harlo-media.s3.us-east-1.amazonaws.com/${u}/${u}/${n}/${k.file_name}`,className:"w-full aspect-square object-cover rounded-lg bg-black-100 dark:bg-black-900 cursor-pointer",alt:k.file_name,onClick:()=>{V(`https://harlo-media.s3.us-east-1.amazonaws.com/${u}/${u}/${n}/${k.file_name}`)}})}),t("div",{className:"flex items-center mt-1 justify-between ",children:[t("div",{className:"w-5/6 flex items-center gap-1",children:[e(Z,{icon:"heroicons-photo-solid",className:"w-6 h-6 text-red-500 "}),e("span",{className:"w-5/6 truncate text-sm font-medium text-black-900 ",children:k.file_name})]}),t("div",{className:"relative",ref:d=>D.current[j]=d,children:[e(Z,{icon:"heroicons-ellipsis-vertical",className:"hover:bg-black-200 cursor-pointer w-6 h-6 rounded-full ",onClick:()=>N(j)}),P===j&&e("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-sm shadow-sm shadow-gray-500 z-10",children:e("ul",{className:"py-1",children:t("li",{className:"flex items-center gap-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white cursor-pointer p-1  ",title:"Delete",onClick:()=>c(k.file_name),children:[e(Z,{icon:"heroicons-trash-16-solid",className:"text-red-600 h-5 w-5 cursor-pointer "}),e("span",{className:"text-sm text-red-600 font-medium ",children:"Delete"})]})})})]})]})]})},j)):e("p",{className:"my-20 text-center mx-auto",children:"No data available"})})}),v&&e("div",{id:"popup-modal",tabIndex:"-1",className:"fixed inset-0 z-50 flex items-center justify-center w-full h-full overflow-x-hidden overflow-y-auto bg-black-800 bg-opacity-20",children:e("div",{className:"relative w-full max-w-md p-4 max-h-full",children:t("div",{className:"relative bg-white rounded-lg shadow dark:bg-gray-700",children:[t("button",{type:"button",className:"absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",onClick:r,children:[e("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 1l6 6m0 0l6 6M7 7l6-6M7 7l-6 6"})}),e("span",{className:"sr-only",children:"Close modal"})]}),t("div",{className:"p-4 md:p-5 text-center",children:[e("svg",{className:"w-12 h-12 mx-auto mb-4 text-gray-400 dark:text-gray-200","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),e("h3",{className:"mb-5 text-lg font-normal text-gray-500 dark:text-gray-400",children:"Are you sure you want to delete this Image?"}),e("button",{onClick:()=>B(O,n),className:"text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center",disabled:!!F,children:F?"Deleting...":"Yes, I'm sure"}),e("button",{onClick:r,className:"py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700",children:"No, cancel"})]})]})})})]})})},kt=({setSelectedImage:n,selectedImage:g,imageFiles:L})=>{const{user:A}=K(i=>i.auth),m=A.id,[y,f]=s.exports.useState(!1),[u,F]=s.exports.useState(null),[p,x]=s.exports.useState(null),h=s.exports.useRef([]),[w,$]=s.exports.useState(!1),I=L&&L.filter(i=>i.parent_folder_name===m),S=i=>{F(u===i?null:i)},R=i=>{h.current.every(v=>v&&!v.contains(i.target))&&F(null)};s.exports.useEffect(()=>(document.addEventListener("mousedown",R),()=>{document.removeEventListener("mousedown",R)}),[]);const P=()=>{f(!1)},W=i=>{x(i),f(!0)},D=async i=>{$(!0);try{const v=await fetch(`https://gii39p06kd.execute-api.us-east-1.amazonaws.com/prod/upload?userId=${m}&filename=${i}`,{method:"DELETE"});if(v.ok){const E=await v.json();P(),z.success(E.message,{autoClose:2e3}),fetchRootFolderImages(),$(!1)}else{const E=await v.json();z.error(E.message,{autoClose:2e3}),$(!1)}}catch(v){z.error(v.message,{autoClose:2e3}),$(!1)}},N=i=>{n(i)};return e(J,{children:t("div",{children:[e("h3",{className:"text-base text-gray-700 m-2 text-left",children:"Files"}),e("div",{className:"w-full text-left rtl:text-right flex flex-wrap box-border",children:I&&I.length>0?I.map((i,v)=>e("div",{className:"w-full sm:w-1/3 md:w-1/6 lg:w-1/8 box-border p-3 dark:bg-gray-800 dark:border-gray-700 ",children:t("div",{className:`px-3 pt-3 pb-1 bg-white rounded-lg shadow-sm 
2                  ${g===`https://harlo-media.s3.us-east-1.amazonaws.com/${m}/${m}/${i.file_name}`?"border border-sky-500":""}
3                  `,children:[e("div",{children:e("img",{src:`https://harlo-media.s3.us-east-1.amazonaws.com/${m}/${m}/${i.file_name}`,className:"w-full aspect-square object-cover rounded-lg bg-black-100 dark:bg-black-900 cursor-pointer text-sm",alt:i.file_name,onClick:()=>{N(`https://harlo-media.s3.us-east-1.amazonaws.com/${m}/${m}/${i.file_name}`)}})}),t("div",{className:"flex items-center mt-1 justify-between ",children:[t("div",{className:"w-5/6 flex items-center gap-1",children:[e(Z,{icon:"heroicons-photo-solid",className:"w-6 h-6 text-red-500  "}),e("span",{className:"w-5/6 truncate text-sm font-medium text-black-900 ",children:i.file_name})]}),t("div",{className:"relative",ref:E=>h.current[v]=E,children:[e(Z,{icon:"heroicons-ellipsis-vertical",className:"hover:bg-black-200 cursor-pointer w-6 h-6 rounded-full ",onClick:()=>S(v)}),u===v&&e("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-sm shadow-sm shadow-gray-500 z-10",children:e("ul",{className:"py-1",children:t("li",{className:"flex items-center gap-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white cursor-pointer p-1  ",title:"Delete",onClick:()=>W(i.file_name),children:[e(Z,{icon:"heroicons-trash-16-solid",className:"text-red-600 h-5 w-5 cursor-pointer "}),e("span",{className:"text-sm text-red-600 font-medium ",children:"Delete"})]})})})]})]})]})},v)):e("p",{className:"my-20 text-center mx-auto",children:"No data available"})}),y&&e("div",{id:"popup-modal",tabIndex:"-1",className:"fixed inset-0 z-50 flex items-center justify-center w-full h-full overflow-x-hidden overflow-y-auto bg-black-800 bg-opacity-20",children:e("div",{className:"relative w-full max-w-md p-4 max-h-full",children:t("div",{className:"relative bg-white rounded-lg shadow dark:bg-gray-700",children:[t("button",{type:"button",className:"absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",onClick:P,children:[e("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 1l6 6m0 0l6 6M7 7l6-6M7 7l-6 6"})}),e("span",{className:"sr-only",children:"Close modal"})]}),t("div",{className:"p-4 md:p-5 text-center",children:[e("svg",{className:"w-12 h-12 mx-auto mb-4 text-gray-400 dark:text-gray-200","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),e("h3",{className:"mb-5 text-lg font-normal text-gray-500 dark:text-gray-400",children:"Are you sure you want to delete this File?"}),e("button",{onClick:()=>D(p),className:"text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center",disabled:!!w,children:w?"Deleting...":"Yes, I'm sure"}),e("button",{onClick:P,className:"py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700",children:"No, cancel"})]})]})})})]})})},St=({setSelectedImage:n,selectedImage:g,imageFolders:L,isLoaded:A,imageFiles:m})=>{const{user:y}=K(a=>a.auth),f=y.id,u=L&&L.filter(a=>a.length>0),[F,p]=s.exports.useState(!1),[x,h]=s.exports.useState(null),[w,$]=s.exports.useState(null),[I,S]=s.exports.useState(!1),[R,P]=s.exports.useState(""),W=s.exports.useRef([]),D=a=>{$(w===a?null:a)},N=a=>{W.current.every(c=>c&&!c.contains(a.target))&&$(null)};s.exports.useEffect(()=>(document.addEventListener("mousedown",N),()=>{document.removeEventListener("mousedown",N)}),[]);const i=()=>{p(!1)},v=a=>{h(a),p(!0)},E=async a=>{try{const c=await fetch(`https://yf36siyyf5.execute-api.us-east-1.amazonaws.com/prod/v1/folder?userId=${f}&folderName=${a}`,{method:"DELETE"});if(c.ok){const r=await c.json();z.success(r.message,{autoClose:2e3}),i(),fetchImageFolders()}else{const r=await c.json();z.error(r.message,{autoClose:2e3})}}catch(c){z.error(c.message,{autoClose:2e3})}},O=a=>{S(!0),P(a),n(null)};return e(J,{children:A?e(Fe,{}):e("div",{children:I?e(vt,{folderName:R,setShowFolderImages:S,setSelectedImage:n,selectedImage:g}):t("div",{children:[e("h3",{className:"text-base text-gray-700 m-2 text-left",children:"Folders"}),e("div",{className:"w-full text-left rtl:text-right flex flex-wrap box-border",children:u&&u.length>0?u.map((a,c)=>e("div",{className:"w-full md:w-1/2 lg:w-1/3 xl:w-1/4 box-border p-3 ",children:t("div",{className:"bg-white w-full flex flex-wrap items-center justify-between p-2.5 rounded-lg shadow-sm",children:[t("div",{className:"flex items-center w-11/12 gap-2",onClick:()=>O(a),title:a,children:[e("svg",{xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",width:"24",height:"24",viewBox:"0 0 24 24",style:{fill:"#4D4D4D"},children:e("path",{d:"M20,6h-8l-1.414-1.414C10.211,4.211,9.702,4,9.172,4H4C2.9,4,2,4.9,2,6v12c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V8 C22,6.9,21.1,6,20,6z"})}),e("span",{className:" text-black-800 dark:text-gray-400 font-bold uppercase my-auto truncate cursor-pointer",style:{fontSize:"13px"},children:a})]}),t("div",{className:"relative w-1/12",ref:r=>W.current[c]=r,children:[e(Z,{icon:"heroicons-ellipsis-vertical",className:"hover:bg-black-200 cursor-pointer w-6 h-6 rounded-full ",onClick:()=>D(c)}),w===c&&e("div",{className:"absolute right-0 mt-2 w-40 bg-white rounded-sm shadow-sm shadow-gray-500 z-10",children:e("ul",{className:"py-1",children:t("li",{className:"flex items-center gap-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white cursor-pointer p-1  ",title:"Delete",onClick:()=>v(a),children:[e(Z,{icon:"heroicons-trash-16-solid",className:"text-red-600 h-5 w-5 cursor-pointer "}),e("span",{className:"text-sm text-red-600 font-medium ",children:"Delete"})]})})})]})]})},c)):e("p",{className:"my-20 text-center mx-auto",children:"No data available"})}),e(kt,{setSelectedImage:n,selectedImage:g,imageFiles:m}),F&&e("div",{id:"popup-modal",tabIndex:"-1",className:"fixed inset-0 z-50 flex items-center justify-center w-full h-full overflow-x-hidden overflow-y-auto bg-black-800 bg-opacity-20",children:e("div",{className:"relative w-full max-w-md p-4 max-h-full",children:t("div",{className:"relative bg-white rounded-lg shadow dark:bg-gray-700",children:[t("button",{type:"button",className:"absolute top-3 right-2.5 text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",onClick:i,children:[e("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 1l6 6m0 0l6 6M7 7l6-6M7 7l-6 6"})}),e("span",{className:"sr-only",children:"Close modal"})]}),t("div",{className:"p-4 md:p-5 text-center",children:[e("svg",{className:"w-12 h-12 mx-auto mb-4 text-gray-400 dark:text-gray-200","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",children:e("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M10 11V6m0 8h.01M19 10a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),e("h3",{className:"mb-5 text-lg font-normal text-gray-500 dark:text-gray-400",children:"Are you sure you want to delete this Folder?"}),e("button",{onClick:()=>E(x),className:"text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center",children:"Yes, I'm sure"}),e("button",{onClick:i,className:"py-2.5 px-5 ms-3 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100 dark:focus:ring-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700",children:"No, cancel"})]})]})})})]})})})},Ct=[{title:"My Images"},{title:"Upload"}],Lt=({setSelectedFile:n,setImgBlog:g=()=>{},handleNextStep:L,customTemp:A})=>{const{user:m}=K(r=>r.auth),y=m.id,[f,u]=s.exports.useState(!0),[F,p]=s.exports.useState(!1),[x,h]=s.exports.useState([]),[w,$]=s.exports.useState([]),[I,S]=s.exports.useState(null),[R,P]=s.exports.useState(null),W=()=>{p(!1)},D=s.exports.useRef(null),N=()=>{D.current.click()},i=r=>{r.preventDefault();const b=r.target,B=b.files[0];if(Object.assign(B,{preview:URL.createObjectURL(B)}),B){g(B),console.log(B,"blob");const V=new FileReader;V.onloadend=()=>{S(V.result)},V.readAsDataURL(B),b.value=""}};s.exports.useEffect(()=>{Promise.a
3ll([v(),E()]).then(()=>{u(!1)}).catch(r=>{console.error("Error fetching data:",r),u(!1)})},[]);const v=async()=>{try{const r=await fetch(`https://yf36siyyf5.execute-api.us-east-1.amazonaws.com/prod/v1/folder?userId=${y}`,{method:"GET"});if(r.ok){const b=await r.json();h(b.folders)}else{const b=await r.json();z.error(b.message,{autoClose:2e3})}}catch(r){z.error(r.message,{autoClose:2e3})}},E=async()=>{try{const r=await fetch(`https://0cte34sxp4.execute-api.us-east-1.amazonaws.com/files/prod?userId=${y}`,{method:"GET"});if(r.ok){const b=await r.json();$(b.files)}else{const b=await r.json();z.error(b.message,{autoClose:2e3})}}catch(r){z.error(r.message,{autoClose:2e3})}},O=async(r,b)=>{await n(b),r.stopPropagation(),r.preventDefault(),W(),S(null),L()},a=async(r,b)=>{r.stopPropagation(),r.preventDefault(),g(b),await n(b),W(),P(null),L()},c=()=>{P(null),S(null)};return e("div",{className:"block w-full max-h-full",children:e("div",{className:"relative p-0 w-full max-h-full",children:t("div",{className:"relative bg-black-50 rounded-lg dark:bg-gray-700 h-[90vh] overflow-y-scroll",style:{scrollbarWidth:"none"},children:[e("div",{className:"flex items-center justify-between p-4 md:p-4 roun
3ded-t dark:border-gray-600 sticky top-0 bg-white z-50",children:e("h3",{className:"text-xl font-semibold text-gray-900 dark:text-white",children:"Select Your File"})}),e("div",{children:t(te.Group,{children:[e(te.List,{className:"lg:space-x-8 md:space-x-8 space-x-0 rtl:space-x-reverse sticky top-14 bg-white  z-50  text-left w-full px-4 border-b",children:Ct.map((r,b)=>e(te,{as:s.exports.Fragment,children:({selected:B})=>e("button",{className:` text-sm font-semibold mb-7 capitalize bg-white
4                            dark:bg-slate-800 ring-0 foucs:ring-0 focus:outline-none px-2
5                              transition duration-150 before:transition-all before:duration-150 relative 
6                              before:absolute before:left-1/2 before:bottom-[-6px] before:h-[1.5px] before:bg-primary-500 
7                              before:-translate-x-1/2 
8                              ${B?"text-primary-500 before:w-full":"text-slate-500 before:w-0 dark:text-slate-300"}
9                              `,onClick:c,children:r.title})},b))}),t(te.Panels,{children:[e(te.Panel,{children:e("div",{children:t("div",{className:"p-4 min-h-[calc(90vh-120px)] ",children:[R?t("div",{className:"flex items-center justify-between bg-sky-200 p-4 sticky bottom-0 w-full ",children:[t("div",{className:"flex text-center gap-2 ",children:[e(Z,{icon:"heroicons-x-mark-20-solid",className:"h-6 w-6 text-black-600 hover:text-black-800 cursor-pointer ",onClick:()=>P(null)}),e("span",{className:"text-base text-black-500 ",children:"1 File Selected"})]}),e("button",{className:"border-2 border-blue-500 text-white bg-blue-500 py-1 px-4 cursor-pointer rounded-md text-sm",onClick:r=>{a(r,R)},children:"Next"})]}):"",e(St,{setSelectedImage:P,selectedImage:R,setIsOpen:p,imageFolders:x,isLoaded:f,imageFiles:w})]})})}),e(te.Panel,{children:t("div",{className:"text-center flex items-center justify-center flex-col h-[60vh]",children:[I?e("img",{src:I,alt:"",className:"w-60 h-60 my-10 mx-auto"}):e("img",{src:dt,className:"w-36 h-36 text-black-300 mx-auto"}),t("div",{className:"relative inline-block overflow-hidden cursor-pointer mt-10",children:[e("button",{className:"border-2 border-blue-500 text-white bg-blue-500 py-1 px-6 cursor-pointer rounded-md text-lg",onClick:N,children:"Browse"}),e("input",{type:"file",ref:D,className:"absolute left-0 top-0 opacity-0 w-full h-full cursor-pointer",onChange:i,accept:"image/*"})]}),I?t("div",{className:"flex items-center justify-between bg-sky-200 p-4 absolute bottom-0 w-full ",children:[t("div",{className:"flex text-center gap-2 ",children:[e(Z,{icon:"heroicons-x-mark-20-solid",className:"h-6 w-6 text-black-600 hover:text-black-800 cursor-pointer ",onClick:()=>{S(null)}}),e("span",{className:"text-base text-black-500",children:"1 File Selected"})]}),e("button",{className:"border-2 border-blue-500 text-white bg-blue-500 py-1 px-4 cursor-pointer rounded-md text-sm",onClick:r=>O(r,I),children:"Open"})]}):""]})})]})]})})]})})})},os=()=>{const[n,g]=s.exports.useState([]),[L,A]=s.exports.useState([]),[m,y]=s.exports.useState([]),[f,u]=s.exports.useState(""),[F,p]=s.exports.useState(""),[x,h]=s.exports.useState("");s.exports.useState(Ce);const[w,$]=s.exports.useState(Ce),[I,S]=s.exports.useState(null),[R,P]=s.exports.useState(null),{user:W}=K(M=>M.auth);s.exports.useState(!1),s.exports.useState(!1);const[D,N]=s.exports.useState({});s.exports.useState(!1),s.exports.useState(0);const[i,v]=s.exports.useState(""),[E,O]=s.exports.useState(""),[a,c]=s.exports.useState(""),[r,b]=s.exports.useState([]),[B,V]=s.exports.useState("");s.exports.useState([]);const[ae,k]=s.exports.useState(null),[j,d]=s.exports.useState(null);s.exports.useState("imessage");const[o,Y]=be();s.exports.useRef();const C=Ge(),U=He(),[l,_]=s.exports.useState(!1),[G,Q]=s.exports.useState(1);s.exports.useState("template"),s.exports.useState("");const[H,he]=s.exports.useState([]),[re,Pe]=s.exports.useState(!1),[ce,De]=s.exports.useState(null),[ue,ee]=s.exports.useState(!1),[le,ie]=s.exports.useState(""),[oe,ye]=s.exports.useState([]),pe=M=>{ie(M.target.value)},Ee=M=>{c(M.target.value)},we=M=>{d(M),Pe(!re),b([])},Ne=()=>{Q(G+1),ve(G+1)},je=()=>{Q(G-1),b([]),V(""),ve(G)-1},ve=M=>{const T=new URLSearchParams(C.search);T.set("step",M),U(`${C.pathname}?${T.toString()}`,{replace:!0})},Re=async M=>{var T;try{let q=M?M.value:"";if(q=q.split("|")[0],u(q),q){const X=await fe(`${Se.url}/getData?memberId=${W.id}&folderName=${q}`),Ye=[{value:"",label:"None"},...((T=X==null?void 0:X.header)==null?void 0:T.map(ke=>({value:ke,label:ke})))||[]];y(Ye),A(X==null?void 0:X.data),console.log(X==null?void 0:X.data)}else y([]),A([])}catch(q){console.log(q)}},Ae=async M=>{if(x==""){alert("Please Enter the Project Name First!!");return}else await Re(M),Ne()};s.exports.useEffect(()=>{(async()=>{try{const T=await fe(`${Se.url}/getData?memberId=${W.id}`),q=T==null?void 0:T.map(X=>({value:X,label:X}));g(q)}catch(T){console.log(T)}})(),We()},[W.id]),s.exports.useEffect(()=>{Y([])},[]);const We=async()=>{try{_(!0);const M=await fe("https://h2sttycpdb.execute-api.us-east-1.amazonaws.com/psd/prod");p(M==null?void 0:M.files),_(!1)}catch(M){_(!1),console.log(M)}},ge=(M,T)=>{N(q=>({...q,[M]:T?T.value:null}))},ze=async()=>
9{if(console.log(L,m,D,j),f==""||i==""&&j!="batch")alert("Please Select Contact Group or Phone Field First!!");else if(H){try{ee(!0),await Qe(H,ce,L,D,le,i,b,V,ye)}catch(M){console.log("error",M)}ee(!1),console.log(oe,"messsage")}},Te=async()=>{console.log(L,m,D),H&&(ee(!0),await et(H,ce,L,D,b,V),ee(!1))},Be=async()=>{if(f==""||E==""&&j!="email")alert("Please Select List or Email Field First!!");else if(H){try{ee(!0),await tt(H,ce,L,D,le,E,a,b,V,ye)}catch(M){console.log("error",M)}ee(!1),console.log(oe,"messsage")}};return s.exports.useEffect(()=>{const M=new URLSearchParams(C.search),T=parseInt(M.get("step"),10);console.log(T,"data"),T===0?(Q(1),S(null)):Q(T||1)},[C.search]),t("div",{className:"relative",children:[e(Xe,{}),e("div",{className:"flex items-start justify-center ",children:t("div",{className:"w-full",children:[G===1&&e("div",{className:"form-step",children:e("div",{className:"box-border rounded-lg dark:bg-gray-800",children:e("div",{className:"py-1 bg-white",children:e(Lt,{setSelectedFile:P,setImgBlog:$,handleNextStep:Ne})})})}),G===2&&e(Me,{className:"h-full py-8",children:e(gt,{handleDatabaseChange:Ae,handlePreviousStep:je,data:n,setProjectName:h})}),G===3&&e("div",{className:"bg-while h-full py-2",children:e("div",{className:"h-full bg-white py-0 p-0",children:e(bt,{psdUrl:R,layers:H,setLayers:he,toggleBatchModal:we,canvas:ce,setCanvas:De})})})]})}),re&&t(it,{title:r&&r.length>0?`${j} Preview`:`Layer Mapping For ${j}`,label:"Layer Mapping",labelClass:"btn-outline-dark",uncontrol:!0,className:"max-w-3xl",toggleBatchModal:we,children:[(j=="iMessage"||j=="WhatsApp")&&e(pt,{layers:o,type:1,databaseHeaders:m,onLayerMappingChange:ge,generateiMessageBatchMethod:ze,viewImages:r,zipContent:B,batchLoader:ue,selectedDatabase:f,projectName:x,messageContent:le,handleMessageChange:pe,setPhoneField:v,setMessageContent:ie,arrayContent:oe,setSelectedImage:k,selectedType:j}),j=="Batch"&&e(yt,{layers:H,type:1,databaseHeaders:m,onLayerMappingChange:ge,generateBatchMethod:Te,viewImages:r,zipContent:B,batchLoader:ue,selectedDatabase:f,projectName:x,messageContent:le,handleMessageChange:pe,setPhoneField:v,setMessageContent:ie,arrayContent:oe,setSelectedImage:k}),j=="Email"&&e(Nt,{layers:H,type:1,databaseHeaders:m,onLayerMappingChange:ge,generateBatchMethod:Be,viewImages:r,zipContent:B,batchLoader:ue,selectedDatabase:f,projectName:x,messageContent:le,handleMessageChange:pe,setEmailField:O,setMessageContent:ie,arrayContent:oe,setSelectedImage:k,handleSubjectChange:Ee})]}),ae&&e(qe,{setSelectedImage:k,selectedImage:ae})]})};export{os 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.