1import{r as u,j as e,m as k}from"./index-DXG05hQ5.js";const Q=["free","guarantee","act now","limited time","urgent","click here","no obligation","risk free","winner","congratulations","cash","earn money","income","profit","discount","lowest price","order now","buy now","don't miss","exclusive deal","amazing","incredible","miracle","once in a lifetime","special promotion"];function P(a){const t=[],s=[],n=a.trim().split(/\s+/).filter(Boolean),o=a.trim().length,l=a.toLowerCase();let x=0,m="";n.length>=6&&n.length<=10&&o>=30&&o<=50?(x=2,m=`${n.length} words, ${o} chars â ideal range`):n.length>=4&&n.length<=12&&o>=20&&o<=60?(x=1,m=`${n.length} words, ${o} chars â acceptable but not ideal`,n.length>10&&s.push({text:`Shorten by ${n.length-10} word${n.length-10>1?"s":""} â 6-10 words is the sweet spot`,impact:"+15% open rate"}),n.length<6&&s.push({text:`Add ${6-n.length} more word${6-n.length>1?"s":""} for context â too short feels spammy`,impact:"+10% open rate"})):(m=`${n.length} words, ${o} chars â too ${o<20?"short":"long"}`,o<20&&s.push({text:"Add more context â ultra-short subjects look automated",impact:"+20% open rate"}),o>60&&s.push({text:`Cut to under 50 chars â ${o-50} chars will be truncated on mobile`,impact:"+25% open rate"})),t.push({category:"length",score:x,max:2,note:m});const d=/\{(name|first_name|company|title)\}/i.test(a),i=/\b(your|you|team)\b/i.test(a);let h=0,r="no personalization detected";d?(h=2,r="merge tag detected â good personalization"):i?(h=1,r='"you/your" language â some personalization',s.push({text:"Add a merge tag like {company} or {first_name} for stronger personalization",impact:"+26% open rate"})):s.push({text:'Add "your" or a merge tag like {first_name} â personalized subjects get 26% more opens',impact:"+26% open rate"}),t.push({category:"personalization",score:h,max:2,note:r});const c=Q.filter(p=>l.includes(p));let y=2,j="no spam triggers detected";c.length===1?(y=1,j=`1 spam trigger: "${c[0]}"`,s.push({text:`Remove spam word "${c[0]}" â replace with a specific benefit or result`,impact:"+30% deliverability"})):c.length>1&&(y=0,j=`${c.length} spam triggers: ${c.slice(0,3).map(p=>`"${p}"`).join(", ")}`,s.push({text:`Remove ${c.length} spam triggers: ${c.slice(0,3).join(", ")}. Rewrite with specifics instead of hype`,impact:"+50% deliverability"})),t.push({category:"spam triggers",score:y,max:2,note:j});const R=a===a.toUpperCase()&&o>3,q=(a.match(/[A-Z]/g)?.length??0)/Math.max(o,1)>.5;let w=1,v="normal capitalization";R?(w=0,v="ALL CAPS â triggers spam filters",s.push({text:"Use sentence case â ALL CAPS is the #1 spam filter trigger",impact:"+40% deliverability"})):q&&(w=0,v="excessive capitalization â looks spammy",s.push({text:"Reduce capitalization â only capitalize the first word and proper nouns",impact:"+20% deliverability"})),t.push({category:"capitalization",score:w,max:1,note:v});const g=(a.match(new RegExp("\\p{Emoji_Presentation}","gu"))??[]).length;let N=1,S="no emojis â neutral";g===1?(N=1,S="1 emoji â acceptable"):g>=2&&(N=0,S=`${g} emojis â hurts deliverability`,s.push({text:`Remove ${g-1} emoji${g>2?"s":""} â max 1 emoji in B2B cold email`,impact:"+15% deliverability"})),t.push({category:"emoji usage",score:N,max:1,note:S});const f=a.trim().endsWith("?");f||s.push({text:"Try framing as a question â questions boost open rates by ~10%",impact:"+10% open rate"}),t.push({category:"question format",score:f?1:0,max:1,note:f?"question format â boosts open rate ~10%":"not a question â neutral"});const b=/\d/.test(a);b||s.push({text:'Add a number for specificity (e.g., "3 ideas", "47% faster")',impact:"+20% open rate"}),t.push({category:"number inclusion",score:b?.5:0,max:.5,note:b?"contains a number â adds specificity":"no numbers â neutral"});const C=["quick","today","this week","before","deadline","soon","now"].some(p=>l.includes(p)),z=c.length>0;let A=0,$="no urgency language";C&&!z?(A=.5,$="appropriate urgency without spam signals"):C&&z&&($="urgency undermined by spam triggers"),t.push({category:"urgency",score:A,max:.5,note:$});const L=Math.min(10,t.reduce((p,B)=>p+B.score,0)*(10/10.5)),M=Math.round(L*10)/10,_=T(a,{hasToken:d,isQuestion:f,hasNumber:b,foundSpam:c,words:n});return{total:M,breakdown:t,improvements:s.slice(0,5),rewriteSuggestions:_}}function T(a,t){const s=[],n=a.trim();if(!n)return s;if(!t.isQuestion&&!t.hasToken){const o=t.words.slice(0,6).join(" ");s.push(`Quick question about {company}'s ${o.toLowerCase().replace(/^(re:|fwd:)\s*/i,"")}?`)}else t.isQuestion||s.push(n.replace(/\.?$/,"?"));if(t.hasNumber||s.push(`3 ideas for ${t.words.slice(0,4).join(" ").toLowerCase().replace(/^(re:|fwd:)\s*/i,"")}`),t.foundSpam.length>0){let o=n;for(const l of t.foundSpam)o=o.replace(new RegExp(l,"gi"),"").replace(/\s{2,}/g," ").trim();o.length>10&&s.push(o)}return s.slice(0,2)}function U(a){return a>=7?"text-green":a>=4?"text-accent":"text-red"}function E(a,t){const s=t>0?a/t:0;return s>=.8?"bg-green":s>=.4?"bg-accent":"bg-red"}function D({onResults:a}){const[t,s]=u.useState(""),[n,o]=u.useState(!1),[l,x]=u.useState(!1),[m,d]=u.useState(!1),i=u.useMemo(()=>t.trim()?P(t):null,[t]);u.useEffect(()=>{n&&i&&a(i)},[n,i,a]);const h=r=>{if(r.preventDefault(),!t.trim()){d(!0);return}d(!1),o(!0)};return e.jsxs("div",{children:[e.jsxs("form",{onSubmit:h,className:"border border-border bg-bg-warm p-6 sm:p-8 paper-shadow",children:[e.jsx("h2",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-text-muted mb-6",children:"your subject line"}),e.jsxs("div",{children:[e.jsx("label",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-text-muted block mb-1.5",children:"email subject line"}),e.jsx("input",{type:"text",value:t,onChange:r=>{s(r.target.value),o(!1),d(!1)},placeholder:"e.g. Quick question about your outbound process",className:`w-full bg-bg-page border text-text-primary text-sm font-mono py-2.5 px-3 outline-none focus:border-text-muted transition-colors ${m?"border-red":"border-border"}`,style:{fontSize:16}}),e.jsxs("div",{className:"flex items-center justify-between mt-1",children:[e.jsxs("span",{className:"font-mono text-[10px] text-text-muted",children:[t.trim().split(/\s+/).filter(
1Boolean).length," words, ",t.trim().length," characters"]}),m&&e.jsx("span",{className:"font-mono text-[10px] text-red",children:"enter a subject line to score"})]})]}),e.jsx(k.button,{type:"submit",whileHover:{scale:1.02},whileTap:{scale:.98},className:"mt-8 px-8 py-3 bg-text-primary text-white text-sm font-medium cursor-pointer hover:opacity-90 transition-opacity",children:"score subject line"})]}),n&&i&&e.jsxs(k.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.5},className:"mt-6 border border-border bg-bg-page p-6 sm:p-8 paper-shadow",children:[e.jsx("h2",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-text-muted mb-6",children:"subject line score"}),e.jsxs("div",{className:"mb-8 pb-6 border-b border-border",children:[e.jsx("span",{className:"font-mono text-[11px] text-text-muted block mb-1",children:"overall score"}),e.jsx("span",{className:`font-mono text-[clamp(2rem,5vw,3rem)] font-semibold tracking-tight ${U(i.total)}`,children:i.total}),e.jsx("span",{className:"font-mono text-sm text-text-muted ml-1",children:"/ 10"})]}),e.jsx("div",{className:"space-y-4 mb-8",children:i.breakdown.map(r=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-text-muted",children:r.category}),e.jsxs("span",{className:`font-mono text-sm font-semibold ${E(r.score,r.max).replace("bg-","text-")}`,children:[r.score,"/",r.max]})]}),e.jsx("div",{className:"h-1.5 bg-bg-warm border border-border overflow-hidden",children:e.jsx(k.div,{initial:{width:0},animate:{width:`${r.max>0?r.score/r.max*100:0}%`},transition:{duration:.6,ease:"easeOut"},className:`h-full ${E(r.score,r.max)}`})}),e.jsx("span",{className:"text-xs text-text-secondary mt-0.5 block",children:r.note})]},r.category))}),i.improvements.length>0&&e.jsxs("div",{className:"mb-8",children:[e.jsx("h3",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-text-muted mb-3",children:"suggested improvements"}),e.jsx("div",{className:"space-y-2",children:i.improvements.map((r,c)=>e.jsxs("div",{className:"flex items-start justify-between gap-3 bg-bg-warm border border-border p-3",children:[e.jsx("span",{className:"text-sm text-text-secondary",children:r.text}),e.jsx("span",{className:"font-mono text-[10px] text-green whitespace-nowrap",children:r.impact})]},c))})]}),i.rewriteSuggestions.length>0&&e.jsxs("div",{className:"mb-8",children:[e.jsx("h3",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-text-muted mb-3",children:"rewrite suggestions"}),e.jsx("div",{className:"space-y-2",children:i.rewriteSuggestions.map((r,c)=>e.jsxs("div",{className:"bg-bg-warm border border-border p-3 flex items-center gap-3",children:[e.jsxs("span",{className:"font-mono text-[10px] text-text-muted",children:[c+1,"."]}),e.jsx("span",{className:"text-sm text-text-primary font-medium",children:r})]},c))})]}),e.jsx("div",{className:"bg-bg-warm border border-border p-4",children:e.jsxs("p",{className:"text-sm text-text-secondary",children:[i.total>=7&&e.jsxs(e.Fragment,{children:[e.jsx("strong",{className:"text-green",children:"strong subject line."})," good personalization, clean of spam triggers, and well-structured. should land in primary inbox."]}),i.total>=4&&i.total<7&&e.jsxs(e.Fragment,{children:[e.jsx("strong",{className:"text-accent",children:"decent but improvable."})," check the low-scoring categories above. small changes to word choice and structure can push this into the green."]}),i.total<4&&e.jsxs(e.Fragment,{children:[e.jsx("strong",{className:"text-red",children:"high risk of spam folder."})," this subject line has multiple red flags. rewrite focusing on specificity, personalization, and removing trigger words."]})]})}),e.jsx("button",{type:"button",onClick:()=>x(!l),className:"text-xs text-text-muted font-mono hover:text-text-secondary transition-colors cursor-pointer mt-6 mb-2",children:l?"-- hide assumptions":"++ show assumptions"}),l&&e.jsx("div",{className:"border border-border bg-bg-warm p-4 mb-4",children:e.jsxs("ul",{className:"space-y-1 text-xs text-text-muted font-mono",children:[e.jsx("li",{children:"-- ideal length: 6-10 words, 30-50 characters"}),e.jsxs("li",{children:["-- personalization: merge tags (","{first_name}",", ","{company}",") are strongest"]}),e.jsx("li",{children:"-- question format boosts open rates ~10% on average"}),e.jsx("li",{children:"-- numbers in subject lines increase open rate by ~20%"}),e.jsx("li",{children:"-- scoring weighted toward deliverability (spam/caps) over style"})]})}),e.jsx("p",{className:"font-mono text-[9px] text-text-muted mt-8",children:"Sources: Mailchimp Email Benchmarks 2025, HubSpot Email Marketing Study, Litmus State of Email Report"})]})]})}export{D as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.