1import{h as E,r as g,c as P,j as e,d as q,C as i,i as o,k as n,q as l,g as c,L as M,e as R,v as A}from"./index-CmblPHEx.js";import{u as L,P as I}from"./seo-CWvEKupB.js";import{H as F}from"./Header-BpeNO_Xm.js";import{F as D}from"./Footer-C0oGYG8m.js";import{P as $}from"./Paywall-BJBEkwro.js";import{B as p}from"./button-Cuds4r5M.js";import{T as B}from"./textarea-CV3khEdv.js";import{I as H}from"./input-CV3W26yd.js";import{B as G}from"./badge-BMhe7-z1.js";import{P as O}from"./progress-BKpByJ20.js";import{S as V}from"./separator-Boa-ZR4_.js";import{T as W,a as Y,b,c as y}from"./tabs-C2NnF7jw.js";import{A as _}from"./arrow-left-BwmEX89L.js";import{m}from"./proxy-BecgI9R_.js";import{S as v}from"./sparkles-BXi46Nbg.js";import{L as w}from"./lightbulb-CmgHhc9d.js";import{M as z}from"./mail-BeFJU52G.js";import{M as S}from"./message-square-DnELkb5I.js";import{F as J}from"./file-text-BoePA4PR.js";import{R as k}from"./refresh-cw-CHgYNIP1.js";import{A as K}from"./index-DzE2VlPx.js";import{C as U}from"./circle-check-BGP72OHo.js";import{T as C}from"./trending-up-CVcTC8lf.js";import"./MFJ Logo Transparent 500x500_1761174039806-GqdhoJga.js";import"./dialog-ARfEL6po.js";import"./index-BK6mZd2d.js";import"./links-DPaWIeah.js";import"./check-BBMEiR7p.js";import"./search-tKnOiw6J.js";import"./graduation-cap-Ceal_dkM.js";import"./use-entitlements-CFu6EvR-.js";import"./heart-DF_Md2uc.js";import"./crown-DqfNpIsw.js";import"./lock-Bzd3vfzF.js";import"./arrow-right-C5sIVFx9.js";import"./index-CjwWbnUX.js";import"./index-BLwFO-gh.js";const Q=[{name:"Follow-up Email",context:"Email to hiring manager after interview",message:"Hey! Just wanted to follow up on our interview last week. Any updates? Thanks!",icon:z},{name:"Team Message",context:"Slack message to team about project delay",message:"Hey guys, the project is gonna be late again. Had some issues. Sorry about that.",icon:S},{name:"Request Email",context:"Email to manager requesting time off",message:"I need to take next friday off for personal reasons. Let me know if thats ok.",icon:J}];function Fe(){L(I.etiquette);const{toast:h}=E(),[d,j]=g.useState(""),[u,N]=g.useState(""),[t,f]=g.useState(null),T=s=>{N(s.context),j(s.message),f(null),h({title:"Example loaded!",description:`Try reviewing this ${s.name.toLowerCase()} for practice.`})},x=P({mutationFn:async()=>await(await R("POST","/api/ai/etiquette",{messageText:d,context:u})).json(),onSuccess:s=>{f(s),h({title:"Review complete!",description:"Check your etiquette score below"})},onError:s=>{h({title:"Review failed",description:s instanceof Error?s.message:"Please try again",variant:"destructive"})}}),a=t?(s=>s>=9?{color:"text-green-600 dark:text-green-400",label:"Excellent",icon:U,description:"Professional and polished"}:s>=7?{color:"text-blue-600 dark:text-blue-400",label:"Good",icon:C,description:"Minor improvements needed"}:s>=5?{color:"text-orange-600 dark:text-orange-400",label:"Adequate",icon:C,description:"Some issues to address"}:{color:"text-red-600 dark:text-red-400",label:"Needs Work",icon:A,description:"Major problems to fix"})(t.score):null;return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[e.jsx(F,{}),e.jsx($,{product:"ai_pack_monthly",children:e.jsxs("main",{className:"flex-1 container mx-auto p-6 max-w-4xl",children:[e.jsx(q,{href:"/tools",children:e.jsxs(p,{variant:"ghost",className:"mb-4","data-testid":"button-back",children:[e.jsx(_,{className:"h-4 w-4 mr-2"}),"Back to AI Tools"]})}),e.jsxs(m.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"mb-8 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-3",children:[e.jsx(v,{className:"h-8 w-8 text-primary"}),e.jsx("h1",{className:"text-4xl font-bold","data-testid":"text-page-title",children:"Digital Etiquette Coach"})]}),e.jsx("p",{className:"text-muted-foreground text-lg","data-testid":"text-page-description",children:"Polish your professional communication with AI-powered feedback on tone, clarity, and etiquette"})]}),!t&&e.jsxs(i,{className:"mb-6",children:[e.jsxs(o,{children:[e.jsxs(n,{className:"flex items-center gap-2",children:[e.jsx(w,{className:"h-5 w-5"}),"Try an Example"]}),e.jsx(l,{children:"Load a sample message to see how the coach works"})]}),e.jsx(c,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:Q.map((s,r)=>e.jsxs(p,{variant:"outline",className:"h-auto py-4 flex flex-col items-center gap-2",onClick:()=>T(s),"data-testid":`button-example-${r}`,children:[e.jsx(s.icon,{className:"h-6 w-6 text-primary"}),e.jsx("span",{className:"font-medium",children:s.name}),e.jsx("span",{className:"text-xs text-muted-foreground text-center",children:s.context})]},r))})})]}),e.jsxs(i,{className:"mb-6",children:[e.jsxs(o,{children:[e.jsxs(n,{className:"flex items-center gap-2",children:[e.jsx(S,{className:"h-5 w-5"}),"Review Your Message"]}),e.jsx(l,{children:"Get AI feedback on your professional communication"})]}),e.jsxs(c,{className:"space-y-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Context *"}),e.jsx(H,{placeholder:"e.g., Email to hiring manager, Slack message to team, LinkedIn connection request",value:u,onChange:s=>N(s.target.value),"data-testid":"input-context"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Describe where and to whom you're sending this message"})]}),e.jsx(V,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Your Message *"}),e.jsx(B,{placeholder:"Paste your message here... Be honest - we'll help you polish it!",value:d,onChange:s=>j(s.target.value),className:"min-h-[200px]","data-testid":"textarea-message"})]}),x.isPending&&e.jsxs(m.div,{initial:{opacity:0,height:0}
1,animate:{opacity:1,height:"auto"},className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Reviewing etiquette..."}),e.jsx("span",{className:"font-medium",children:"Analyzing"})]}),e.jsx(O,{value:60,className:"h-2"})]}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(p,{onClick:()=>x.mutate(),disabled:!d||!u||x.isPending,className:"flex-1",size:"lg","data-testid":"button-review",children:x.isPending?e.jsxs(e.Fragment,{children:[e.jsx(M,{className:"mr-2 h-4 w-4 animate-spin"}),"Reviewing..."]}):e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"mr-2 h-4 w-4"}),"Review Etiquette"]})}),t&&e.jsxs(p,{variant:"outline",onClick:()=>f(null),"data-testid":"button-reset",children:[e.jsx(k,{className:"h-4 w-4 mr-2"}),"New Review"]})]})]})]}),e.jsx(K,{mode:"wait",children:t&&a&&e.jsxs(m.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.4},className:"space-y-6",children:[e.jsxs(i,{children:[e.jsxs(o,{className:"text-center",children:[e.jsx(n,{className:"text-2xl",children:"Etiquette Score"}),e.jsx(l,{children:"Professional communication assessment"})]}),e.jsx(c,{children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsxs("div",{className:"relative w-48 h-48",children:[e.jsxs("svg",{className:"w-full h-full transform -rotate-90",children:[e.jsx("circle",{cx:"96",cy:"96",r:"88",fill:"none",stroke:"currentColor",strokeWidth:"12",className:"text-muted",opacity:"0.2"}),e.jsx("circle",{cx:"96",cy:"96",r:"88",fill:"none",stroke:"currentColor",strokeWidth:"12",strokeLinecap:"round",strokeDasharray:`${2*Math.PI*88}`,strokeDashoffset:`${2*Math.PI*88*(1-t.score/10)}`,className:a.color,style:{transition:"stroke-dashoffset 1s ease-in-out"}})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("div",{className:`text-5xl font-bold ${a.color}`,children:t.score}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"out of 10"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(a.icon,{className:`h-5 w-5 ${a.color}`}),e.jsx("span",{className:`font-semibold text-lg ${a.color}`,children:a.label})]}),e.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md","data-testid":"text-feedback",children:t.feedback})]})})]}),e.jsxs(i,{children:[e.jsxs(o,{children:[e.jsxs(n,{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-5 w-5"}),"Message Comparison"]}),e.jsx(l,{children:"See how your message can be improved"})]}),e.jsx(c,{children:e.jsxs(W,{defaultValue:"before",className:"w-full",children:[e.jsxs(Y,{className:"grid w-full grid-cols-2",children:[e.jsx(b,{value:"before",children:"Your Version"}),e.jsx(b,{value:"after",children:"Improved Version"})]}),e.jsx(y,{value:"before",className:"mt-4",children:e.jsx("div",{className:"p-4 bg-red-50 dark:bg-red-950/20 rounded-lg border border-red-200 dark:border-red-900",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:d})})}),e.jsx(y,{value:"after",className:"mt-4",children:e.jsx("div",{className:"p-4 bg-green-50 dark:bg-green-950/20 rounded-lg border border-green-200 dark:border-green-900",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap","data-testid":"text-rewrite",children:t.rewriteSuggestion})})})]})})]}),t.improvements.length>0&&e.jsx(m.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.1},children:e.jsxs(i,{children:[e.jsxs(o,{children:[e.jsxs(n,{className:"flex items-center gap-2 text-primary",children:[e.jsx(w,{className:"h-5 w-5"}),"Key Improvements"]}),e.jsx(l,{children:"Specific areas to focus on for better communication"})]}),e.jsx(c,{className:"space-y-3",children:t.improvements.map((s,r)=>e.jsxs(m.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:.1+r*.05},className:"flex items-start gap-3 p-3 bg-primary/5 rounded-lg border border-primary/20","data-testid":`improvement-${r}`,children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(G,{variant:"default",className:"font-bold",children:r+1})}),e.jsx("p",{className:"text-sm pt-0.5",children:s})]},r))})]})})]})})]})}),e.jsx(D,{})]})})}export{Fe 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.