PageSourceSearch

https://my850.ai/_next/static/chunks/5560-e637a3a2c0b706a3.js

js my850.ai collected 2026-10-05 14:31:48 UTC 153,391 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5560],{5560:(e,t,a)=>{a.d(t,{X:()=>eL,A:()=>eU});var s=a(95155),r=a(80455),l=a(26497),n=a(18085),i=a(89715),o=a(35626),d=a(9582),c=a(61712),u=a(56154),m=a(1524),h=a(20639),x=a(25563),p=a(27816),b=a(26983),f=a(99708),g=a(23664),y=a(57828),w=a(39867),v=a(919),j=a(309),N=a(65229),C=a(95740),k=a(20063),S=a(12115),A=a(85733),I=a(11547),D=a(96816),P=a(7235),E=a(19708),T=a(93726),O=a(7818),M=a(3326),F=a(77494),B=a(68881),L=a(8024),U=a(97167),R=a(95671),_=a(68399),q=a(94644),K=a(59719),z=a(31154),Y=a(32255),G=a(89916),H=a(51165),$=a(68854),W=a(85409);function V(e){let{open:t,mailedCount:a,remainingCount:r,onAddTokens:l,onUpgrade:n,onClose:i,tokenPurchaseHidden:o}=e,d=(0,W.K)(),c=!!l&&!(null!=o?o:d);return(0,s.jsxs)(q.l,{open:t,onClose:i,className:"relative z-[200]",children:[(0,s.jsx)("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm","aria-hidden":"true"}),(0,s.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,s.jsx)("div",{className:"flex min-h-full items-end sm:items-center justify-center p-4",children:(0,s.jsxs)(q.l.Panel,{className:"w-full max-w-md rounded-2xl bg-[#0f172a] border border-slate-700 p-6 shadow-2xl pb-safe",children:[(0,s.jsx)("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-emerald-500/15 border border-emerald-400/30",children:(0,s.jsx)(g.A,{className:"h-6 w-6 text-emerald-300"})}),(0,s.jsxs)(q.l.Title,{className:"text-xl font-bold text-white text-center",children:[a," ",1===a?"letter mailed":"letters mailed"]}),(0,s.jsxs)("p",{className:"mt-2 text-sm text-slate-300 text-center leading-relaxed",children:["That's your included mail this month."," ",c?"Add tokens to keep going, or upgrade":"Upgrade"," to Pro and send the ",r," ",1===r?"remaining letter":"remaining letters"," now."]}),(0,s.jsxs)("div",{className:"mt-6 space-y-3",children:[(0,s.jsxs)("button",{type:"button",onClick:n,className:"w-full inline-flex items-center justify-center gap-2 rounded-xl bg-gradient-to-r from-purple-600 to-blue-600 px-4 py-3 text-sm font-semibold text-white shadow-lg hover:from-purple-500 hover:to-blue-500",children:[(0,s.jsx)($.A,{className:"h-4 w-4"}),"Upgrade to Pro and send the rest"]}),c&&(0,s.jsx)("button",{type:"button",onClick:l,className:"w-full rounded-xl border border-white/20 bg-white/10 px-4 py-3 text-sm font-semibold text-white hover:bg-white/20",children:"Add tokens and keep sending"}),(0,s.jsx)("button",{type:"button",onClick:i,className:"w-full px-4 py-2 text-sm text-slate-400 hover:text-white",children:"I'll finish later"})]})]})})})]})}function J(e){let{letter:t,clientId:a,mailedCount:r,queueLength:l,remainingAfterCurrent:n,onSkip:i,onClose:o,onUpgrade:d,onMailSuccess:c,onStatusChange:u,onLetterRegenerated:m,onMemberUpgradeRequired:h}=e,[x,p]=(0,S.useState)(null),b=(0,S.useCallback)(e=>(p(()=>e),!0),[]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(D.default,{letter:t,clientId:a,onBack:o,onMailForMe:()=>{},onDownload:()=>{},onMoreOptions:()=>{},onStatusChange:u,onLetterRegenerated:m,onMemberUpgradeRequired:h,onMailSuccess:c,onMailBlockedByTokens:b,guidedSend:{mailedCount:r,queueLength:l,onSkip:i,onUpgrade:d}}),(0,s.jsx)(V,{open:null!==x,mailedCount:r,remainingCount:n+1,onAddTokens:()=>{p(null),null==x||x()},onUpgrade:()=>{p(null),d()},onClose:()=>p(null)})]})}var X=a(91078),Q=a(89559),Z=a(52987),ee=a(78519),et=a(9781),ea=a(3667),es=a(54679),er=a(1131),el=a(92510);let en=e=>"$".concat(e.toFixed(2)),ei=(e,t)=>"".concat(e," ").concat(t).concat(1===e?"":"s"),eo=[{key:"auto",planCode:F.T4.AI_PRO_99,name:"Auto",pitch:"AI mails every letter for you — mailing included",icon:u.A,accent:"from-indigo-500/20 to-purple-500/20 border-indigo-400/40",button:"from-indigo-500 to-purple-600 hover:from-indigo-400 hover:to-purple-500"},{key:"automax",planCode:F.T4.AI_AUTOMAX,name:"AutoMax",pitch:"Everything in Auto + email, fax & online filings (CFPB, FTC & more)",icon:C.A,accent:"from-fuchsia-500/20 to-amber-500/15 border-fuchsia-400/40",button:"from-fuchsia-500 to-pink-600 hover:from-fuchsia-400 hover:to-pink-500"}];function ed(e){var t,a;let{sessionId:r,letters:l,onOpenLetter:n,onLettersQueued:o,onUpgraded:c}=e,[u,m]=(0,S.useState)(null),[h,p]=(0,S.useState)(!1),[b,j]=(0,S.useState)(null),[N,C]=(0,S.useState)(0),[k,A]=(0,S.useState)(new Set),I=(0,S.useMemo)(()=>l.map(e=>e.id).sort().join("|"),[l]);(0,S.useEffect)(()=>{let e=I?I.split("|"):[];if(0===e.length)return void m([]);let t=!1;return p(!0),j(null),(async()=>{try{let a=await (0,er.getAuthHeaders)(),s=await Promise.all((function(e,t){let a=[];for(let t=0;t<e.length;t+=60)a.push(e.slice(t,t+60));return a})(e,60).map(async e=>{let t=await fetch("/api/mail/diy-send",{method:"POST",headers:a,body:JSON.stringify({entryIds:e,quoteOnly:!0})}),s=await t.json().catch(()=>({}));if(!t.ok||!(null==s?void 0:s.quote))throw Error((null==s?void 0:s.error)||"Could not price these letters.");return s.quote.lines||[]}));if(t)return;let r=s.flat();m(r),A(new Set(r.filter(e=>!e.blockedReason).map(e=>e.entryId)))}catch(e){if(t)return;j((null==e?void 0:e.message)||"Could not price these letters.")}finally{t||p(!1)}})(),()=>{t=!0}},[I,N]);let D=(0,S.useMemo)(()=>new Map(l.map(e=>[e.id,e])),[l]),P=(0,S.useMemo)(()=>new Map((u||[]).map(e=>[e.entryId,e])),[u]),E=(0,S.useMemo)(()=>l.map(e=>{let t=P.get(e.id)||null,a=(null==t?void 0:t.blockedReason)||e.blockedReason||null;return{letter:e,line:t,blockedReason:a}}),[l,P]),T=(0,S.useMemo)(()=>E.filter(e=>e.line&&!e.blockedReason).map(e=>e.letter.id),[E]),O=(0,S.useMemo)(()=>T.filter(e=>k.has(e)),[T,k]),M=(0,S.useMemo)(()=>{let e=0,t=0;for(let a of O){let s=P.get(a);s&&(e+=s.pages,t+=Math.round(100*s.amount))}return{letters:O.length,pages:e,total:t/100}},[O,P]),B=(0,S.useCallback)(e=>{A(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),L=T.length>0&&O.length===T.length,[U,R]=(0,S.useState)(!1),[_,q]=(0,S.useState)(null),[K,z]=(0,S.useState)(null),Y=M.letters>60,G=(0,S.useCallback)(e=>{let{amountCharged:t,response:a}=e;R(!1);let s=Array.isArray(null==a?void 0:a.results)?a.results:[];q(s),z("number"==typeof t?t:null);let r=s.filter(e=>e.ok).map(e=>e.entryId);r.length>0&&(null==o||o(r))},[o]),H=(0,S.useCallback)(()=>{q(null),z(null),C(e=>e+1)},[]),[$,W]=(0,S.useState)(!1),[V,J]=(0,S.useState)(null),ee=(0,S.useCallback)(async()=>
1{if(!$){W(!0),J(null);try{let e=await (0,er.getAuthHeaders)(),t=await fetch("/api/autoblast/sessions/".concat(r,"/print-pack"),{headers:e});if(!t.ok){let e=await t.json().catch(()=>null);throw Error((null==e?void 0:e.error)||"Download failed (".concat(t.status,")"))}let a=await t.blob(),s=/filename="([^"]+)"/.exec(t.headers.get("Content-Disposition")||""),l=(null==s?void 0:s[1])||"Dispute-round-print-pack.zip",n=URL.createObjectURL(a),i=document.createElement("a");i.href=n,i.download=l,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(n)}catch(e){console.error("[DiyMailSendScreen] print pack failed:",e),J(e instanceof Error?e.message:"Could not download this round's letters.")}finally{W(!1)}}},[$,r]),[ea,es]=(0,S.useState)(null);(0,S.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await fetch("/api/recurly/diy-upgrade-offer?sessionId=".concat(encodeURIComponent(r)),{headers:await (0,er.getAuthHeaders)()}),a=await t.json().catch(()=>({}));if(e||!t.ok)return;es({eligible:(null==a?void 0:a.eligible)===!0,reason:"string"==typeof(null==a?void 0:a.reason)?a.reason:null,prices:(null==a?void 0:a.prices)||null})}catch(e){}})(),()=>{e=!0}},[r]);let[ed,eu]=(0,S.useState)(null);return(0,s.jsxs)("div",{className:"w-full max-w-3xl mx-auto space-y-5",children:[(0,s.jsxs)("div",{className:"bg-black/40 backdrop-blur-md rounded-2xl p-5 sm:p-6 border border-white/20 shadow-2xl",children:[(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-br from-emerald-500/25 to-cyan-500/25 border border-emerald-400/40 flex items-center justify-center shrink-0",children:(0,s.jsx)(i.A,{className:"h-6 w-6 text-emerald-200"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl sm:text-3xl font-bold text-white leading-tight",children:"Your letters are ready"}),(0,s.jsxs)("p",{className:"text-white/60 text-sm mt-1",children:["Print and mail them yourself for free, or let 850mail print and mail them for"," ",en(el.ow),"/page."]})]})]}),(0,s.jsxs)("button",{type:"button",onClick:ee,disabled:$,className:"w-full sm:w-auto shrink-0 inline-flex items-center justify-center gap-2 px-5 py-3 rounded-xl bg-white text-zinc-900 font-semibold shadow-lg hover:bg-white/90 disabled:opacity-60 transition-colors",children:[$?(0,s.jsx)(v.A,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(w.A,{className:"h-5 w-5"}),$?"Preparing ZIP…":"Download all PDFs — free"]})]}),V&&(0,s.jsxs)("p",{className:"mt-3 text-sm text-red-200 flex items-start gap-1.5",children:[(0,s.jsx)(X.A,{className:"h-4 w-4 mt-0.5 shrink-0"}),V]})]}),_?(0,s.jsxs)("div",{className:"bg-black/40 backdrop-blur-md rounded-2xl p-5 sm:p-6 border border-white/20 shadow-2xl space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)(x.A,{className:"h-7 w-7 text-emerald-400 shrink-0"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-xl font-bold text-white",children:_.every(e=>e.ok)?"".concat(ei(_.length,"letter")," scheduled"):"".concat(_.filter(e=>e.ok).length," of ").concat(ei(_.length,"letter")," scheduled")}),(0,s.jsxs)("p",{className:"text-white/60 text-sm mt-0.5",children:[null!==K?"".concat(en(K)," charged to your card on file. "):"","Letters are held for 24 hours so you can still cancel or edit them."]})]})]}),(0,s.jsx)("ul",{className:"divide-y divide-white/10 rounded-xl border border-white/10 bg-white/5",children:_.map(e=>{var t,a,r;let l=function(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}(e.holdUntil);return(0,s.jsxs)("li",{className:"flex items-start gap-3 px-4 py-3",children:[e.ok?(0,s.jsx)(x.A,{className:"h-5 w-5 text-emerald-400 shrink-0 mt-0.5"}):(0,s.jsx)(d.A,{className:"h-5 w-5 text-amber-300 shrink-0 mt-0.5"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-white font-medium truncate",children:(t=e.entryId,(null==(a=D.get(t))?void 0:a.label)||(null==(r=P.get(t))?void 0:r.label)||"Letter")}),e.ok?(0,s.jsxs)("p",{className:"text-emerald-200/80 text-xs mt-0.5",children:["Scheduled",l?" — mails after ".concat(l):""]}):(0,s.jsxs)("p",{className:"text-amber-100/80 text-xs mt-0.5",children:[e.error||"Could not schedule this letter."," Your payment is kept — open the letter and mail it later at no extra charge."]})]}),n&&(0,s.jsx)("button",{type:"button",onClick:()=>n(e.entryId),className:"shrink-0 px-2.5 h-8 rounded-lg text-xs font-semibold border border-white/25 bg-white/10 text-white/90 hover:bg-white/20",children:e.ok?"View":"Open letter"})]},e.entryId)})}),(0,s.jsx)("button",{type:"button",onClick:H,className:"w-full py-3 rounded-xl border border-white/20 bg-white/10 hover:bg-white/20 text-white font-semibold transition-colors",children:"Back to my letters"})]}):(0,s.jsxs)("div",{className:"bg-black/40 backdrop-blur-md rounded-2xl border border-white/20 shadow-2xl",children:[(0,s.jsxs)("div",{className:"px-4 sm:px-6 pt-5 pb-3 flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(g.A,{className:"h-5 w-5 text-cyan-300"}),(0,s.jsx)("h2",{className:"text-lg font-bold text-white",children:"Send with 850mail"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1 text-xs",children:[(0,s.jsx)("button",{type:"button",onClick:()=>A(new Set(T)),disabled:0===T.length||L,className:"px-2.5 py-1.5 rounded-lg text-white/80 hover:bg-white/10 disabled:opacity-40",children:"Select all"}),(0,s.jsx)("span",{className:"text-white/30",children:"\xb7"}),(0,s.jsx)("button",{type:"button",onClick:()=>A(new Set),disabled:0===O.length,className:"px-2.5 py-1.5 rounded-lg text-white/80 hover:bg-white/10 disabled:opacity-40",children:"None"})]})]}),b&&(0,s.jsxs)("div",{className:"mx-4 sm:mx-6 mb-3 rounded-xl bg-red-500/10 border border-red-400/30 p-3 flex items-start gap-2",children:[(0,s.jsx)(X.A,{className:"h-5 w-5 text-red-300 shrink-0 mt-0.5"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-red-200 text-sm",children:b}),(0,s.jsxs)("button",{type:"button",onClick:()=>C(e=>e+1),className:"mt-1 inline-flex items-center gap-1 text-xs font-semibold text-red-100 hover:text-white",children:[(0,s.jsx)(Q.A,{className:"h-3.5 w-3.5"}),"Try again"]})]})]}),(0,s.jsxs)("ul",{className:"divide-y divide-white/10 border-t border-white/10",children:[E.map(e=>{let{letter:t,line:a,blockedReason:r}=e,l=!a||!!r,i=!l&&k.has(t.id);return(0,s.jsxs)("li",{className:"flex items-center gap-3 px-4 sm:px-6 py-3 ".concat(l?"opacity-60":""),children:[(0,s.jsx)("input",{type:"checkbox",checked:i,disabled:l,onChange:()=>B(t.id),"aria-label":"Mail ".concat(t.label),className:"h-5 w-5 shrink-0 rounded border-white/30 bg-white/10 accent-emerald-500 disabled:cursor-not-allowed"}),(0,s.jsxs)("button",{type:"button",disabled:l,onClick:()=>B(t.id),className:"flex-1 min-w-0 text-left disabled:cursor-not-allowed",children:[(0,s.jsx)("p",{className:"text-white font-medium truncate",children:t.label}),(0,s.jsxs)("p",{className:"text-white/50 text-xs mt-0.5 truncate",children:["bureau"===t.type?"Bureau letter":"Creditor letter",a?" \xb7 ".concat(ei(a.pages,"page")):"",r?" \xb7 ".concat(r):""]})]}),(0,s.jsx)("span",{className:"shrink-0 text-sm font-semibold text-white tabular-nums",children:a?r?(0,s.jsx)("span",{className:"text-white/40",children:"—"}):en(a.amount):h?(0,s.jsx)(v.A,{className:"h-4 w-4 animate-spin text-white/50"}):(0,s.jsx)("span",{className:"text-white/40",children:"—"})}),n&&(0,s.jsx)("button",{type:"button",onClick:()=>n(t.id),title:"Open the letter to view, edit or download its PDF (free)","aria-label":"Open ".concat(t.label," to download its PDF"),className:"shrink-0 w-8 h-8 rounded-lg border border-white/25 bg-white/10 text-white/80 hover:bg-white/20 hover:text-white flex items-center justify-center",children:r?(0,s.jsx)(y.A,{className:"h-4 w-4"}):(0,s.jsx)(w.A,{className:"h-4 w-4"})})]},t.id)}),0===E.length&&(0,s.jsx)("li",{className:"px-6 py-6 text-center text-white/60 text-sm",children:"No bureau or creditor letters to mail in this round."})]}),(0,s.jsx)("div",{className:"sticky bottom-0 z-10 rounded-b-2xl border-t border-white/15 bg-slate-950/90 backdrop-blur-md px-4 sm:px-6 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[(0,s.jsxs)("p",{className:"text-white/80 text-sm",children:[h&&!u?(0,s.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,s.jsx)(v.A,{className:"h-4 w-4 animate-spin"}),"Pricing your letters…"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"font-semibold text-white",children:[ei(M.letters,"letter")," \xb7 ",ei(M.pages,"page")," \xb7"," ",en(M.total)]}),(0,s.jsx)("span",{className:"text-white/60",children:" — USPS First Class via 850mail"})]}),Y&&(0,s.jsxs)("span",{className:"block text-amber-200 text-xs mt-1",children:["Mail up to ",60," letters at a time."]})]}),(0,s.jsxs)("button",{type:"button",onClick:()=>
1R(!0),disabled:0===M.letters||h||Y,className:"w-full sm:w-auto shrink-0 inline-flex items-center justify-center gap-2 px-5 py-3 rounded-xl bg-gradient-to-r from-emerald-500 to-cyan-600 hover:from-emerald-400 hover:to-cyan-500 text-white font-semibold shadow-lg disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[(0,s.jsx)(g.A,{className:"h-5 w-5"}),"Mail selected — ",en(M.total)]})]})})]}),(0,s.jsxs)("div",{className:"bg-black/40 backdrop-blur-md rounded-2xl p-5 sm:p-6 border border-white/20 shadow-2xl",children:[(0,s.jsx)("h2",{className:"text-lg font-bold text-white",children:"Rather not mail them yourself?"}),(0,s.jsx)("p",{className:"text-white/60 text-sm mt-0.5",children:"Upgrade and 850 sends every letter for you."}),(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mt-4",children:eo.map(e=>{var t,a,r,l,n;let i=null==ea||null==(t=ea.prices)?void 0:t[e.key],o=null!=(l=null!=(r=null==i?void 0:i.regular)?r:null==(a=F.bk[e.planCode])?void 0:a.price)?l:0,d=null!=(n=null==i?void 0:i.firstMonth)?n:o,c=(null==ea?void 0:ea.eligible)===!0&&d<o,u=e.icon;return(0,s.jsxs)("div",{className:"rounded-xl border bg-gradient-to-br ".concat(e.accent," p-4 flex flex-col"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(u,{className:"h-5 w-5 text-white"}),(0,s.jsx)("h3",{className:"text-white font-bold text-lg",children:e.name})]}),(0,s.jsx)("p",{className:"text-white/80 text-sm mt-1",children:e.pitch}),(0,s.jsx)("div",{className:"mt-3 text-white",children:c?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-white/50 line-through mr-2",children:en(o)}),(0,s.jsxs)("span",{className:"text-xl font-bold",children:[en(d)," first month"]}),(0,s.jsxs)("p",{className:"text-white/60 text-xs mt-0.5",children:["then ",en(o),"/mo"]})]}):(0,s.jsxs)("span",{className:"text-xl font-bold",children:[en(o),"/mo"]})}),(0,s.jsxs)("button",{type:"button",onClick:()=>eu({planCode:e.planCode,name:e.name}),className:"mt-4 w-full py-2.5 rounded-xl bg-gradient-to-r ".concat(e.button," text-white text-sm font-semibold shadow-lg transition-colors inline-flex items-center justify-center gap-1.5"),children:["Upgrade to ",e.name,(0,s.jsx)(Z.A,{className:"h-4 w-4"})]})]},e.key)})}),(0,s.jsxs)("p",{className:"text-white/60 text-xs mt-3 flex items-start gap-1.5",children:[(0,s.jsx)(f.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),"Replaces your DIY plan — you'll never be billed for both."]}),(null==ea?void 0:ea.reason)==="no_payment_yet"&&(0,s.jsx)("p",{className:"text-amber-100/80 text-xs mt-1.5",children:"Your first month is free — $30 off unlocks after your first payment or when you add your credit report."})]}),(0,s.jsx)(et.default,{isOpen:U,onClose:()=>R(!1),sku:"mail_pages",pages:M.pages,endpoint:"/api/mail/diy-send",requestBody:{entryIds:O},amount:M.total,title:"Mail with 850mail",description:"".concat(ei(M.letters,"letter")," \xb7 ").concat(ei(M.pages,"page"),", USPS First Class"),termsNote:"One-time charge. Letters are held for 24 hours so you can still cancel or edit them.",onPaid:G}),(0,s.jsx)(ec,{targetPlanCode:null!=(t=null==ed?void 0:ed.planCode)?t:null,targetPlanName:null!=(a=null==ed?void 0:ed.name)?a:null,sessionId:r,onClose:()=>eu(null),onChanged:e=>{eu(null),null==c||c(e)}})]})}function ec(e){let{targetPlanCode:t,targetPlanName:a,sessionId:r,onClose:l,onChanged:n}=e,i=!!t,[o,d]=(0,S.useState)("loading"),[c,u]=(0,S.useState)(null),[m,h]=(0,S.useState)(null),[p,b]=(0,S.useState)(null),g=a||(null==c?void 0:c.targetPlanName)||"your new plan";(0,S.useEffect)(()=>{if(!t)return;let e=!1;return d("loading"),u(null),h(null),b(null),(async()=>{try{let a=await fetch("/api/recurly/subscription/change-self/preview",{method:"POST",headers:await (0,er.getAuthHeaders)(),body:JSON.stringify({targetPlanCode:t,offer:"diy_send_screen",sessionId:r})}),s=await a.json().catch(()=>({}));if(e)return;if(!a.ok||!(null==s?void 0:s.preview))throw Error((null==s?void 0:s.error)||"Could not preview this plan change.");u(s.preview),d("confirm")}catch(t){if(e)return;h((null==t?void 0:t.message)||"Could not preview this plan change."),d("error")}})(),()=>{e=!0}},[t,r]);let y=async()=>
1{if(t){d("processing"),h(null),b(null);try{let e=await fetch("/api/recurly/subscription/change-self",{method:"POST",headers:await (0,er.getAuthHeaders)(),body:JSON.stringify({targetPlanCode:t,offer:"diy_send_screen",sessionId:r})}),a=await e.json().catch(()=>({}));if(!e.ok)throw"string"==typeof(null==a?void 0:a.code)&&b(a.code),Error((null==a?void 0:a.error)||"The plan change could not be completed.");d("success");let s=(null==a?void 0:a.newPlanCode)||t;setTimeout(()=>n(s),1200)}catch(e){h((null==e?void 0:e.message)||"The plan change could not be completed."),d("error")}}},w=function(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"})}(null==c?void 0:c.nextBillingAt);return(0,s.jsx)(es.lG,{open:i,onOpenChange:e=>{e||"processing"===o||"success"===o||l()},children:(0,s.jsxs)(es.Cf,{className:"bg-gradient-to-br from-slate-900/95 via-indigo-950/95 to-slate-900/95 backdrop-blur-md border border-white/15 text-white w-[95vw] max-w-md p-0 overflow-hidden",children:[(0,s.jsx)(es.c7,{className:"px-6 pt-6",children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-br from-indigo-500/25 to-purple-500/25 border border-indigo-400/40 flex items-center justify-center shrink-0",children:(0,s.jsx)(ee.A,{className:"h-6 w-6 text-indigo-200"})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)(es.L3,{className:"text-lg font-bold leading-tight",children:["Upgrade to ",g]}),(0,s.jsx)(es.rr,{className:"text-white/60 text-xs mt-0.5",children:"Billed to your card on file"})]})]})}),(0,s.jsxs)("div",{className:"px-6 pb-6 pt-4 space-y-4",children:["loading"===o&&(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3 py-8",children:[(0,s.jsx)(v.A,{className:"h-8 w-8 text-indigo-300 animate-spin"}),(0,s.jsx)("p",{className:"text-white/80 text-sm",children:"Calculating your total…"})]}),"confirm"===o&&c&&(0,s.jsxs)(s.Fragment,{children:[c.currentPlanName&&(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-white/80",children:[(0,s.jsx)("span",{children:c.currentPlanName}),(0,s.jsx)(Z.A,{className:"h-4 w-4 text-white/40"}),(0,s.jsx)("span",{className:"font-semibold text-white",children:g})]}),(0,s.jsxs)("div",{className:"rounded-xl bg-white/5 border border-white/10 p-4 space-y-2",children:[c.lineItems.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-3 text-sm",children:[(0,s.jsx)("span",{className:e.isCredit?"text-emerald-300/90":"text-white/80",children:e.description}),(0,s.jsxs)("span",{className:"shrink-0 ".concat(e.isCredit?"text-emerald-300":"text-white"),children:[e.isCredit?"−":"",en(Math.abs(e.amount))]})]},t)),c.lineItems.length>0&&(0,s.jsx)("div",{className:"border-t border-white/10"}),(0,s.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,s.jsx)("span",{className:"text-white font-semibold text-sm",children:"Due today"}),(0,s.jsx)("span",{className:"text-2xl font-bold text-white",children:en(c.dueToday)})]})]}),(0,s.jsxs)("p",{className:"text-white/50 text-xs flex items-start gap-1.5",children:[(0,s.jsx)(f.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),(0,s.jsxs)("span",{children:[g," replaces your DIY plan — you'll never be billed for both.",c.endsFreeMonth?" This ends your free DIY month and starts your paid plan today.":"",w?" Your plan renews on ".concat(w,"."):""]})]}),(0,s.jsx)("button",{type:"button",onClick:y,className:"w-full py-3 rounded-xl bg-gradient-to-r from-indigo-500 to-purple-600 hover:from-indigo-400 hover:to-purple-500 text-white font-semibold shadow-lg transition-colors",children:c.dueToday>0?"Confirm & Pay ".concat(en(c.dueToday)):"Confirm upgrade"}),(0,s.jsx)("button",{type:"button",onClick:l,className:"w-full py-2 text-white/50 hover:text-white/80 text-sm transition-colors",children:"Cancel"})]}),"processing"===o&&(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3 py-8",children:[(0,s.jsx)(v.A,{className:"h-8 w-8 text-indigo-300 animate-spin"}),(0,s.jsx)("p",{className:"text-white/80 text-sm",children:"Upgrading your plan…"})]}),"success"===o&&(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3 py-8 text-center",children:[(0,s.jsx)(x.A,{className:"h-10 w-10 text-emerald-400"}),(0,s.jsxs)("p",{className:"text-white font-semibold",children:["You're on ",g]}),(0,s.jsx)("p",{className:"text-white/60 text-sm",children:"Loading your one-click Deploy…"})]}),"error"===o&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"rounded-xl bg-red-500/10 border border-red-400/30 p-4 flex items-start gap-2.5",children:[(0,s.jsx)(X.A,{className:"h-5 w-5 text-red-300 shrink-0 mt-0.5"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-red-200 text-sm font-medium",children:"Upgrade not completed"}),(0,s.jsx)("p",{className:"text-red-200/80 text-xs mt-1",children:m})]})]}),p&&ea.PAYMENT_ISSUE_CODES.has(p)&&(0,s.jsx)("a",{href:"/user-portal?section=billing",className:"block w-full py-3 rounded-xl bg-gradient-to-r from-indigo-500 to-purple-600 hover:from-indigo-400 hover:to-purple-500 text-white font-semibold text-center transition-colors",children:"Update payment method"}),(0,s.jsx)("button",{type:"button",onClick:l,className:"w-full py-2 text-white/50 hover:text-white/80 text-sm transition-colors",children:"Close"})]})]})]})})}var eu=a(92306);function em(e){return function(e){var t,a;if(!e)return!1;if("inquiry_dispute"===String(e.letterKind||""))return!0;
1if("bureau"===String(e.letterType||""))return!1;let s=Array.isArray(e.inquiryIds)?e.inquiryIds.length:0,r=Number(null!=(a=null!=(t=e.inquiryCount)?t:e.numberOfInquiries)?a:0);return s>0||r>0}(e)&&((null==e?void 0:e.contentEditedAt)==null||""===e.contentEditedAt)}let eh=new Set(["sent","mailed"]),ex=new Set(["queued"]);function ep(e){var t;return"bureau"===e.letterType?0:"creditor"===e.letterType&&(e.hasChargeOffs||e.hasCollections)?1:"creditor"===e.letterType&&("inquiry_dispute"===e.letterKind||(null!=(t=e.inquiryCount)?t:0)>0&&"bureau"!==e.letterType)?3:"creditor"===e.letterType?2:4}function eb(e){let t=[],a=[];for(let s of e){if(!(null==s?void 0:s.id))continue;let e=function(e){return ex.has((e.mailStatus||"").toLowerCase())?"already_queued":!function(e){let t=(e.mailStatus||"").toLowerCase();return!!eh.has(t)||"sent"===e.status||!0===e.emailSent}(e)?"cfpb"===e.letterType?"cfpb_filing":"secondary_bureau"===e.letterType?"secondary_bureau":!0===e.addressMissing?"address_missing":em(e)?"needs_edit":"bureau"!==e.letterType&&"creditor"!==e.letterType||e.status&&"ready"!==e.status&&"sent"!==e.status?"not_ready":null:"already_sent"}(s);if(e){a.push({id:s.id,reason:e,title:s.title||s.recipient||s.id});continue}t.push(s)}return t.sort((e,t)=>{let a=ep(e)-ep(t);return 0!==a?a:String(e.title||e.recipient||"").localeCompare(String(t.title||t.recipient||""))}),{ready:t,excluded:a}}var ef=a(24580),eg=a(84676),ey=a(77801),ew=a(92927),ev=a(12108),ej=a(24033),eN=a(48937),eC=a(79427),ek=a(32535),eS=a(49447);let eA=["Mail","Phone Call","Email","Website or App","Social Media","Online Ad or Pop-up","Text","In Person","TV or Radio"];function eI(e){let{checked:t,indeterminate:a,disabled:r,onChange:l}=e,n=(0,S.useRef)(null);return(0,S.useEffect)(()=>{n.current&&(n.current.indeterminate=a)},[a]),(0,s.jsx)("input",{ref:n,type:"checkbox",checked:t,"aria-checked":a?"mixed":t,disabled:r,onChange:l,className:"w-4 h-4 rounded border-white/20 bg-white/5 text-red-500 focus:ring-red-500 shrink-0 cursor-pointer disabled:cursor-not-allowed"})}function eD(e,t){e(e=>{let a=new Set(e);return a.has(t)?a.delete(t):a.add(t),a})}function eP(e){let{userId:t,autoBlastId:a,accounts:r,onSkip:l,onFile:n,onBack:d,busy:c=!1,standalone:u=!1}=e,[m,x]=(0,S.useState)(()=>r.map(e=>({account:e,checked:!0,status:"idle"}))),[b,f]=(0,S.useState)(new Set),[g,y]=(0,S.useState)(()=>eS.pw.map(e=>({bureau:e,checked:!0,status:"idle"}))),w=(0,S.useRef)("ftcbatch_".concat(Date.now(),"_").concat(Math.random().toString(36).slice(2,6))),[j,N]=(0,S.useState)(eA[0]),[C,k]=(0,S.useState)(!1),[A,I]=(0,S.useState)(null),[D,P]=(0,S.useState)(!0),[O,M]=(0,S.useState)(null);(0,S.useEffect)(()=>{if(!t)return;let e=!1;return(0,E.getDoc)((0,E.doc)(T.db,"users",t)).then(t=>{if(e||!t.exists())return;let a=t.data();M({firstName:a.firstName||"",lastName:a.lastName||"",email:a.email||"",phone:a.phone?String(a.phone):null,address:a.address||null})}).catch(e=>console.error("[FTC-DEPLOY] Failed to load profile:",e)).finally(()=>{e||P(!1)}),()=>{e=!0}},[t]);let F=(0,S.useMemo)(()=>{let e=[],t=null==O?void 0:O.address;return(null==O?void 0:O.firstName)&&(null==O?void 0:O.lastName)||e.push("name"),(null==t?void 0:t.streetAddress)||(null==t?void 0:t.street)||e.push("street address"),(null==t?void 0:t.city)||e.push("city"),(null==t?void 0:t.state)||e.push("state"),(null==t?void 0:t.zipCode)||(null==t?void 0:t.zip)||e.push("ZIP code"),(null==O?void 0:O.email)||e.push("email"),e},[O]),B=m.filter(e=>e.checked),L=(0,ek.om)(B,e=>e.account.creditorName),U=g.filter(e=>e.checked),R=L.filter(e=>e.accounts.every(e=>"done"===e.status)).length+g.filter(e=>"done"===e.status).length,_=L.length+U.length,q=(0,S.useCallback)(async()=>{let e=g.filter(e=>e.checked&&"done"!==e.status),s=m.filter(e=>e.checked&&"done"!==e.status);if(0===e.length&&0===s.length&&0===R)return;k(!0),I(null);let r=w.current,l=null==O?void 0:O.address,i={firstName:(null==O?void 0:O.firstName)||"",lastName:(null==O?void 0:O.lastName)||"",email:(null==O?void 0:O.email)||"",email850:"",phone:(null==O?void 0:O.phone)||"",address:{streetAddress:String((null==l?void 0:l.streetAddress)||(null==l?void 0:l.street)||""),city:(null==l?void 0:l.city)||"",state:(null==l?void 0:l.state)||"",zipCode:String((null==l?void 0:l.zipCode)||(null==l?void 0:l.zip)||"")}},o=await (0,er.getAuthHeaders)(),d=0,c=[],u=new Set,h=(e,t)=>{u.has(e)||(u.add(e),c.push({caseId:e,creditorName:t}))};for(let e of g)"done"===e.status&&e.caseId&&h(e.caseId,e.bureau);for(let e of m)"done"===e.status&&e.caseId&&h(e.caseId,e.account.creditorName);let p=async e=>{let s=await fetch("/api/ftc/save",{method:"POST",headers:o,body:JSON.stringify({userId:t,consumerInfo:i,questionnaireAnswers:{didPayMoney:!1,paymentAmount:0,paymentMethod:"",howDidItStart:j},source:"autoblast",autoBlastId:a,batchId:r,...e})}),l=await s.json();if(!s.ok||!l.caseId)throw Error(l.error||"Failed to prepare the report");return String(l.caseId)};for(let e=0;e<g.length;e++){let t=g[e];if(t.checked&&"done"!==t.status){y(t=>t.map((t,a)=>a===e?{...t,status:"saving",error:void 0}:t));try{let a=await p({creditorName:t.bureau,targetType:"bureau",description:(0,eC.YG)(t.bureau,O)});c.push({caseId:a,creditorName:t.bureau}),y(t=>t.map((t,s)=>s===e?{...t,status:"done",caseId:a}:t))}catch(t){d++,y(a=>a.map((a,s)=>s===e?{...a,status:"error",error:(null==t?void 0:t.message)||"Save failed"}:a))}}}let b=m.map((e,t)=>({row:e,idx:t})).filter(e=>{let{row:t}=e;return t.checked&&"done"!==t.status});for(let e of(0,ek.om)(b,e=>e.row.account.creditorName)){let t=new Set(e.accounts.map(e=>e.idx));x(e=>e.map((e,a)=>t.has(a)?{...e,status:"saving",error:void 0}:e));try{let a=await p({accountId:e.accounts[0].row.account.accountId,accountIds:e.accounts.map(e=>e.row.account.accountId),balance:e.accounts.reduce((e,t)=>
1e+(t.row.account.balance||0),0),creditorName:e.displayName,description:(0,eC.LB)(e.accounts.map(t=>({creditorName:e.displayName,accountNumber:t.row.account.accountNumber,balance:t.row.account.balance})),O,!0),targetType:"account"});h(a,e.displayName),x(e=>e.map((e,s)=>t.has(s)?{...e,status:"done",caseId:a}:e))}catch(e){d++,x(a=>a.map((a,s)=>t.has(s)?{...a,status:"error",error:(null==e?void 0:e.message)||"Save failed"}:a))}}if(k(!1),d>0)return void I("".concat(d," report").concat(1!==d?"s":""," could not be prepared. Retry, or continue with the ones that saved."));c.length>0&&n({batchId:r,caseIds:c.map(e=>e.caseId),creditorNames:c.map(e=>e.creditorName)})},[m,g,R,O,t,a,j,n]);return D?(0,s.jsxs)("div",{className:"py-10 text-center",children:[(0,s.jsx)(v.A,{className:"w-6 h-6 text-red-400 animate-spin mx-auto mb-3"}),(0,s.jsx)("p",{className:"text-sm text-white/60",children:"Preparing FTC report details..."})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)(eN.A,{agency:"ftc"}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,s.jsx)(ey.A,{className:"w-5 h-5 text-red-400"}),(0,s.jsx)("h3",{className:"text-lg font-bold text-white",children:"File FTC Fraud Reports"})]}),(0,s.jsxs)("p",{className:"text-xs text-white/60 mb-4",children:["You claimed identity theft on ",r.length," account",1!==r.length?"s":"",". We prepare one FTC report per company (up to 5 accounts each — extras start another report), plus Equifax, Experian, and TransUnion. Expand a company to leave an account out. Reports file with CFPB and the PDF is saved to the Evidence Locker."]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("span",{className:"text-[10px] font-medium text-white/40 uppercase tracking-wide",children:"Credit bureaus"}),(0,s.jsx)("p",{className:"text-[11px] text-white/45 mt-0.5 mb-1.5",children:"File directly against the bureau for failing to block unauthorized accounts."}),(0,s.jsx)("div",{className:"space-y-1.5",children:g.map((e,t)=>(0,s.jsxs)("label",{className:"flex items-center gap-2.5 px-3 py-2 rounded-lg border transition-colors ".concat("done"===e.status?"bg-emerald-500/5 border-emerald-500/20":"error"===e.status?"bg-red-500/5 border-red-500/20":e.checked?"bg-red-500/[0.06] border-red-500/25 cursor-pointer":"bg-white/[0.02] border-white/5 cursor-pointer"),children:["done"===e.status?(0,s.jsx)(p.A,{className:"w-4 h-4 text-emerald-400 shrink-0"}):"saving"===e.status?(0,s.jsx)(v.A,{className:"w-4 h-4 text-red-400 animate-spin shrink-0"}):(0,s.jsx)("input",{type:"checkbox",checked:e.checked,disabled:C||c,onChange:()=>{!C&&!c&&y(e=>e.map((e,a)=>a===t&&"done"!==e.status?{...e,checked:!e.checked}:e))},className:"w-4 h-4 rounded border-white/20 bg-white/5 text-red-500 focus:ring-red-500 shrink-0"}),(0,s.jsx)(ew.A,{className:"w-3.5 h-3.5 text-white/30 shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-white truncate",children:e.bureau}),e.error&&(0,s.jsx)("span",{className:"text-[10px] text-red-300 truncate",children:e.error})]}),(0,s.jsx)("span",{className:"text-[10px] text-white/25 shrink-0",children:"1 report"})]},e.bureau))})]}),(0,s.jsxs)("div",{className:"space-y-1.5 mb-4 max-h-44 overflow-y-auto pr-1",children:[(0,s.jsx)("span",{className:"text-[10px] font-medium text-white/40 uppercase tracking-wide",children:"Companies"}),(0,ek.S0)(m.map((e,t)=>({...e,idx:t})),e=>e.account.creditorName).map(e=>{let t=b.has(e.key),a=e.accounts.filter(e=>"done"!==e.status),r=e.accounts.filter(e=>e.checked&&"done"!==e.status),l=e.accounts.every(e=>"done"===e.status),n=e.accounts.some(e=>"error"===e.status),i=e.accounts.some(e=>"saving"===e.status),o=!l&&r.length===a.length&&a.length>0,d=r.length>0&&!o,u=e.accounts.reduce((e,t)=>e+(t.account.balance||0),0),m=(0,ek.KG)(e.accounts.filter(e=>e.checked).length);return(0,s.jsxs)("div",{className:"rounded-lg border transition-colors ".concat(l?"bg-emerald-500/5 border-emerald-500/20":n?"bg-red-500/5 border-red-500/20":r.length>0?"bg-red-500/[0.06] border-red-500/25":"bg-white/[0.02] border-white/5"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2.5 px-3 py-2",children:[l?(0,s.jsx)(p.A,{className:"w-4 h-4 text-emerald-400 shrink-0"}):i?(0,s.jsx)(v.A,{className:"w-4 h-4 text-red-400 animate-spin shrink-0"}):(0,s.jsx)(eI,{checked:o,indeterminate:d,disabled:C||c,onChange:()=>{let t=!o;x(a=>a.map(a=>"done"===a.status?a:e.accounts.some(e=>e.account.accountId===a.account.accountId)?{...a,checked:t}:a))}}),(0,s.jsxs)("button",{type:"button",onClick:()=>eD(f,e.key),className:"flex-1 min-w-0 text-left",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-white truncate",children:e.displayName}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-[10px] text-white/35",children:[e.accounts.filter(e=>e.checked).length," of ",e.accounts.length," account",1===e.accounts.length?"":"s"]}),u>0&&(0,s.jsxs)("span",{className:"text-[10px] text-red-400",children:["$",u.toLocaleStr
1ing()]}),n&&(0,s.jsx)("span",{className:"text-[10px] text-red-300 truncate",children:"Could not prepare"})]})]}),(0,s.jsxs)("span",{className:"text-[10px] text-white/25 shrink-0",children:[m," report",1===m?"":"s"]}),(0,s.jsx)("button",{type:"button",onClick:()=>eD(f,e.key),className:"p-1 text-white/30","aria-label":t?"Hide accounts":"Show accounts",children:t?(0,s.jsx)(ev.A,{className:"w-3.5 h-3.5"}):(0,s.jsx)(ej.A,{className:"w-3.5 h-3.5"})})]}),t&&(0,s.jsx)("div",{className:"px-3 pb-2 space-y-1 border-t border-white/5 pt-2",children:e.accounts.map(e=>{var t;return(0,s.jsxs)("label",{className:"flex items-center gap-2.5 px-2 py-1.5 rounded-lg",children:["done"===e.status?(0,s.jsx)(p.A,{className:"w-3.5 h-3.5 text-emerald-400 shrink-0"}):"saving"===e.status?(0,s.jsx)(v.A,{className:"w-3.5 h-3.5 text-red-400 animate-spin shrink-0"}):(0,s.jsx)("input",{type:"checkbox",checked:e.checked,disabled:C||c,onChange:()=>{var t;return t=e.idx,void(!C&&!c&&x(e=>e.map((e,a)=>a===t&&"done"!==e.status?{...e,checked:!e.checked}:e)))},className:"w-3.5 h-3.5 rounded border-white/20 bg-white/5 text-red-500 focus:ring-red-500 shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("p",{className:"text-[11px] text-white/80",children:["****",(null==(t=e.account.accountNumber)?void 0:t.slice(-4))||"----"]}),e.error&&(0,s.jsx)("span",{className:"text-[10px] text-red-300 truncate",children:e.error})]}),e.account.balance>0&&(0,s.jsxs)("span",{className:"text-[10px] text-red-400",children:["$",e.account.balance.toLocaleString()]})]},e.account.accountId)})})]},e.key)})]}),(0,s.jsxs)("div",{className:"mb-4 p-3 rounded-xl bg-white/[0.03] border border-white/10",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)(i.A,{className:"w-3.5 h-3.5 text-white/40"}),(0,s.jsx)("span",{className:"text-[10px] font-medium text-white/40 uppercase tracking-wide",children:"Report details (applied to every report)"})]}),(0,s.jsx)("p",{className:"text-[11px] text-white/50 mb-2.5",children:"Reported as identity theft: no money was paid or sent by the consumer."}),(0,s.jsx)("label",{className:"block text-[11px] text-white/60 mb-1",children:"How did it start?"}),(0,s.jsx)("select",{value:j,onChange:e=>N(e.target.value),disabled:C||c,className:"white-select w-full p-2.5 rounded-lg bg-slate-800 border border-white/10 text-white text-xs outline-none focus:border-red-500/40",children:eA.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})]}),F.length>0&&(0,s.jsxs)("div",{className:"mb-4 p-3 rounded-xl bg-amber-500/10 border border-amber-500/20 flex items-start gap-2",children:[(0,s.jsx)(X.A,{className:"w-4 h-4 text-amber-400 shrink-0 mt-0.5"}),(0,s.jsxs)("p",{className:"text-xs text-amber-200",children:["The FTC form requires the client's ",F.join(", ")," — currently missing from the profile. Complete the profile to prepare these reports, or continue without FTC."]})]}),A&&(0,s.jsxs)("div",{className:"mb-3 p-3 rounded-xl bg-red-500/10 border border-red-500/20",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(X.A,{className:"w-4 h-4 text-red-400 shrink-0"}),(0,s.jsx)("p",{className:"text-xs text-red-300",children:A})]}),R>0&&(0,s.jsxs)("button",{onClick:()=>{let e=new Map;for(let t of g)"done"===t.status&&t.caseId&&e.set(t.caseId,t.bureau);for(let t of m)"done"===t.status&&t.caseId&&e.set(t.caseId,t.account.creditorName);if(0===e.size)return void l();n({batchId:w.current,caseIds:[...e.keys()],creditorNames:[...e.values()]})},disabled:C||c,className:"mt-2 text-[11px] text-red-300 underline hover:text-red-200",children:["Continue with the ",R," saved report",1!==R?"s":""]})]}),(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)("button",{onClick:d,disabled:C||c,className:"px-4 py-3 rounded-xl bg-slate-800 hover:bg-slate-700 border border-slate-600 text-slate-300 hover:text-white font-medium transition-all text-sm",children:(0,s.jsx)(o.A,{className:"w-4 h-4 inline -mt-0.5"})}),(0,s.jsx)("button",{onClick:l,disabled:C||c,className:"px-4 py-3 rounded-xl bg-slate-800 hover:bg-slate-700 border border-slate-600 text-slate-300 hover:text-white font-medium transition-all text-sm disabled:opacity-50",children:"Skip FTC"}),(0,s.jsx)("button",{onClick:q,disabled:0===_||F.length>0||C||c,className:"flex-1 px-4 py-3 rounded-xl font-semibold text-sm shadow-lg transition-all ".concat(!(_>0)||0!==F.length||C||c?"bg-slate-700/60 text-white/40 cursor-not-allowed":"bg-gradient-to-r from-red-600 to-rose-600 hover:from-red-700 hover:to-rose-700 text-white"),children:C||c?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v.A,{className:"w-4 h-4 inline animate-spin mr-1.5"}),C?"Preparing ".concat(R,"/").concat(_,"..."):u?"Working...":"Deploying..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.A,{className:"w-4 h-4 inline mr-1.5 -mt-0.5"}),u?"Prepare ".concat(_," FTC"):"Deploy + File ".concat(_," FTC")]})})]})]})}var eE=a(26331);let eT="Access Denied: You do not have permission to view this report.",eO=e=>"bureau"===e?"bureau":"cfpb"===e?"cfpb":"secondary_bureau"===e?"secondary_bureau":"creditor",eM=e=>"mailed"===e||"sent"===e,eF=(e,t)=>!0===e||"sent"===t||"delivered"===t,eB=e=>"deployed"===e||"deploying"===e;function eL(){var e,t,$,W;let{sessionId:V=null,autoStartGuidedSend:X=!1,onBack:Q,onStartNew:Z,onGoToPortal:ee,onGoToSuccess:et,onClose:ea}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},es=(0,k.useRouter)(),er=(0,k.useParams)(),el=(0,z.hQ)(),en=V||(null==er?void 0:er.id),{currentUser:ei,profileData:eo,isAdmin:ec,isSuperAdmin:eh,loading:ex}=(0,A.A)(),[ep,ey]=(0,S.useState)(null),[ew,ev]=(0,S.useState)(null),ej=(null==eo?void 0:eo.planCode)||null,eN=ej&&F.VB[ej]||0;null==eo||null==(e=eo.blastTokens)||e.remaining;let eC=!0===ec||!0===eh,ek=!eC&&(null==eo?void 0:eo.subIsActive)!==!0,eS=!eC&&!0!==(0,F.XE)(ej).autoDeploy,eA=(0,S.useMemo)(()=>{var e;return(0,eu.B9)({planCode:ej,entitlementMode:(null==eo?void 0:eo.subIsActive)===!0?"paid":(null==eo||null==(e=eo.trial)?void 0:e.status)==="active"?"trial":(0,F._S)(ej)?"free":"paid",isAdmin:eC})},[ej,null==eo?void 0:eo.subIsActive,null==eo||null==(t=eo.trial)?void 0:t.status,eC]),[eI,eD]=(0,S.useState)(!1);(0,S.useEffect)(()=>{},[]);let eL=eI||eS&&(0,eu.t7)(eA),eU=!eC&&!el&&(0,F.VX)(ej),[eR,e_]=(0,S.useState)(!1),[eq,eK]=(0,S.useState)(!1),[ez,eY]=(0,S.useState)({dl:!1,ssn:!1}),[eG,eH]=(0,S.useState)(!1),[e$,eW]=(0,S.useState)("confirm"),[eV,eJ]=(0,S.useState)([]),[eX,eQ]=(0,S.useState)(0),[eZ,e0]=(0,S.useState)(null),[e1,e5]=(0,S.useState)(!1),[e2,e4]=(0,S.useState)(null),[e3,e6]=(0,S.useState)(!1),[e8,e9]=(0,S.useState)("deploy"),[e7,te]=(0,S.useState)(!1),[tt,ta]=(0,S.useState)(!1),ts=!eC&&(0,F._S)(ej)&&
1(0,B.K)(eo,el),tr=(0,S.useCallback)(e=>{if(e9(e),ts)return void te(!0);e6(!0)},[ts]),tl=(0,S.useMemo)(()=>"letter"===e8?{memberTitle:"Secondary-bureau letters come with Auto",memberDescription:"Bureau, creditor, and CFPB letters are included on your plan. Editing and sending secondary-bureau letters (LexisNexis, Innovis, and others) comes with Auto and AutoMax.",title:"Unlock Creditor & CFPB Letters",subtitle:"Bureau letters are free on your plan. Creditor, CFPB, and secondary-bureau letters require Pro or Auto."}:{memberTitle:"One-click Deploy comes with Auto",memberDescription:"Auto and AutoMax mail, email, and fax every letter in the round for you. On your current plan, open each letter you want to mail and send it from the letter card. Each send uses your 850mail tokens.",title:"Upgrade to Pro to Deploy",subtitle:"One-click Deploy of the whole batch requires the Pro plan. You can still mail any letter right now: click into the letters you want to mail and send each one from the letter card — billed per letter to your 850mail tokens."},[e8]),[tn,ti]=(0,S.useState)(!1),to=(0,S.useRef)(null),[td,tc]=(0,S.useState)(null),[tu,tm]=(0,S.useState)(null),[th,tx]=(0,S.useState)(null);(0,S.useEffect)(()=>{if(ep)return;let e=(null==eo?void 0:eo.selectedUid)||(null==eo?void 0:eo.uid)||(null==ei?void 0:ei.uid)||null;e&&ey(e)},[ep,eo,null==ei?void 0:ei.uid]),(0,S.useEffect)(()=>{if(!ew||!ei||ex)return;let e=ei.uid===ew.userId,t=ec||eh;if(e||t)return void ae(e=>e===eT?null:e);if(!eo)return;let a=eo.planCode||null,s="".concat(ei.uid,":").concat(ew.userId);to.current!==s&&((0,F.xW)(a)?(ti(!0),(0,R.W)(ei.uid,ew.userId).then(e=>{e?ae(e=>e===eT?null:e):(console.warn("⛔ Access denied: Agent does not manage this client",{agentUid:ei.uid,clientUid:ew.userId}),ae(eT)),to.current=s}).catch(()=>{ae(eT),to.current=s}).finally(()=>ti(!1))):(console.warn("⛔ Access denied: User is not owner, admin, or agent",{currentUserId:ei.uid,sessionUserId:ew.userId,isAdmin:ec,isSuperAdmin:eh}),ae(eT)))},[ew,ei,ec,eh,ex,eo]);let[tp,tb]=(0,S.useState)(null),[tf,tg]=(0,S.useState)(null),[ty,tw]=(0,S.useState)(!1);(0,S.useEffect)(()=>{ew&&en&&!ew.reviewAcknowledged&&(eB(ew.deployStatus)||tw(!0))},[ew,en]);let tv=async()=>{if(tw(!1),en)try{let e=(0,E.doc)(T.db,"autoblastSessions",en);await (0,E.updateDoc)(e,{reviewAcknowledged:!0})}catch(e){console.error("Failed to save review acknowledgement:",e)}},[tj,tN]=(0,S.useState)(!1),[tC,tk]=(0,S.useState)(!1),[tS,tA]=(0,S.useState)(!1),tI=eB(null==ew?void 0:ew.deployStatus),tD="deployed"===(null==ew?void 0:ew.deployStatus),tP=(0,S.useMemo)(()=>["Mail","Email","Fax","Complaints","Reports","Statements","Documents"],[]),[tE,tT]=(0,S.useState)(0);(0,S.useEffect)(()=>{if(!tj)return void tT(0);let e=setInterval(()=>{tT(e=>(e+1)%tP.length)},1400);return()=>clearInterval(e)},[tj,tP]);let[tO,tM]=(0,S.useState)(-1),[tF,tB]=(0,S.useState)(0),[tL,tU]=(0,S.useState)(new Set),[tR,t_]=(0,S.useState)(new Map),[tq,tK]=(0,S.useState)(!1),[tz,tY]=(0,S.useState)(null),[tG,tH]=(0,S.useState)(null),[t$,tW]=(0,S.useState)(!1),[tV,tJ]=(0,S.useState)(!1),[tX,tQ]=(0,S.useState)(0),[tZ,t0]=(0,S.useState)(0),[t1,t5]=(0,S.useState)(new Set),[t2,t4]=(0,S.useState)([]),[t3,t6]=(0,S.useState)([]),[t8,t9]=(0,S.useState)(!0),[t7,ae]=(0,S.useState)(null),[at,aa]=(0,S.useState)([]),[as,ar]=(0,S.useState)({}),[al,an]=(0,S.useState)({}),ai=(0,S.useRef)([]),ao=(0,S.useRef)({}),ad=(0,S.useRef)({}),ac=(0,S.useRef)(new Set),au=(0,S.useRef)(new Set),am=(0,S.useCallback)(e=>Array.isArray(e)?e.map((e,t)=>{var a;return{planKey:null!=(a=null==e?void 0:e.planKey)?a:"plan-".concat(t),type:eO(null==e?void 0:e.type),creditorName:(null==e?void 0:e.creditorName)||(null==e?void 0:e.bureau)||(null==e?void 0:e.displayName)||"Unknown Creditor",accountCount:"number"==typeof(null==e?void 0:e.accountCount)?e.accountCount:0,inquiryCount:"number"==typeof(null==e?void 0:e.inquiryCount)?e.inquiryCount:0,order:"number"==typeof(null==e?void 0:e.order)?e.order:t,manualSendOnly:(null==e?void 0:e.manualSendOnly)===!0||(null==e?void 0:e.type)==="secondary_bureau"}}):[],[]),ah=(0,S.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s={};return e.forEach((e,r)=>{let l=t[e.planKey]||a[e.planKey],n=(null==l?void 0:l.status)==="completed"||(null==l?void 0:l.status)==="error"?l.status:"pending";s[e.planKey]={...e,status:n,entryId:null==l?void 0:l.entryId,error:(null==l?void 0:l.errorMessage)||(null==l?void 0:l.error),completedAtIso:null==l?void 0:l.completedAtIso}}),Object.keys(t||{}
1).forEach((a,r)=>{if(s[a])return;let l=t[a];s[a]={planKey:a,type:eO(null==l?void 0:l.type),creditorName:(null==l?void 0:l.creditorName)||"Unknown Creditor",accountCount:"number"==typeof(null==l?void 0:l.accountCount)?l.accountCount:0,inquiryCount:"number"==typeof(null==l?void 0:l.inquiryCount)?l.inquiryCount:0,order:"number"==typeof(null==l?void 0:l.order)?l.order:e.length+r,manualSendOnly:(null==l?void 0:l.manualSendOnly)===!0||(null==l?void 0:l.type)==="secondary_bureau",status:(null==l?void 0:l.status)==="completed"||(null==l?void 0:l.status)==="error"?l.status:"pending",entryId:null==l?void 0:l.entryId,error:(null==l?void 0:l.errorMessage)||(null==l?void 0:l.error),completedAtIso:null==l?void 0:l.completedAtIso}}),s},[]);(0,S.useEffect)(()=>{try{let e=sessionStorage.getItem("autoblast-progress");if(!e)return;let t=JSON.parse(e);if((null==t?void 0:t.autoBlastId)&&en&&t.autoBlastId!==en)return;let a=am((null==t?void 0:t.entries)||[]);ai.current=a,aa(a);let s=ah(a,(null==t?void 0:t.entryStatus)||{},ao.current);ao.current=s,ar(s),t9(!1)}catch(e){console.warn("⚠️ Failed to bootstrap AutoBlast progress from session storage",e)}},[en,am,ah]),(0,S.useEffect)(()=>{if(!en)return;t9(!0);let e=(0,E.doc)(T.db,"autoblastSessions",en),t=(0,E.onSnapshot)(e,e=>{if(!e.exists()){ae("AutoBlast session not found"),t9(!1);return}let t=e.data();ae(null),ev(t),t.userId&&ey(e=>e===t.userId?e:t.userId);let a=am(t.plannedEntries||ai.current);t.plannedEntries&&t.plannedEntries.length>=ai.current.length?(ai.current=a,aa(a)):0===ai.current.length&&a.length>0&&(ai.current=a,aa(a));let s=ah(ai.current,t.entryStatus||{},ao.current);ao.current=s,ar(s),t9(!1)},e=>{console.error("❌ Failed to subscribe to AutoBlast session",e),ae(e instanceof Error?e.message:"Failed to load AutoBlast session"),t9(!1)});return()=>t()},[en,ah,am]),(0,S.useEffect)(()=>{try{let e=sessionStorage.getItem("autoblast-results");if(!e)return;let t=JSON.parse(e);if((null==t?void 0:t.autoBlastId)&&en&&t.autoBlastId!==en||!Array.isArray(null==t?void 0:t.entries))return;an(e=>{let a={...e};return t.entries.forEach(e=>{(null==e?void 0:e.entryId)&&!a[e.entryId]&&(a[e.entryId]={generatedText:e.finalLetterText||e.letterText||"Letter generation in progress...",signatureUrl:e.userSignatureUrl||null,creditorId:e.creditorId,accountIds:Array.isArray(e.accountIds)?e.accountIds:[],mailStatus:e.mailStatus||null,hasEmail:!!e.emailBody,emailSent:!0===e.emailSent,emailStatus:e.emailStatus||null,emailBody:e.emailBody||null,letterKind:e.letterKind||null,contentEditedAt:e.contentEditedAt||null,addressMissing:!0===e.addressMissing})}),ad.current=a,a})}catch(e){console.warn("⚠️ Unable to hydrate AutoBlast results from storage",e)}},[en]),(0,S.useEffect)(()=>{let e=Object.values(as),t=e.length,a=e.filter(e=>"completed"===e.status).length,s=null==ew?void 0:ew.status;t0(t),tQ(a),("completed"===s||"completed_with_errors"===s||"failed"===s)&&0===t?tJ(!0):tJ(t>0&&a===t)},[as,null==ew?void 0:ew.status]);let ax=(0,S.useMemo)(()=>{let e=Object.values(as),t=null==ew?void 0:ew.status;return"completed"!==t&&"completed_with_errors"!==t&&"failed"!==t&&0!==e.length&&e.filter(e=>"pending"===e.status).length>0},[as,null==ew?void 0:ew.status]);(0,S.useEffect)(()=>{Object.values(as).forEach(e=>{e.entryId&&("completed"===e.status||"error"===e.status)&&!ad.current[e.entryId]&&(ac.current.has(e.entryId)||(ac.current.add(e.entryId),(async()=>{try{let t=await fetch("/api/entries/".concat(e.entryId),{headers:await (0,M.authHeader)()});if(!t.ok)throw Error("Failed to fetch entry ".concat(e.entryId,": ").concat(t.status));let a=await t.json(),s=a.accountTypeSummary||{};an(t=>{let r={...t,[e.entryId]:{generatedText:a.finalLetterText||a.letterText||"Letter generation in progress...",signatureUrl:a.userSignatureUrl||null,creditorId:a.creditorId,accountIds:Array.isArray(a.accountIds)?a.accountIds:"string"==typeof a.accountIdsCsv?a.accountIdsCsv.split(",").map(e=>e.trim()).filter(Boolean):[],mailStatus:a.mailStatus||null,hasEmail:!!a.emailBody,emailSent:!0===a.emailSent,emailStatus:a.emailStatus||null,emailBody:a.emailBody||null,collectionsCount:s.collectionsCount||0,chargeOffsCount:s.chargeOffsCount||0,hasCollections:s.hasCollections||!1,hasChargeOffs:s.hasChargeOffs||!1,inquiryCount:"number"==typeof a.numberOfInquiries?a.numberOfInquiries:Array.isArray(a.inquiryIds)?a.inquiryIds.length:0,letterKind:a.letterKind||null,contentEditedAt:a.contentEditedAt||null,addressMissing:!0===a.addressMissing}};return ad.current=r,r})}catch(t){console.error("❌ Failed to load letter content for ".concat(e.entryId),t)}finally{ac.current.delete(e.entryId)}})()))})},[as]),(0,S.useEffect)(()=>{ad.current=al},[al]);let ap=(0,S.useRef)(void 0);(0,S.useEffect)(()=>{var e;
1let t=null!=(e=null==ew?void 0:ew.deployStatus)?e:null,a=ap.current;if(ap.current=t,"deployed"!==t||null==a||"deployed"===a)return;let s=Array.from(new Set(Object.values(ao.current).map(e=>e.entryId).filter(e=>!!e)));0!==s.length&&(async()=>{let e={};await Promise.all(s.map(async t=>{try{let a=await fetch("/api/entries/".concat(t),{headers:await (0,M.authHeader)()});if(!a.ok)return;let s=await a.json();e[t]={mailStatus:s.mailStatus||null,emailSent:!0===s.emailSent,emailStatus:s.emailStatus||null}}catch(e){console.warn("⚠️ Failed to refresh delivery status for entry ".concat(t),e)}})),0!==Object.keys(e).length&&(an(t=>{let a={...t};return Object.entries(e).forEach(e=>{let[t,s]=e;a[t]&&(a[t]={...a[t],...s})}),ad.current=a,a}),console.log("\uD83D\uDD04 Refreshed entry delivery status after deploy completed",{entryCount:Object.keys(e).length}))})()},[null==ew?void 0:ew.deployStatus]),(0,S.useEffect)(()=>{if(!en)return;let e={},t=[];Object.values(as).forEach(a=>{var s;if("error"!==a.status||!a.entryId||!a.planKey||au.current.has(a.planKey))return;let r=null==(s=al[a.entryId])?void 0:s.mailStatus;eM(r)&&(au.current.add(a.planKey),t.push(a.planKey),e["entryStatus.".concat(a.planKey,".status")]="completed",e["entryStatus.".concat(a.planKey,".error")]=null,e["entryStatus.".concat(a.planKey,".completedAtIso")]=new Date().toISOString(),e["entryStatus.".concat(a.planKey,".resolvedByManualResend")]=!0,e["entryStatus.".concat(a.planKey,".resolvedMailStatus")]=r)}),0!==t.length&&(async()=>{try{let a=(0,E.doc)(T.db,"autoblastSessions",en);await (0,E.updateDoc)(a,e),console.log("✅ Reconciled stale AutoBlast entry errors from live mail status",{sessionId:en,planKeys:t})}catch(e){console.error("❌ Failed to reconcile AutoBlast entry statuses after manual resend",e),t.forEach(e=>au.current.delete(e))}})()},[en,as,al]);let ab=(0,S.useMemo)(()=>Object.values(as).filter(e=>{var t;return"error"===e.status&&(!e.entryId||!eM(null==(t=al[e.entryId])?void 0:t.mailStatus))}),[as,al]),af=(0,S.useMemo)(()=>(null==ew?void 0:ew.errors)?ew.errors.filter(Boolean).length:0,[null==ew?void 0:ew.errors]),ag=(null==ew?void 0:ew.status)==="completed_with_errors"||ab.length>0||af>0,ay=(0,S.useMemo)(()=>{let e=Object.values(as);console.log("\uD83D\uDD04 Calculating derivedLetterCards:",{plannedEntriesCount:at.length,statusMapCount:e.length,plannedEntries:at.map(e=>e.creditorName),statusEntries:e.map(e=>e.creditorName)});let t=at.length>0&&at.length>=e.length?at:e.map((e,t)=>{var a;return{planKey:e.planKey,type:e.type,creditorName:e.creditorName,accountCount:e.accountCount,inquiryCount:e.inquiryCount,order:null!=(a=e.order)?a:t}}),a=new Map;return t.forEach(e=>a.set(e.planKey,e)),e.forEach(e=>{if(!a.has(e.planKey)){var t;a.set(e.planKey,{planKey:e.planKey,type:e.type,creditorName:e.creditorName,accountCount:e.accountCount,inquiryCount:e.inquiryCount,order:null!=(t=e.order)?t:a.size})}}),[...Array.from(a.values())].sort((e,t)=>{let a={bureau:0,creditor:1,cfpb:2,secondary_bureau:3};if(e.type!==t.type){var s,r;return(null!=(s=a[e.type])?s:1)-(null!=(r=a[t.type])?r:1)}return e.order-t.order}).map(e=>{var t,a;let r=ao.current[e.planKey]||as[e.planKey],l=null!=(t=null==r?void 0:r.status)?t:"pending",o=(null==r?void 0:r.entryId)?al[r.entryId]:void 0,d=(null==o?void 0:o.generatedText)&&o.generatedText.trim().length>50,c=eM(null==o?void 0:o.mailStatus)||eF(null==o?void 0:o.emailSent,null==o?void 0:o.emailStatus),u="error"===l&&c?"completed":l,m="completed"===u&&(null==r?void 0:r.entryId)&&d||c,h="error"===u,x="bureau"===e.type?"".concat(e.creditorName," Bureau"):"cfpb"===e.type?"CFPB Complaint":e.creditorName,p=(null==r?void 0:r.entryId)||e.planKey,b="number"==typeof e.inquiryCount&&e.inquiryCount>0?e.inquiryCount:(null==o?void 0:o.inquiryCount)||0;return{id:p,planKey:e.planKey,creditorId:(null==o?void 0:o.creditorId)||("secondary_bureau"===e.type?e.planKey.replace(/^secondary-/,""):void 0),title:"secondary_bureau"===e.type?"".concat(x," Dispute"):"".concat(x," Credit Dispute"),recipient:x,status:c?"sent":m?"ready":"scheduled",entryStatus:u,icon:c?(0,s.jsx)(n.A,{className:"h-5 w-5 text-white"}):(0,s.jsx)(i.A,{className:"h-5 w-5 text-white"}),color:"bureau"===e.type?"bg-gradient-to-r from-purple-500 to-purple-600":"cfpb"===e.type?"bg-gradient-to-r from-amber-500 to-orange-600":"secondary_bureau"===e.type?"bg-gradient-to-r from-teal-500 to-cyan-600":"bg-gradient-to-r from-blue-500 to-blue-600",manualSendOnl
1y:"secondary_bureau"===e.type||!0===e.manualSendOnly,description:(()=>{let t="bureau"===e.type?b>0&&0===e.accountCount?"Bureau inquiry dispute for ".concat(b," inquir").concat(1===b?"y":"ies"):"Bureau letter for ".concat(e.accountCount," account").concat(1!==e.accountCount?"s":"").concat(b>0?" and ".concat(b," inquir").concat(1===b?"y":"ies"):""):"cfpb"===e.type?"CFPB complaint covering ".concat(e.accountCount," account").concat(1!==e.accountCount?"s":""," across all bureaus"):"secondary_bureau"===e.type?"Secondary bureau letter for ".concat(e.accountCount," account").concat(1!==e.accountCount?"s":""," — send manually from the letter view"):b>0&&0===e.accountCount?"Inquiry dispute for ".concat(b," inquir").concat(1===b?"y":"ies"):"Dispute letter for ".concat(e.accountCount," account").concat(1!==e.accountCount?"s":"");return m?t:h?"".concat(t," • Generation failed"):"".concat(t," • Generating…")})(),generatedText:m?(null==o?void 0:o.generatedText)||"Loading letter content...":h?(null==r?void 0:r.error)?"Letter generation failed:\n".concat(r.error):"Letter generation failed. Please retry the AutoBlast.":"Letter is still generating...",signatureUrl:m&&null!=(a=null==o?void 0:o.signatureUrl)?a:null,type:e.type,accountCount:e.accountCount,inquiryCount:b,accountIds:(null==o?void 0:o.accountIds)||[],mailStatus:(null==o?void 0:o.mailStatus)||null,hasEmail:(null==o?void 0:o.hasEmail)||!1,emailSent:eF(null==o?void 0:o.emailSent,null==o?void 0:o.emailStatus),emailBody:(null==o?void 0:o.emailBody)||null,collectionsCount:(null==o?void 0:o.collectionsCount)||0,chargeOffsCount:(null==o?void 0:o.chargeOffsCount)||0,hasCollections:(null==o?void 0:o.hasCollections)||!1,hasChargeOffs:(null==o?void 0:o.hasChargeOffs)||!1,letterKind:(null==o?void 0:o.letterKind)||null,contentEditedAt:(null==o?void 0:o.contentEditedAt)||null,addressMissing:(null==o?void 0:o.addressMissing)===!0}})},[at,as,al]);(0,S.useEffect)(()=>{t4(ay)},[ay]),(0,S.useEffect)(()=>{if(!tp)return;let e=t2.find(e=>e.id===tp.id);e&&(e.status!==tp.status||e.emailBody!==tp.emailBody||e.generatedText!==tp.generatedText||e.signatureUrl!==tp.signatureUrl||e.hasEmail!==tp.hasEmail)&&(console.log("\uD83D\uDD04 Syncing selected letter with updated data:",{id:e.id,hasEmailOld:tp.hasEmail,hasEmailNew:e.hasEmail,hasBodyOld:!!tp.emailBody,hasBodyNew:!!e.emailBody}),tb(t=>t?{...t,...e}:e))},[t2,tp]);let aw=(0,S.useMemo)(()=>tp?{id:tp.id,creditorName:tp.recipient,creditorId:tp.creditorId||tp.id,reasonName:tp.title,letterGeneratedText:tp.generatedText||"Letter content loading...",emailBody:tp.emailBody,status:"sent"===tp.status?"sent":"completed",date:new Date().toLocaleDateString(),formattedDate:new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),selectedUid:ep||(null==ei?void 0:ei.uid)||"",userFullName:"",userEmail:"",letterType:tp.type,isSecondaryBureauLetter:"secondary_bureau"===tp.type,mailStatus:tp.mailStatus||null}:null,[null==tp?void 0:tp.id,null==tp?void 0:tp.recipient,null==tp?void 0:tp.creditorId,null==tp?void 0:tp.title,null==tp?void 0:tp.generatedText,null==tp?void 0:tp.emailBody,null==tp?void 0:tp.status,null==tp?void 0:tp.type,null==tp?void 0:tp.mailStatus,ep,null==ei?void 0:ei.uid]);(0,S.useEffect)(()=>{(async()=>{let e="results_".concat(Date.now(),"_").concat(Math.random().toString(36).substr(2,9)),t=Date.now();console.log("\uD83D\uDCCA [".concat(e,"] Starting AutoBlast results loading"),{timestamp:new Date().toISOString(),url:window.location.href,autoBlastId:en,userAgent:navigator.userAgent});try{var a,r,l,o;if(en){console.log("\uD83D\uDD0D [".concat(e,"] Loading AutoBlast session from Firestore: ").concat(en));let r=(0,E.doc)(T.db,"autoblastSessions",en),l=await (0,E.getDoc)(r);if(l.exists()){let r=l.data();console.log("✅ [".concat(e,"] Found AutoBlast session in Firestore"),{userId:r.userId,totalLetters:r.totalLetters,status:r.status,entryCount:(null==(a=r.entryDetails)?void 0:a.length)||0}),ev(r),r.userId&&ey(r.userId);let o=Date.now(),d=await Promise.all((r.entryDetails||[]).map(async(t,a)=>{var r;let l,o="".concat(e,"_entry_").concat(a);console.log("\uD83D\uDD04 [".concat(o,"] Processing entry from session"),{entryId:t.entryId,creditorName:t.creditorName,accountCount:t.accountCount,type:t.type});let d="Letter is being generated...",c=null,u=null,m=null,h=!1,x=null,p=null,b=null,f=!1;try{let e=Date.now();console.log("\uD83C\uDF10 [".concat(o,"] Fetching letter text from API..."));let a=await fetch("/api/entries/".concat(t.entryId),{headers:await (0,M.authHeader)()}),s=Date.now()-e;if(console.log("\uD83C\uDF10 [".concat(o,"] Entry fetch completed in ").concat(s,"ms"),{status:a.status,ok:a.ok}),a.ok){let e=await a.json();m=e.mailStatus||null,p=e.letterKind||null,b=e.contentEditedAt||null,f=!0===e.addressMissing,d=e.finalLetterText||e.letterText||"Letter generation in progress...",l=e.creditorId,e.userSignatureUrl&&(c=e.userSignatureUrl),e.emailBody&&(u=e.emailBody),h=!0===e.emailSent,x=e.emailStatus||null,console.log("✅ [".concat(o,"] Letter text loaded"),{hasText:!!d,textLength:d.length,hasSignature:!!c,hasEmail:!!u,emailSent:h,fetchTime:s})}else console.warn("⚠️ [".concat(o,"] Entry fetch failed: ").concat(a.status))}catch(e){console.error("❌ [".concat(o,"] Could not fetch letter text:"),{error:e instanceof Error?e.message:"Unknown error",entryId:t.entryId})}let g="bureau"===t.type,y="cfpb"===t.type,w="secondary_bureau"===t.type,v=Array.isArray(t.accountIds)?t.accountIds:[],j="number"==typeof t.accountCount?t.accountCount:v.length,N=g?"".concat(t.creditorName," Bureau"):t.creditorName,C={id:t.entryId,planKey:t.planKey,creditorId:l||(w?null==(r=t.planKey
1)?void 0:r.replace(/^secondary-/,""):void 0),title:w?"".concat(N," Dispute"):"".concat(N," Credit Dispute"),recipient:N,status:eM(m)||eF(h,x)?"sent":"ready",icon:eM(m)||eF(h,x)?(0,s.jsx)(n.A,{className:"h-5 w-5 text-white"}):(0,s.jsx)(i.A,{className:"h-5 w-5 text-white"}),color:g?"bg-gradient-to-r from-purple-500 to-purple-600":w?"bg-gradient-to-r from-teal-500 to-cyan-600":"bg-gradient-to-r from-blue-500 to-blue-600",description:g?"Bureau letter for ".concat(j," account").concat(1!==j?"s":""," + inquiries"):w?"Secondary bureau letter for ".concat(j," account").concat(1!==j?"s":""," — send manually from the letter view"):"Dispute letter for ".concat(j," account").concat(1!==j?"s":""),generatedText:d,signatureUrl:c,type:y?"cfpb":w?"secondary_bureau":g?"bureau":"creditor",accountCount:j,accountIds:v,mailStatus:m,hasEmail:!!u,emailSent:eF(h,x),emailBody:u||null,letterKind:p,contentEditedAt:b,addressMissing:f,manualSendOnly:w||!0===t.manualSendOnly},k=null;return u&&(k={id:"email-".concat(t.entryId),subject:"Dispute of Inaccurate Reporting - ".concat(N),recipient:N,preview:u.substring(0,120)+"...",status:"ready",createdAt:"Just generated",type:"initial",content:u}),{letterCard:C,emailDraft:k}})),c=d.map(e=>e.letterCard);c.sort((e,t)=>{let a={bureau:0,creditor:1,cfpb:2,secondary_bureau:3};if(e.type!==t.type){var s,l;return(null!=(s=a[e.type])?s:1)-(null!=(l=a[t.type])?l:1)}let n=e=>{var t,a;if(!e)return 9999;let s=null==(t=r.plannedEntries)?void 0:t.find(t=>t.planKey===e);if((null==s?void 0:s.order)!==void 0)return s.order;let l=ai.current.find(t=>t.planKey===e);return null!=(a=null==l?void 0:l.order)?a:9999},i=n(e.planKey),o=n(t.planKey);return i-o});let u=d.map(e=>e.emailDraft).filter(e=>null!==e),m=Date.now()-o,h=Date.now()-t;console.log("✅ [".concat(e,"] Results conversion from Firestore completed in ").concat(m,"ms"),{cardsCreated:c.length,draftsCreated:u.length,totalLoadTime:h}),t4(c),t6(u),t9(!1);return}console.warn("⚠️ [".concat(e,"] AutoBlast session not found in Firestore: ").concat(en))}let d=Date.now(),c=sessionStorage.getItem("autoblast-results"),u=Date.now()-d;if(console.log("\uD83D\uDD0D [".concat(e,"] Session storage check completed in ").concat(u,"ms"),{hasStoredResults:!!c,storedDataLength:(null==c?void 0:c.length)||0}),c){let a=Date.now(),d=JSON.parse(c),m=Date.now()-a,h=d.targetUserId||d.targetUser||d.userId;h&&ey(e=>e||h),console.log("\uD83D\uDCCA [".concat(e,"] Found real AutoBlast results from session storage in ").concat(m,"ms:"),{created:d.created,failed:d.failed,serverRequestId:d.requestId,entriesCount:(null==(r=d.entries)?void 0:r.length)||0,creditorNames:(null==(l=d.entries)?void 0:l.map(e=>e.creditorName))||[],serverTiming:d.timing,serverPerformance:d.performance});let x=Date.now(),p=await Promise.all((null==(o=d.entries)?void 0:o.map(async(t,a)=>{let r=Date.now(),l="".concat(e,"_entry_").concat(a);console.log("\uD83D\uDD04 [".concat(l,"] Processing entry for UI display"),{entryId:t.entryId,creditorName:t.creditorName,accountCount:t.accountCount,letterGenerated:t.letterGenerated});let o="Letter is being generated...",d=null,c=null,u=null,m=!1,h=null,x=null,p=null,b=!1;if((t.letterGenerated||"completed"===t.status||t.entryId&&t.entryId.length>5)&&t.entryId)try{let e=Date.now();console.log("\uD83C\uDF10 [".concat(l,"] Fetching letter text from API..."));let a=await fetch("/api/entries/".concat(t.entryId),{headers:await (0,M.authHeader)()}),s=Date.now()-e;if(console.log("\uD83C\uDF10 [".concat(l,"] Entry fetch completed in ").concat(s,"ms"),{status:a.status,ok:a.ok}),a.ok){var f;let e=await a.json();u=e.mailStatus||null,x=e.letterKind||null,p=e.contentEditedAt||null,b=!0===e.addressMissing,o=e.finalLetterText||e.letterText||"Letter generation in progress...";let r=(null==e||null==(f=e.targetUserInfo)?void 0:f.userLetterID)||(null==e?void 0:e.selectedUid)||(null==e?void 0:e.clientUid)||(null==e?void 0:e.userId);r&&ey(e=>e===r?e:r),e.userSignatureUrl&&(d=e.userSignatureUrl),e.emailBody&&(c=e.emailBody),m=!0===e.emailSent,h=e.emailStatus||null,console.log("✅ [".concat(l,"] Letter text loaded"),{hasText:!!o,textLength:o.length,textPreview:o.substring(0,100)+"...",hasSignature:!!d,hasEmail:!!c,emailSent:m,fetchTime:s}),t.signatureUrl=d}else console.warn("⚠️ [".concat(l,"] Entry fetch failed: ").concat(a.status))}catch(e){console.error("❌ [".concat(l,"] Could not fetch letter text:"),{error:e instanceof Error?e.message:"Unknown error",entryId:t.entryId})}else console.log("⏳ [".concat(l,"] Letter not yet generated, showing placeholder"));let g=Date.now()-r;console.log("⏱️ [".concat(l,"] Entry processing completed in ").concat(g,"ms"));let y="bureau"===t.type||t.isBureauLetter,w="cfpb"===t.type||t.isCFPBLetter,v="secondary_bureau"===t.type||t.isSecondaryBureauLetter,j=Array.isArray(t.accountIds)?t.accountIds:[],N="number"==typeof t.accountCount?t.accountCount:j.length,C=y?"".concat(t.creditorName," Bureau"):t.creditorName,k=y?"Bureau letter for ".concat(N," account").concat(1!==N?"s":""," + inquiries"):v?"Secondary bureau letter for ".concat(N," account").concat(1!==N?"s":""," — send manually from the letter view"):"Dispute letter for ".concat(N," account").concat(1!==N?"s":""),S={id:t.entryId,planKey:t.planKey,title:v?"".concat(C," Dispute"):"".concat(C," Credit Dispute"),recipient:C,status:eM(u)||eF(m,h)?"sent":"ready",icon:eM(u)||eF(m,h)?(0,s.jsx)(n.A,{className:"h-5 w-5 text-white"}):(0,s.jsx)(i.A,{className:"h-5 w-5 text-white"}),color:y?"bg-gradient-to-r from-purple-500 to-purple-600":v?"bg-gradient-to-r from-teal-500 to-cyan-600":"bg-gradient-to-r from-blue-500 to-blue-600",description:k,generatedText:o,signatureUrl:t.signatureUrl||null,type:w?"cfpb":v?"secondary_bureau":y?"bureau":"creditor",accountCount:N,accountIds:j,mailStatus:u,hasEmail:!!c,emailSent:eF(m,h),emailBody:c||null,letterKind:x,contentEditedAt:p,addressMissing:b,manualSendOnl
1y:v||!0===t.manualSendOnly},A=null;return c&&(A={id:"email-".concat(t.entryId),subject:"Dispute of Inaccurate Reporting - ".concat(C),recipient:C,preview:c.substring(0,120)+"...",status:"ready",createdAt:"Just generated",type:"initial",content:c}),{letterCard:S,emailDraft:A}}))||[]),b=p.map(e=>e.letterCard);b.sort((e,t)=>{let a={bureau:0,creditor:1,cfpb:2,secondary_bureau:3};if(e.type!==t.type){var s,r;return(null!=(s=a[e.type])?s:1)-(null!=(r=a[t.type])?r:1)}let l=e=>{var t;if(!e)return 9999;let a=ai.current.find(t=>t.planKey===e);return null!=(t=null==a?void 0:a.order)?t:9999},n=l(e.planKey),i=l(t.planKey);return n-i});let f=p.map(e=>e.emailDraft).filter(e=>null!==e),g=Date.now()-x,y=Date.now()-t;console.log("✅ [".concat(e,"] Results conversion completed in ").concat(g,"ms"),{cardsCreated:b.length,draftsCreated:f.length,totalLoadTime:y,timing:{sessionCheckTime:u,parseTime:m,conversionTime:g,totalLoadTime:y}}),t4(b),t6(f),t9(!1),sessionStorage.removeItem("autoblast-results"),console.log("\uD83C\uDFAF [".concat(e,"] AutoBlast results loaded successfully"),{finalCardCount:b.length,totalLoadTime:y,success:!0});return}let m=Date.now()-t;console.log("\uD83D\uDCCB [".concat(e,"] No AutoBlast results found after ").concat(m,"ms, showing empty state")),0===ai.current.length&&t4([]),t9(!1)}catch(s){let a=Date.now()-t;console.error("❌ [".concat(e,"] Failed to load AutoBlast results after ").concat(a,"ms:"),{error:s instanceof Error?s.message:"Unknown error",stack:s instanceof Error?s.stack:void 0,timing:{totalLoadTime:a,failed:!0}}),ae(s instanceof Error?s.message:"Failed to load results"),t9(!1)}})()},[en]);let av=(0,S.useMemo)(()=>{var e;if(null==ew||null==(e=ew.selectedAccountIds)?void 0:e.length)return ew.selectedAccountIds.length;let t=new Set;return(t2.forEach(e=>{var a;null==(a=e.accountIds)||a.forEach(e=>t.add(e))}),0===t.size&&ai.current.length>0)?ai.current.reduce((e,t)=>e+t.accountCount,0):t.size},[ew,t2]),aj=(0,S.useCallback)(e=>"secondary_bureau"===e.type||!0===e.manualSendOnly,[]),aN=(0,S.useCallback)(e=>(0,L.SZ)(e.type,{planTier:eN,isAdmin:eC,session:ew}),[eN,eC,ew]),aC=(0,S.useMemo)(()=>t2.filter(e=>!t1.has(e.id)&&!aj(e)),[t2,t1,aj]),ak=(0,S.useMemo)(()=>t2.filter(e=>aj(e)).length,[t2,aj]),aS=(0,S.useMemo)(()=>aC.filter(e=>"bureau"===e.type).length,[aC]),aA=(0,S.useMemo)(()=>aC.filter(e=>"creditor"===e.type).length,[aC]),aI=(0,S.useMemo)(()=>aC.filter(e=>"cfpb"===e.type).length,[aC]),aD=aC.length,aP=t2.length>0,aE=t2.some(e=>"ready"===e.status||"sent"===e.status),aT=!ax&&!t8&&!aE,aO=(0,S.useMemo)(()=>{if(!eU)return[];let e=(0,ef._t)(t2.map(e=>({...e,creditorName:e.title})),null==ew?void 0:ew.inquiryCreditorNames).filter(e=>("bureau"===e.type||"creditor"===e.type)&&!0!==e.manualSendOnly&&("ready"===e.status||"sent"===e.status)),{excluded:t}=eb(e.map(e=>({id:e.id,letterType:e.type,letterKind:e.letterKind,contentEditedAt:e.contentEditedAt,mailStatus:e.mailStatus,emailSent:e.emailSent,addressMissing:e.addressMissing,inquiryCount:e.inquiryCount,status:e.status,title:e.title,recipient:e.recipient}))),a=new Map(t.map(e=>[e.id,function(e){switch(e){case"already_sent":return"Already sent";case"already_queued":return"Already scheduled";case"cfpb_filing":return"CFPB complaint — file separately";case"secondary_bureau":return"Secondary bureau — view only on this plan";case"address_missing":return"No mailable address";case"needs_edit":return"Edit this inquiry letter before it can be sent";default:return"Not ready to mail"}}(e.reason)]));return e.map(e=>{var t;return{id:e.id,label:e.recipient||e.title,type:e.type,blockedReason:null!=(t=a.get(e.id))?t:null}})},[eU,t2,null==ew?void 0:ew.inquiryCreditorNames]),aM=eU&&!ax&&!t8&&aE&&!!en,aF=[],aB=e=>{if("ready"===e.status||"sent"===e.status){if(aN(e)&&"secondary_bureau"!==e.type)return void tr("letter");tb(e),tg(null)}},aL=(0,S.useCallback)(()=>{if(Z)return void Z();es.push("/autoblast")},[Z,es]),aU=(0,S.useCallback)(()=>Q?void Q():ea?void ea():void es.back(),[Q,ea,es]),aR=(0,S.useCallback)(()=>ee?void ee():ea?void ea():void es.push("/user-portal"),[ee,ea,es]),a_=(0,S.useCallback)(()=>{es.push("/dashboard")},[es]),aq=(0,S.useCallback)(e=>{if(et)return void et(e);es.push("/autoblast/success/".concat(e))},[et,es]),aK=!!(Q||ea),az=aK?"min-h-full":"min-h-screen",aY=aK?(0,s.jsxs)("button",{type:"button",onClick:aU,className:"inline-flex items-center gap-2 rounded-full bg-white px-4 py-2 text-sm font-semibold text-zinc-900 transition-colors hover:bg-white/90","aria-label":"Back to Credit Strategy",children:[(0,s.jsx)(o.A,{className:"h-4 w-4"}),"Back to strategy"]}
1):null,aG=(0,S.useRef)(async()=>{});(0,S.useEffect)(()=>{tt&&!eS&&(ta(!1),aG.current())},[tt,eS]);let aH=(0,S.useCallback)((e,t)=>{let a="queued"===t||"sent"===t||"mailed"===t||"email"===t||"fax"===t;an(a=>{let s={...a};return s[e]&&(s[e]={...s[e],mailStatus:"email"===t||"fax"===t?s[e].mailStatus||"sent":t,emailSent:"email"===t||s[e].emailSent}),s}),t4(s=>s.map(s=>s.id===e?{...s,mailStatus:"email"===t||"fax"===t?s.mailStatus||"sent":t,status:a?"sent":s.status,emailSent:"email"===t||s.emailSent}:s))},[]),a$=(0,S.useCallback)(()=>{tm(null),tb(null)},[]),aW=(0,S.useCallback)(e=>{tm(t=>{if(!t)return t;let a=t.index+1,s=t.mailed+ +(null!=e&&!!e.mailed);if(a>=t.ids.length)return tb(null),null;let r=t2.find(e=>e.id===t.ids[a]);return r&&tb(r),{...t,index:a,mailed:s}})},[t2]),aV=(0,S.useCallback)(()=>{let e=eb((0,ef._t)(t2.map(e=>({...e,creditorName:e.title})),null==ew?void 0:ew.inquiryCreditorNames).map(e=>({id:e.id,letterType:e.type,letterKind:e.letterKind,contentEditedAt:e.contentEditedAt,mailStatus:e.mailStatus,emailSent:e.emailSent,addressMissing:e.addressMissing,hasChargeOffs:e.hasChargeOffs,hasCollections:e.hasCollections,inquiryCount:e.inquiryCount,status:e.status,title:e.title,recipient:e.recipient})));if(0===e.ready.length)return void tx(e.excluded.some(e=>"cfpb_filing"===e.reason)?"These items are CFPB complaints or cannot be mailed yet. Open a bureau or creditor letter to send it.":"No letters are ready to mail yet.");tx(null),tm({ids:e.ready.map(e=>e.id),index:0,mailed:0});let t=t2.find(t=>t.id===e.ready[0].id);t&&tb(t)},[t2,null==ew?void 0:ew.inquiryCreditorNames]),aJ=(0,S.useRef)(!1);(0,S.useEffect)(()=>{X&&!aJ.current&&eL&&!eU&&(t8||ax||!aE||(aJ.current=!0,aV()))},[X,eL,eU,t8,ax,aE,aV]);let aX=async()=>{if(eL)return void aV();if(eS)return void tr("deploy");if(tI)return void tH(tD?"This session has already been deployed. Letters were already sent.":"This session has already been deployed and is awaiting admin approval or final processing.");let e=ep||(null==ei?void 0:ei.uid);if(!eC&&e){let t=await (0,Y.S)(e);if(e0(t),!t.hasDriversLicense||!t.hasSsnCard){eY({dl:!t.hasDriversLicense,ssn:!t.hasSsnCard}),eK(!0);return}}aZ()};aG.current=aX;let aQ=()=>{eK(!1),aZ()};function aZ(){eH(!1),eW("confirm"),eQ(e=>e+1),e4(null),e_(!0)}let a0=async function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],s=(t2.length>0?t2:aF).filter(e=>!t1.has(e.id)&&!aj(e));if(0===s.length)return void e4("All cards are switched off. Turn on at least one card to deploy.");e5(!0),e4(null);try{var r;let{getAuth:l}=await Promise.resolve().then(a.bind(a,59253)),n=await (null==(r=l().currentUser)?void 0:r.getIdToken());if(!n)throw Error("Authentication required");await (0,eE.PJ)({entryIds:s.map(e=>e.id),selections:e,includeMarkup:t,userId:ep||(null==ei?void 0:ei.uid),authHeaders:{"Content-Type":"application/json",Authorization:"Bearer ".concat(n)}})}catch(e){e5(!1),e4((null==e?void 0:e.message)||"Could not save your attachment choices.");return}e5(!1),eW("cfpb")},a1=async()=>{await a3()},a5=async e=>{var t,a,s,r;try{if(en){let t=(0,E.doc)(T.db,"autoblastSessions",en),l={};e.caseIds.length>
10&&(l.cfpbFiling={batchId:e.batchId,caseIds:e.caseIds,creditorNames:e.creditorNames,categories:e.categories,...(null==(s=e.filingKinds)?void 0:s.length)?{filingKinds:e.filingKinds}:{},...(null==(r=e.priorComplaintNumbers)?void 0:r.some(Boolean))?{priorComplaintNumbers:e.priorComplaintNumbers}:{},status:"ready",createdAt:new Date().toISOString()}),(null==(a=e.followUps)?void 0:a.length)&&(l.cfpbFollowUps=e.followUps),Object.keys(l).length>0&&(await (0,E.updateDoc)(t,l),(0,O.J)(en,()=>{var e,t;return null!=(t=null==(e=T.auth.currentUser)?void 0:e.getIdToken())?t:Promise.resolve(null)}))}}catch(e){console.error("❌ [DEPLOY] Failed to record CFPB batch on session:",e)}if(((null==(t=e.identityTheftAccounts)?void 0:t.length)||0)>0){eJ(e.identityTheftAccounts),eW("ftc");return}await a3()},a2=async()=>{await a3()},a4=async e=>{try{if(en){let t=(0,E.doc)(T.db,"autoblastSessions",en);await (0,E.updateDoc)(t,{ftcFiling:{batchId:e.batchId,caseIds:e.caseIds,creditorNames:e.creditorNames,status:"ready",autoStart:!0,createdAt:new Date().toISOString()}}),(0,O.J)(en,()=>{var e,t;return null!=(t=null==(e=T.auth.currentUser)?void 0:e.getIdToken())?t:Promise.resolve(null)})}}catch(e){console.error("❌ [DEPLOY] Failed to record FTC batch on session:",e)}await a3()},a3=async()=>{e_(!1),tN(!0),tk(!0),tU(new Set),tM(0),tB(0),t_(new Map),tH(null),tY(null),tW(!0);let e=(t2.length>0?t2:aF).filter(e=>!t1.has(e.id)&&!aj(e)).length;if(0===e){tH("All cards are switched off. Turn on at least one card to deploy."),tN(!1);return}console.log("\uD83D\uDE80 [DEPLOY] Starting deployment...",{sessionId:en,totalItems:e,excludedCount:t1.size});let t=await se();if(tW(!1),!t.success){tH(t.error||"Failed to start deployment"),tN(!1);return}let a=a6(e);await a,tN(!1),tM(-1),tA(!0),console.log("\uD83D\uDE80 [DEPLOY] Animation complete, launching to success page..."),setTimeout(()=>{en&&(console.log("✅ [DEPLOY] Navigating to success page (worker processing in background)"),aq(en))},150)},a6=e=>new Promise(t=>{let a=[];for(let t=0;t<e;t++){let e,t=Math.random();e=t<.1?2500+1e3*Math.random():t<.4?3500+1500*Math.random():t<.8?5e3+1e3*Math.random():6e3+1e3*Math.random(),a.push(e)}let s=Math.max(2,Math.floor(.1*e));for(let t=0;t<s;t++)a[Math.floor(Math.random()*e)]=7e3-200*t;let r=Date.now(),l=()=>{let s=Date.now()-r,n=new Map,i=new Set;for(let t=0;t<e;t++){let e=Math.min(100,s/a[t]*100);n.set(t,e),e>=100&&i.add(t)}t_(n),tU(e=>new Set([...e,...i])),tB(i.size/e*100),s<7200?setTimeout(l,50):t()};l()}),[a8,a9]=(0,S.useState)(null),a7=async e=>{if(!a8){a9(e.id);try{var t;let{getAuth:s}=await Promise.resolve().then(a.bind(a,59253)),r=await (null==(t=s().currentUser)?void 0:t.getIdToken());if(!r)throw Error("Authentication required");let l=await fetch("/api/entries/".concat(e.id,"/self-mail-kit"),{headers:{Authorization:"Bearer ".concat(r)}});if(!l.ok){let e=await l.json().catch(()=>null);throw Error((null==e?void 0:e.error)||"Self-mail kit failed (".concat(l.status,")"))}let n=await l.blob(),i=window.URL.createObjectURL(n),o=document.createElement("a");o.href=i,o.download="Self-Mail-Kit_".concat(e.recipient.replace(/[^a-zA-Z0-9]+/g,"-"),"_").concat(new Date().toISOString().split("T")[0],".pdf"),document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(i),document.body.removeChild(o)}catch(e){console.error("❌ Self-mail kit download failed:",e),alert(e instanceof Error?e.message:"Could not generate the self-mail kit.")}finally{a9(null)}}},se=async()=>{try{var e;console.log("\uD83D\uDCE4 [DEPLOY] Calling deploy kickoff API...",{sessionId:en,dryRun:tq});let{getAuth:t}=await Promise.resolve().then(a.bind(a,59253)),s=t(),r=await (null==(e=s.currentUser)?void 0:e.getIdToken());if(!r)throw Error("Authentication required");let l=new AbortController,n=setTimeout(()=>l.abort(),3e4),i=Array.from(t1),o=await fetch("/api/autoblast/deploy",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(r)},body:JSON.stringify({sessionId:en,dryRun:tq,consent:(0,U.WH)("results_page"),...i.length>0&&{excludeEntryIds:i}}),signal:l.signal});clearTimeout(n);let d=await o.json();if(!o.ok)throw Error(d.error||"Failed to start deployment");return console.log("✅ [DEPLOY] Kickoff accepted:",{jobId:d.jobId,status:d.status}),{success:!0,jobId:d.jobId}}catch(e){return console.error("❌ [DEPLOY] Kickoff failed:",e.message),{success:!1,error:e.message||"Failed to start deployment"}}};if(t8||ex)return(0,s.jsxs)("div",{className:"".concat(az," bg-gradient-to-br from-blue-900 via-purple-900 to-indigo-900 flex items-center justify-center relative"),children:[aY&&(0,s.jsx)("div",{className:"absolute top-4 left-4",children:aY}),(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-white mx-auto mb-4"}),(0,s.jsx)("p",{className:"text-white text-lg",children:"Loading AutoBlast results..."}),en&&(0,s.jsxs)("p",{className:"text-white/60 text-sm mt-2",children:["Session: ",en]})]})]});if(ew&&ei){let e=ei.uid===ew.userId,t=ec||eh;if(!e&&!t&&!t7&&(tn||!to.current))return(0,s.jsxs)("div",{className:"".concat(az," bg-gradient-to-br from-blue-900 via-purple-900 to-indigo-900 flex items-center justify-center relative"),children:[aY&&(0,s.jsx)("div",{className:"absolute top-4 left-4",children:aY}),(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-white mx-auto mb-4"}),(0,s.jsx)("p",{className:"text-white text-lg",children:"Verifying access..."})]})]})}if(t7)return(0,s.jsx)("div",{className:"".concat(az," bg-gradient-to-br from-blue-900 via-purple-900 to-indigo-900 flex items-center justify-center"),children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)(d.A,{className:"h-12 w-12 text-red-400 mx-auto mb-4"}),(0,s.jsx)("p",{className:"text-white text-lg mb-4",children:"Failed to load AutoBlast results"}),(0,s.jsx)("p",{className:"text-white/60 mb-6",children:t7}),(0,s.jsx)("button",{onClick:aK?aU:aR,className:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg",children:aK?"Back to strategy":"Return to Dashboard"})]})});if(tp&&aw){let e={clientId:ep||(null==ei?void 0:ei.uid),onMemberUpgradeRequired:()=>{tm(null),tb(null),tr("letter")},onStatusChange:(e,t)=>
1{aH(e,t),("cancelled"===t||"draft"===t)&&t4(t=>t.map(t=>t.id===e?{...t,status:"ready",icon:(0,s.jsx)(i.A,{className:"h-5 w-5 text-white"})}:t))},onLetterRegenerated:(e,t)=>{an(a=>{let s={...a};return s[e]&&(s[e]={...s[e],generatedText:t}),s}),t4(a=>a.map(a=>a.id===e?{...a,generatedText:t}:a))}};return tu?(0,s.jsx)(J,{letter:aw,clientId:e.clientId,mailedCount:tu.mailed,queueLength:tu.ids.length,remainingAfterCurrent:tu.ids.length-tu.index-1,onSkip:()=>aW({skipped:!0}),onClose:a$,onUpgrade:()=>{a$(),tr("deploy")},onMailSuccess:(e,t)=>{aH(e,t),window.setTimeout(()=>aW({mailed:!0}),700)},onStatusChange:e.onStatusChange,onLetterRegenerated:e.onLetterRegenerated,onMemberUpgradeRequired:e.onMemberUpgradeRequired}):(0,s.jsx)(D.default,{letter:aw,clientId:e.clientId,onBack:()=>tb(null),onReviewAndDeploy:()=>tb(null),onMailForMe:()=>{},onDownload:()=>{},onMoreOptions:()=>{},onMemberUpgradeRequired:e.onMemberUpgradeRequired,onStatusChange:e.onStatusChange,onLetterRegenerated:e.onLetterRegenerated})}return tf?(0,s.jsx)(I.A,{email:tf,onBack:()=>tg(null)}):(0,s.jsxs)("div",{className:"".concat(az," bg-gradient-to-br from-blue-900 via-purple-900 to-indigo-900"),children:[(0,s.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6 sm:py-8",children:[(0,s.jsxs)("div",{className:"flex items-center mb-6 sm:mb-8",children:[aK?aY:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.P.button,{onClick:aU,className:"group flex items-center justify-center w-12 h-12 bg-white/10 hover:bg-white/20 backdrop-blur-md text-white rounded-lg transition-all duration-300 border border-white/20 hover:border-white/30",whileHover:{scale:1.05},whileTap:{scale:.95},initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{duration:.3},title:"Go Back",children:(0,s.jsx)(o.A,{className:"h-5 w-5 group-hover:-translate-x-0.5 transition-transform"})}),(0,s.jsx)("div",{className:"w-4"})]}),(0,s.jsx)("div",{className:"flex-1"}),!aK&&(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(r.P.button,{onClick:a_,className:"flex items-center gap-2 rounded-lg border border-white/20 bg-white/10 px-3 py-2 text-sm font-medium text-white transition-all hover:bg-white/20",whileHover:{scale:1.02},whileTap:{scale:.98},title:"Go to Dashboard",children:[(0,s.jsx)(c.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Dashboard"})]}),(0,s.jsxs)(r.P.button,{onClick:aR,className:"flex items-center gap-2 rounded-lg border border-white/20 bg-white/10 px-3 py-2 text-sm font-medium text-white transition-all hover:bg-white/20",whileHover:{scale:1.02},whileTap:{scale:.98},title:"Go to User Portal",children:[(0,s.jsx)(c.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"User Portal"})]})]})]}),!tV&&tZ>0&&(0,s.jsx)(r.P.div,{className:"mb-6 sm:mb-8",initial:{opacity:0,y:-12},animate:{opacity:1,y:0},transition:{duration:.4},children:(0,s.jsxs)("div",{className:"relative overflow-hidden rounded-xl border border-blue-400/40 bg-gradient-to-r from-blue-600/20 to-purple-600/20 backdrop-blur-md px-6 py-4 shadow-2xl",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-500/10 to-purple-500/10 transition-all duration-1000",style:{width:"".concat(tX/tZ*100,"%"),backgroundImage:"linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%)"}}),(0,s.jsxs)("div",{className:"relative flex items-center gap-4",children:[(0,s.jsx)("div",{className:"flex-shrink-0",children:(0,s.jsx)(r.P.div,{animate:{rotate:360},transition:{duration:2,repeat:1/0,ease:"linear"},className:"w-10 h-10 rounded-full bg-gradient-to-br from-blue-400 to-purple-400 flex items-center justify-center",children:(0,s.jsx)(u.A,{className:"w-5 h-5 text-white"})})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("h3",{className:"font-bold text-white text-lg",children:"Generating Your Letters..."}),(0,s.jsxs)("span",{className:"text-white/90 font-semibold text-sm",children:[tX,"/",tZ]})]}),(0,s.jsx)("div",{className:"w-full bg-white/10 rounded-full h-2 overflow-hidden",children:(0,s.jsx)(r.P.div,{className:"h-full bg-gradient-to-r from-blue-400 to-purple-400 rounded-full",initial:{width:0},animate:{width:"".concat(tX/tZ*100,"%")},transition:{duration:.5,ease:"easeOut"}})}),(0,s.jsx)("p",{className:"text-white/70 text-sm mt-2",children:0===tX?"⚡ Starting AI generation for all letters...":tX===tZ?"✅ All letters complete! Click any letter to view":"⏳ ".concat(tZ-tX," ").concat(tZ-tX==1?"letter":"letters"," still generating...")})]})]})]})}),ag&&(0,s.jsx)(r.P.div,{className:"mb-6 sm:mb-8",initial:{opacity:0,y:12}
1,animate:{opacity:1,y:0},transition:{duration:.35},children:(0,s.jsxs)("div",{className:"flex items-start gap-3 rounded-xl border border-amber-400/40 bg-amber-500/10 px-4 py-3 text-amber-100 shadow-lg/30 backdrop-blur",children:[(0,s.jsx)(d.A,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-amber-200"}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("p",{className:"font-semibold text-amber-50",children:"AutoBlast finished with warnings"}),(0,s.jsx)("p",{className:"text-sm text-amber-100/80 mt-1",children:ab.length>0?"We couldn't finish ".concat(ab.length," letter").concat(1===ab.length?"":"s",". You can review and retry them below."):"Some items still need a quick review. The details are highlighted in the letter list."}),ab.length>0&&(0,s.jsxs)("ul",{className:"mt-2 space-y-1 text-sm text-amber-50/80",children:[ab.slice(0,3).map(e=>(0,s.jsxs)("li",{className:"list-disc list-inside",children:[e.creditorName," \xb7"," ","bureau"===e.type?"Bureau letter":"cfpb"===e.type?"CFPB Complaint":"secondary_bureau"===e.type?"Secondary bureau letter":"Creditor letter"]},e.planKey)),ab.length>3&&(0,s.jsxs)("li",{className:"list-disc list-inside italic",children:["+ ",ab.length-3," more item",ab.length-3==1?"":"s"," ","waiting for attention"]})]})]})]})}),aT?(0,s.jsx)(r.P.div,{className:"flex justify-center mb-6 sm:mb-8",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.2},children:(0,s.jsxs)("div",{className:"bg-black/40 backdrop-blur-md rounded-xl p-8 border border-white/20 shadow-2xl max-w-md w-full text-center",children:[(0,s.jsx)("div",{className:"w-16 h-16 mx-auto mb-5 rounded-full bg-gradient-to-br from-purple-500/20 to-blue-500/20 border border-purple-400/30 flex items-center justify-center",children:(0,s.jsx)(u.A,{className:"w-7 h-7 text-purple-300"})}),(0,s.jsx)("h2",{className:"text-xl font-bold text-white mb-2",children:"No Disputes to Deploy"}),(0,s.jsx)("p",{className:"text-white/60 text-sm mb-6",children:"Create a new AutoBlast to scan your report and generate personalized dispute letters."}),(0,s.jsx)(r.P.button,{onClick:()=>aL(),className:"w-full py-3.5 px-6 rounded-xl bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-500 hover:to-blue-500 text-white font-semibold text-base shadow-lg shadow-purple-500/25 border border-purple-400/30 transition-all duration-200",whileHover:{scale:1.02},whileTap:{scale:.98},children:"Start AutoBlast"})]})}):aM&&en?(0,s.jsx)(r.P.div,{className:"flex justify-center mb-6 sm:mb-8",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.2},children:(0,s.jsx)(ed,{sessionId:en,letters:aO,onOpenLetter:e=>{let t=t2.find(t=>t.id===e);t&&aB(t)},onLettersQueued:e=>e.forEach(e=>aH(e,"queued")),onUpgraded:()=>{window.location.reload()}})}):(0,s.jsx)(r.P.div,{className:"flex justify-center mb-6 sm:mb-8",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.2},children:(0,s.jsxs)("div",{className:"bg-black/40 backdrop-blur-md rounded-xl p-6 border border-white/20 shadow-2xl max-w-2xl w-full",children:[(0,s.jsx)("div",{className:"text-center mb-5",children:(0,s.jsx)("h1",{className:"text-2xl sm:text-3xl font-bold text-white mb-1",children:"Review Your Dispute Strategy"})}),(0,s.jsxs)("div",{className:"bg-gradient-to-br from-purple-500/10 to-blue-500/10 backdrop-blur-md rounded-xl p-5 border border-purple-400/20 mb-6 space-y-4",children:[(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"text-4xl font-black text-transparent bg-clip-text bg-gradient-to-r from-purple-300 to-blue-300 mb-1",children:aP?av:aF.length+t3.length}),(0,s.jsx)("div",{className:"text-white/70 text-sm font-medium",children:"Negative Items Found by AI"})]}),(0,s.jsxs)("div",{className:"grid ".concat(ak>0?"grid-cols-2 sm:grid-cols-4":"grid-cols-3"," gap-3"),children:[(0,s.jsxs)("div",{className:"bg-white/5 rounded-lg p-3 text-center border border-white/10",children:[(0,s.jsx)("div",{className:"text-lg font-bold text-blue-300",children:aS}),(0,s.jsx)("div",{className:"text-[11px] text-white/50",children:"Bureau Letters"})]}),(0,s.jsxs)("div",{className:"bg-white/5 rounded-lg p-3 text-center border border-white/10",children:[(0,s.jsx)("div",{className:"text-lg font-bold text-purple-300",children:aA}),(0,s.jsx)("div",{className:"text-[11px] text-white/50",children:"Creditor Letters"})]}),(0,s.jsxs)("div",{className:"bg-white/5 rounded-lg p-3 text-center border border-white/10",children:[(0,s.jsx)("div",{className:"text-lg font-bold text-cyan-300",children:aI}),(0,s.jsx)("div",{className:"text-[11px] text-white/50",children:"CFPB Complaints"})]}),ak>0&&(0,s.jsxs)("div",{className:"bg-white/5 rounded-lg p-3 text-center border border-teal-400/20",children:[(0,s.jsx)("div",{className:"text-lg font-bold text-teal-300",children:ak}),(0,s.jsx)("div",{className:"text-[11px] text-white/50",children:"Secondary Bureaus (Manual)"})]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-2 border-t border-white/10",children:[(0,s.jsx)(m.A,{className:"w-4 h-4 text-green-400"}),(0,s.jsxs)("span",{className:"text-sm text-green-300 font-medium",children:["Estimated"," ",Math.max(2,(aP?aD:aF.length)*1.5).toFixed(0),"+ hours of work saved"]})]})]}),(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsxs)(r.P.button,{onClick:aX,disabled:tj||tS||ax||tI,className:"relative mx-auto w-52 h-52 rounded-full shadow-2xl transition-all duration-300 border-8 group overflow-hidden ".concat(tS?"bg-gradient-to-r from-green-500 via-emerald-500 to-green-400 border-green-300/80":tI?"bg-gradient-to-r from-green-700 via-green-600 to-green-500 border-green-400/60 cursor-not-allowed":ax?"bg-gradient-to-r from-amber-600 via-orange-500 to-amber-600 border-amber-400/60 cursor-not-allowed":tj?"bg-gradient-to-r from-gray-700 to-gray-800 border-gray-500/50":"bg-gradient-to-r from-purple-700 via-purple-600 to-purple-500 hover:from-purple-800 hover:via-purple-700 hover:to-purple-600 border-blue-400/80 hover:border-blue-300/90 hover:shadow-blue-400/80"),whileHover:{scale:tj||tS||ax||tI?1:1.12},whileTap:{scale:tj||tS||ax||tI?1:.88},animate:tS?{scale:1.3,opacity:0,y:-50,boxShadow:"0 0 100px rgba(34, 197, 94, 1), 0 0 200px rgba(34, 197, 94, 0.8)"}:tj?{scale:[1,1.05,1]}:{scale:[1,1.08,1],boxShadow:["0 0 40px rgba(59, 130, 246, 0.8), 0 0 80px rgba(59, 130, 246, 0.4), 0 0 120px rgba(59, 130, 246, 0.2)","0 0 60px rgba(59, 130, 246, 1), 0 0 120px rgba(59, 130, 246, 0.6), 0 0 180px rgba(59, 130, 246, 0.3)","0 0 40px rgba(59, 130, 246, 0.8), 0 0 80px rgba(59, 130, 246, 0.4), 0 0 120px rgba(59, 130, 246, 0.2)"],borderColor:["rgba(96, 165, 250, 0.8)","rgba(96, 165, 250, 1)","rgba(96, 165, 250, 0.8)"]},transition:tS?{duration:.3,ease:"easeOut"}:tj?{duration:2,repeat:1/0,ease:"easeInOut"}:{boxShadow:{duration:1.5,repeat:1/0,ease:"easeInOut",times:[0,.5,1]},scale:{duration:2.2,repeat:1/0,ease:"easeInOut",times:[0,.5,1]},borderColor:{duration:1.8,repeat:1/0,ease:"easeInOut",times:[0,.5,1]}},children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-purple-500 to-blue-500 rounded-full animate-pulse opacity-60"}),(0,s.jsx)(r.P.div,{className:"absolute inset-0 bg-gradient-to-r from-blue-400 to-purple-500 rounded-full opacity-30",animate:{scale:[1,1.2,1],opacity:[.3,.6,.3]},transition:{duration:tj?.8:1.5,repeat:1/0,ease:"easeInOut"}}),(0,s.jsx)(r.P.div,{className:"absolute -inset-4 border-4 border-blue-400/40 rounded-full",animate:{scale:[1,1.1,1],opacity:[.4,.8,.4]},transition:{duration:tj?1:2,repeat:1/0,ease:"easeInOut"}}),ax&&(0,s.jsx)("div",{className:"absolute inset-0 rounded-full overflow-hidden z-[5]",children:(0,s.jsxs)(r.P.div,{className:"absolute inset-x-0 bottom-0",initial:{height:"4%"},animate:{height:"".concat(Math.max(6,tX/Math.max(tZ,1)*100),"%")},transition:{duration:1,ease:"easeOut"},children:[(0,s.jsx)("div",{className:"absolute inset-0",style:{background:"linear-gradient(to top, rgba(245, 158, 11, 0.95), rgba(249, 115, 22, 0.85), rgba(234, 88, 12, 0.6))"}}),(0,s.jsx)(r.P.svg,{className:"absolute -top-[10px] left-0 h-5",style:{width:"200%"},viewBox:"0 0 400 20",preserveAspectRatio:"none",animate:{x:["0%","-50%"]},transition:{duration:4,repeat:1/0,ease:"linear"},children:(0,s.jsx)("path",{d:"M0,10 C50,4 100,16 150,10 C200,4 250,16 300,10 C350,4 400,16 450,10 L450,20 L0,20 Z",fill:"rgba(251, 191, 36, 0.7)"})}),(0,s.jsx)(r.P.svg,{className:"absolute -top-[6px] left-0 h-4",style:{width:"200%"},viewBox:"0 0 400 16",preserveAspectRatio:"none",animate:{x:["-50%","0%"]},transition:{duration:3,repeat:1/0,ease:"linear"},children:(0,s.jsx)("path",{d:"M0,8 C30,3 70,13 100,8 C130,3 170,13 200,8 C230,3 270,13 300,8 C330,3 370,13 400,8 L400,16 L0,16 Z",fill:"rgba(249, 115, 22, 0.5)"})}),(0,s.jsx)(r.P.div,{className:"absolute inset-0",style:{background:"linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.12) 50%, transparent 70%)"},animate:{x:["-100%","100%"]},transition:{duration:2.5,repeat:1/0,ease:"easeInOut",repeatDelay:1}}),[0,1,2,3,4].map(e=>(0,s.jsx)(r.P.div,{className:"absolute rounded-full bg-white/25",style:{width:4+e%3*3,height:4+e%3*3,left:"".concat(12+18*e,"%"),bottom:"10%"},animate:{y:[0,-50-8*e],opacity:[.5,0],scale:[1,.4]},transition:{duration:2+.3*e,repeat:1/0,ease:"easeOut",delay:.6*e}},"bubble-".concat(e)))]})}),tj&&(0,s.jsx)(s.Fragment,{children:[0,1,2,3,4,5].map(e=>(0,s.jsx)(r.P.div,{className:"absolute w-3 h-3 rounded-full",style:{background:e%2==0?"linear-gradient(135deg, #60a5fa, #a78bfa)":"linear-gradient(135deg, #f472b6, #fbbf24)",boxShadow:e%2==0?"0 0 10px rgba(96, 165, 250, 0.8)":"0 0 10px rgba(251, 191, 36, 0.8)",left:"50%",top:"50%",marginLeft:"-6px",marginTop:"-6px"},animate:{x:[75*Math.cos(e/6*Math.PI*2),75*Math.cos(e/6*Math.PI*2+2*Math.PI)],y:[75*Math.sin(e/6*Math.PI*2),75*Math.sin(e/6*Math.PI*2+2*Math.PI)],scale:[1,1.3,1],opacity:[.8,1,.8]},transition:{duration:2,repeat:1/0,ease:"linear",delay:.1*e}},"orbit-particle-".concat(e)))}),tj&&t2.length>0&&(0,s.jsxs)("svg",{className:"absolute -inset-6 w-[calc(100%+48px)] h-[calc(100%+48px)]",style:{transform:"rotate(-90deg)"},children:[(0,s.jsx)("circle",{cx:"50%",cy:"50%",r:"calc(50% - 4px)",fill:"none",stroke:"rgba(255,255,255,0.2)",strokeWidth:"6"}),(0,s.jsx)(r.P.circle,{cx:"50%",cy:"50%",r:"calc(50% - 4px)",fill:"none",stroke:"url
1(#deployGradient)",strokeWidth:"6",strokeLinecap:"round",initial:{pathLength:0},animate:{pathLength:t2.length>0?tL.size/t2.length:0},transition:{duration:.3,ease:"easeOut"},style:{filter:"drop-shadow(0 0 6px rgba(96, 165, 250, 0.8))"}}),(0,s.jsx)("defs",{children:(0,s.jsxs)("linearGradient",{id:"deployGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#60a5fa"}),(0,s.jsx)("stop",{offset:"50%",stopColor:"#a78bfa"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#f472b6"})]})})]}),tj&&(0,s.jsx)(r.P.div,{className:"absolute -inset-2 border-2 border-dashed border-yellow-400/60 rounded-full",animate:{rotate:360},transition:{duration:1.5,repeat:1/0,ease:"linear"}}),!tj&&!ax&&(0,s.jsx)(r.P.div,{className:"absolute inset-4 border-4 border-white/40 rounded-full",animate:{rotate:360},transition:{duration:4,repeat:1/0,ease:"linear"}}),(0,s.jsx)("div",{className:"relative z-10 flex flex-col items-center justify-center h-full w-full",children:ax?(0,s.jsxs)(r.P.div,{className:"flex flex-col items-center z-20",animate:{scale:[1,1.03,1]},transition:{duration:2.5,repeat:1/0,ease:"easeInOut"},children:[(0,s.jsxs)(r.P.div,{className:"text-3xl font-black text-white mb-1",style:{textShadow:"0 2px 12px rgba(0,0,0,0.6), 0 0 20px rgba(245, 158, 11, 0.4)"},animate:{opacity:[1,.85,1]},transition:{duration:1.5,repeat:1/0},children:[Math.round(tX/Math.max(tZ,1)*100),"%"]}),(0,s.jsx)("div",{className:"text-xs font-bold text-white/95 tracking-widest",style:{textShadow:"0 1px 8px rgba(0,0,0,0.5)"},children:"GENERATING"}),(0,s.jsxs)(r.P.div,{className:"text-xs text-white/70 mt-1",style:{textShadow:"0 1px 4px rgba(0,0,0,0.4)"},animate:{opacity:[.6,1,.6]},transition:{duration:2,repeat:1/0},children:[tX,"/",tZ," letters"]})]}):tj?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"relative flex flex-col items-center -mt-10",children:[(0,s.jsx)(r.P.div,{className:"relative w-14 h-14 mb-1",initial:{rotate:0},animate:{y:[0,-4,0],rotate:-45},transition:{y:{duration:1.5,repeat:1/0,ease:"easeInOut"},rotate:{duration:.8,ease:"easeOut"}},children:(0,s.jsx)(h.A,{className:"w-14 h-14 text-white absolute inset-0 z-10",style:{filter:"drop-shadow(0 0 8px rgba(255, 255, 255, 0.5))"}})}),(0,s.jsx)(r.P.div,{className:"absolute left-1/2 top-[65px] z-0 pointer-events-none overflow-visible",initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{delay:.8,duration:.3,ease:"easeOut"},children:(0,s.jsxs)(r.P.div,{className:"relative flex justify-center items-end",style:{width:0,height:0,scale:.9},animate:{y:[0,3,0]},transition:{duration:.15,repeat:1/0,ease:"easeInOut",delay:.8},children:[(0,s.jsx)(r.P.div,{className:"absolute bottom-0 w-8 h-10 rounded-full",style:{background:"linear-gradient(to bottom, rgba(251, 191, 36, 0.9) 0%, rgba(249, 115, 22, 0.7) 50%, rgba(239, 68, 68, 0.4) 80%, transparent 100%)",filter:"blur(6px)",left:"50%",x:"-50%"},animate:{scaleY:[1,1.3,.9,1.2,1],scaleX:[1,.85,1.1,.9,1],opacity:[.8,1,.75,.9,.8]},transition:{duration:.18,repeat:1/0,ease:"easeInOut"}}),(0,s.jsx)(r.P.div,{className:"absolute bottom-1 w-4 h-8 rounded-full",style:{background:"linear-gradient(to bottom, #fff 0%, #fef08a 30%, #fbbf24 60%, #f97316 85%, transparent 100%)",filter:"blur(2px)",left:"50%",x:"-50%"},animate:{scaleY:[1,1.4,.8,1.2,1],opacity:[.95,1,.85,.95,.95]},transition:{duration:.12,repeat:1/0,ease:"easeInOut"}}),[0,1,2].map(e=>(0,s.jsx)(r.P.div,{className:"absolute rounded-full",style:{width:4-e,height:4-e,left:"50%",marginLeft:(e-1)*6,top:6+3*e,background:1===e?"#fef08a":"#fbbf24",filter:"blur(1px)",x:"-50%"},animate:{y:[0,15+4*e,0],opacity:[1,0,1],scale:[1,.4,1]},transition:{duration:.35+.08*e,repeat:1/0,ease:"easeOut",delay:.08*e}},"flame-particle-".concat(e)))]})})]}),(0,s.jsxs)(r.P.div,{className:"absolute bottom-6 left-1/2 -translate-x-1/2 text-white font-bold text-center z-20",animate:{opacity:[1,.8,1]},transition:{duration:1,repeat:1/0},children:[(0,s.jsxs)("div",{className:"text-lg font-black text-yellow-300",style:{textShadow:"0 0 10px rgba(250, 204, 21, 0.8)"},children:[tL.size,"/",t2.length]}),(0,s.jsx)("div",{className:"text-xs text-white/90",children:"DEPLOYING"})]})]}):(0,s.jsxs)(r.P.div,{className:"flex flex-col items-center",animate:{scale:[1,1.1,1],y:[0,-2,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},children:[(0,s.jsx)(h.A,{className:"w-16 h-16 text-white group-hover:text-yellow-300 transition-colors mb-2"}),(0,s.jsx)("div",{className:"text-white font-bold text-sm leading-tight text-center",children:eL?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{children:"START"}),(0,s.jsx)("div",{children:"SENDING"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{children:"DEPLOY"}),(0,s.jsx)("div",{children:"AUTO BLAST"})]})})]})})]}),(0,s.jsxs)(r.P.div,{className:"text-center mt-6",animate:ax?{opacity:[1,.8,1],scale:[1,1.01,1]}:tj?{opacity:[1,.7,1],scale:[1,1.02,1]}:{y:[0,-3,0]},transition:ax?{duration:2,repeat:1/0}:tj?{duration:1.5,repeat:1/0}:{duration:3,repeat:1/0,ease:"easeInOut"},children:[(0,s.jsx)("div",{className:"text-2xl text-white font-bold mb-3 tracking-wide",children:tI?"✅ ALREADY DEPLOYED":ax?"\uD83D\uDD04 GENERATING LETTERS...":tj?"\uD83D\uDE80 DEPLOYING AUTO BLAST":eL?"⚡ START SENDING":"⚡ DEPLOY AUTO BLAST"}),(tI||ax||tj)&&(0,s.jsx)("p",{className:"text-white/90 text-lg font-medium max-w-md mx-auto leading-relaxed",children:tI?tD?"This session was already deployed. ".concat((null==ew||null==($=ew.deploySummary)?void 0:$.bureauMailed)||0," bureau letters mailed, ").concat((null==ew||null==(W=ew.deploySummary)?void 0:W.creditorEmailed)||0," creditor emails sent."):"This session has already been deployed and is awaiting admin a
1pproval or final processing.":ax?"Creating ".concat(tZ," personalized dispute letters. Please wait until all letters are ready before deploying."):""}),tI&&en&&(0,s.jsxs)(r.P.button,{onClick:()=>aq(en),className:"mt-4 inline-flex items-center gap-2 px-5 py-2.5 rounded-xl bg-gradient-to-r from-emerald-600 to-green-600 hover:from-emerald-500 hover:to-green-500 text-white font-semibold text-sm shadow-lg shadow-green-500/25 border border-green-400/30 transition-all duration-200",whileHover:{scale:1.03},whileTap:{scale:.97},children:[(0,s.jsx)(x.A,{className:"w-4 h-4"}),"View Confirmation Page"]}),eL&&!tj&&!tI&&!ax&&(0,s.jsxs)("p",{className:"text-white/80 text-sm mt-2",children:[t2.filter(e=>"ready"===e.status&&"cfpb"!==e.type&&"secondary_bureau"!==e.type).length," ","ready"]}),th&&(0,s.jsx)("p",{className:"text-amber-200 text-sm mt-2 max-w-md mx-auto",children:th}),t1.size>0&&!eL&&!tj&&!tI&&!ax&&(0,s.jsxs)("p",{className:"text-amber-300/90 text-sm mt-2",children:[t1.size," card",1===t1.size?"":"s"," excluded \xb7 ",aD," will be deployed"]}),ak>0&&!tj&&!ax&&(0,s.jsxs)("p",{className:"text-teal-300/90 text-sm mt-2",children:[ak," secondary bureau letter",1===ak?"":"s"," created \xb7 never sent without you — open each letter to mail it (850mail tokens)"]}),tG&&(0,s.jsxs)("div",{className:"mt-4 mx-auto max-w-md rounded-lg bg-red-500/20 border border-red-400/50 px-4 py-3 text-left",children:[(0,s.jsx)("p",{className:"text-red-200 font-medium",children:"Deployment could not start"}),(0,s.jsx)("p",{className:"text-red-100/90 text-sm mt-1",children:tG})]}),ax&&tZ>0&&(0,s.jsxs)(r.P.div,{className:"mt-4 max-w-xs mx-auto",initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm text-white/80 mb-2",children:[(0,s.jsx)("span",{children:"Generating letters..."}),(0,s.jsxs)("span",{className:"font-bold text-yellow-300",children:[tX," / ",tZ]})]}),(0,s.jsx)("div",{className:"h-2 bg-white/20 rounded-full overflow-hidden",children:(0,s.jsx)(r.P.div,{className:"h-full bg-gradient-to-r from-amber-400 via-orange-400 to-yellow-400 rounded-full",initial:{width:0},animate:{width:"".concat(tZ>0?tX/tZ*100:0,"%")},transition:{duration:.3,ease:"easeOut"},style:{boxShadow:"0 0 10px rgba(251, 191, 36, 0.6)"}})}),(0,s.jsx)(r.P.p,{className:"mt-2 text-xs text-white/60 truncate",animate:{opacity:[.6,1,.6]},transition:{duration:1.5,repeat:1/0},children:"⏳ AI is creating personalized dispute letters..."})]}),!ax&&tj&&t2.length>0&&(0,s.jsxs)(r.P.div,{className:"mt-4 max-w-xs mx-auto",initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm text-white/80 mb-2",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1",children:["Processing To"," ",(0,s.jsx)("span",{className:"inline-block min-w-[90px] relative",children:(0,s.jsx)(l.N,{mode:"wait",children:(0,s.jsx)(r.P.span,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.25},className:"font-semibold text-cyan-300",children:tP[tE]},tE)})}),".."]}),(0,s.jsxs)("span",{className:"font-bold text-yellow-300",children:[tL.size," / ",t2.length]})]}),(0,s.jsx)("div",{className:"h-2 bg-white/20 rounded-full overflow-hidden",children:(0,s.jsx)(r.P.div,{className:"h-full bg-gradient-to-r from-blue-400 via-purple-400 to-pink-400 rounded-full",initial:{width:0},animate:{width:"".concat(t2.length>0?tL.size/t2.length*100:0,"%")},transition:{duration:.3,ease:"easeOut"},style:{boxShadow:"0 0 10px rgba(167, 139, 250, 0.6)"}})}),(0,s.jsx)(r.P.p,{className:"mt-2 text-xs text-white/60 truncate",animate:{opacity:[.6,1,.6]},transition:{duration:1,repeat:1/0},children:"\uD83D\uDE80 Deploying all Disputes and Actions..."})]})]})]})]})}),(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)("div",{className:"w-full max-w-4xl space-y-6",children:(0,s.jsxs)(r.P.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5,delay:.4},children:[(0,s.jsx)("h2",{className:"text-xl font-bold text-white mb-4",children:"Blast Schedule"}),(0,s.jsx)("div",{className:"space-y-3",children:(()=>{let e=t2.length>0?t2:aF,t={bureau:{label:"Credit Bureaus",description:"Disputes sent to Equifax, Experi
1an & TransUnion"},creditor:{label:"Creditors & Data Furnishers",description:"Disputes sent directly to the companies reporting the accounts"},cfpb:{label:"CFPB Complaints",description:"Federal complaints filed with the Consumer Financial Protection Bureau"},secondary_bureau:{label:"Secondary Bureaus & Data Furnishers",description:"Manual-send letters to secondary reporting agencies"}},a=e.reduce((e,t)=>(e[t.type]=(e[t.type]||0)+1,e),{});return e.map((l,n)=>{var i;let o=n>0?e[n-1].type:null,d=l.type!==o,c=t[l.type],m="ready"===l.status,h="sent"===l.status,N=aj(l),C=aN(l),k="secondary_bureau"===l.type,A=C&&!k,I=t1.has(l.id),D=m||h,E="error"===l.entryStatus,T=h?{text:eM(l.mailStatus)?"Mailed":"Sent",className:"bg-blue-500/20 text-blue-300 border border-blue-500/30"}:"queued"===l.mailStatus?{text:"Scheduled",className:"bg-amber-500/20 text-amber-200 border border-amber-500/30"}:"cfpb"===l.type&&m?{text:"Not filed",className:"bg-amber-500/20 text-amber-200 border border-amber-500/30"}:em(l)?{text:"Edit before send",className:"bg-amber-500/20 text-amber-200 border border-amber-500/30"}:m?{text:"Ready",className:"bg-green-500/20 text-green-300 border border-green-500/30"}:E?{text:"Needs Attention",className:"bg-red-500/20 text-red-300 border border-red-500/40"}:{text:"Generating…",className:"bg-yellow-500/20 text-yellow-200 border border-yellow-500/30"},O=I||N,M=O?0:null!=(i=tR.get(n))?i:0,F=!O&&tj&&M>0&&M<100,B=!O&&(tL.has(n)||M>=100),L=!O&&tj&&0===M&&!B,U=["bg-white/10 rounded-lg border p-3 transition-all duration-300 group shadow-lg backdrop-blur-sm relative overflow-hidden",I?"opacity-40 border-white/10":B?"border-green-500/50 bg-green-500/10":F?"border-blue-400/60 bg-blue-500/10 scale-[1.02]":"border-white/20",I||tj?"cursor-default":D?"hover:bg-white/15 cursor-pointer":"cursor-default opacity-80"].join(" ");return(0,s.jsxs)(S.Fragment,{children:[d&&c&&(0,s.jsxs)("div",{className:"flex items-center gap-2 ".concat(n>0?"pt-4":""," pb-1"),children:[(0,s.jsx)("div",{className:"h-px flex-1 bg-white/10"}),(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,s.jsx)("span",{className:"text-[11px] font-bold uppercase tracking-wider text-white/70",children:c.label}),(0,s.jsx)("span",{className:"text-[10px] font-medium text-white/40 bg-white/5 border border-white/10 rounded-full px-2 py-0.5",children:a[l.type]})]}),(0,s.jsx)("div",{className:"h-px flex-1 bg-white/10"})]}),(0,s.jsxs)(r.P.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0,scale:F?1.02:1},transition:{delay:tj?0:.1*n,duration:.3},className:U,onClick:()=>!tj&&D&&aB(l),title:D?"View letter":void 0,children:[F&&(0,s.jsx)(r.P.div,{className:"absolute inset-0 bg-gradient-to-r from-blue-500/20 to-purple-500/20 pointer-events-none",initial:{width:"0%"},animate:{width:"".concat(M,"%")},transition:{duration:.05}}),B&&(0,s.jsx)(r.P.div,{className:"absolute inset-0 bg-gradient-to-r from-green-500/10 to-emerald-500/10 pointer-events-none",initial:{opacity:0}
1,animate:{opacity:1},transition:{duration:.3}}),(0,s.jsxs)("div",{className:"flex items-start gap-3 relative z-10",children:[(0,s.jsx)("div",{className:"p-2 rounded-lg ".concat(B?"bg-gradient-to-r from-green-500 to-emerald-500":l.color," flex-shrink-0 transition-all duration-300 ").concat(F?"animate-pulse":""," group-hover:scale-105"),children:B?(0,s.jsx)(r.P.div,{initial:{scale:0,rotate:-180},animate:{scale:1,rotate:0},transition:{type:"spring",stiffness:200,damping:10},children:(0,s.jsx)(p.A,{className:"h-5 w-5 text-white"})}):F?(0,s.jsx)(r.P.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:(0,s.jsx)(u.A,{className:"h-5 w-5 text-white"})}):l.icon}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3 mb-2",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h3",{className:"font-semibold text-sm mb-1.5 transition-colors line-clamp-1 text-white group-hover:text-white/90 pr-2",children:l.title}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[B?(0,s.jsxs)(r.P.div,{className:"px-2 py-1 rounded-full text-xs font-medium bg-green-500/30 text-green-200 border border-green-400/50 flex items-center gap-1",initial:{scale:.8,opacity:0}
1,animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:300},children:[(0,s.jsx)(x.A,{className:"w-3 h-3"}),(0,s.jsx)("span",{children:"Deployed!"})]}):F?(0,s.jsxs)(r.P.div,{className:"px-2 py-1 rounded-full text-xs font-medium bg-blue-500/30 text-blue-200 border border-blue-400/50 flex items-center gap-1",animate:{opacity:[1,.7,1]},transition:{duration:.8,repeat:1/0},children:[(0,s.jsx)(u.A,{className:"w-3 h-3"}),(0,s.jsxs)("span",{children:["Deploying..."," ",Math.round(M),"%"]})]}):L?(0,s.jsxs)("div",{className:"px-2 py-1 rounded-full text-xs font-medium bg-gray-500/20 text-gray-300 border border-gray-500/30 flex items-center gap-1",children:[(0,s.jsx)(b.A,{className:"w-3 h-3"}),(0,s.jsx)("span",{children:"Queued"})]}):(0,s.jsx)("div",{className:"px-2 py-1 rounded-full text-xs font-medium ".concat(T.className),children:T.text}),C&&!ek&&(0,s.jsxs)("div",{className:"px-2 py-1 rounded-full text-xs font-medium bg-purple-500/20 text-purple-200 border border-purple-500/40 flex items-center gap-1",children:[(0,s.jsx)(f.A,{className:"w-3 h-3"}),(0,s.jsx)("span",{children:"Pro"})]}),N&&!h&&!C&&(0,s.jsxs)("div",{className:"px-2 py-1 rounded-full text-xs font-medium bg-teal-500/20 text-teal-300 border border-teal-500/30 flex items-center gap-1",children:[(0,s.jsx)(g.A,{className:"w-3 h-3"}),(0,s.jsx)("span",{children:"Manual Send"})]}),l.hasEmail&&(l.emailSent?(0,s.jsxs)("div",{className:"px-2 py-1 rounded-full text-xs font-medium bg-green-500/20 text-green-300 border border-green-500/30 flex items-center gap-1",children:[(0,s.jsx)(x.A,{className:"w-3 h-3"}),(0,s.jsx)("span",{children:"Emailed"})]}):(0,s.jsxs)("div",{className:"px-2 py-1 rounded-full text-xs font-medium bg-blue-500/20 text-blue-300 border border-blue-500/30 flex items-center gap-1",children:[(0,s.jsx)(g.A,{className:"w-3 h-3"}),(0,s.jsx)("span",{children:"Email"})]})),l.hasCollections&&l.collectionsCount&&l.collectionsCount>0&&(0,s.jsx)("div",{className:"px-2 py-1 rounded-full text-xs font-medium bg-orange-500/20 text-orange-300 border border-orange-500/30 flex items-center gap-1",children:(0,s.jsxs)("span",{children:[l.collectionsCount," Collection",l.collectionsCount>1?"s":""]})}),l.hasChargeOffs&&l.chargeOffsCount&&l.chargeOffsCount>0&&(0,s.jsx)("div",{className:"px-2 py-1 rounded-full text-xs font-medium bg-red-500/20 text-red-300 border border-red-500/30 flex items-center gap-1",children:(0,s.jsxs)("span",{children:[l.chargeOffsCount," Charge-Off",l.chargeOffsCount>1?"s":""]})})]}),(0,s.jsx)("p",{className:"text-xs font-medium line-clamp-1 text-white/60",children:l.recipient})]}),!tj&&(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-shrink-0",children:[(0,s.jsx)("button",{className:"border w-8 h-8 rounded transition-colors flex items-center justify-center ".concat(A?"bg-purple-500/10 border-purple-500/40 text-purple-200 hover:bg-purple-500/20 hover:text-white":"bg-white/10 border-white/30 text-white/80 "+(D?"hover:bg-white/20 hover:text-white":"opacity-50 cursor-not-allowed")),disabled:!D&&!A,onClick:e=>{e.stopPropagation(),A?tr("letter"):D&&aB(l)},title:A?ek?"Activate your plan to view":"Upgrade to view":k&&C?"View only — upgrade to send":D?"View Letter":void 0,children:A?(0,s.jsx)(f.A,{className:"h-4 w-4"}):(0,s.jsx)(y.A,{className:"h-4 w-4"})}),(0,s.jsx)("button",{className:"border w-8 h-8 rounded transition-colors flex items-center justify-center ".concat(C?"bg-purple-500/10 border-purple-500/40 text-purple-200 hover:bg-purple-500/20 hover:text-white":"bg-white/10 border-white/30 text-white/80 "+(m||h?"hover:bg-white/20 hover:text-white":"opacity-50 cursor-not-allowed")),disabled:!m&&!h&&!C,onClick:e=>{if(e.stopPropagation(),C)return void tr("letter");(m||h)&&aB(l)},title:C?ek?"Activate your plan to download":"Upgrade to download":"Download PDF",children:C?(0,s.jsx)(f.A,{className:"h-4 w-4"}):(0,s.jsx)(w.A,{className:"h-4 w-4"})}),N&&!C&&(m||h)&&(0,s.jsx)("button",{className:"border w-8 h-8 rounded transition-colors flex items-center justify-center bg-teal-500/10 border-teal-500/30 text-teal-300 hover:bg-teal-500/20 hover:text-white disabled:opacity-50",disabled:a8===l.id,onClick:e=>{e.stopPropagation(),a7(l)},title:"Download self-mail kit (addressed envelope + instructions)",children:a8===l.id?(0,s.jsx)(v.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(j.A,{className:"h-4 w-4"})}),eL&&!C?(0,s.jsx)("button",{type:"button",className:"px-2 h-8 rounded text-[11px] font-semibold uppercase tracking-wide border border-white/25 bg-white/10 text-white/90 hover:bg-white/20",onClick:e=>{e.stopPropagation(),D&&aB(l)},children:"cfpb"===l.type?"Review complaint":h||"queued"===l.mailStatus?"View":"Review & mail"}):C?(0,s.jsx)("div",{className:"w-11 h-6 rounded-full border-2 border-white/10 bg-white/5 opacity-60",title:ek?"Activate your plan to include this letter":"Upgrade to include this letter","aria-label":"Plan required to include this letter",children:(0,s.jsx)("span",{className:"block h-5 w-5 rounded-full bg-white/30"})}):N?(0,s.jsx)("span",{className:"w-11 h-6 flex items-center justify-center text-[9px] font-semibold uppercase tracking-wide text-teal-300/90 border border-teal-500/30 bg-teal-500/10 rounded-full",title:"This letter is not auto-deployed. Open it and mail it manually (uses tokens or plan mailing).",onClick:e=>e.stopPropagation(),children:"Manual"}):(0,s.jsx)(P.d,{checked:!I,disabled:tI,onCheckedChange:e=>{tI||t5(t=>{let a=new Set(t);return e?a.delete(l.id):a.add(l.id),a})},onClick:e=>e.stopPropagation(),className:"data-[state=checked]:bg-green-500 ".concat(tI?"opacity-50 cursor-not-allowed":""),title:tI?"Deployed — locked":I?"Excluded from deploy":"Included in deploy"})]})]}),(0,s.jsx)("p",{className:"text-xs line-clamp-2 leading-relaxed ".concat(B?"text-green-300":F?"text-blue-300":"text-white/50"),children:B?"✓ Successfully deployed to ".concat("bureau"===l.type?"bureau":"cfpb"===l.type?"CFPB":"creditor","!"):F?"Deploying letter to ".concat(l.recipient,"..."):l.description})]})]}),F&&(0,s.jsx)(r.P.div,{className:"absolute bottom-0 left-0 h-1 bg-gradient-to-r from-blue-400 via-purple-500 to-blue-400 rounded-b-lg",initial:{width:"0%"},animate:{width:"".concat(M,"%")}
1,transition:{duration:.05}}),B&&(0,s.jsx)(r.P.div,{className:"absolute bottom-0 left-0 w-full h-1 bg-gradient-to-r from-green-400 to-emerald-400 rounded-b-lg",initial:{scaleX:0},animate:{scaleX:1},transition:{duration:.3}})]})]},l.id)})})()})]})})})]}),(0,s.jsx)(B.A,{open:e7,onClose:()=>te(!1),source:"autoblast_results_".concat(e8),highlight:"pro",minimumPlanId:"deploy"===e8?"pro":"diy",title:"deploy"===e8?"Deploy the whole round in one click":"Unlock creditor & CFPB letters",description:"deploy"===e8?"One-click Deploy mails, emails and faxes every letter in this round for you. Upgrade on the card you already have on file — no re-entering details.":"Bureau letters are included on Free. Creditor, CFPB and secondary-bureau letters open with a paid plan — upgrade on the card you already have on file.",onUpgraded:e=>{let{planId:t}=e;"deploy"===e8&&("pro"===t||"automax"===t)&&ta(!0)}}),e3&&el&&(0,s.jsx)(K.default,{title:tl.memberTitle,description:tl.memberDescription,preferredPlan:"auto",onClose:()=>e6(!1)}),(0,s.jsx)(_.e,{appear:!0,show:e3&&!el,as:"div",children:(0,s.jsxs)(q.l,{as:"div",className:"relative z-[130]",onClose:()=>e6(!1),children:[(0,s.jsx)(_.e.Child,{as:"div",enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,s.jsx)("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm"})}),(0,s.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,s.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center",children:(0,s.jsx)(_.e.Child,{as:"div",enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsx)(q.l.Panel,{className:"w-full max-w-lg transform overflow-hidden rounded-2xl bg-[#0f172a] border border-slate-700 p-6 text-left align-middle shadow-2xl transition-all",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("button",{onClick:()=>e6(!1),className:"absolute top-4 right-4 p-1.5 rounded-full bg-slate-800 hover:bg-slate-700 transition-colors border border-slate-600",children:(0,s.jsx)(N.A,{className:"w-5 h-5 text-slate-400"})}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("div",{className:"mx-auto flex h-16 w-16 items-center justify-center overflow-hidden rounded-full bg-slate-950 shadow-lg shadow-purple-500/30 ring-2 ring-purple-500/50",children:(0,s.jsx)("img",{src:"/assets/850ai-head-256.png",alt:"850 AI",className:"h-[85%] w-[85%] object-contain"})}),(0,s.jsx)(q.l.Title,{as:"h3",className:"text-2xl font-bold text-white mb-2",children:tl.title}),(0,s.jsx)("p",{className:"text-slate-400 text-sm",children:tl.subtitle})]}),(0,s.jsxs)("div",{className:"space-y-3 mb-6",children:["letter"===e8&&(0,s.jsxs)("div",{onClick:()=>{td||(tc("pro"),window.location.href="/checkout?plan=pro&from=/dashboard")},"aria-busy":"pro"===td,className:"bg-slate-800/80 hover:bg-slate-800 border border-purple-500/50 hover:border-purple-400 rounded-xl p-4 transition-all group text-left relative ".concat(td?"cursor-wait opacity-90 pointer-events-none":"cursor-pointer hover:scale-[1.02]"),children:[(0,s.jsx)("div",{className:"absolute -top-2.5 left-4 bg-purple-600 text-white text-[10px] font-bold px-2.5 py-1 rounded-full shadow-lg",children:"RECOMMENDED"}),(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsx)("div",{className:"w-12 h-12 bg-purple-600/30 rounded-xl flex items-center justify-center flex-shrink-0 border border-purple-500/30",children:(0,s.jsx)("svg",{className:"w-6 h-6 text-purple-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("div",{className:"font-bold text-white text-lg mb-1",children:"Upgrade to Pro"}),(0,s.jsx)("div",{className:"text-purple-300 text-sm",children:"3-Bureau Monitoring • All Tools • 850mail tokens included"}),(0,s.jsx)("div",{className:"text-slate-400 text-xs mt-2",children:"pro"===td?"Opening checkout…":"$99.99/month"})]}),(0,s.jsx)("div",{className:"text-purple-400 group-hover:translate-x-1 transition-transform self
1-center",children:"pro"===td?(0,s.jsx)(v.A,{className:"w-5 h-5 animate-spin"}):(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),(0,s.jsxs)("div",{onClick:()=>{td||(tc("auto"),window.location.href="/checkout?plan=automax&from=/dashboard")},"aria-busy":"auto"===td,className:"bg-gradient-to-r from-amber-900/40 to-orange-900/40 hover:from-amber-900/60 hover:to-orange-900/60 border-2 border-amber-500/70 hover:border-amber-400 rounded-xl px-4 pb-4 pt-5 transition-all group text-left relative ".concat(td?"cursor-wait opacity-90 pointer-events-none":"cursor-pointer hover:scale-[1.02]"),children:[(0,s.jsx)("div",{className:"absolute right-4 top-2 bg-gradient-to-r from-amber-500 to-orange-500 text-white text-[10px] font-bold px-2.5 py-1 rounded-full shadow-lg",children:"deploy"===e8?"RECOMMENDED":"BEST VALUE"}),(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsx)("div",{className:"w-12 h-12 bg-amber-600/30 rounded-xl flex items-center justify-center flex-shrink-0 border border-amber-500/30",children:(0,s.jsx)("svg",{className:"w-6 h-6 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("div",{className:"font-bold text-white text-lg mb-1",children:"Upgrade to AutoMax"}),(0,s.jsx)("div",{className:"text-amber-300 text-sm",children:"Filings • included AI • auto mailing"}),(0,s.jsx)("div",{className:"text-slate-400 text-xs mt-2",children:"auto"===td?"Opening checkout…":"$199.99/month • Max effort"})]}),(0,s.jsx)("div",{className:"text-amber-400 group-hover:translate-x-1 transition-transform self-center",children:"auto"===td?(0,s.jsx)(v.A,{className:"w-5 h-5 animate-spin"}):(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),"deploy"===e8&&(0,s.jsx)("div",{className:"bg-slate-800/60 border border-indigo-500/30 rounded-xl p-4 text-left",children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 bg-indigo-600/30 rounded-xl flex items-center justify-center flex-shrink-0 border border-indigo-500/30",children:(0,s.jsx)(g.A,{className:"w-5 h-5 text-indigo-300"})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("div",{className:"font-semibold text-white text-sm mb-1",children:"Or mail letters one at a time — right now"}),(0,s.jsx)("div",{className:"text-slate-400 text-xs leading-relaxed",children:"Click into the letters you want to mail and send each one from the letter card. Each send is billed per letter to your 850mail tokens."})]})]})})]}),(0,s.jsxs)("div",{className:"bg-slate-800/60 border border-slate-700 rounded-lg p-4 mb-4",children:[(0,s.jsx)("div",{className:"text-slate-300 text-sm font-medium mb-3",children:"deploy"===e8?"What you get with Auto:":"What you get with Pro or Auto:"}),(0,s.jsxs)("ul",{className:"text-left text-slate-400 text-sm space-y-2",children:[(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)(x.A,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),(0,s.jsx)("span",{children:"One-click Deploy for your whole letter batch (you still review & click)"})]}),(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)(x.A,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),(0,s.jsx)("span",{children:"Chat AI Premium plus home, car & business tools"})]}),(0,s.jsxs)("li",{className:"flex items-center gap-2",children:[(0,s.jsx)(x.A,{className:"w-4 h-4 text-green-500 flex-shrink-0"}),(0,s.jsx)("span",{children:"Certified mail proofs & delivery tracking via 850mail"})]})]})]}),(0,s.jsx)("button",{onClick:()=>e6(!1),className:"w-full px-4 py-3 rounded-lg bg-slate-800 hover:bg-slate-700 border border-slate-600 text-slate-300 hover:text-white font-medium transition-all text-sm",children:"Not now, I'll send letters individually"})]})})})})})]})}),(0,s.jsx)(_.e,{appear:!0,show:ty,as:S.Fragment,children:(0,s.jsxs)(q.l,{as:"div",className:"relative z-[100]",onClose:tv,children:[(0,s.jsx)(_.e.Child,{as:"div",enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",className:"fixed inset-0 bg-black/60 backdrop-blur-sm"}),(0,s.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,s.jsx)("div",{className:"flex min-h-full items-center justify-center p-4",children:(0,s.jsx)(_.e.Child,{as:S.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsxs)(q.l.Panel,{className:"w-full max-w-md transform overflow-hidden rounded-2xl bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900 border border-white/20 p-6 shadow-2xl transition-all",children:[(0,s.jsx)(q.l.Title,{className:"text-xl font-bold text-white text-center mb-4",children:"Before You Deploy"}),(0,s.jsxs)("div",{className:"space-y-4 text-sm text-white/80 leading-relaxed",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"mt-0.5 flex-shrink-0 w-6 h-6 rounded-full bg-blue-500/20 flex items-center justify-center",children:(0,s.jsx)(y.A,{className:"w-3.5 h-3.5 text-blue-400"})}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-white font-semibold",children:"Review each letter and action"})," ","by clicking into them before hitting the deploy button."]})]}),(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"mt-0.5 flex-shrink-0 w-6 h-6 rounded-full bg-cyan-500/20 flex items-center justify-center",children:(0,s.jsx)(C.A,{className:"w-3.5 h-3.5 text-cyan-400"})}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-white font-semibold",children:"Refresh any letter"})," ","to change the dispute reason or regenerate it until you're satisfied — you can do this as many times as you want before it's sent."]})]}),(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("div",{className:"mt-0.5 flex-shrink-0 w-6 h-6 rounded-full bg-amber-500/20 flex items-center justify-center",children:(0,s.jsx)(N.A,{className:"w-3.5 h-3.5 text-amber-400"})}),(0,s.jsxs)("p",{children:[(0,s.jsx)("span",{className:"text-white font-semibold",children:"Unselect any dispute or action"})," ","you don't want taken by toggling it off before deploying."]})]})]}),(0,s.jsx)("button",{onClick:tv,className:"mt-6 w-full px-4 py-3 rounded-xl bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 text-white font-semibold text-sm shadow-lg transition-all",children:"Got it, let me review"})]})})})})]})}),eq&&(0,s.jsx)(G.A,{isOpen:eq,onClose:()=>eK(!1),userId:ep||(null==ei?void 0:ei.uid)||"",needDriversLicense:ez.dl,needSsnCard:ez.ssn,onComplete:aQ,actionDescription:"deploy your letters",continueLabel:"Continue Deploy",allowSkip:!0,onSkip:aQ}),(0,s.jsx)(_.e,{appear:!0,show:eR,as:S.Fragment,children:(0,s.jsxs)(q.l,{as:"div",className:"relative z-[140]",onClose:()=>e_(!1),children:[(0,s.jsx)(_.e.Child,{as:"div",enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",className:"fixed inset-0 bg-black/70 backdrop-blur-sm"}),(0,s.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,s.jsx)("div",{className:"flex min-h-full items-center justify-center p-4",children:(0,s.jsx)(_.e.Child,{as:S.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,s.jsx)(q.l.Panel,{className:"w-full ".concat("cfpb"===e$||"ftc"===e$?"max-w-xl":"max-w-lg"," transform max-h-[calc(100dvh-2rem)] overflow-y-auto overscroll-contain rounded-2xl bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900 border border-white/20 p-6 shadow-2xl transition-all text-left"),children:"confirm"===e$?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(q.l.Title,{className:"text-xl font-bold text-white mb-1 flex items-center gap-2",children:[(0,s.jsx)(h.A,{className:"w-5 h-5 text-purple-400"}),"Confirm Your Deploy"]}),(0,s.jsx)("p",{className:"text-white/60 text-xs mb-4",children:"Your click is what sends these letters. Review the list — you can still close this and edit any letter first."}),(0,s.jsx)("div",{className:"max-h-52 overflow-y-auto rounded-xl border border-white/10 bg-white/[0.04] divide-y divide-white/5 mb-3",children:(t2.length>0?t2:aF).filter(e=>!t1.has(e.id)&&!aj(e)).map(e=>(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 px-3 py-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"text-sm text-white font-medium truncate",children:e.recipient||e.title}),(0,s.jsxs)("div",{className:"text-[10px] text-white/50",children:["bureau"===e.type?"Bureau letter \xb7 mailed via 850mail":"cfpb"===e.type?"CFPB complaint letter \xb7 mailed via 850mail":"Creditor letter \xb7 emailed",e.accountCount>0?" \xb7 ".concat(e.accountCount," account").concat(1!==e.accountCount?"s":""):""]})]}),(0,s.jsx)("button",{type:"button",onClick:()=>{e_(!1),aB(e)},className:"text-[10px] font-semibold text-indigo-300 hover:text-indigo-200 flex-shrink-0",children:"Review / E
1dit"})]},e.id))}),ak>0&&(0,s.jsxs)("p",{className:"text-[10px] text-teal-300/80 mb-3",children:[ak," secondary-bureau letter",1!==ak?"s are":" is"," manual-send only and will NOT be included in this deploy."]}),(0,s.jsxs)("label",{className:"flex items-start gap-3 rounded-xl border border-purple-400/30 bg-purple-500/10 p-3 cursor-pointer select-none",children:[(0,s.jsx)("input",{type:"checkbox",checked:eG,onChange:e=>eH(e.target.checked),className:"mt-0.5 h-4 w-4 rounded border-white/30 bg-transparent accent-purple-500 flex-shrink-0"}),(0,s.jsx)("span",{className:"text-xs text-white/85 leading-relaxed",children:U.rp})]}),(0,s.jsxs)("div",{className:"mt-5 flex gap-3",children:[(0,s.jsx)("button",{onClick:()=>e_(!1),className:"flex-1 px-4 py-3 rounded-xl bg-slate-800 hover:bg-slate-700 border border-slate-600 text-slate-300 hover:text-white font-medium transition-all text-sm",children:"Not yet"}),(0,s.jsx)("button",{onClick:()=>{e4(null),eW("attachments");let e=ep||(null==ei?void 0:ei.uid);e&&!eZ&&(0,Y.S)(e).then(e0).catch(()=>e0(null))},disabled:!eG,className:"flex-1 px-4 py-3 rounded-xl font-semibold text-sm shadow-lg transition-all ".concat(eG?"bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700 text-white":"bg-slate-700/60 text-white/40 cursor-not-allowed"),children:"Continue — Choose Attachments"})]})]}):"attachments"===e$?(0,s.jsx)(s.Fragment,{children:(0,s.jsx)(H.A,{docStatus:eZ,isPreparing:e1,error:e2,onBack:()=>eW("confirm"),onSend:a0},eX)}):"cfpb"===e$?(0,s.jsx)(eg.A,{userId:ep||(null==ei?void 0:ei.uid)||"",autoBlastId:en||"",onSkip:a1,onDeploy:a5,onBack:()=>eW("attachments"),busy:t$||e1}):(0,s.jsx)(eP,{userId:ep||(null==ei?void 0:ei.uid)||"",autoBlastId:en||"",accounts:eV,onSkip:a2,onFile:a4,onBack:()=>eW("cfpb"),busy:t$||e1})})})})})]})})]})}function eU(){return(0,s.jsx)(eL,{})}},11547:(e,t,a)=>{a.d(t,{A:()=>v});var s=a(95155),r=a(88661),l=a.n(r),n=a(12115),i=a(26983),o=a(19408),d=a(23664),c=a(35626),u=a(39867),m=a(18085),h=a(80455),x=a(54679),p=a(97003),b=a(47554),f=a(20063),g=a(88273),y=a(85733),w=a(87337);function v(e){let{email:t,onBack:a}=e,r=(0,f.useRouter)(),{currentUser:v}=(0,y.A)(),[j,N]=(0,n.useState)(!1),[C,k]=(0,n.useState)(!1),S=t.content||(t.preview?t.preview:"Subject: Follow-up: Credit Report Dispute Investigation\n\nDear Dispute Resolution Team,\n\nI hope this email finds you well. I am writing to follow up on my credit report dispute that was submitted on [DATE] regarding inaccuracies found on my credit report.\n\nDISPUTE REFERENCE INFORMATION:\n• Dispute Reference Number: [If provided]\n• Date of Original Dispute: [DATE]\n• Method of Submission: Online/Mail\n• Account(s) in Question: [Account details]\n\nCURRENT STATUS INQUIRY:\nIt has been [X] days since I submitted my dispute, and I have not yet received confirmation that the investigation has been completed. According to the Fair Credit Reporting Act (FCRA), credit reporting agencies have 30 days to investigate and respond to consumer disputes.\n\nSPECIFIC CONCERNS:\nThe disputed items include:\n1. Incorrect account balance on [Creditor Name] account\n2. Inaccurate payment history showing late payments that never occurred  \n3. Account status incorrectly reported as delinquent\n\nDOCUMENTATION PROVIDED:\nWith my original dispute, I provided the following supporting documentation:\n• Bank statements showing on-time payments\n• Payment confirmation receipts\n• Previous correspondence with creditor\n• Account statements showing correct information\n\nREQUESTED ACTION:\nI respectfully request that you:\n1. Provide an immediate status update on my dispute investigation\n2. Expedite the review process if it has been delayed\n3. Ensure all inaccurate information is corrected or removed from my credit report\n4. Provide written confirmation of any changes made\n\nLEGAL COMPLIANCE:\nPlease be advised that under the FCRA (15 U.S.C. \xa7 1681i), you are required to:\n• Complete investigations within 30 days of receipt\n• Provide written results of the investigation\n• Correct or delete any information found to be inaccurate or unverifiable\n\nCONTACT INFORMATION:\nIf you need any additional information or documentation to complete this investigation, please contact me immediately at:\n• Email: [Your Email]\n• Phone: [Your Phone]\n• Address: [Your Address]\n\nI appreciate your prompt attention to this matter and look forward to your immediate response.\n\nThank you for your cooperation.\n\nSincerely,\n\n[Your Name]\n[Date]\n\n---\nThis draft was generated 
1with a self-directed educational tool. Review it for accuracy and decide whether to send it. For platform questions, contact support."),A=async()=>{k(!1),await (0,g.Ad)("blpa_auto-15",v,r)},I=async()=>{k(!1),await (0,g.Ad)("blpa_auto-6m",v,r)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l(),{id:"4262b25e31118010",children:"@media print{body *{visibility:hidden}.print-content,.print-content *{visibility:visible}.print-content{position:absolute;left:0;top:0;width:100%}.no-print{display:none!important}}"}),(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 min-h-screen bg-gradient-to-br from-blue-900 via-purple-900 to-purple-950 relative",children:[(0,s.jsx)("div",{className:"jsx-4262b25e31118010 fixed top-0 left-0 right-0 z-50 bg-gradient-to-r from-blue-900/95 via-purple-900/95 to-purple-800/95 backdrop-blur-md border-b border-white/10 no-print",children:(0,s.jsx)("div",{className:"jsx-4262b25e31118010 px-4 py-3 sm:py-4",children:(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 flex items-center justify-between",children:[(0,s.jsxs)(h.P.button,{onClick:a,className:"flex items-center gap-2 bg-white/10 hover:bg-white/20 backdrop-blur-md text-white px-3 py-2 sm:px-4 sm:py-2 rounded-lg transition-all duration-300 border border-white/20 hover:border-white/30",whileHover:{scale:1.02},whileTap:{scale:.98},children:[(0,s.jsx)(c.A,{className:"h-4 w-4 sm:h-5 sm:w-5"}),(0,s.jsx)("span",{className:"jsx-4262b25e31118010 font-medium text-sm sm:text-base",children:"Back"})]}),(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 flex-1 mx-4 text-center",children:[(0,s.jsx)("h1",{className:"jsx-4262b25e31118010 text-white font-bold text-base sm:text-lg truncate",children:t.subject}),(0,s.jsx)("p",{className:"jsx-4262b25e31118010 text-white/60 text-xs sm:text-sm truncate",children:t.recipient})]}),(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 flex items-center gap-2",children:[(0,s.jsx)("div",{className:"jsx-4262b25e31118010 "+"px-2 py-1 rounded-full text-xs font-medium ".concat((e=>{switch(e){case"ready":return"bg-green-500/20 text-green-300 border-green-500/30";case"scheduled":return"bg-blue-500/20 text-blue-300 border-blue-500/30";case"sent":return"bg-blue-600/20 text-blue-400 border-blue-600/30";case"draft":return"bg-yellow-500/20 text-yellow-300 border-yellow-500/30";default:return"bg-gray-500/20 text-gray-300 border-gray-500/30"}})(t.status)),children:"ready"===t.status?"Ready":"scheduled"===t.status?"Scheduled":"sent"===t.status?"Sent":"Draft"}),(0,s.jsx)(w.A,{className:"ml-1"})]})]})})}),(0,s.jsx)("div",{className:"jsx-4262b25e31118010 fixed bottom-0 left-0 right-0 z-50 bg-gradient-to-t from-blue-900/95 via-purple-900/95 to-purple-800/95 backdrop-blur-md border-t border-white/10 no-print",children:(0,s.jsx)("div",{className:"jsx-4262b25e31118010 px-4 py-3 sm:py-4",children:(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 flex items-center gap-3 sm:gap-4 max-w-4xl mx-auto",children:[(0,s.jsxs)(p.$,{onClick:()=>{window.print()},variant:"outline",size:"sm",className:"flex-1 bg-white/10 border-white/30 text-white hover:bg-white/20 hover:text-white text-xs sm:text-sm h-9 sm:h-10",children:[(0,s.jsx)(u.A,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1 sm:mr-2"}),"Download"]}),(0,s.jsxs)(p.$,{onClick:()=>{N(!0)},className:"flex-1 bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700 text-white font-semibold text-xs sm:text-sm h-9 sm:h-10 shadow-lg",children:[(0,s.jsx)(m.A,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1 sm:mr-2"}),"Send"]})]})})}),(0,s.jsx)("div",{className:"jsx-4262b25e31118010 h-full overflow-hidden",children:(0,s.jsx)("main",{className:"jsx-4262b25e31118010 h-full overflow-y-auto pt-[calc(80px+var(--bb-safe-top,0px))] pb-[80px] sm:pt-[calc(90px+var(--bb-safe-top,0px))] sm:pb-[90px] px-4 sm:px-6",children:(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 bg-white p-4 sm:p-6 rounded-xl border border-gray-200 max-w-4xl mx-auto w-full shadow-2xl my-4 sm:my-6 print-content",children:[(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 flex items-start gap-3 mb-4 sm:mb-6 pb-4 border-b border-gray-200 no-print",children:[(0,s.jsx)("div",{className:"jsx-4262b25e31118010 p-2 bg-purple-500/20 rounded-lg",children:(e=>{switch(e){case"follow-up":return(0,s.jsx)(i.A,{className:"h-4 w-4"});case"escalation":return(0,s.jsx)(o.A,{className:"h-4 w-4"});default:return(0,s.jsx)(d.A,{className:"h-4 w-4"})}})(t.type)}),(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 flex-1",children:[(0,s.jsx)("h2",{className:"jsx-4262b25e31118010 text-lg sm:text-xl font-bold text-gray-800 mb
1-1",children:"Email Dispute"}),(0,s.jsxs)("p",{className:"jsx-4262b25e31118010 text-sm sm:text-base text-gray-600 mb-2",children:["To: ",t.recipient]}),(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 flex flex-wrap items-center gap-2 text-xs text-gray-500",children:[(0,s.jsx)("span",{className:"jsx-4262b25e31118010 bg-gray-100 px-2 py-1 rounded-full",children:t.type.charAt(0).toUpperCase()+t.type.slice(1)}),(0,s.jsx)("span",{className:"jsx-4262b25e31118010",children:"•"}),(0,s.jsx)("span",{className:"jsx-4262b25e31118010",children:t.createdAt})]})]})]}),(0,s.jsx)("div",{className:"jsx-4262b25e31118010 prose prose-sm sm:prose-base max-w-none text-gray-800",children:(0,s.jsx)("div",{className:"jsx-4262b25e31118010 whitespace-pre-line leading-relaxed text-sm sm:text-base",children:S||t.content})}),(0,s.jsx)("div",{className:"jsx-4262b25e31118010 mt-6 sm:mt-8 pt-4 border-t border-gray-200 no-print",children:(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 flex items-center justify-between text-xs sm:text-sm text-gray-500",children:[(0,s.jsx)("span",{className:"jsx-4262b25e31118010",children:"Generated for Free Trial"}),(0,s.jsx)("span",{className:"jsx-4262b25e31118010",children:new Date().toLocaleDateString()})]})})]})})}),(0,s.jsx)(x.lG,{open:j,onOpenChange:N,children:(0,s.jsxs)(x.Cf,{className:"bg-gradient-to-br from-blue-900/95 via-purple-900/95 to-blue-900/95 backdrop-blur-md border border-white/20 text-white w-[95vw] max-w-md sm:max-w-lg",children:[(0,s.jsx)(x.c7,{children:(0,s.jsx)(x.L3,{className:"text-xl sm:text-2xl font-bold text-center text-white",children:"Activate Your Plan"})}),(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 space-y-4 sm:space-y-6 p-2 sm:p-4",children:[(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 text-center",children:[(0,s.jsx)("div",{className:"jsx-4262b25e31118010 w-16 h-16 sm:w-20 sm:h-20 mx-auto mb-4 bg-gradient-to-r from-purple-500 to-blue-500 rounded-full flex items-center justify-center",children:(0,s.jsx)(m.A,{className:"h-8 w-8 sm:h-10 sm:w-10 text-white"})}),(0,s.jsx)("p",{className:"jsx-4262b25e31118010 text-white/90 text-sm sm:text-base leading-relaxed",children:"Activate a full plan to review this draft, use the self-directed dispute workspace, and choose whether to send it."})]}),(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 bg-white/10 rounded-lg p-3 sm:p-4",children:[(0,s.jsx)("h4",{className:"jsx-4262b25e31118010 font-semibold text-white mb-2 sm:mb-3 text-sm sm:text-base",children:"Full Plan Includes:"}),(0,s.jsxs)("ul",{className:"jsx-4262b25e31118010 space-y-1 sm:space-y-2 text-xs sm:text-sm text-white/80",children:[(0,s.jsxs)("li",{className:"jsx-4262b25e31118010 flex items-center gap-2",children:[(0,s.jsx)("div",{className:"jsx-4262b25e31118010 w-1.5 h-1.5 bg-purple-400 rounded-full"}),"Self-directed email drafting tools"]}),(0,s.jsxs)("li",{className:"jsx-4262b25e31118010 flex items-center gap-2",children:[(0,s.jsx)("div",{className:"jsx-4262b25e31118010 w-1.5 h-1.5 bg-purple-400 rounded-full"}),"Optional email submission selected by you"]}),(0,s.jsxs)("li",{className:"jsx-4262b25e31118010 flex items-center gap-2",children:[(0,s.jsx)("div",{className:"jsx-4262b25e31118010 w-1.5 h-1.5 bg-purple-400 rounded-full"}),"Follow-up tracking"]}),(0,s.jsxs)("li",{className:"jsx-4262b25e31118010 flex items-center gap-2",children:[(0,s.jsx)("div",{className:"jsx-4262b25e31118010 w-1.5 h-1.5 bg-purple-400 rounded-full"}),"Platform support"]})]})]}),(0,s.jsxs)("div",{className:"jsx-4262b25e31118010 flex gap-3 pt-2",children:[(0,s.jsx)(p.$,{onClick:()=>N(!1),variant:"outline",className:"flex-1 bg-white/10 border-white/30 text-white hover:bg-white/20 hover:text-white text-sm sm:text-base h-10 sm:h-12",children:"Cancel"}),(0,s.jsx)(p.$,{onClick:()=>{console.log("\uD83D\uDD13 [FREE TRIAL EMAIL DETAIL] Activate Plan Now button clicked - opening plan selection modal"),N(!1),k(!0)},className:"flex-1 bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700 text-white font-semibold text-sm sm:text-base h-10 sm:h-12",children:"Activate Plan Now"})]})]})]})}),(0,s.jsx)(b.A,{isOpen:C,onClose:()=>k(!1),onBack:()=>{k(!1),N(!0)},onSelectMonthly:A,onSelect6Month:I})]})]})}},47554:(e,t,a)=>{a.d(t,{A:()=>u});var s=a(95155),r=a(12115),l=a(54679),n=a(97003),i=a(35626),o=a(65229),d=a(78519),c=a(56154);function u(e){let{isOpen:t,onClose:a,onBack:u,onSelectMonthly:m,onSelect6Month:h}=e;return(0,r.useEffect)(()=>{t&&console.log('\uD83D\uDD13 [PLAN SELECTION MODAL] "Choose Your Plan" popup opened')},[t]),(0,s.jsx)(l.lG,{open:t,onOpenChange:a,children:(0,s.jsxs)(l.Cf,{className:"bg-gradient-to-br from-blue-900/95 via-purple-900/95 to-blue-900/95 backdrop-blur-md border border-white/20 text-white w-[95vw] max-w-md 
1sm:max-w-lg h-[85vh] sm:h-auto max-h-[90vh] overflow-hidden flex flex-col",children:[(0,s.jsxs)(l.c7,{className:"relative shrink-0",children:[(0,s.jsx)("button",{onClick:u,className:"absolute -top-2 -left-2 p-2 rounded-full hover:bg-white/10 transition-colors z-10","aria-label":"Back",children:(0,s.jsx)(i.A,{className:"h-5 w-5 text-white/70 hover:text-white"})}),(0,s.jsx)("button",{onClick:a,className:"absolute -top-2 -right-2 p-2 rounded-full hover:bg-white/10 transition-colors z-10","aria-label":"Close",children:(0,s.jsx)(o.A,{className:"h-5 w-5 text-white/70 hover:text-white"})}),(0,s.jsxs)("div",{className:"text-center pt-2 sm:pt-4 pb-2",children:[(0,s.jsx)("div",{className:"mx-auto w-12 h-12 sm:w-16 sm:h-16 bg-gradient-to-br from-green-500 to-blue-600 rounded-full flex items-center justify-center mb-3 sm:mb-4",children:(0,s.jsx)(d.A,{className:"h-6 w-6 sm:h-8 sm:w-8 text-white"})}),(0,s.jsx)(l.L3,{className:"text-lg sm:text-xl md:text-2xl font-bold text-white mb-2",children:"Choose Your Plan"}),(0,s.jsx)("p",{className:"text-white/80 text-xs sm:text-sm md:text-base px-2",children:"Select the subscription plan that works best for you:"})]})]}),(0,s.jsxs)("div",{className:"space-y-3 sm:space-y-4 px-4 sm:px-6 pb-4 sm:pb-6 overflow-y-auto flex-1",children:[(0,s.jsxs)("div",{className:"bg-gradient-to-r from-blue-500/20 to-purple-500/20 border border-blue-400/30 rounded-xl p-4 sm:p-6 hover:from-blue-500/30 hover:to-purple-500/30 transition-all duration-300",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 bg-blue-500/20 rounded-lg flex items-center justify-center",children:(0,s.jsx)(d.A,{className:"h-5 w-5 text-blue-400"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-white",children:"Monthly Plan"}),(0,s.jsx)("p",{className:"text-white/70 text-sm",children:"Pay as you go - flexible"})]})]}),(0,s.jsxs)("div",{className:"text-right",children:[(0,s.jsx)("div",{className:"text-2xl font-bold text-white",children:"$199"}),(0,s.jsx)("div",{className:"text-white/60 text-xs",children:"per month"})]})]}),(0,s.jsxs)("ul",{className:"text-sm text-white/80 space-y-1 mb-4",children:[(0,s.jsx)("li",{children:"• Fully Automated Disputes"}),(0,s.jsx)("li",{children:"• Mail, fax & email included"}),(0,s.jsx)("li",{children:"• All 3 credit bureau reports"}),(0,s.jsx)("li",{children:"• AI-powered letter generation"}),(0,s.jsx)("li",{children:"• Priority support"})]}),(0,s.jsxs)(n.$,{onClick:m,className:"w-full bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-semibold py-2 sm:py-3 rounded-lg transition-all duration-300 shadow-lg hover:shadow-xl text-sm sm:text-base",children:[(0,s.jsx)(d.A,{className:"h-4 w-4 mr-2"}),"Choose Monthly - $199"]})]}),(0,s.jsxs)("div",{className:"bg-gradient-to-r from-green-500/20 to-emerald-500/20 border border-green-400/30 rounded-xl p-4 sm:p-6 hover:from-green-500/30 hover:to-emerald-500/30 transition-all duration-300 relative",children:[(0,s.jsx)("div",{className:"absolute -top-2 -right-2 bg-gradient-to-r from-green-500 to-emerald-500 text-white text-xs font-bold px-3 py-1 rounded-full shadow-lg",children:"SAVE $180"}),(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("div",{className:"w-10 h-10 bg-green-500/20 rounded-lg flex items-center justify-center",children:(0,s.jsx)(c.A,{className:"h-5 w-5 text-green-400"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-white",children:"6-Month Plan"}),(0,s.jsx)("p",{className:"text-white/70 text-sm",children:"Best value - $180 savings!"})]})]}),(0,s.jsxs)("div",{className:"text-right",children:[(0,s.jsx)("div",{className:"text-white/60 text-xs line-through",children:"$1,194"}),(0,s.jsx)("div",{className:"text-2xl font-bold text-green-400",children:"$1,014"}),(0,s.jsx)("div",{className:"text-white/60 text-xs",children:"6 months total"})]})]}),(0,s.jsxs)("ul",{className:"text-sm text-white/80 space-y-1 mb-4",children:[(0,s.jsx)("li",{children:"• Everything in monthly plan"}),(0,s.jsx)("li",{children:"• $180 total savings"}),(0,s.jsx)("li",{children:"• 6 months of full access"}),(0,s.jsx)("li",{children:"• Priority support"}),(0,s.jsx)("li",{children:"• Best value option"})]}),(0,s.jsxs)(n.$,{onClick:h,className:"w-full bg-gradient-to-r from-green-500 to-emerald-600 hover:from-green-600 hover:to-emerald-700 text-white font-semibold py-2 sm:py-3 rounded-lg transition-all duration-300 shadow-lg hover:shadow-xl text-sm sm:text-base",children:[(0,s.jsx)(c.A,{className:"h-4 w-4 mr-2"}),"Choose 6-Month - $1,014"]})]}),(0,s.jsx)("div",{className:"text-center pt-1 sm:pt-2",children:(0,s.jsx)("p",{className:"text-white/60 text-xs",children:"Secure payment processing • Cancel anytime"})})]})]})})}},87337:(e,t,a)=>{a.d(t,{A:()=>
1o});var s=a(95155);a(12115);var r=a(61712),l=a(80455),n=a(20063),i=a(85733);function o(e){let{className:t=""}=e,a=(0,n.useRouter)(),{currentUser:o}=(0,i.A)();return o?(0,s.jsxs)(l.P.button,{onClick:()=>{a.push("/user-portal")},className:"group flex items-center gap-2 bg-white/10 hover:bg-white/20 backdrop-blur-md text-white px-3 py-2 rounded-lg transition-all duration-300 border border-white/20 hover:border-white/30 ".concat(t),whileHover:{scale:1.02},whileTap:{scale:.98},title:"Return to User Portal",children:[(0,s.jsx)(r.A,{className:"h-4 w-4 group-hover:scale-110 transition-transform"}),(0,s.jsx)("span",{className:"font-medium text-sm hidden sm:inline",children:"Home"})]}):null}},88273:(e,t,a)=>{a.d(t,{Ad:()=>n});var s=a(19708),r=a(93726);let l=async(e,t,a,l)=>{let n=new URLSearchParams({plan:e});l&&n.append("from",l);let i=a;if(!i&&t)try{let e=await (0,s.getDoc)((0,s.doc)(r.db,"users",t.uid));e.exists()&&(i=e.data())}catch(e){console.warn("Failed to fetch user profile for checkout:",e)}if(i){var o,d,c,u;i.firstName&&n.append("prefillFirstName",i.firstName),i.lastName&&n.append("prefillLastName",i.lastName),i.phone&&n.append("prefillPhone",i.phone),(null==(o=i.address)?void 0:o.streetAddress)&&n.append("prefillAddress1",i.address.streetAddress),(null==(d=i.address)?void 0:d.city)&&n.append("prefillCity",i.address.city),(null==(c=i.address)?void 0:c.state)&&n.append("prefillState",i.address.state),(null==(u=i.address)?void 0:u.zipCode)&&n.append("prefillPostalCode",i.address.zipCode)}return(null==t?void 0:t.email)&&n.append("prefillEmail",t.email),"/checkout?".concat(n.toString())},n=async(e,t,a,s,r)=>{let n=r||window.location.pathname,i=await l(e,t,s,n);console.log("\uD83D\uDCDD Navigating to checkout with user data:",i),a.push(i)}},95671:(e,t,a)=>{a.d(t,{W:()=>l});var s=a(19708),r=a(93726);async function l(e,t){try{var a,l;let n=await (0,s.getDoc)((0,s.doc)(r.db,"users",t));if(n.exists()&&(null==(a=n.data())?void 0:a.adminId)===e)return console.log("\uD83D\uDD10 [AGENT ACCESS] Fast path: adminId match",{agentUid:e,clientUid:t}),!0;console.log("\uD83D\uDD10 [AGENT ACCESS] Fast path miss",{exists:n.exists(),adminId:null==(l=n.data())?void 0:l.adminId,agentUid:e})}catch(e){console.warn("\uD83D\uDD10 [AGENT ACCESS] Fast path error (user doc read denied):",e)}try{let a=(0,s.query)((0,s.collection)(r.db,"clientAssignments"),(0,s.where)("managerUid","==",e),(0,s.where)("clientUid","==",t),(0,s.where)("isActive","==",!0),(0,s.limit)(1)),l=await (0,s.getDocs)(a);return console.log("\uD83D\uDD10 [AGENT ACCESS] Fallback clientAssignments:",{found:!l.empty,agentUid:e,clientUid:t}),!l.empty}catch(e){console.warn("\uD83D\uDD10 [AGENT ACCESS] Fallback error (clientAssignments read denied):",e)}return!1}}}]);

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.