1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[45326],{45326:function(e,a,t){t.r(a),t.d(a,{default:function(){return Y}});var s=t(57437),r=t(2265),n=t(79820),l=t(12381),i=t(40279),o=t(75060),d=t(69174),c=t(23675),m=t(66901),u=t(91723),x=t(45131),h=t(33245),p=t(32660),f=t(53417),g=t(82431),v=t(99397),y=t(63639),b=t(96362),j=t(48736),N=t(73247),w=t(82023),E=t(42208),P=t(78867),C=t(56266),k=t(15863),A=t(18930),_=t(11239),T=t(44743),R=t(74291),z=t(15291),I=t(32060),Z=t(71488),L=t(14438),S=t(71837),U=t(5442),D=t(27648);let V=e=>e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),B=e=>({en:"English",en_US:"English (US)",hi:"Hindi",es:"Spanish",fr:"French",de:"German",pt_BR:"Portuguese",ar:"Arabic"})[e]||e,O=e=>({MARKETING:"Marketing",UTILITY:"Utility",AUTHENTICATION:"Authentication"})[e]||e;function Y(){let[e,a]=(0,r.useState)([]),[t,Y]=(0,r.useState)(!0),[q,W]=(0,r.useState)(!1),[Q,F]=(0,r.useState)(""),[M,G]=(0,r.useState)("ALL"),[H,J]=(0,r.useState)(!1),[K,X]=(0,r.useState)(!1),[$,ee]=(0,r.useState)(null),[ea,et]=(0,r.useState)(null),[es,er]=(0,r.useState)(!1),[en,el]=(0,r.useState)({name:"",category:"MARKETING",language:"en",header_type:"NONE",header_text:"",body_text:"",footer_text:"",buttons:[]}),ei=localStorage.getItem("workspace_id")||"";(0,r.useEffect)(()=>{eo()},[]);let eo=async()=>{Y(!0),er(!1);try{let e=(await S.api.get("/whatsapp/meta-templates/sync?workspace_id=".concat(ei))).data;e.success&&a(e.meta_templates||[])}catch(r){var e,t,s;console.error("Error fetching templates:",r);let a=(null==r?void 0:null===(t=r.response)||void 0===t?void 0:null===(e=t.data)||void 0===e?void 0:e.detail)||"";(null==r?void 0:null===(s=r.response)||void 0===s?void 0:s.status)===400&&a.toLowerCase().includes("not connected")?er(!0):L.A.error((0,U._V)(r,"Failed to fetch templates"))}finally{Y(!1)}},ed=async()=>{W(!0);try{await eo(),L.A.success("Templates synced successfully")}finally{W(!1)}},ec=async()=>{if(!en.name||!en.body_text){L.A.error("Name and body text are required");return}X(!0);try{let e={workspace_id:ei,name:en.name,category:en.category,language:en.language,header_type:"NONE"!==en.header_type?en.header_type:null,header_text:"TEXT"===en.header_type?en.header_text:null,body_text:en.body_text,footer_text:en.footer_text||null,buttons:en.buttons.length>0?en.buttons:null};(await S.api.post("/whatsapp/meta-templates/create",e)).data.success&&(L.A.success("Template submitted for approval!"),J(!1),el({name:"",category:"MARKETING",language:"en",header_type:"NONE",header_text:"",body_text:"",footer_text:"",buttons:[]}),await eo())}catch(r){var e,a;console.error("Error creating template:",r);let t=(null==r?void 0:null===(a=r.response)||void 0===a?void 0:null===(e=a.data)||void 0===e?void 0:e.detail)||"",s=t.toLowerCase();if(s.includes("whatsapp not connected")||s.includes("connect assets"))L.A.error("WhatsApp is not connected. Please connect your WhatsApp Business account first.");else if(s.includes("business account id not configured"))L.A.error("WhatsApp Business Account is not configured. Please set up WhatsApp in settings.");else if(s.includes("name already exists")||s.includes("duplicate"))L.A.error("A template with this name already exists. Please use a different name.");else if(s.includes("invalid name")||s.includes("template name"))L.A.error("Invalid template name. Use only lowercase letters, numbers, and underscores (e.g., my_template_1).");else if(s.includes("body")&&(s.includes("long")||s.includes("length")))L.A.error("Template body is too long. Please shorten your message (max 1024 characters).");else if(s.includes("parameter")||s.includes("variable"))L.A.error("Invalid variable format. Use {{1}}, {{2}}, etc. for placeholders.");else if(s.includes("button"))L.A.error("Button configuration error. Check button type, text, and URL/phone number.");else if(s.includes("rate limit")||s.includes("too many"))L.A.error("Too many requests. Please wait a moment and try again.");else if(s.includes("failed to create template")){let e=t.replace(/failed to create template:\s*/i,"").trim();e&&e.length>5?L.A.error("Template creation failed: ".concat(e)):L.A.error("Failed to create template. Please check your template format and try again.")}else t&&t.length>5&&!t.startsWith("E")?L.A.error(t):L.A.error((0,U._V)(r,"Failed to create template. Please check your inputs and try again."))}finally{X(!1)}},em=async e=>{ee(e);try{(await S.api.delete("/whatsapp/meta-templates/".concat(e,"?workspace_id=").concat(ei))).data.success&&(L.A.success("Template deleted successfully"),await eo())}catch(r){var a,t;console.error("Error deleting template:",r);let e=(null==r?void 0:null===(t=r.response)||void 0===t?void 0:null===(a=t.data)||void 0===a?void 0:a.detail)||"",s=e.toLowerCase();
1if(s.includes("whatsapp not connected"))L.A.error("WhatsApp is not connected. Please reconnect your WhatsApp Business account.");else if(s.includes("not found"))L.A.error("Template not found. It may have already been deleted.");else if(s.includes("failed to delete template")){let a=e.replace(/failed to delete template:\s*/i,"");L.A.error("Failed to delete: ".concat(a))}else L.A.error((0,U._V)(r,"Failed to delete template. Please try again."))}finally{ee(null)}},eu=e=>{let a=ep(e);navigator.clipboard.writeText(a),L.A.success("Template content copied to clipboard")},ex=e=>{el({...en,buttons:en.buttons.filter((a,t)=>t!==e)})},eh=(e,a,t)=>{let s=[...en.buttons];s[e]={...s[e],[a]:t},el({...en,buttons:s})},ep=e=>{var a;let t=null===(a=e.components)||void 0===a?void 0:a.find(e=>"BODY"===e.type);return(null==t?void 0:t.text)||""},ef=e=>{var a;let t=null===(a=e.components)||void 0===a?void 0:a.find(e=>"HEADER"===e.type);return(null==t?void 0:t.text)||""},eg=e=>{var a;let t=null===(a=e.components)||void 0===a?void 0:a.find(e=>"FOOTER"===e.type);return(null==t?void 0:t.text)||""},ev=e=>{var a;let t=null===(a=e.components)||void 0===a?void 0:a.find(e=>"BUTTONS"===e.type);return(null==t?void 0:t.buttons)||[]},ey=e.filter(e=>{let a=e.name.toLowerCase().includes(Q.toLowerCase())||ep(e).toLowerCase().includes(Q.toLowerCase()),t="ALL"===M||e.status===M;return a&&t}),eb={ALL:e.length,APPROVED:e.filter(e=>"APPROVED"===e.status).length,PENDING:e.filter(e=>"PENDING"===e.status).length,REJECTED:e.filter(e=>"REJECTED"===e.status).length},ej=e=>{switch(e){case"APPROVED":return{icon:m.Z,label:"Approved",className:"bg-emerald-50 text-emerald-700 border-emerald-200",dotColor:"bg-emerald-500"};case"PENDING":return{icon:u.Z,label:"Pending Review",className:"bg-amber-50 text-amber-700 border-amber-200",dotColor:"bg-amber-500"};case"REJECTED":return{icon:x.Z,label:"Rejected",className:"bg-red-50 text-red-700 border-red-200",dotColor:"bg-red-500"};default:return{icon:h.Z,label:e,className:"bg-slate-50 text-slate-700 border-slate-200",dotColor:"bg-slate-500"}}};return(0,s.jsx)(Z.pn,{children:(0,s.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-emerald-50/30",children:[(0,s.jsx)("div",{className:"sticky top-0 z-10 bg-white/80 backdrop-blur-xl border-b border-slate-200/60",children:(0,s.jsx)("div",{className:"px-4 md:px-6 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsx)(D.default,{href:"/dashboard/email",children:(0,s.jsxs)(l.z,{variant:"ghost",size:"sm",className:"gap-1.5 text-slate-600 hover:text-slate-900 hover:bg-slate-100",children:[(0,s.jsx)(p.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Back"})]})}),(0,s.jsx)("div",{className:"h-6 w-px bg-slate-200 hidden sm:block"}),(0,s.jsx)("div",{children:(0,s.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-emerald-500 to-green-600 flex items-center justify-center shadow-lg shadow-emerald-500/20",children:(0,s.jsx)(f.Z,{className:"w-5 h-5 text-white"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-xl font-semibold text-slate-900",children:"Template Manager"}),(0,s.jsx)("p",{className:"text-sm text-slate-500",children:"Create and manage WhatsApp message templates"})]})]})})]}),!es&&(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(Z.u,{children:[(0,s.jsx)(Z.aJ,{asChild:!0,children:(0,s.jsxs)(l.z,{variant:"outline",size:"sm",onClick:ed,disabled:q,className:"gap-2 border-slate-200 hover:border-slate-300 hover:bg-slate-50",children:[(0,s.jsx)(g.Z,{className:"w-4 h-4 ".concat(q?"animate-spin":"")}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Sync from Meta"})]})}),(0,s.jsx)(Z._v,{children:(0,s.jsx)("p",{children:"Refresh templates from Meta Business"})})]}),(0,s.jsxs)(l.z,{size:"sm",onClick:()=>J(!0),className:"gap-2 bg-gradient-to-r from-emerald-600 to-green-600 hover:from-emerald-700 hover:to-green-700 shadow-lg shadow-emerald-500/25 text-white",children:[(0,s.jsx)(v.Z,{className:"w-4 h-4"}),"Create Template"]})]})]})})}),(0,s.jsx)("div",{className:"px-4 md:px-6 py-6 space-y-6",children:es?(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-16",children:[(0,s.jsx)("div",{className:"w-20 h-20 rounded-full bg-amber-100 flex items-center justify-center mb-6",children:(0,s.jsx)(y.Z,{className:"w-10 h-10 text-amber-600"})}),(0,s.jsx)("h2",{className:"text-2xl font-semibold text-slate-900 mb-2",children:"WhatsApp Not Connected"}),(0,s.jsx)("p",{className:"text-slate-500 text-center max-w-md mb-6",children:"Connect your WhatsApp Business account to create and manage message templates for your workspace."}),(0,s.jsx)(D.default,{href:"/dashboard/connect-assets",children:(0,s.jsxs)(l.z,{className:"gap-2 bg-gradient-to-r from-emerald-600 to-green-600 hover:from-emerald-700 hover:to-green-700 shadow-lg shadow-emerald-500/25 text-white",children:[(0,s.jsx)(b.Z,{className:"w-4 h-4"}),"Connect WhatsApp"]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,s.jsxs)("button",{onClick:()=>G("ALL"),className:"relative overflow-hidden rounded-2xl p-5 text-left transition-all duration-300 hover:scale-[1.02] hover:shadow-lg ".concat("ALL"===M?"ring-2 ring-slate-900 shadow-lg":"bg-white border border-slate-200 hover:border-slate-300"),children:[(0,s.jsx)("div",{className:"absolute top-0 right-0 w-20 h-20 bg-gradient-to-br from-slate-100 to-transparent roun
1ded-full -translate-y-1/2 translate-x-1/2"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,s.jsx)("div",{className:"w-8 h-8 rounded-lg bg-slate-100 flex items-center justify-center",children:(0,s.jsx)(j.Z,{className:"w-4 h-4 text-slate-600"})})}),(0,s.jsx)("p",{className:"text-3xl font-bold text-slate-900",children:eb.ALL}),(0,s.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Total Templates"})]})]}),(0,s.jsxs)("button",{onClick:()=>G("APPROVED"),className:"relative overflow-hidden rounded-2xl p-5 text-left transition-all duration-300 hover:scale-[1.02] hover:shadow-lg ".concat("APPROVED"===M?"ring-2 ring-emerald-500 shadow-lg shadow-emerald-500/10":"bg-white border border-slate-200 hover:border-emerald-200"),children:[(0,s.jsx)("div",{className:"absolute top-0 right-0 w-20 h-20 bg-gradient-to-br from-emerald-100 to-transparent rounded-full -translate-y-1/2 translate-x-1/2"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,s.jsx)("div",{className:"w-8 h-8 rounded-lg bg-emerald-100 flex items-center justify-center",children:(0,s.jsx)(m.Z,{className:"w-4 h-4 text-emerald-600"})})}),(0,s.jsx)("p",{className:"text-3xl font-bold text-emerald-600",children:eb.APPROVED}),(0,s.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Ready to Use"})]})]}),(0,s.jsxs)("button",{onClick:()=>G("PENDING"),className:"relative overflow-hidden rounded-2xl p-5 text-left transition-all duration-300 hover:scale-[1.02] hover:shadow-lg ".concat("PENDING"===M?"ring-2 ring-amber-500 shadow-lg shadow-amber-500/10":"bg-white border border-slate-200 hover:border-amber-200"),children:[(0,s.jsx)("div",{className:"absolute top-0 right-0 w-20 h-20 bg-gradient-to-br from-amber-100 to-transparent rounded-full -translate-y-1/2 translate-x-1/2"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,s.jsx)("div",{className:"w-8 h-8 rounded-lg bg-amber-100 flex items-center justify-center",children:(0,s.jsx)(u.Z,{className:"w-4 h-4 text-amber-600"})})}),(0,s.jsx)("p",{className:"text-3xl font-bold text-amber-600",children:eb.PENDING}),(0,s.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Awaiting Approval"})]})]}),(0,s.jsxs)("button",{onClick:()=>G("REJECTED"),className:"relative overflow-hidden rounded-2xl p-5 text-left transition-all duration-300 hover:scale-[1.02] hover:shadow-lg ".concat("REJECTED"===M?"ring-2 ring-red-500 shadow-lg shadow-red-500/10":"bg-white border border-slate-200 hover:border-red-200"),children:[(0,s.jsx)("div",{className:"absolute top-0 right-0 w-20 h-20 bg-gradient-to-br from-red-100 to-transparent rounded-full -translate-y-1/2 translate-x-1/2"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,s.jsx)("div",{className:"w-8 h-8 rounded-lg bg-red-100 flex items-center justify-center",children:(0,s.jsx)(x.Z,{className:"w-4 h-4 text-red-600"})})}),(0,s.jsx)("p",{className:"text-3xl font-bold text-red-600",children:eb.REJECTED}),(0,s.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Needs Attention"})]})]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-200 p-4",children:[(0,s.jsxs)("div",{className:"flex flex-col md:flex-row gap-3",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)(N.Z,{className:"absolute left-3.5 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),(0,s.jsx)(i.I,{placeholder:"Search templates by name or content...",value:Q,onChange:e=>F(e.target.value),className:"pl-10 h-11 bg-slate-50 border-slate-200 focus:bg-white transition-colors"})]}),(0,s.jsxs)(z.Ph,{value:M,onValueChange:G,children:[(0,s.jsx)(z.i4,{className:"w-full md:w-48 h-11 bg-slate-50 border-slate-200",children:(0,s.jsx)(z.ki,{placeholder:"Filter by status"})}),(0,s.jsxs)(z.Bw,{children:[(0,s.jsxs)(z.Ql,{value:"ALL",children:["All Templates (",eb.ALL,")"]}),(0,s.jsxs)(z.Ql,{value:"APPROVED",children:["Approved (",eb.APPROVED,")"]}),(0,s.jsxs)(z.Ql,{value:"PENDING",children:["Pending (",eb.PENDING,")"]}),(0,s.jsxs)(z.Ql,{value:"REJECTED",children:["Rejected (",eb.REJECTED,")"]})]})]})]}),"ALL"!==M&&(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm text-slate-500",children:"Showing:"}),(0,s.jsxs)(d.C,{variant:"secondary",className:"gap-1",children:[M.charAt(0)+M.slice(1).toLowerCase(),(0,s.jsx)("button",{onClick:()=>G("ALL"),className:"ml-1 hover:text-slate-900",children:(0,s.jsx)(x.Z,{className:"w-3 h-3"})})]})]})]}),t?(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-20",children:[(0,s.jsx)("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-emerald-500 to-green-600 flex items-center justify-center mb-4 animate-pulse",children:(0,s.jsx)(f.Z,{className:"w-8 h-8 text-white"})}),(0,s.jsx)("p",{className:"text-slate-500",children:"Loading templates..."})]}):0===ey.length?(0,s.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-200 p-12 text-center",children:[(0,s.jsx)("div",{className:"w-20 h-20 rounded-2xl bg-gradient-to-br from-slate-100 to-slate-50 flex items-center justify-center mx-auto mb-6",children:(0,s.jsx)(f.Z,{className:"w-10 h-10 text-slate-300"})}),(0,s.jsx)("h3",{className:"text-xl font-semibold text-slate-900 mb-2",children:0===e.length?"No templates yet":"No matching templates"}),(0,s.jsx)("p",{className:"text-slate-500 mb-6 max-w-md mx-auto",children:0===e.length?"Create your first WhatsApp template to start sending personalized messages to your customers.":"Try adjusting your search or filter criteria to find what you're looking for."}),0===e.length?(0,s.jsxs)(l.z,{onClick:()=>J(!0),className:"gap-2 bg-gradient-to-r from-emerald-600 to-green-600 hover:from-emerald-700 hover:to-green-700 shadow-lg shadow-emerald-500/25",children:[(0,s.jsx)(w.Z,{className:"w-4 h-4"}),"Create Your First Template"]}):(0,s.jsx)(l.z,{variant:"outline",onClick:()=>{F(""),G("ALL")},children:"Clear Filters"})]}):(0,s.jsxs)("div",{className:"grid gap-4",children:[(0,s.jsx)("div",{className:"flex items-center justify-between",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-slate-900",children:"Your Templates"}),(0,s.jsxs)("p",{className:"text-sm text-slate-500",children:[ey.length," template",1!==ey.length?"s":""," found"]}
1)]})}),(0,s.jsx)("div",{className:"grid gap-3",children:ey.map(e=>{let a=ej(e.status);a.icon;let t=ep(e),r=ev(e);return(0,s.jsx)(n.Zb,{className:"group overflow-hidden border-slate-200 hover:border-slate-300 hover:shadow-md transition-all duration-200",children:(0,s.jsx)(n.aY,{className:"p-0",children:(0,s.jsxs)("div",{className:"flex flex-col lg:flex-row",children:[(0,s.jsxs)("div",{className:"flex-1 p-3",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-2",children:[(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("h3",{className:"font-medium text-sm text-slate-900 truncate",children:V(e.name)}),(0,s.jsxs)(d.C,{className:"".concat(a.className," border gap-1 text-[10px] px-1.5 py-0"),children:[(0,s.jsx)("span",{className:"w-1 h-1 rounded-full ".concat(a.dotColor)}),a.label]}),(0,s.jsx)(d.C,{variant:"outline",className:"text-[10px] px-1.5 py-0 text-slate-500",children:O(e.category)}),(0,s.jsx)(d.C,{variant:"outline",className:"text-[10px] px-1.5 py-0 text-slate-500",children:B(e.language)})]})}),(0,s.jsxs)("div",{className:"flex items-center gap-0.5 lg:opacity-0 lg:group-hover:opacity-100 transition-opacity",children:[(0,s.jsxs)(Z.u,{children:[(0,s.jsx)(Z.aJ,{asChild:!0,children:(0,s.jsx)(l.z,{variant:"ghost",size:"sm",onClick:()=>et(e),className:"h-7 w-7 p-0 hover:bg-slate-100",children:(0,s.jsx)(E.Z,{className:"w-3.5 h-3.5 text-slate-500"})})}),(0,s.jsx)(Z._v,{children:"Preview"})]}),(0,s.jsxs)(Z.u,{children:[(0,s.jsx)(Z.aJ,{asChild:!0,children:(0,s.jsx)(l.z,{variant:"ghost",size:"sm",onClick:()=>eu(e),className:"h-7 w-7 p-0 hover:bg-slate-100",children:(0,s.jsx)(P.Z,{className:"w-3.5 h-3.5 text-slate-500"})})}),(0,s.jsx)(Z._v,{children:"Copy"})]}),(0,s.jsxs)(I.h_,{children:[(0,s.jsx)(I.$F,{asChild:!0,children:(0,s.jsx)(l.z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-slate-100",children:(0,s.jsx)(C.Z,{className:"w-3.5 h-3.5 text-slate-500"})})}),(0,s.jsxs)(I.AW,{align:"end",className:"w-44",children:[(0,s.jsxs)(I.Xi,{onClick:()=>et(e),className:"text-xs",children:[(0,s.jsx)(E.Z,{className:"w-3.5 h-3.5 mr-2"}),"Preview"]}),(0,s.jsxs)(I.Xi,{onClick:()=>eu(e),className:"text-xs",children:[(0,s.jsx)(P.Z,{className:"w-3.5 h-3.5 mr-2"}),"Copy Content"]}),(0,s.jsx)(I.VD,{}),(0,s.jsxs)(I.Xi,{onClick:()=>em(e.name),className:"text-xs text-red-600 focus:text-red-600 focus:bg-red-50",disabled:$===e.name,children:[$===e.name?(0,s.jsx)(k.Z,{className:"w-3.5 h-3.5 mr-2 animate-spin"}):(0,s.jsx)(A.Z,{className:"w-3.5 h-3.5 mr-2"}),"Delete"]})]})]})]})]}),(0,s.jsx)("div",{className:"bg-slate-50 rounded-lg p-2.5",children:(0,s.jsx)("p",{className:"text-xs text-slate-600 whitespace-pre-wrap line-clamp-2",children:t||"No message content"})}),r.length>0&&(0,s.jsx)("div",{className:"flex items-center gap-1.5 flex-wrap mt-2",children:r.map((e,a)=>(0,s.jsx)(d.C,{variant:"outline",className:"bg-white text-slate-500 font-normal text-[10px] px-1.5 py-0",children:e.text},a))}),"REJECTED"===e.status&&e.rejected_reason&&(0,s.jsxs)("div",{className:"mt-2 flex items-start gap-1.5 text-xs text-red-700 bg-red-50 border border-red-100 p-2 rounded-lg",children:[(0,s.jsx)(y.Z,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),(0,s.jsx)("p",{className:"text-red-600 line-clamp-1",children:e.rejected_reason})]})]}),"APPROVED"===e.status&&(0,s.jsxs)("div",{className:"hidden lg:flex flex-col items-center justify-center px-4 py-3 bg-gradient-to-b from-emerald-50 to-green-50 border-l border-emerald-100",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-full bg-emerald-100 flex items-center justify-center mb-1",children:(0,s.jsx)(_.Z,{className:"w-4 h-4 text-emerald-600"})}),(0,s.jsx)("span",{className:"text-[10px] text-emerald-700 font-medium",children:"Ready"})]})]})})},e.id)})})]}),(0,s.jsx)("div",{className:"bg-gradient-to-r from-slate-900 to-slate-800 rounded-2xl p-6 text-white",children:(0,s.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsx)("div",{className:"w-12 h-12 rounded-xl bg-white/10 flex items-center justify-center flex-shrink-0",children:(0,s.jsx)(h.Z,{className:"w-6 h-6 text-white"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-lg mb-1",children:"Need help with templates?"}),(0,s.jsx)("p",{className:"text-slate-300 text-sm",children:"Learn how to create effective WhatsApp templates that get approved by Meta."})]})]}),(0,s.jsxs)(l.z,{variant:"secondary",className:"gap-2 whitespace-nowrap bg-white text-slate-900 hover:bg-slate-100",children:[(0,s.jsx)(b.Z,{className:"w-4 h-4"}),"View Guidelines"]})]})})]})}),(0,s.jsx)(R.Vq,{open:H,onOpenChange:J,children:(0,s.jsxs)(R.cZ,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[(0,s.jsx)(R.fK,{children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-emerald-500 to-green-600 flex items-center justify-center",children:(0,s.jsx)(v.Z,{className:"w-5 h-5 text-white"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)(R.$N,{className:"text-xl",children:"Create New Template"}),(0,s.jsx)(R.Be,{children:"Templates are submitted to Meta for approval (typically 24-48 hours)."})]})]})}),(0,s.jsxs)("div",{className:"space-y-5 py-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(o._,{className:"text-sm font-medium",children:["Template Name ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)(i.I,{placeholder:"e.g., welcome_message",value:en.name,onChange:e=>el({...en,name:e.target.value.toLowerCase().replace(/[^a-z0-9_]/g,"_")}),className:"h-11"}),(0,s.jsxs)("p",{className:"text-xs text-slate-500 flex items-center gap-1",children:[(0,s.jsx)(h.Z,{className:"w-3 h-3"}),"Use lowercase letters, numbers, and underscores only"]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(o._,{className:"text-sm font-medium",children:["Category ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsxs)(z.Ph,{value:en.category,onValueChange:e=>el({...en,category:e}),children:[(0,s.jsx)(z.i4,{className:"h-11",children:(0,s.jsx)(z.ki,{})}),(0,s.jsxs)(z.Bw,{children:[(0,s.jsx)(z.Ql,{value:"MARKETING",children:"Marketing"}),(0,s.jsx)(z.Ql,{value:"UTILITY",children:"Utility"}),(0,s.jsx)(z.Ql,{value:"AUTHENTICATION",children:"Authentication"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(o._,{className:"text-sm font-medium",children:"Language"}),(0,s.jsxs)(z.Ph,{value:en.language,onValueChange:e=>el({...en,language:e}),children:[(0,s.jsx)(z.i4,{className:"h-11",children:(0,s.jsx)(z.ki,{})}),(0,s.jsxs)(z.Bw,{children:[(0,s.jsx)(z.Ql,{value:"en",children:"English"}),(0,s.jsx)(z.Ql,{value:"en_US",children:"English (US)"}),(0,s.jsx)(z.Ql,{value:"hi",children:"Hindi"}),(0,s.jsx)(z.Ql,{value:"es",children:"Spanish"}),(0,s.jsx)(z.Ql,{value:"fr",children:"French"}),(0,s.jsx)(z.Ql,{value:"de",children:"German"}),(0,s.jsx)(z.Ql,{value:"pt_BR",children:"Portuguese (BR)"}),(0,s.jsx)(z.Ql,{value:"ar",children:"Arabic"})]})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(o._,{className:"text-sm font-medium",children:["Header ",(0,s.jsx)("span",{className:"text-slate-400 font-normal",children:"(Optional)"})]}),(0,s.jsxs)(z.Ph,{value:en.header_type,onValueChange:e=>el({...en,header_type:e}),children:[(0,s.jsx)(z.i4,{className:"h-11",children:(0,s.jsx)(z.ki,{})}),(0,s.jsxs)(z.Bw,{children:[(0,s.jsx)(z.Ql,{value:"NONE",children:"No Header"}),(0,s.jsx)(z.Ql,{value:"TEXT",children:"Text Header"})]})]}),"TEXT"===en.header_type&&(0,s.jsx)(i.I,{placeholder:"Enter header text...",value:en.header_text,onChange:e=>el({...en,header_text:e.target.value}),className:"h-11 mt-2"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(o._,{className:"text-sm font-medium",children:["Message Body ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)(c.g,{placeholder:"Hi {{1}}, thank you for contacting us! We'll get back to you about {{2}} soon.",value:en.body_text,onChange:e=>el({...en,body_text:e.target.value}),rows:4,className:"resize-none"}),(0,s.jsxs)("p",{className:"text-xs text-slate-500 flex items-center gap-1",children:[(0,s.jsx)(h.Z,{className:"w-3 h-3"}),"Use ","{{1}}",", ","{{2}}",", etc. for dynamic variables like names or order IDs"]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(o._,{className:"text-sm font-medium",children:["Footer ",(0,s.jsx)("span",{className:"text-slate-400 font-normal",children:"(Optional)"})]}),(0,s.jsx)(i.I,{placeholder:"Reply STOP to unsubscribe",value:en.footer_text,onChange:e=>el({...en,footer_text:e.target.value}),maxLength:60,className:"h-11"})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)(o._,{className:"text-sm font-medium",children:["Buttons ",(0,s.jsx)("span",{className:"text-slate-400 font-normal",children:"(Optional, max 3)"})]}),(0,s.jsxs)(l.z,{variant:"outline",size:"sm",onClick:()=>
1{if(en.buttons.length>=3){L.A.error("Maximum 3 buttons allowed");return}el({...en,buttons:[...en.buttons,{type:"QUICK_REPLY",text:""}]})},disabled:en.buttons.length>=3,className:"gap-1",children:[(0,s.jsx)(v.Z,{className:"w-3.5 h-3.5"}),"Add Button"]})]}),en.buttons.map((e,a)=>(0,s.jsxs)("div",{className:"flex items-start gap-3 p-4 bg-slate-50 rounded-xl border border-slate-200",children:[(0,s.jsxs)("div",{className:"flex-1 space-y-3",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)(z.Ph,{value:e.type,onValueChange:e=>eh(a,"type",e),children:[(0,s.jsx)(z.i4,{className:"h-10",children:(0,s.jsx)(z.ki,{})}),(0,s.jsxs)(z.Bw,{children:[(0,s.jsx)(z.Ql,{value:"QUICK_REPLY",children:"Quick Reply"}),(0,s.jsx)(z.Ql,{value:"URL",children:"URL Button"}),(0,s.jsx)(z.Ql,{value:"PHONE_NUMBER",children:"Call Button"})]})]}),(0,s.jsx)(i.I,{placeholder:"Button label",value:e.text,onChange:e=>eh(a,"text",e.target.value),maxLength:25,className:"h-10"})]}),"URL"===e.type&&(0,s.jsx)(i.I,{placeholder:"https://example.com/{{1}}",value:e.url||"",onChange:e=>eh(a,"url",e.target.value),className:"h-10"}),"PHONE_NUMBER"===e.type&&(0,s.jsx)(i.I,{placeholder:"+1234567890",value:e.phone_number||"",onChange:e=>eh(a,"phone_number",e.target.value),className:"h-10"})]}),(0,s.jsx)(l.z,{variant:"ghost",size:"sm",onClick:()=>ex(a),className:"h-10 w-10 p-0 text-slate-400 hover:text-red-500 hover:bg-red-50",children:(0,s.jsx)(A.Z,{className:"w-4 h-4"})})]},a))]})]}),(0,s.jsxs)(R.cN,{className:"gap-2",children:[(0,s.jsx)(l.z,{variant:"outline",onClick:()=>J(!1),children:"Cancel"}),(0,s.jsx)(l.z,{onClick:ec,disabled:K||!en.name||!en.body_text,className:"gap-2 bg-gradient-to-r from-emerald-600 to-green-600 hover:from-emerald-700 hover:to-green-700",children:K?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(k.Z,{className:"w-4 h-4 animate-spin"}),"Submitting..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(T.Z,{className:"w-4 h-4"}),"Submit for Approval"]})})]})]})}),(0,s.jsx)(R.Vq,{open:!!ea,onOpenChange:()=>et(null),children:(0,s.jsxs)(R.cZ,{className:"max-w-md",children:[(0,s.jsxs)(R.fK,{children:[(0,s.jsx)(R.$N,{children:"Template Preview"}),(0,s.jsx)(R.Be,{children:"How your message will appear on WhatsApp"})]}),ea&&(0,s.jsxs)("div",{className:"py-4",children:[(0,s.jsxs)("div",{className:"bg-[#e5ddd5] rounded-2xl p-4 max-w-xs mx-auto",children:[(0,s.jsxs)("div",{className:"bg-white rounded-lg shadow-sm p-3 space-y-2",children:[ef(ea)&&(0,s.jsx)("p",{className:"font-semibold text-slate-900 text-sm",children:ef(ea)}),(0,s.jsx)("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:ep(ea)||"No message content"}),eg(ea)&&(0,s.jsx)("p",{className:"text-xs text-slate-500",children:eg(ea)}),(0,s.jsx)("p",{className:"text-[10px] text-slate-400 text-right",children:new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),ev(ea).length>0&&(0,s.jsx)("div",{className:"mt-2 space-y-1",children:ev(ea).map((e,a)=>(0,s.jsx)("button",{className:"w-full bg-white text-[#00a884] font-medium text-sm py-2 rounded-lg shadow-sm hover:bg-slate-50 transition-colors",children:e.text},a))})]}),(0,s.jsxs)("div",{className:"mt-4 p-3 bg-slate-50 rounded-xl space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{className:"text-slate-500",children:"Status"}),(0,s.jsx)(d.C,{className:ej(ea.status).className,children:ej(ea.status).label})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{className:"text-slate-500",children:"Category"}),(0,s.jsx)("span",{className:"font-medium",children:O(ea.category)})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{className:"text-slate-500",children:"Language"}),(0,s.jsx)("span",{className:"font-medium",children:B(ea.language)})]})]})]}),(0,s.jsxs)(R.cN,{children:[(0,s.jsx)(l.z,{variant:"outline",onClick:()=>et(null),children:"Close"}),ea&&(0,s.jsxs)(l.z,{onClick:()=>eu(ea),className:"gap-2",children:[(0,s.jsx)(P.Z,{className:"w-4 h-4"}),"Copy Content"]})]})]})})]})})}},69174:function(e,a,t){t.d(a,{C:function(){return i}});var s=t(57437);t(2265);var r=t(90535),n=t(93448);let l=(0,r.j)("inline-flex items-center rounded-[4px] border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function i(e){let{className:a,variant:t,...r}=e;return(0,s.jsx)("div",{className:(0,n.cn)(l({variant:t}),a),...r})}},12381:function(e,a,t){t.d(a,{d:function(){return o},z:function(){return d}});var s=t(57437),r=t(2265),n=t(37053),l=t(90535),i=t(93448);let o=(0,l.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[4px] text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-[4px] px-3 text-xs",lg:"h-10 rounded-[4px] px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),d=r.forwardRef((e,a)=>{let{className:t,variant:r,size:l,asChild:d=!1,...c}=e,m=d?n.g7:"button";return(0,s.jsx)(m,{className:(0,i.cn)(o({variant:r,size:l,className:t})),ref:a,...c})});d.displayName="Button"},79820:function(e,a,t){t.d(a,{Ol:function(){return i},SZ:function(){return d},Zb:function(){return l},aY:function(){return c},eW:function(){return m},ll:function(){return o}});var s=t(57437),r=t(2265),n=t(93448);let l=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,n.cn)("rounded-[4px] border bg-card text-card-foreground shadow",t),...r})});
1l.displayName="Card";let i=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",t),...r})});i.displayName="CardHeader";let o=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,n.cn)("font-display font-semibold leading-none tracking-tight",t),...r})});o.displayName="CardTitle";let d=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,n.cn)("text-sm text-muted-foreground",t),...r})});d.displayName="CardDescription";let c=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,n.cn)("p-6 pt-0",t),...r})});c.displayName="CardContent";let m=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)("div",{ref:a,className:(0,n.cn)("flex items-center p-6 pt-0",t),...r})});m.displayName="CardFooter"},74291:function(e,a,t){t.d(a,{$N:function(){return p},Be:function(){return f},Vq:function(){return o},cN:function(){return h},cZ:function(){return u},fK:function(){return x},hg:function(){return d}});var s=t(57437),r=t(2265),n=t(49027),l=t(93448),i=t(20653);let o=n.fC,d=n.xz,c=n.h_;n.x8;let m=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.aV,{ref:a,className:(0,l.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r})});m.displayName=n.aV.displayName;let u=r.forwardRef((e,a)=>{let{className:t,children:r,overlayClassName:o,...d}=e;return(0,s.jsxs)(c,{children:[(0,s.jsx)(m,{className:o}),(0,s.jsxs)(n.VY,{ref:a,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 translate-x-[-50%] translate-y-[-50%] border bg-background shadow-lg duration-200","w-[calc(100%-1rem)] xs:w-[calc(100%-2rem)] sm:w-full max-w-lg","p-4 sm:p-6","max-h-[90vh] sm:max-h-[85vh]","rounded-lg sm:rounded-lg","flex flex-col","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",t),...d,children:[r,(0,s.jsxs)(n.x8,{className:"absolute right-3 top-3 sm:right-4 sm:top-4 z-50 rounded-full opacity-70 ring-offset-background transition-all hover:opacity-100 hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground bg-white dark:bg-gray-900 shadow-md border border-gray-200 dark:border-gray-700 p-1.5",children:[(0,s.jsx)(i.Pxu,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});u.displayName=n.VY.displayName;let x=e=>{let{className:a,...t}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left flex-shrink-0",a),...t})};x.displayName="DialogHeader";let h=e=>{let{className:a,...t}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 flex-shrink-0 mt-4",a),...t})};h.displayName="DialogFooter";let p=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.Dx,{ref:a,className:(0,l.cn)("font-display text-lg font-semibold leading-none tracking-tight",t),...r})});p.displayName=n.Dx.displayName;let f=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.dk,{ref:a,className:(0,l.cn)("text-sm text-muted-foreground",t),...r})});f.displayName=n.dk.displayName},32060:function(e,a,t){t.d(a,{$F:function(){return d},AW:function(){return c},Ju:function(){return x},VD:function(){return h},Xi:function(){return m},bO:function(){return u},h_:function(){return o}});var s=t(57437),r=t(2265),n=t(70085),l=t(93448),i=t(20653);let o=n.fC,d=n.xz;n.ZA,n.Uv,n.Tr,n.Ee,r.forwardRef((e,a)=>{let{className:t,inset:r,children:o,...d}=e;return(0,s.jsxs)(n.fF,{ref:a,className:(0,l.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",r&&"pl-8",t),...d,children:[o,(0,s.jsx)(i.XCv,{className:"ml-auto"})]})}).displayName=n.fF.displayName,r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.tu,{ref:a,className:(0,l.cn)("z-50 min-w-[8rem] overflow-hidden rounded-[4px] border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",t),...r})}).displayName=n.tu.displayName;let c=r.forwardRef((e,a)=>{let{className:t,sideOffset:r=4,...i}=e;return(0,s.jsx)(n.Uv,{children:(0,s.jsx)(n.VY,{ref:a,sideOffset:r,className:(0,l.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-[4px] border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",t),...i})})});c.displayName=n.VY.displayName;let m=r.forwardRef((e,a)=>{let{className:t,inset:r,...i}=e;return(0,s.jsx)(n.ck,{ref:a,className:(0,l.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",r&&"pl-8",t),...i})});m.displayName=n.ck.displayName;let u=r.forwardRef((e,a)=>{let{className:t,children:r,checked:o,...d}=e;return(0,s.jsxs)(n.oC,{ref:a,className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:o,...d,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(i.nQG,{className:"h-4 w-4"})})}),r]})});u.displayName=n.oC.displayName,r.forwardRef((e,a)=>{let{className:t,children:r,...o}=e;return(0,s.jsxs)(n.Rk,{ref:a,className:(0,l.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(i.jXb,{className:"h-2 w-2 fill-current"})})}),r]})}).displayName=n.Rk.displayName;let x=r.forwardRef((e,a)=>{let{className:t,inset:r,...i}=e;return(0,s.jsx)(n.__,{ref:a,className:(0,l.cn)("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",t),...i})});x.displayName=n.__.displayName;let h=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.Z0,{ref:a,className:(0,l.cn)("-mx-1 my-1 h-px bg-muted",t),...r})});h.displayName=n.Z0.displayName},40279:function(e,a,t){t.d(a,{I:function(){return l}});var s=t(57437),r=t(2265),n=t(93448);let l=r.forwardRef((e,a)=>{let{className:t,type:r,error:l,...i}=e;return(0,s.jsx)("input",{type:r,"aria-invalid":l?"true":void 0,className:(0,n.cn)("flex h-9 w-full rounded-[4px] border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",l&&"border-red-500 focus-visible:ring-red-500",t),ref:a,...i})});l.displayName="Input"},75060:function(e,a,t){t.d(a,{_:function(){return d}});var s=t(57437),r=t(2265),n=t(6394),l=t(90535),i=t(93448);let o=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.f,{ref:a,className:(0,i.cn)(o(),t),...r})});d.displayName=n.f.displayName},15291:function(e,a,t){t.d(a,{Bw:function(){return x},DI:function(){return c},Ph:function(){return d},Ql:function(){return p},i4:function(){return u},ki:function(){return m},n5:function(){return h}});var s=t(57437),r=t(2265),n=t(56873),l=t(40875),i=t(30401),o=t(93448);let d=n.fC,c=n.ZA,m=n.B4,u=r.forwardRef((e,a)=>{let{className:t,children:r,...i}=e;return(0,s.jsxs)(n.xz,{ref:a,className:(0,o.cn)("flex h-10 w-full items-center justify-between rounded-[4px] border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 dark:text-gray-100 px-3 py-2 text-sm r
1ing-offset-white dark:ring-offset-gray-950 placeholder:text-gray-500 dark:placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-gray-950 dark:focus:ring-gray-300 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...i,children:[r,(0,s.jsx)(n.JO,{asChild:!0,children:(0,s.jsx)(l.Z,{className:"h-4 w-4 opacity-50"})})]})});u.displayName=n.xz.displayName;let x=r.forwardRef((e,a)=>{let{className:t,children:r,position:l="popper",...i}=e;return(0,s.jsx)(n.h_,{children:(0,s.jsx)(n.VY,{ref:a,className:(0,o.cn)("relative z-50 min-w-[8rem] overflow-hidden rounded-[4px] border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-950 dark:text-gray-100 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:l,...i,children:(0,s.jsx)(n.l_,{className:(0,o.cn)("p-1 max-h-[300px] overflow-y-auto","popper"===l&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:r})})})});x.displayName=n.VY.displayName;let h=r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.__,{ref:a,className:(0,o.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...r})});h.displayName=n.__.displayName;let p=r.forwardRef((e,a)=>{let{className:t,children:r,...l}=e;return(0,s.jsxs)(n.ck,{ref:a,className:(0,o.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-gray-100 dark:focus:bg-gray-700 focus:text-gray-900 dark:focus:text-gray-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...l,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})}),(0,s.jsx)(n.eT,{children:r})]})});p.displayName=n.ck.displayName,r.forwardRef((e,a)=>{let{className:t,...r}=e;return(0,s.jsx)(n.Z0,{ref:a,className:(0,o.cn)("-mx-1 my-1 h-px bg-gray-100 dark:bg-gray-700",t),...r})}).displayName=n.Z0.displayName},23675:function(e,a,t){t.d(a,{g:function(){return l}});var s=t(57437),r=t(2265),n=t(93448);let l=r.forwardRef((e,a)=>{let{className:t,error:r,...l}=e;return(0,s.jsx)("textarea",{"aria-invalid":r?"true":void 0,className:(0,n.cn)("flex min-h-[80px] w-full rounded-[4px] border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r&&"border-red-500 focus-visible:ring-red-500",t),ref:a,...l})});l.displayName="Textarea"},71488:function(e,a,t){t.d(a,{_v:function(){return c},aJ:function(){return d},pn:function(){return i},u:function(){return o}});var s=t(57437),r=t(2265),n=t(61312),l=t(93448);let i=n.zt,o=n.fC,d=n.xz,c=r.forwardRef((e,a)=>{let{className:t,sideOffset:r=4,...i}=e;return(0,s.jsx)(n.h_,{children:(0,s.jsx)(n.VY,{ref:a,sideOffset:r,className:(0,l.cn)("z-[9999] overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...i})})});c.displayName=n.VY.displayName},5442:function(e,a,t){t.d(a,{Yo:function(){return l},_V:function(){return n}});let s={E1001:"Your session has expired. Please log in again.",E1002:"Invalid authentication. Please log in again.",E1003:"Please log in to continue.",E1004:"You do not have permission to perform this action.",E1005:"Your account has been suspended. Please contact support.",E1006:"Your session has expired. Please log in again.",E1007:"Two-factor authentication is required.",E1008:"Invalid password.",E2001:"Please check your input and try again.",E2002:"This field is required.",E2003:"Invalid value provided.",E2004:"Invalid format. Please check your input.",E2005:"This value already exists.",E2006:"Value length is invalid.",E3001:"The requested item was not found.",E3002:"This item already exists.",E3003:"This item has been deleted.",E3004:"This item is currently locked. Please try again later.",E3005:"A conflict occurred. This item may already exist.",E3006:"Workspace not found.",E3007:"Lead not found.",E3008:"Campaign not found.",E3009:"Contact not found.",E3010:"Template not found.",E4001:"You don't have enough credits for this action.",E4002:"Credit service is temporarily unavailable. Please try again.",E4003:"Credit limit exceeded.",E4004:"You've reached your plan limit. Please upgrade to continue.",E4005:"This feature is not available on your current plan.",E4006:"Your subscription has expired. Please renew to continue.",E4007:"Payment failed. Please try again or use a different payment method.",E4008:"Payment is required to continue.",E4009:"Your trial has expired. Please upgrade to continue.",E4010:"You've exceeded your quota.",E5001:"Unable to connect to external service. Please try again.",E5003:"Unable to connect to Meta. Please try again later.",E5004:"Rate limit reached. Please wait a moment and try again.",E5007:"WhatsApp service error. Please try again.",E5008:"Email service error. Please try again.",E5009:"SMS service error. Please try again.",E5010:"AI service error. Please try again.",E5013:"External service timed out. Please try again.",E5014:"External service is unavailable. Please try again later.",E6001:"Too many requests. Please wait a moment.",E6002:"Hourly limit reached. Please try again later.",E6003:"Daily limit reached. Please try again tomorrow.",E6004:"Too many requests. Please slow down.",E6005:"API rate limit reached.",E6006:"Too many concurrent requests.",E7001:"Database error occurred. Please try again.",E7002:"Sync conflict detected. Please refresh and try again.",E7003:"Sync failed. Please try again.",E7004:"Transaction failed. Please try again.",E7005:"Connection error. Please try again.",E8001:"Failed to create payment order. Please try again.",E8002:"Payment verification failed. Please contact support if you were charged.",E8003:"A similar payment was recently completed. Please wait before retrying.",E8004:"Another payment operation is in progress. Please wait.",E8005:"Payment order has expired. Please create a new order.",E8006:"Payment amount does not match the order.",E8007:"This payment has already been processed.",E8008:"Payment gateway error. Please try again.",E8009:"Payment signature verification failed.",E8010:"Payment order not found.",E8011:"Refund processing failed. Please contact support.",E8012:"Insufficient balance for this operation.",E8013:"A payment request is already being processed. Please wait.",E9001:"Something went wrong. Please try again later.",E9002:"Service temporarily unavailable. Please try again later.",E9003:"Configuration error. Please contact support.",E9004:"System is under maintenance. Please try again later.",E9999:"Network error. Please check your internet connection."}
1,r={sqlalchemy:"Service temporarily unavailable. Please try again later.",database:"Service temporarily unavailable. Please try again later.",psycopg:"Service temporarily unavailable. Please try again later.",mysql:"Service temporarily unavailable. Please try again later.",mongodb:"Service temporarily unavailable. Please try again later.",redis:"Service temporarily unavailable. Please try again later.","connection refused":"Service temporarily unavailable. Please try again later.","connection error":"Unable to connect to server. Please check your internet connection.","connection reset":"Connection interrupted. Please try again.",timeout:"Request timed out. Please try again.","timed out":"Request timed out. Please try again.",unauthorized:"Your session has expired. Please log in again.","invalid credentials":"Invalid email or password. Please try again.","invalid token":"Your session has expired. Please log in again.","token expired":"Your session has expired. Please log in again.",forbidden:"You do not have permission to perform this action.","access denied":"You do not have permission to perform this action.","already exists":"This email is already registered. Please sign in or use a different email.","already registered":"This email is already registered. Please sign in or use a different email.","email already":"This email is already registered. Please sign in or use a different email.",duplicate_email:"This email is already registered. Please sign in or use a different email.",duplicate_username:"This email is already registered. Please sign in or use a different email.","email does not match":"The email does not match the invitation. Please use the invited email address.","invalid invitation":"This invitation link is invalid or has expired.","invitation has expired":"This invitation link has expired. Please request a new one.","invitation has already been used":"This invitation has already been used.","invitation has been cancelled":"This invitation has been cancelled.","whatsapp not connected":"WhatsApp is not connected. Please connect your WhatsApp Business account first.","whatsapp business account id not configured":"WhatsApp Business Account is not configured. Please set up WhatsApp in settings.","template not found":"Template not found. It may have been deleted.","failed to delete template":"Failed to delete template. Please try again.","meta api error":"WhatsApp API error. Please check your template format and try again.","whatsapp api error":"WhatsApp API error. Please try again later.","template name already exists":"A template with this name already exists. Please use a different name.","invalid template name":"Invalid template name. Use only lowercase letters, numbers, and underscores.","template body too long":"Template body is too long. Please shorten your message.","invalid parameter format":"Invalid parameter format. Use {{1}}, {{2}}, etc. for variables.","too many buttons":"Too many buttons. Maximum 3 buttons allowed.","invalid button type":"Invalid button type. Use URL, PHONE_NUMBER, or QUICK_REPLY.","missing required field":"Missing required field. Please fill in all required fields.","network error":"Unable to connect. Please check your internet connection.","fetch failed":"Unable to connect. Please check your internet connection.","failed to fetch":"Unable to connect. Please check your internet connection.",econnrefused:"Service temporarily unavailable. Please try again later.",enotfound:"Service temporarily unavailable. Please try again later.","socket hang up":"Connection interrupted. Please try again.","internal server error":"Something went wrong on our end. Please try again later.","server error":"Something went wrong on our end. Please try again later.","rate limit":"Too many requests. Please wait a moment and try again.","too many requests":"Too many requests. Please wait a moment and try again.","not found":"The requested resource was not found."};function n(e){var a,t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Something went wrong. Please try again.",i=(null==e?void 0:null===(a=e.response)||void 0===a?void 0:a.data)||e;if(i&&!1===i.success&&i.error){let e=i.error;if(s[e])return s[e];if(i.message&&!/^E\d+$/.test(i.message)&&i.message.length>3){let e=i.message.replace(/\bE\d{4}\b/g,"").trim();if(e&&e.length>3)return e}}let o=l(e),d=o.toLowerCase();if(/^E\d+$/.test(o))return s[o]||n;let c=o.match(/^(E\d+)[:\s]*/);if(c){let e=c[1];if(s[e])return s[e];let a=o.replace(/^E\d+[:\s]*/,"").trim();if(a&&a.length>3&&!/^E\d+$/.test(a))return a}for(let[e,a]of Object.entries(r))if(d.includes(e.toLowerCase()))return a;let m=(null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.status)||(null==e?void 0:e.status);if(m){if(401===m)return r.unauthorized;if(403===m)return r.forbidden;if(404===m)return r["not found"];if(429===m)return r["rate limit"];if(m>=500)return r["internal server error"]}return[/traceback/i,/exception/i,/error\s+at\s+line/i,/stack\s*trace/i,/file\s+"[^"]+",\s+line\s+\d+/i,/\w+Error:/,/\w+Exception:/,/at\s+\w+\.\w+\s*\(/,/sqlalchemy\./i,/psycopg2?\./i,/mysql\./i,/mongodb\./i,/redis\./i,/operationalerror/i,/programmingerror/i,/integrityerror/i].some(e=>e.test(o))||o.length>150?n:o.replace(/\bE\d{4}\b/g,"").trim()||n}function l(e){var a;return(null==e?void 0:e.detail)&&Array.isArray(e.detail)?e.detail.map(e=>"string"==typeof e?e:(null==e?void 0:e.msg)?e.msg:(null==e?void 0:e.message)?e.message:"Validation error").join(", "):"str
1ing"==typeof(null==e?void 0:e.detail)?e.detail:"string"==typeof(null==e?void 0:e.message)||e instanceof Error?e.message:"string"==typeof e?e:(null==e?void 0:null===(a=e.response)||void 0===a?void 0:a.data)?l(e.response.data):"An unexpected error occurred"}},93448:function(e,a,t){t.d(a,{cn:function(){return n}});var s=t(61994),r=t(53335);function n(){for(var e=arguments.length,a=Array(e),t=0;t<e;t++)a[t]=arguments[t];return(0,r.m6)((0,s.W)(a))}}}]);
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.