1import{r as i,j as e,n as g,b as U,O as N,ap as P,Z as O,aP as A,k as $,am as I,x as v,y as C,h as R}from"./index-CGeo62Qw.js";import{C as W}from"./calendar-DqNYs1_s.js";import{H as B}from"./help-circle-T0K-LmoC.js";import{T as F}from"./trending-up-CFpmKRyA.js";import{C as H}from"./chevron-up-Bc_X9j2B.js";const M=()=>{const[l,p]=i.useState(""),[d,u]=i.useState(!1),[s,b]=i.useState(null),[f,x]=i.useState(""),[j,m]=i.useState(null),[k,w]=i.useState({}),c={bigrams:{label:"2-Word Phrases (Bigrams)",description:"Unique two-word combinations",icon:I,color:"bg-blue-100 text-blue-700 border-blue-200",headerColor:"from-blue-500 to-blue-600"},trigrams:{label:"3-Word Phrases (Trigrams)",description:"Unique three-word sequences",icon:F,color:"bg-purple-100 text-purple-700 border-purple-200",headerColor:"from-purple-500 to-purple-600"},fourgrams:{label:"4-Word Phrases (4-grams)",description:"Unique four-word combinations",icon:$,color:"bg-pink-100 text-pink-700 border-pink-200",headerColor:"from-pink-500 to-pink-600"},informational:{label:"Informational Phrases",description:"Educational and how-to phrases",icon:B,color:"bg-cyan-100 text-cyan-700 border-cyan-200",headerColor:"from-cyan-500 to-cyan-600"},commercial:{label:"Commercial Phrases",description:"Buying-intent and comparison phrases",icon:A,color:"bg-green-100 text-green-700 border-green-200",headerColor:"from-green-500 to-green-600"},longtail:{label:"Long-tail Phrases",description:"Highly specific niche phrases",icon:O,color:"bg-amber-100 text-amber-700 border-amber-200",headerColor:"from-amber-500 to-amber-600"},seasonal:{label:"Seasonal/Contextual",description:"Time-based and situational phrases",icon:W,color:"bg-orange-100 text-orange-700 border-orange-200",headerColor:"from-orange-500 to-orange-600"},authority:{label:"Authority-Building Phrases",description:"Expert-level unique phrases",icon:P,color:"bg-indigo-100 text-indigo-700 border-indigo-200",headerColor:"from-indigo-500 to-indigo-600"}},y=async()=>{if(!l.trim()){x("Please enter a search term");return}u(!0),x(""),b(null);try{const t=await fetch("/api/ai-tools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operation:"unique-ngrams.generate",inputs:{term:l}})});if(!t.ok)throw new Error("AI API error");const r=await t.json(),a=JSON.parse(r.text);b(a);const o={};Object.keys(c).forEach(n=>{o[n]=!0}),w(o)}catch(t){console.error("Error generating n-grams:",t),x(`Failed to generate: ${t.message}`)}finally{u(!1)}},q=t=>{if(!s||!s[t])return;const a=s[t].join(` 2`);navigator.clipboard.writeText(a),m(t),setTimeout(()=>m(null),2e3)},E=()=>
2{if(!s)return;let t=`# Unique N-Grams: ${s.term} 3 4`;Object.entries(c).forEach(([r,a])=>{const o=s[r];o&&o.length>0&&(t+=`## ${a.label} 5`,o.forEach(n=>{t+=`- ${n} 6`}),t+=` 7`)}),navigator.clipboard.writeText(t),m("all"),setTimeout(()=>m(null),2e3)},S=t=>{w(r=>({...r,[t]:!r[t]}))},T=()=>s?Object.keys(c).reduce((t,r)=>{var a;return t+(((a=s[r])==null?void 0:a.length)||0)},0):0;return e.jsx("div",{className:"content-tool-page tool-dark-surface bg-gradient-to-br from-slate-50 to-violet-50 p-3 md:p-6",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"bg-gradient-to-r from-violet-600 to-purple-600 rounded-2xl p-4 md:p-8 text-white mb-6 md:mb-8 shadow-xl",children:[e.jsxs("div",{className:"flex items-center gap-3 md:gap-4 mb-4",children:[e.jsx("div",{className:"w-12 md:w-14 h-12 md:h-14 bg-white/20 rounded-xl flex items-center justify-center backdrop-blur-sm",children:e.jsx(g,{className:"w-6 md:w-7 h-6 md:h-7"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl md:text-3xl font-bold",children:"Unique N-Grams Generator"}),e.jsx("p",{className:"text-sm md:text-base text-violet-200",children:"Generate original word sequences for SEO authority"})]})]}),e.jsxs("div",{className:"bg-white/10 backdrop-blur-sm rounded-xl p-4 mb-6 border border-white/20",children:[e.jsx("h3",{className:"font-semibold mb-2",children:"ð Why Use Unique N-Grams?"}),e.jsx("p",{className:"text-sm text-violet-100",children:"Unique n-grams are specific, original sequences of words not commonly found elsewhere. They help your content stand out and signal to search engines that you're providing specialized, valuable informationâboosting your authority and ranking potential."})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(U,{className:"absolute left-4 top-1/2 -translate-y-1/2 w-5 h-5 text-violet-200"}),e.jsx("input",{type:"text",value:l,onChange:t=>p(t.target.value),placeholder:"Enter a topic (e.g., hot water benefits, laptop maintenance)",className:"w-full pl-12 pr-4 py-4 bg-white/15 border border-white/30 rounded-xl text-white placeholder-violet-200 focus:outline-none focus:ring-2 focus:ring-white/50 focus:bg-white/20 backdrop-blur-sm transition-all",onKeyDown:t=>t.key==="Enter"&&!d&&y()})]}),e.jsxs("button",{onClick:y,disabled:d||!l.trim(),className:"px-8 py-4 bg-white text-violet-600 rounded-xl font-bold hover:bg-violet-50 disabled:opacity-50 disabled:cursor-not-allowed transition flex items-center justify-center gap-2 shadow-lg",children:[d?e.jsx(N,{className:"w-5 h-5 animate-spin"}):e.jsx(g,{className:"w-5 h-5"}),"Generate"]})]})]}),f&&e.jsx("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-xl text-red-600",children:f}),s&&e.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-gray-200 p-4 md:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-bold text-gray-900",children:['Unique Phrases for "',s.term,'"']}),e.jsxs("p",{className:"text-sm text-gray-500",children:[T()," unique n-grams across ",Object.keys(c).length," categories"]})]}),e.jsxs("button",{onClick:E,className:"flex items-center gap-2 px-4 py-2 bg-violet-50 text-violet-600 rounded-lg hover:bg-violet-100 transition font-medium",children:[j==="all"?e.jsx(v,{className:"w-4 h-4"}):e.jsx(C,{className:"w-4 h-4"}),"Copy All"]})]}),e.jsx("div",{className:"space-y-4",children:Object.entries(c).map(([t,r])=>{const a=s[t]||[],o=r.icon,n=k[t]!==!1;return a.length===0?null:e.jsxs("div",{className:"border border-gray-200 rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 cursor-pointer hover:bg-gray-100 transition",onClick:()=>S(t),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-lg bg-gradient-to-br ${r.headerColor} flex items-center justify-center text-white`,children:e.jsx(o,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900",children:r.label}),e.jsx("p",{className:"text-xs text-gray-500",children:r.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:`px-2 py-1 rounded-lg text-xs font-medium ${r.color}`,children:[a.length," phrases"]}),e.jsx("button",{onClick:h=>{h.stopPropagation(),q(t)},className:"p-2 text-gray-500 hover:text-violet-600 hover:bg-violet-50 rounded-lg transition",title:"Copy",children:j===t?e.jsx(v,{className:"w-4 h-4 text-green-500"}):e.jsx(C,{className:"w-4 h-4"})}),n?e.jsx(H,{className:"w-5 h-5 text-gray-400"}):e.jsx(R,{className:"w-5 h-5 text-gray-400"})]})]}),n&&e.jsx("div",{className:"p-4",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:a.map((h,G)=>e.jsx("span",{className:`px-3 py-1.5 rounded-lg text-sm border ${r.color} hover:shadow-sm transition cursor-default`,children:h},G))})})]},t)})})]}),!s&&!d&&e.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-gray-200 p-8 md:p-12 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-violet-100 rounded-2xl flex items-center justify-center mx-auto mb-4",children:e.jsx(g,{className:"w-8 h-8 text-violet-600"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Generate Unique N-Grams"}),e.jsx("p",{className:"text-gray-500 max-w-md mx-auto mb-6",children:"Enter any topic to generate unique, uncommon word sequences that will help your content stand out and rank higher."}),e.jsxs("div",{className:"bg-violet-50 rounded-xl p-4 max-w-lg mx-auto text-left mb-6",children:[e.jsx("h4",{className:"font-semibold text-violet-800 mb-2",children:"ð Example"}),e.jsx("p",{className:"text-sm text-violet-700",children:'For "health benefits of hot water", instead of generic phrases, get unique ones like "drinking hot water after dinner" or "drinking hot water during winter" that have less competition.'})]}),e.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:["hot water benefits","laptop maintenance","email marketing","home gardening","yoga for beginners"].map(t=>e.jsx("button",{onClick:()=>{p(t)},className:"px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-violet-50 hover:text-violet-600 transition text-sm",children:t},t))})]}),d&&e.jsxs("div",{className:"bg-white rounded-2xl shadow-lg border border-gray-200 p-8 md:p-12 text-center",children:[e.jsx(N,{className:"w-12 h-12 text-violet-500 mx-auto mb-4 animate-spin"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Generating Unique N-Grams"}),e.jsxs("p",{className:"text-gray-500",children:['Finding original word sequences for "',l,'"...']})]})]})})};export{M 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.