sanity-plugin-seo-copilot 0.2.13 → 0.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { definePlugin } from "sanity";
5
5
  import { createElement } from "react";
6
6
 
7
7
  // src/components/SEOCopilotPanel.tsx
8
- import { useState as useState16, useRef as useRef11, useCallback as useCallback5, useEffect as useEffect11, useMemo as useMemo5, Suspense } from "react";
8
+ import { useState as useState17, useRef as useRef12, useCallback as useCallback5, useEffect as useEffect12, useMemo as useMemo5, Suspense } from "react";
9
9
  import { useWorkspace } from "sanity";
10
10
  import { createPortal } from "react-dom";
11
11
 
@@ -50,30 +50,83 @@ function extractHeadingsDetailed(blocks) {
50
50
  }
51
51
  return out;
52
52
  }
53
- function extractBodyLinks(blocks) {
54
- const urls = /* @__PURE__ */ new Set();
53
+ function normalizeLink(raw) {
54
+ const s = raw.trim().replace(/[.,;:!?]+$/, "");
55
+ if (!s) return null;
56
+ if (/^https?:\/\//i.test(s)) return s;
57
+ if (/^www\.\S+\.\S+/i.test(s) || /^[a-z0-9-]+(\.[a-z0-9-]+)+(\/|$)/i.test(s)) return `https://${s}`;
58
+ return null;
59
+ }
60
+ var UNSTYLED_HEADING_SCAN_CAP = 600;
61
+ function extractUnstyledHeadings(blocks) {
62
+ if (!Array.isArray(blocks)) return [];
63
+ const items = blocks.slice(0, UNSTYLED_HEADING_SCAN_CAP).map((b) => {
64
+ if (!b || b._type !== "block") return null;
65
+ const style = b.style || "normal";
66
+ const text = (b.children || []).map((c) => c.text || "").join("").trim();
67
+ return {
68
+ isHeading: /^h[1-6]$/.test(style),
69
+ isPlain: style === "normal",
70
+ isList: typeof b.listItem === "string" && b.listItem.length > 0,
71
+ text,
72
+ words: text ? text.split(/\s+/).filter(Boolean).length : 0
73
+ };
74
+ });
75
+ const out = [];
76
+ for (let i = 0; i < items.length; i++) {
77
+ const it = items[i];
78
+ if (!it || it.isHeading || it.isList || !it.isPlain) continue;
79
+ if (it.words < 2 || it.words > 9) continue;
80
+ if (/[.!?]$/.test(it.text)) continue;
81
+ if (!/[A-Za-z]/.test(it.text)) continue;
82
+ if (/https?:\/\/|doi:|\baccessed\b|image credit|stock\.adobe|^figure\b|^table\b|^source[:s]?\b|^references?\b/i.test(it.text)) continue;
83
+ let next = null;
84
+ for (let j = i + 1; j < items.length; j++) {
85
+ if (items[j] && items[j].text) {
86
+ next = items[j];
87
+ break;
88
+ }
89
+ }
90
+ if (!next || next.isHeading || next.words < 12) continue;
91
+ out.push(it.text);
92
+ if (out.length >= 8) break;
93
+ }
94
+ return out;
95
+ }
96
+ function extractBodyLinksDetailed(blocks) {
97
+ const linked = /* @__PURE__ */ new Set();
98
+ const all = /* @__PURE__ */ new Set();
99
+ const anchorByUrl = /* @__PURE__ */ new Map();
55
100
  if (Array.isArray(blocks)) {
56
101
  for (const block of blocks) {
57
102
  if (block._type === "block" && Array.isArray(block.markDefs)) {
58
103
  for (const md of block.markDefs) {
59
104
  const href = md.href || md.url;
60
- if (typeof href === "string" && /^https?:\/\//i.test(href)) {
61
- urls.add(href.trim());
62
- }
105
+ if (typeof href !== "string") continue;
106
+ const n = normalizeLink(href);
107
+ if (!n) continue;
108
+ linked.add(n);
109
+ all.add(n);
110
+ const anchor = (block.children || []).filter((c) => Array.isArray(c.marks) && md._key && c.marks.includes(md._key)).map((c) => c.text || "").join("").trim();
111
+ if (anchor && !anchorByUrl.has(n)) anchorByUrl.set(n, anchor);
63
112
  }
64
113
  }
65
114
  }
66
- }
67
- if (Array.isArray(blocks)) {
68
115
  for (const block of blocks) {
69
116
  if (block._type === "block" && Array.isArray(block.children)) {
70
117
  const blockText = block.children.map((c) => c.text || "").join(" ");
71
- const matches = blockText.match(/https?:\/\/[^\s"'<>)\]]+/g);
72
- if (matches) matches.forEach((u) => urls.add(u.replace(/[.,;:!?]+$/, "")));
118
+ const matches = blockText.match(/(?:https?:\/\/|www\.)[^\s"'<>)\]]+/gi);
119
+ if (matches) for (const u of matches) {
120
+ const n = normalizeLink(u);
121
+ if (n) all.add(n);
122
+ }
73
123
  }
74
124
  }
75
125
  }
76
- return Array.from(urls);
126
+ return [...all].map((url) => ({ url, hyperlinked: linked.has(url), anchorText: anchorByUrl.get(url) }));
127
+ }
128
+ function extractBodyLinks(blocks) {
129
+ return extractBodyLinksDetailed(blocks).map((l) => l.url);
77
130
  }
78
131
  function detectSlug(val) {
79
132
  if (!val) return void 0;
@@ -148,6 +201,86 @@ function detectAuthor(val) {
148
201
  }
149
202
  return { authorIsReference: false };
150
203
  }
204
+ var FACT_CHECK_STATUS_WORDS = /* @__PURE__ */ new Set([
205
+ "pending",
206
+ "approved",
207
+ "rejected",
208
+ "done",
209
+ "complete",
210
+ "completed",
211
+ "in review",
212
+ "in progress",
213
+ "not started",
214
+ "draft",
215
+ "review",
216
+ "reviewed",
217
+ "unreviewed",
218
+ "checked",
219
+ "unchecked",
220
+ "verified",
221
+ "unverified",
222
+ "true",
223
+ "false",
224
+ "yes",
225
+ "no",
226
+ "n/a",
227
+ "na",
228
+ "none",
229
+ "tbd",
230
+ "todo",
231
+ "to do"
232
+ ]);
233
+ function isLikelyPersonName(s) {
234
+ const t = s.trim().toLowerCase();
235
+ if (!t || FACT_CHECK_STATUS_WORDS.has(t)) return false;
236
+ return /[a-z]/i.test(s);
237
+ }
238
+ function detectFactChecker(val) {
239
+ if (!val) return { factCheckerIsReference: false };
240
+ const candidateFields = [
241
+ "factChecker",
242
+ "factCheckers",
243
+ "factCheckedBy",
244
+ "reviewer",
245
+ "reviewers",
246
+ "reviewedBy",
247
+ "medicalReviewer",
248
+ "medicallyReviewedBy"
249
+ ];
250
+ const dynamic = Object.keys(val).filter(
251
+ (k) => (
252
+ // Require "checker"/"checked by"/"reviewer"/"reviewed by" - NOT a bare "check" flag.
253
+ /factchecker|fact.?checked.?by|reviewer|reviewed.?by/i.test(k) && // never date/timestamp fields (lastReviewedAt, medicallyReviewedAt, reviewedDate),
254
+ // free-text/status/flag sidecars (reviewerNotes, reviewStatus), nor image/url/id fields.
255
+ !/at$|date$|on$|url|link|count|note|comment|status|flag|bool|photo|image|avatar|picture|id$/i.test(k)
256
+ )
257
+ );
258
+ const fields = Array.from(/* @__PURE__ */ new Set([...candidateFields, ...dynamic]));
259
+ for (const f of fields) {
260
+ const raw = val[f];
261
+ if (!raw) continue;
262
+ if (Array.isArray(raw)) {
263
+ const names = raw.filter((x) => typeof x === "string" && isLikelyPersonName(x)).map((x) => x.trim());
264
+ if (names.length > 0) return { factCheckerName: names.slice(0, 3).join(", "), factCheckerIsReference: false };
265
+ }
266
+ const first = Array.isArray(raw) ? raw[0] : raw;
267
+ if (!first) continue;
268
+ if (typeof first === "string") {
269
+ const trimmed = first.trim();
270
+ if (trimmed && isLikelyPersonName(trimmed)) return { factCheckerName: trimmed, factCheckerIsReference: false };
271
+ continue;
272
+ }
273
+ if (typeof first === "object" && first !== null) {
274
+ const o = first;
275
+ const name = [o.name, o.fullName, o.displayName].find((v) => typeof v === "string" && isLikelyPersonName(v));
276
+ if (name) return { factCheckerName: name, factCheckerIsReference: false };
277
+ if (typeof o._ref === "string" || o._type === "reference") {
278
+ return { factCheckerIsReference: true };
279
+ }
280
+ }
281
+ }
282
+ return { factCheckerIsReference: false };
283
+ }
151
284
  function extractImageMeta(value) {
152
285
  const names = [];
153
286
  const titles = [];
@@ -186,6 +319,7 @@ function buildDocumentFields(value) {
186
319
  const title = typeof val?.title === "string" ? val.title : void 0;
187
320
  const body = val?.body;
188
321
  const { authorName, authorCredentials, authorBioUrl, authorIsReference } = detectAuthor(val);
322
+ const { factCheckerName, factCheckerIsReference } = detectFactChecker(val);
189
323
  const imageMeta = val ? extractImageMeta(val) : { names: [], titles: [], count: 0 };
190
324
  return {
191
325
  title: title || void 0,
@@ -197,13 +331,17 @@ function buildDocumentFields(value) {
197
331
  imageCount: imageMeta.count,
198
332
  headings: extractHeadings(body),
199
333
  headingsDetailed: extractHeadingsDetailed(body),
334
+ unstyledHeadings: extractUnstyledHeadings(body),
200
335
  bodyLinks: extractBodyLinks(body),
336
+ bodyLinksDetailed: extractBodyLinksDetailed(body),
201
337
  contentCategory: typeof val?.contentCategory === "string" ? val.contentCategory : typeof val?.category === "string" ? val.category : void 0,
202
338
  contentPlacement: Array.isArray(val?.contentPlacement) ? val.contentPlacement : void 0,
203
339
  authorName,
204
340
  authorCredentials,
205
341
  authorBioUrl,
206
342
  authorIsReference,
343
+ factCheckerName,
344
+ factCheckerIsReference,
207
345
  // `published` is MJH's date field; `publishedAt`/`publishDate` cover other schemas
208
346
  publishedAt: [val?.publishedAt, val?.publishDate, val?.published, val?._createdAt].find((v) => typeof v === "string" && v.trim().length > 0),
209
347
  // `updatedOn` is MJH's "Updated On" field. `updatedAt` is the standard Sanity convention.
@@ -251,6 +389,15 @@ function useDocumentContent() {
251
389
  // src/hooks/useKeywordAnalysis.ts
252
390
  import { useState as useState2, useEffect as useEffect2, useCallback, useRef as useRef2 } from "react";
253
391
 
392
+ // src/lib/apiKey.ts
393
+ var SHARED_CLIENT_KEY = "seo-copilot-public-client-key-v1";
394
+ function authHeaders() {
395
+ return { "x-api-key": SHARED_CLIENT_KEY };
396
+ }
397
+ function jsonHeaders() {
398
+ return { "Content-Type": "application/json", ...authHeaders() };
399
+ }
400
+
254
401
  // src/lib/api.ts
255
402
  function safeParseJson(text) {
256
403
  try {
@@ -271,7 +418,7 @@ function safeParseJson(text) {
271
418
  async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword, secondaryKeyword, signal) {
272
419
  const response = await fetch(`${apiUrl}/api/seo-copilot/analyze`, {
273
420
  method: "POST",
274
- headers: { "Content-Type": "application/json" },
421
+ headers: jsonHeaders(),
275
422
  body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword, secondaryKeyword }),
276
423
  signal
277
424
  });
@@ -286,7 +433,7 @@ async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, d
286
433
  async function fetchChatStream(apiUrl, messages, documentContext, publication, keywordPanelData, signal) {
287
434
  const response = await fetch(`${apiUrl}/api/seo-copilot/chat`, {
288
435
  method: "POST",
289
- headers: { "Content-Type": "application/json" },
436
+ headers: jsonHeaders(),
290
437
  body: JSON.stringify({ messages, documentContext, publication, keywordPanelData }),
291
438
  signal
292
439
  });
@@ -298,16 +445,17 @@ async function fetchChatStream(apiUrl, messages, documentContext, publication, k
298
445
  return response.body;
299
446
  }
300
447
  async function submitFeedback(apiUrl, data) {
301
- await fetch(`${apiUrl}/api/seo-copilot/feedback`, {
448
+ const res = await fetch(`${apiUrl}/api/seo-copilot/feedback`, {
302
449
  method: "POST",
303
- headers: { "Content-Type": "application/json" },
450
+ headers: jsonHeaders(),
304
451
  body: JSON.stringify(data)
305
452
  });
453
+ if (!res.ok) throw new Error(`Feedback submit failed: HTTP ${res.status}`);
306
454
  }
307
455
  async function lookupKeywords(apiUrl, keywords, signal) {
308
456
  const response = await fetch(`${apiUrl}/api/seo-copilot/keywords`, {
309
457
  method: "POST",
310
- headers: { "Content-Type": "application/json" },
458
+ headers: jsonHeaders(),
311
459
  body: JSON.stringify({ keywords }),
312
460
  signal
313
461
  });
@@ -321,7 +469,8 @@ async function lookupKeywords(apiUrl, keywords, signal) {
321
469
  async function loadChatHistory(apiUrl, userId, documentId) {
322
470
  try {
323
471
  const res = await fetch(
324
- `${apiUrl}/api/seo-copilot/chat-history?userId=${encodeURIComponent(userId)}&documentId=${encodeURIComponent(documentId)}`
472
+ `${apiUrl}/api/seo-copilot/chat-history?userId=${encodeURIComponent(userId)}&documentId=${encodeURIComponent(documentId)}`,
473
+ { headers: authHeaders() }
325
474
  );
326
475
  if (!res.ok) return [];
327
476
  const data = await res.json();
@@ -335,7 +484,7 @@ async function fetchContentSuggestions(apiUrl, content, primaryKeyword, publicat
335
484
  try {
336
485
  const res = await fetch(`${apiUrl}/api/seo-copilot/content-suggestions`, {
337
486
  method: "POST",
338
- headers: { "Content-Type": "application/json" },
487
+ headers: jsonHeaders(),
339
488
  body: JSON.stringify({ content, primaryKeyword, publication }),
340
489
  signal
341
490
  });
@@ -356,7 +505,7 @@ async function fetchLinkingSuggestions(apiUrl, content, primaryKeyword, supporti
356
505
  try {
357
506
  const res = await fetch(`${apiUrl}/api/seo-copilot/linking-suggestions`, {
358
507
  method: "POST",
359
- headers: { "Content-Type": "application/json" },
508
+ headers: jsonHeaders(),
360
509
  body: JSON.stringify({ content, primaryKeyword, supportingKeywords, currentDocumentId, publication }),
361
510
  signal
362
511
  });
@@ -373,7 +522,7 @@ async function checkLinks(apiUrl, urls) {
373
522
  try {
374
523
  const res = await fetch(`${apiUrl}/api/seo-copilot/check-links`, {
375
524
  method: "POST",
376
- headers: { "Content-Type": "application/json" },
525
+ headers: jsonHeaders(),
377
526
  body: JSON.stringify({ urls })
378
527
  });
379
528
  if (!res.ok) return [];
@@ -388,7 +537,7 @@ async function saveChatHistory(apiUrl, userId, documentId, messages, publication
388
537
  try {
389
538
  await fetch(`${apiUrl}/api/seo-copilot/chat-history`, {
390
539
  method: "POST",
391
- headers: { "Content-Type": "application/json" },
540
+ headers: jsonHeaders(),
392
541
  body: JSON.stringify({ userId, documentId, messages, publication })
393
542
  });
394
543
  } catch {
@@ -1802,7 +1951,7 @@ function SuggestedKeywordsCard({
1802
1951
  const previousSuggestions = forceRegenerate && helpData[term] ? helpData[term].map((s) => s.revised || s.sentence || "").filter(Boolean) : void 0;
1803
1952
  const res = await fetch(`${apiUrl}/api/seo-copilot/keyword-help`, {
1804
1953
  method: "POST",
1805
- headers: { "Content-Type": "application/json" },
1954
+ headers: jsonHeaders(),
1806
1955
  // Clip to 5,000 chars: the backend only reads the first 4,000 anyway, so sending
1807
1956
  // the full article needlessly bloats the request on long pieces.
1808
1957
  body: JSON.stringify({ keyword: term, content: text.slice(0, 5e3), publication, previousSuggestions })
@@ -1830,7 +1979,7 @@ function SuggestedKeywordsCard({
1830
1979
  try {
1831
1980
  const res = await fetch(`${apiUrl}/api/seo-copilot/keywords`, {
1832
1981
  method: "POST",
1833
- headers: { "Content-Type": "application/json" },
1982
+ headers: jsonHeaders(),
1834
1983
  body: JSON.stringify({ keywords: [trimmed] })
1835
1984
  });
1836
1985
  if (res.ok) {
@@ -1911,7 +2060,7 @@ function SuggestedKeywordsCard({
1911
2060
  const existingTerms = allKeywords.map((kw) => kw.term);
1912
2061
  const res = await fetch(`${apiUrl}/api/seo-copilot/more-keywords`, {
1913
2062
  method: "POST",
1914
- headers: { "Content-Type": "application/json" },
2063
+ headers: jsonHeaders(),
1915
2064
  body: JSON.stringify({ content: text, existingKeywords: existingTerms, publication })
1916
2065
  });
1917
2066
  if (res.ok) {
@@ -3119,12 +3268,219 @@ function OnboardingCard({ onDismiss, closing }) {
3119
3268
  ] });
3120
3269
  }
3121
3270
 
3271
+ // src/components/ReportProblemButton.tsx
3272
+ import { useState as useState11, useRef as useRef10, useEffect as useEffect9 } from "react";
3273
+ import { useCurrentUser as useCurrentUser3 } from "sanity";
3274
+ import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
3275
+ function ReportProblemButton({ activeTab, publication, documentId, documentType, primaryKeyword }) {
3276
+ const { apiUrl } = useConfig();
3277
+ const sanityUser = useCurrentUser3();
3278
+ const [open, setOpen] = useState11(false);
3279
+ const [text, setText] = useState11("");
3280
+ const [submitting, setSubmitting] = useState11(false);
3281
+ const [submitted, setSubmitted] = useState11(false);
3282
+ const [failed, setFailed] = useState11(false);
3283
+ const popRef = useRef10(null);
3284
+ const textareaRef = useRef10(null);
3285
+ const closeTimer = useRef10(null);
3286
+ const mounted = useRef10(true);
3287
+ useEffect9(() => () => {
3288
+ mounted.current = false;
3289
+ if (closeTimer.current) clearTimeout(closeTimer.current);
3290
+ }, []);
3291
+ useEffect9(() => {
3292
+ if (!open) return;
3293
+ const handler = (e) => {
3294
+ if (popRef.current && !popRef.current.contains(e.target)) setOpen(false);
3295
+ };
3296
+ document.addEventListener("mousedown", handler);
3297
+ return () => document.removeEventListener("mousedown", handler);
3298
+ }, [open]);
3299
+ useEffect9(() => {
3300
+ if (open) setTimeout(() => textareaRef.current?.focus(), 50);
3301
+ }, [open]);
3302
+ const handleSubmit = async () => {
3303
+ const trimmed = text.trim();
3304
+ if (!trimmed || submitting) return;
3305
+ setFailed(false);
3306
+ setSubmitting(true);
3307
+ try {
3308
+ await submitFeedback(apiUrl, {
3309
+ suggestion_type: "bug_report",
3310
+ suggestion_text: trimmed.slice(0, 1e4),
3311
+ vote: "down",
3312
+ document_id: documentId,
3313
+ publication,
3314
+ user_id: sanityUser?.id,
3315
+ context: {
3316
+ surface: "sanity-plugin",
3317
+ activeTab,
3318
+ primaryKeyword: primaryKeyword || void 0,
3319
+ documentType,
3320
+ url: typeof window !== "undefined" && /^https?:\/\//i.test(window.location.href) ? window.location.href.slice(0, 500) : void 0,
3321
+ userAgent: typeof navigator !== "undefined" ? navigator.userAgent.slice(0, 500) : void 0,
3322
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
3323
+ }
3324
+ });
3325
+ } catch (e) {
3326
+ console.error("[SEO Copilot] failed to send problem report:", e);
3327
+ if (mounted.current) {
3328
+ setSubmitting(false);
3329
+ setFailed(true);
3330
+ }
3331
+ return;
3332
+ }
3333
+ if (!mounted.current) return;
3334
+ setSubmitting(false);
3335
+ setSubmitted(true);
3336
+ closeTimer.current = setTimeout(() => {
3337
+ if (!mounted.current) return;
3338
+ setOpen(false);
3339
+ setSubmitted(false);
3340
+ setText("");
3341
+ }, 1500);
3342
+ };
3343
+ return /* @__PURE__ */ jsxs8("div", { style: { position: "relative", display: "flex" }, children: [
3344
+ /* @__PURE__ */ jsxs8(
3345
+ "button",
3346
+ {
3347
+ type: "button",
3348
+ onClick: (e) => {
3349
+ e.stopPropagation();
3350
+ if (closeTimer.current) {
3351
+ clearTimeout(closeTimer.current);
3352
+ closeTimer.current = null;
3353
+ }
3354
+ setOpen((o) => !o);
3355
+ },
3356
+ onMouseDown: (e) => e.stopPropagation(),
3357
+ "aria-label": "Report a problem",
3358
+ title: "Report a problem",
3359
+ style: {
3360
+ display: "inline-flex",
3361
+ alignItems: "center",
3362
+ gap: 4,
3363
+ padding: "3px 8px",
3364
+ borderRadius: 99,
3365
+ border: `1px solid ${open ? MJH_BLUE : "#d1d5db"}`,
3366
+ background: open ? "rgba(0,93,172,0.08)" : "rgba(255,255,255,0.6)",
3367
+ cursor: "pointer",
3368
+ fontSize: 10,
3369
+ fontWeight: 600,
3370
+ color: open ? MJH_BLUE : "#6b7280",
3371
+ whiteSpace: "nowrap",
3372
+ transition: "all 150ms"
3373
+ },
3374
+ children: [
3375
+ /* @__PURE__ */ jsx9("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx9("path", { d: "M3 2.75a.75.75 0 00-1.5 0v14.5a.75.75 0 001.5 0v-4.392l1.657-.348a6.449 6.449 0 014.271.572 7.948 7.948 0 005.965.524l2.078-.64A.75.75 0 0017.5 12.25v-8.5a.75.75 0 00-.904-.734l-1.74.348a7.948 7.948 0 01-5.965-.524 6.449 6.449 0 00-4.271-.572L3 2.842V2.75z" }) }),
3376
+ "Report a problem"
3377
+ ]
3378
+ }
3379
+ ),
3380
+ open && /* @__PURE__ */ jsx9(
3381
+ "div",
3382
+ {
3383
+ ref: popRef,
3384
+ onMouseDown: (e) => e.stopPropagation(),
3385
+ style: {
3386
+ position: "absolute",
3387
+ top: "100%",
3388
+ right: 0,
3389
+ marginTop: 6,
3390
+ width: 260,
3391
+ padding: 12,
3392
+ borderRadius: 10,
3393
+ background: "#ffffff",
3394
+ boxShadow: "0 6px 22px rgba(0,0,0,0.16), 0 1px 4px rgba(0,0,0,0.1)",
3395
+ border: "1px solid #e5e7eb",
3396
+ zIndex: 100
3397
+ },
3398
+ children: submitted ? /* @__PURE__ */ jsx9("div", { style: { fontSize: 12, color: "#16a34a", textAlign: "center", padding: "6px 0", fontWeight: 600 }, children: "Thanks - we got it." }) : /* @__PURE__ */ jsxs8(Fragment5, { children: [
3399
+ /* @__PURE__ */ jsx9("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 3 }, children: "Report a problem" }),
3400
+ /* @__PURE__ */ jsx9("div", { style: { fontSize: 10.5, color: "#6b7280", marginBottom: 8, lineHeight: 1.45 }, children: "Beta - tell us what went wrong. We also note which tab you're on to help us track it down." }),
3401
+ failed && /* @__PURE__ */ jsx9("div", { style: { fontSize: 10.5, color: "#dc2626", marginBottom: 8, lineHeight: 1.45, fontWeight: 600 }, children: "Couldn't send - please try again." }),
3402
+ /* @__PURE__ */ jsx9(
3403
+ "textarea",
3404
+ {
3405
+ ref: textareaRef,
3406
+ value: text,
3407
+ onChange: (e) => setText(e.target.value),
3408
+ onKeyDown: (e) => {
3409
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
3410
+ e.preventDefault();
3411
+ handleSubmit();
3412
+ }
3413
+ },
3414
+ placeholder: "What happened? The more detail, the better.",
3415
+ rows: 4,
3416
+ maxLength: 4e3,
3417
+ style: {
3418
+ width: "100%",
3419
+ padding: "6px 8px",
3420
+ fontSize: 11,
3421
+ borderRadius: 6,
3422
+ border: "1px solid #e5e7eb",
3423
+ outline: "none",
3424
+ fontFamily: "inherit",
3425
+ resize: "vertical",
3426
+ boxSizing: "border-box",
3427
+ lineHeight: 1.5
3428
+ }
3429
+ }
3430
+ ),
3431
+ /* @__PURE__ */ jsxs8("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: 8, gap: 6 }, children: [
3432
+ /* @__PURE__ */ jsx9(
3433
+ "button",
3434
+ {
3435
+ type: "button",
3436
+ onClick: () => {
3437
+ setOpen(false);
3438
+ setText("");
3439
+ },
3440
+ style: {
3441
+ padding: "4px 10px",
3442
+ fontSize: 10.5,
3443
+ borderRadius: 5,
3444
+ border: "1px solid #e5e7eb",
3445
+ background: "#ffffff",
3446
+ color: "#4b5563",
3447
+ cursor: "pointer"
3448
+ },
3449
+ children: "Cancel"
3450
+ }
3451
+ ),
3452
+ /* @__PURE__ */ jsx9(
3453
+ "button",
3454
+ {
3455
+ type: "button",
3456
+ onClick: handleSubmit,
3457
+ disabled: !text.trim() || submitting,
3458
+ style: {
3459
+ padding: "4px 12px",
3460
+ fontSize: 10.5,
3461
+ borderRadius: 5,
3462
+ border: "none",
3463
+ background: !text.trim() || submitting ? "#cbd5e1" : MJH_BLUE,
3464
+ color: "#ffffff",
3465
+ cursor: !text.trim() || submitting ? "default" : "pointer",
3466
+ fontWeight: 700
3467
+ },
3468
+ children: submitting ? "Sending..." : "Send"
3469
+ }
3470
+ )
3471
+ ] })
3472
+ ] })
3473
+ }
3474
+ )
3475
+ ] });
3476
+ }
3477
+
3122
3478
  // src/components/tabs/SummaryTab.tsx
3123
- import { useMemo, useState as useState12 } from "react";
3479
+ import { useMemo, useState as useState13 } from "react";
3124
3480
 
3125
3481
  // src/components/ShimmerLoader.tsx
3126
- import { useEffect as useEffect9, useState as useState11 } from "react";
3127
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
3482
+ import { useEffect as useEffect10, useState as useState12 } from "react";
3483
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
3128
3484
  var keyframesInjected = false;
3129
3485
  var KEYFRAMES = `
3130
3486
  @keyframes seo-copilot-text-shimmer {
@@ -3133,13 +3489,13 @@ var KEYFRAMES = `
3133
3489
  }
3134
3490
  `;
3135
3491
  function LoaderBars({ color = MJH_GOLD }) {
3136
- return /* @__PURE__ */ jsx9(
3492
+ return /* @__PURE__ */ jsx10(
3137
3493
  "div",
3138
3494
  {
3139
3495
  role: "status",
3140
3496
  "aria-label": "Loading",
3141
3497
  style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: 14, flexShrink: 0 },
3142
- children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx9(
3498
+ children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx10(
3143
3499
  "div",
3144
3500
  {
3145
3501
  style: {
@@ -3161,8 +3517,8 @@ function ShimmerLoader({
3161
3517
  textSize = 14,
3162
3518
  iconColor = MJH_GOLD
3163
3519
  }) {
3164
- const [idx, setIdx] = useState11(0);
3165
- useEffect9(() => {
3520
+ const [idx, setIdx] = useState12(0);
3521
+ useEffect10(() => {
3166
3522
  if (typeof window !== "undefined" && !keyframesInjected) {
3167
3523
  keyframesInjected = true;
3168
3524
  const style = document.createElement("style");
@@ -3171,7 +3527,7 @@ function ShimmerLoader({
3171
3527
  document.head.appendChild(style);
3172
3528
  }
3173
3529
  }, []);
3174
- useEffect9(() => {
3530
+ useEffect10(() => {
3175
3531
  if (messages.length <= 1) return;
3176
3532
  const id = setInterval(() => {
3177
3533
  setIdx((i) => (i + 1) % messages.length);
@@ -3179,7 +3535,7 @@ function ShimmerLoader({
3179
3535
  return () => clearInterval(id);
3180
3536
  }, [messages.length, intervalMs]);
3181
3537
  const text = messages[idx] || messages[0] || "";
3182
- return /* @__PURE__ */ jsxs8(
3538
+ return /* @__PURE__ */ jsxs9(
3183
3539
  "div",
3184
3540
  {
3185
3541
  style: {
@@ -3191,8 +3547,8 @@ function ShimmerLoader({
3191
3547
  letterSpacing: "0.01em"
3192
3548
  },
3193
3549
  children: [
3194
- /* @__PURE__ */ jsx9(LoaderBars, { color: iconColor }),
3195
- /* @__PURE__ */ jsx9(
3550
+ /* @__PURE__ */ jsx10(LoaderBars, { color: iconColor }),
3551
+ /* @__PURE__ */ jsx10(
3196
3552
  "span",
3197
3553
  {
3198
3554
  style: {
@@ -3270,9 +3626,9 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
3270
3626
  detail = `Primary keyword over-used at ${density.toFixed(2)}% density - reduce to 0.5-2.5%`;
3271
3627
  }
3272
3628
  }
3273
- components.push({ label: "Primary keyword", points: pts, max: 25, detail });
3629
+ components.push({ label: "Primary keyword usage", points: pts, max: 25, detail });
3274
3630
  } else {
3275
- components.push({ label: "Primary keyword", points: 0, max: 25, detail: "No primary keyword identified yet" });
3631
+ components.push({ label: "Primary keyword usage", points: 0, max: 25, detail: "No primary keyword identified yet" });
3276
3632
  }
3277
3633
  const supportingKws = analysis.supportingKeywords || [];
3278
3634
  if (supportingKws.length > 0) {
@@ -3280,13 +3636,13 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
3280
3636
  const coverageRatio = inContentCount / supportingKws.length;
3281
3637
  const pts = Math.round(coverageRatio * 25);
3282
3638
  components.push({
3283
- label: "Supporting keywords",
3639
+ label: "Supporting keyword coverage",
3284
3640
  points: pts,
3285
3641
  max: 25,
3286
3642
  detail: `${inContentCount} of ${supportingKws.length} supporting keywords present (${Math.round(coverageRatio * 100)}%)`
3287
3643
  });
3288
3644
  } else {
3289
- components.push({ label: "Supporting keywords", points: 0, max: 25, detail: "No supporting keywords yet" });
3645
+ components.push({ label: "Supporting keyword coverage", points: 0, max: 25, detail: "No supporting keywords yet" });
3290
3646
  }
3291
3647
  let wcPts = 0;
3292
3648
  let wcDetail;
@@ -3596,18 +3952,6 @@ function buildSummaryItems(input) {
3596
3952
  });
3597
3953
  }
3598
3954
  if (headingsDetailed) {
3599
- const bodyH1 = headingsDetailed.filter((h) => h.level === 1).length;
3600
- if (bodyH1 > 0) {
3601
- items.push({
3602
- id: "headings-h1-in-body",
3603
- category: "headings",
3604
- severity: "warning",
3605
- label: "H1 inside the body",
3606
- description: `${bodyH1} H1 heading${bodyH1 === 1 ? "" : "s"} in the body of the article.`,
3607
- howToFix: "The article title is your H1. Body headings should start at H2 so the outline isn't ambiguous.",
3608
- jumpTo: { tab: "technical", anchorId: "anchor-headings-structure" }
3609
- });
3610
- }
3611
3955
  let prevLevel = 0;
3612
3956
  let skips = 0;
3613
3957
  for (const h of headingsDetailed) {
@@ -3637,6 +3981,23 @@ function buildSummaryItems(input) {
3637
3981
  jumpTo: { tab: "technical", anchorId: "anchor-headings-structure" }
3638
3982
  });
3639
3983
  }
3984
+ const subheads = headingsDetailed.filter((h) => h.level >= 2);
3985
+ if (subheads.length > 0 && (primaryKeyword || secondaryKeyword)) {
3986
+ const subText = subheads.map((h) => h.text).join(" ");
3987
+ const hasP = primaryKeyword ? containsKeywordTokens(subText, primaryKeyword) : false;
3988
+ const hasS = secondaryKeyword ? containsKeywordTokens(subText, secondaryKeyword) : false;
3989
+ if (!hasP && !hasS) {
3990
+ items.push({
3991
+ id: "headings-keyword-missing",
3992
+ category: "headings",
3993
+ severity: "opportunity",
3994
+ label: "Keyword missing from subheadings",
3995
+ description: "No H2/H3 subheading uses your primary or secondary keyword.",
3996
+ howToFix: "Work your primary or secondary keyword into at least one subheading - keywords in headers reinforce relevance for readers and search.",
3997
+ jumpTo: { tab: "technical", anchorId: "anchor-headings-keyword" }
3998
+ });
3999
+ }
4000
+ }
3640
4001
  }
3641
4002
  const images = documentFields?.imageNames || [];
3642
4003
  if (images.length === 0 && wordCount2 > 300) {
@@ -3889,7 +4250,7 @@ function buildSummaryItems(input) {
3889
4250
  }
3890
4251
 
3891
4252
  // src/components/tabs/SummaryTab.tsx
3892
- import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
4253
+ import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
3893
4254
  var cardStyle2 = {
3894
4255
  borderRadius: 14,
3895
4256
  background: "rgba(255,255,255,0.55)",
@@ -3911,11 +4272,16 @@ function scoreColors(score) {
3911
4272
  if (score >= 40) return { bg: "rgba(230,192,27,0.15)", text: "#8B7310", label: "Decent" };
3912
4273
  return { bg: "rgba(220,38,38,0.08)", text: "#dc2626", label: "Needs work" };
3913
4274
  }
4275
+ function componentTier(pct) {
4276
+ if (pct >= 75) return { label: "Strong", color: "#16a34a", bar: "#16a34a" };
4277
+ if (pct >= 40) return { label: "OK", color: "#8B7310", bar: "#E6C01B" };
4278
+ return { label: "Low", color: "#dc2626", bar: "#dc2626" };
4279
+ }
3914
4280
  function ScoreBadge({ score, breakdown }) {
3915
4281
  const c = scoreColors(score);
3916
- return /* @__PURE__ */ jsxs9("div", { style: cardStyle2, children: [
3917
- /* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
3918
- /* @__PURE__ */ jsxs9(
4282
+ return /* @__PURE__ */ jsxs10("div", { style: cardStyle2, children: [
4283
+ /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
4284
+ /* @__PURE__ */ jsx11(
3919
4285
  "div",
3920
4286
  {
3921
4287
  style: {
@@ -3924,37 +4290,28 @@ function ScoreBadge({ score, breakdown }) {
3924
4290
  borderRadius: "50%",
3925
4291
  background: c.bg,
3926
4292
  display: "flex",
3927
- flexDirection: "column",
3928
4293
  alignItems: "center",
3929
4294
  justifyContent: "center",
3930
- flexShrink: 0,
3931
- lineHeight: 1
4295
+ flexShrink: 0
3932
4296
  },
3933
- children: [
3934
- /* @__PURE__ */ jsx10("span", { style: { fontSize: 20, fontWeight: 700, color: c.text }, children: score }),
3935
- /* @__PURE__ */ jsx10("span", { style: { fontSize: 8, fontWeight: 700, color: c.text, opacity: 0.7, letterSpacing: "0.06em", marginTop: 2 }, children: "/ 100" })
3936
- ]
4297
+ children: /* @__PURE__ */ jsx11("div", { style: { width: 22, height: 22, borderRadius: "50%", background: c.text, opacity: 0.9 } })
3937
4298
  }
3938
4299
  ),
3939
- /* @__PURE__ */ jsxs9("div", { style: { flex: 1, minWidth: 0 }, children: [
3940
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
3941
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 14, fontWeight: 700, color: c.text }, children: c.label })
4300
+ /* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
4301
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
4302
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 16, fontWeight: 700, color: c.text }, children: c.label })
3942
4303
  ] })
3943
4304
  ] }),
3944
- breakdown.length > 0 && /* @__PURE__ */ jsx10("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
4305
+ breakdown.length > 0 && /* @__PURE__ */ jsx11("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
3945
4306
  const pct = comp.max > 0 ? comp.points / comp.max * 100 : 0;
3946
- const barColor = pct >= 75 ? "#16a34a" : pct >= 40 ? "#E6C01B" : "#dc2626";
3947
- return /* @__PURE__ */ jsxs9("div", { children: [
3948
- /* @__PURE__ */ jsxs9("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
3949
- /* @__PURE__ */ jsx10("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
3950
- /* @__PURE__ */ jsxs9("span", { style: { fontSize: 11, color: "#4b5563", fontVariantNumeric: "tabular-nums" }, children: [
3951
- comp.points,
3952
- " / ",
3953
- comp.max
3954
- ] })
4307
+ const tier = componentTier(pct);
4308
+ return /* @__PURE__ */ jsxs10("div", { children: [
4309
+ /* @__PURE__ */ jsxs10("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
4310
+ /* @__PURE__ */ jsx11("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
4311
+ /* @__PURE__ */ jsx11("span", { style: { fontSize: 9.5, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.04em", color: tier.color }, children: tier.label })
3955
4312
  ] }),
3956
- /* @__PURE__ */ jsx10("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ jsx10("div", { style: { width: `${pct}%`, height: "100%", background: barColor, transition: "width 200ms" } }) }),
3957
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
4313
+ /* @__PURE__ */ jsx11("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ jsx11("div", { style: { width: `${pct}%`, height: "100%", background: tier.bar, transition: "width 200ms" } }) }),
4314
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
3958
4315
  ] }, i);
3959
4316
  }) })
3960
4317
  ] });
@@ -3968,7 +4325,7 @@ function ItemCard({ item, onClick }) {
3968
4325
  const v = severityVisual(item.severity);
3969
4326
  const tab = item.jumpTo.tab;
3970
4327
  const tabLabel = TAB_LABEL[tab] ?? tab.charAt(0).toUpperCase() + tab.slice(1);
3971
- return /* @__PURE__ */ jsxs9(
4328
+ return /* @__PURE__ */ jsxs10(
3972
4329
  "div",
3973
4330
  {
3974
4331
  onClick,
@@ -3985,8 +4342,8 @@ function ItemCard({ item, onClick }) {
3985
4342
  cursor: "pointer"
3986
4343
  },
3987
4344
  children: [
3988
- /* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
3989
- /* @__PURE__ */ jsx10(
4345
+ /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
4346
+ /* @__PURE__ */ jsx11(
3990
4347
  "div",
3991
4348
  {
3992
4349
  style: {
@@ -3999,12 +4356,12 @@ function ItemCard({ item, onClick }) {
3999
4356
  }
4000
4357
  }
4001
4358
  ),
4002
- /* @__PURE__ */ jsxs9("div", { style: { flex: 1, minWidth: 0 }, children: [
4003
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
4004
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
4359
+ /* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
4360
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
4361
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
4005
4362
  ] })
4006
4363
  ] }),
4007
- /* @__PURE__ */ jsxs9(
4364
+ /* @__PURE__ */ jsxs10(
4008
4365
  "div",
4009
4366
  {
4010
4367
  style: {
@@ -4016,12 +4373,12 @@ function ItemCard({ item, onClick }) {
4016
4373
  lineHeight: 1.55
4017
4374
  },
4018
4375
  children: [
4019
- /* @__PURE__ */ jsx10("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
4376
+ /* @__PURE__ */ jsx11("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
4020
4377
  item.howToFix
4021
4378
  ]
4022
4379
  }
4023
4380
  ),
4024
- item.jumpTo.tab !== "summary" && /* @__PURE__ */ jsx10("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs9("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
4381
+ item.jumpTo.tab !== "summary" && /* @__PURE__ */ jsx11("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs10("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
4025
4382
  "Go to ",
4026
4383
  tabLabel,
4027
4384
  " \u203A"
@@ -4037,7 +4394,7 @@ function FilterChip({
4037
4394
  count,
4038
4395
  dotColor
4039
4396
  }) {
4040
- return /* @__PURE__ */ jsxs9(
4397
+ return /* @__PURE__ */ jsxs10(
4041
4398
  "button",
4042
4399
  {
4043
4400
  onClick,
@@ -4056,9 +4413,9 @@ function FilterChip({
4056
4413
  transition: "all 150ms"
4057
4414
  },
4058
4415
  children: [
4059
- dotColor && /* @__PURE__ */ jsx10("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
4060
- /* @__PURE__ */ jsx10("span", { children: label }),
4061
- /* @__PURE__ */ jsx10("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
4416
+ dotColor && /* @__PURE__ */ jsx11("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
4417
+ /* @__PURE__ */ jsx11("span", { children: label }),
4418
+ /* @__PURE__ */ jsx11("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
4062
4419
  ]
4063
4420
  }
4064
4421
  );
@@ -4096,7 +4453,7 @@ function SummaryTab({
4096
4453
  }),
4097
4454
  [analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text, primaryKeyword, secondaryKeyword]
4098
4455
  );
4099
- const [filter, setFilter] = useState12("all");
4456
+ const [filter, setFilter] = useState13("all");
4100
4457
  const counts = useMemo(
4101
4458
  () => ({
4102
4459
  all: items.length,
@@ -4108,15 +4465,15 @@ function SummaryTab({
4108
4465
  );
4109
4466
  const filtered = filter === "all" ? items : items.filter((i) => i.severity === filter);
4110
4467
  if (!analysis) {
4111
- return /* @__PURE__ */ jsxs9("div", { style: { padding: 24, textAlign: "center" }, children: [
4112
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
4113
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
4468
+ return /* @__PURE__ */ jsxs10("div", { style: { padding: 24, textAlign: "center" }, children: [
4469
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
4470
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
4114
4471
  ] });
4115
4472
  }
4116
- return /* @__PURE__ */ jsxs9("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4117
- score != null && scoreDetail && /* @__PURE__ */ jsx10(ScoreBadge, { score, breakdown: scoreDetail.components }),
4118
- /* @__PURE__ */ jsxs9("div", { style: cardStyle2, children: [
4119
- isAnyLoading ? /* @__PURE__ */ jsx10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ jsx10(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ jsx10(
4473
+ return /* @__PURE__ */ jsxs10("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4474
+ score != null && scoreDetail && /* @__PURE__ */ jsx11(ScoreBadge, { score, breakdown: scoreDetail.components }),
4475
+ /* @__PURE__ */ jsxs10("div", { style: cardStyle2, children: [
4476
+ isAnyLoading ? /* @__PURE__ */ jsx11("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ jsx11(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ jsx11(
4120
4477
  "button",
4121
4478
  {
4122
4479
  onClick: onGenerateAll,
@@ -4144,24 +4501,24 @@ function SummaryTab({
4144
4501
  children: "Run all analyses"
4145
4502
  }
4146
4503
  ),
4147
- /* @__PURE__ */ jsxs9("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
4504
+ /* @__PURE__ */ jsxs10("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
4148
4505
  "Runs the analyses that fill the ",
4149
- /* @__PURE__ */ jsx10("strong", { children: "AEO/GEO" }),
4506
+ /* @__PURE__ */ jsx11("strong", { children: "AEO/GEO" }),
4150
4507
  ", ",
4151
- /* @__PURE__ */ jsx10("strong", { children: "Linking" }),
4508
+ /* @__PURE__ */ jsx11("strong", { children: "Linking" }),
4152
4509
  ", and ",
4153
- /* @__PURE__ */ jsx10("strong", { children: "Other Recs" }),
4510
+ /* @__PURE__ */ jsx11("strong", { children: "Other Recs" }),
4154
4511
  " tabs. New issues they find appear in this Summary as each one finishes."
4155
4512
  ] })
4156
4513
  ] }),
4157
- /* @__PURE__ */ jsxs9("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
4158
- /* @__PURE__ */ jsx10(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
4159
- /* @__PURE__ */ jsx10(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
4160
- /* @__PURE__ */ jsx10(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
4161
- /* @__PURE__ */ jsx10(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
4514
+ /* @__PURE__ */ jsxs10("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
4515
+ /* @__PURE__ */ jsx11(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
4516
+ /* @__PURE__ */ jsx11(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
4517
+ /* @__PURE__ */ jsx11(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
4518
+ /* @__PURE__ */ jsx11(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
4162
4519
  ] }),
4163
- /* @__PURE__ */ jsx10("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ jsx10("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ jsxs9(Fragment5, { children: [
4164
- /* @__PURE__ */ jsx10(
4520
+ /* @__PURE__ */ jsx11("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ jsx11("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
4521
+ /* @__PURE__ */ jsx11(
4165
4522
  "div",
4166
4523
  {
4167
4524
  style: {
@@ -4174,21 +4531,21 @@ function SummaryTab({
4174
4531
  justifyContent: "center",
4175
4532
  margin: "0 auto 8px"
4176
4533
  },
4177
- children: /* @__PURE__ */ jsx10("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ jsx10("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) })
4534
+ children: /* @__PURE__ */ jsx11("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ jsx11("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) })
4178
4535
  }
4179
4536
  ),
4180
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
4181
- /* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
4182
- ] }) : /* @__PURE__ */ jsx10("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ jsx10(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
4183
- isAnyLoading && items.length > 0 && /* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
4184
- /* @__PURE__ */ jsx10(LoadingBars, { size: "xs", color: MJH_BLUE }),
4185
- /* @__PURE__ */ jsx10("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
4537
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
4538
+ /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
4539
+ ] }) : /* @__PURE__ */ jsx11("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ jsx11(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
4540
+ isAnyLoading && items.length > 0 && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
4541
+ /* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: MJH_BLUE }),
4542
+ /* @__PURE__ */ jsx11("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
4186
4543
  ] })
4187
4544
  ] });
4188
4545
  }
4189
4546
 
4190
4547
  // src/components/tabs/AEOTab.tsx
4191
- import { useEffect as useEffect10, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
4548
+ import { useEffect as useEffect11, useMemo as useMemo2, useRef as useRef11, useState as useState14 } from "react";
4192
4549
 
4193
4550
  // src/lib/geoAnalysis.ts
4194
4551
  var FACT_PATTERN = /\d+(?:\.\d+)?\s*%|\b\d{1,3}(?:,\d{3})+\b|\bn\s*=\s*\d+\b|\bp\s*[<=]\s*0?\.\d+\b|\b\d+(?:\.\d+)?\s*(?:patients|participants|subjects|cases|deaths|adverse events|mg|mcg|hours|days|weeks|months|years|fold|x)\b|\b(?:NEJM|JAMA|FDA|EMA|CDC|WHO|NIH|ACC|ASCO|ASH|ESMO|AHA|ACS)\b|\bet al\.?\b|\b(?:phase|stage)\s+(?:I{1,3}V?|1|2|3|4)\b/i;
@@ -4262,7 +4619,7 @@ function analyzeGEO(text, headings) {
4262
4619
  }
4263
4620
 
4264
4621
  // src/components/tabs/AEOTab.tsx
4265
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
4622
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
4266
4623
  var AEO_PURPLE = "#005DAC";
4267
4624
  var GEO_TEAL = "#C9A716";
4268
4625
  var cardStyle3 = {
@@ -4274,7 +4631,7 @@ var cardStyle3 = {
4274
4631
  padding: "14px"
4275
4632
  };
4276
4633
  function AiPill() {
4277
- return /* @__PURE__ */ jsx11(
4634
+ return /* @__PURE__ */ jsx12(
4278
4635
  "span",
4279
4636
  {
4280
4637
  style: {
@@ -4293,16 +4650,16 @@ function AiPill() {
4293
4650
  );
4294
4651
  }
4295
4652
  function SectionHeader2({ label, iconColor, ai }) {
4296
- return /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
4297
- /* @__PURE__ */ jsx11("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4298
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4299
- ai && /* @__PURE__ */ jsx11(AiPill, {})
4653
+ return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
4654
+ /* @__PURE__ */ jsx12("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4655
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4656
+ ai && /* @__PURE__ */ jsx12(AiPill, {})
4300
4657
  ] });
4301
4658
  }
4302
4659
  function CopyButton({ text }) {
4303
- const [copied, setCopied] = useState13(false);
4304
- const copyTimerRef = useRef10(null);
4305
- useEffect10(() => {
4660
+ const [copied, setCopied] = useState14(false);
4661
+ const copyTimerRef = useRef11(null);
4662
+ useEffect11(() => {
4306
4663
  return () => {
4307
4664
  if (copyTimerRef.current) clearTimeout(copyTimerRef.current);
4308
4665
  };
@@ -4315,7 +4672,7 @@ function CopyButton({ text }) {
4315
4672
  } catch {
4316
4673
  }
4317
4674
  };
4318
- return /* @__PURE__ */ jsx11(
4675
+ return /* @__PURE__ */ jsx12(
4319
4676
  "button",
4320
4677
  {
4321
4678
  onClick: handleCopy,
@@ -4334,9 +4691,9 @@ function CopyButton({ text }) {
4334
4691
  transition: "color 150ms"
4335
4692
  },
4336
4693
  title: copied ? "Copied!" : "Copy to clipboard",
4337
- children: copied ? /* @__PURE__ */ jsx11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx11("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) }) : /* @__PURE__ */ jsxs10("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
4338
- /* @__PURE__ */ jsx11("path", { d: "M7 3.5A1.5 1.5 0 018.5 2h3.879a1.5 1.5 0 011.06.44l3.122 3.12A1.5 1.5 0 0117 6.622V12.5a1.5 1.5 0 01-1.5 1.5h-1v-3.379a3 3 0 00-.879-2.121L10.5 5.379A3 3 0 008.379 4.5H7v-1z" }),
4339
- /* @__PURE__ */ jsx11("path", { d: "M4.5 6A1.5 1.5 0 003 7.5v9A1.5 1.5 0 004.5 18h7a1.5 1.5 0 001.5-1.5v-5.879a1.5 1.5 0 00-.44-1.06L9.44 6.439A1.5 1.5 0 008.378 6H4.5z" })
4694
+ children: copied ? /* @__PURE__ */ jsx12("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx12("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) }) : /* @__PURE__ */ jsxs11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
4695
+ /* @__PURE__ */ jsx12("path", { d: "M7 3.5A1.5 1.5 0 018.5 2h3.879a1.5 1.5 0 011.06.44l3.122 3.12A1.5 1.5 0 0117 6.622V12.5a1.5 1.5 0 01-1.5 1.5h-1v-3.379a3 3 0 00-.879-2.121L10.5 5.379A3 3 0 008.379 4.5H7v-1z" }),
4696
+ /* @__PURE__ */ jsx12("path", { d: "M4.5 6A1.5 1.5 0 003 7.5v9A1.5 1.5 0 004.5 18h7a1.5 1.5 0 001.5-1.5v-5.879a1.5 1.5 0 00-.44-1.06L9.44 6.439A1.5 1.5 0 008.378 6H4.5z" })
4340
4697
  ] })
4341
4698
  }
4342
4699
  );
@@ -4351,13 +4708,13 @@ function GEOCard({ geo, publication }) {
4351
4708
  const fdBg = effectiveStatus === "strong" ? "rgba(22,163,74,0.1)" : effectiveStatus === "moderate" ? "rgba(230,192,27,0.15)" : "rgba(220,38,38,0.08)";
4352
4709
  const goodCount = geo.headingAudit.filter((h) => h.status === "good").length;
4353
4710
  const totalHeadings = geo.headingAudit.length;
4354
- return /* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
4355
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
4356
- /* @__PURE__ */ jsx11(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
4357
- /* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
4711
+ return /* @__PURE__ */ jsxs11("div", { style: cardStyle3, children: [
4712
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
4713
+ /* @__PURE__ */ jsx12(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
4714
+ /* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
4358
4715
  ] }),
4359
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10, lineHeight: 1.5 }, children: "How easy this article is for ChatGPT, Perplexity, Gemini, and Google's AI Overviews to cite." }),
4360
- /* @__PURE__ */ jsxs10(
4716
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10, lineHeight: 1.5 }, children: "How easy this article is for ChatGPT, Perplexity, Gemini, and Google's AI Overviews to cite." }),
4717
+ /* @__PURE__ */ jsxs11(
4361
4718
  "div",
4362
4719
  {
4363
4720
  style: {
@@ -4370,7 +4727,7 @@ function GEOCard({ geo, publication }) {
4370
4727
  marginBottom: 8
4371
4728
  },
4372
4729
  children: [
4373
- /* @__PURE__ */ jsxs10(
4730
+ /* @__PURE__ */ jsxs11(
4374
4731
  "div",
4375
4732
  {
4376
4733
  style: {
@@ -4386,17 +4743,17 @@ function GEOCard({ geo, publication }) {
4386
4743
  boxShadow: "0 1px 2px rgba(0,0,0,0.06)"
4387
4744
  },
4388
4745
  children: [
4389
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
4390
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
4746
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
4747
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
4391
4748
  ]
4392
4749
  }
4393
4750
  ),
4394
- /* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
4395
- /* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
4751
+ /* @__PURE__ */ jsxs11("div", { style: { flex: 1, minWidth: 0 }, children: [
4752
+ /* @__PURE__ */ jsxs11("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
4396
4753
  "Fact density: ",
4397
4754
  fdLabel
4398
4755
  ] }),
4399
- /* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
4756
+ /* @__PURE__ */ jsxs11("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
4400
4757
  fd.factCount,
4401
4758
  " specific stat",
4402
4759
  fd.factCount === 1 ? "" : "s",
@@ -4412,7 +4769,7 @@ function GEOCard({ geo, publication }) {
4412
4769
  ]
4413
4770
  }
4414
4771
  ),
4415
- fd.driftPassages > 0 && /* @__PURE__ */ jsxs10(
4772
+ fd.driftPassages > 0 && /* @__PURE__ */ jsxs11(
4416
4773
  "div",
4417
4774
  {
4418
4775
  style: {
@@ -4426,15 +4783,15 @@ function GEOCard({ geo, publication }) {
4426
4783
  lineHeight: 1.45
4427
4784
  },
4428
4785
  children: [
4429
- /* @__PURE__ */ jsx11("strong", { children: fd.driftPassages }),
4786
+ /* @__PURE__ */ jsx12("strong", { children: fd.driftPassages }),
4430
4787
  " passage",
4431
4788
  fd.driftPassages === 1 ? "" : "s",
4432
4789
  " over 200 words with no specific stats or citations. AI engines tend to skip these."
4433
4790
  ]
4434
4791
  }
4435
4792
  ),
4436
- totalHeadings > 0 && /* @__PURE__ */ jsxs10("div", { style: { marginTop: 4 }, children: [
4437
- /* @__PURE__ */ jsxs10(
4793
+ totalHeadings > 0 && /* @__PURE__ */ jsxs11("div", { style: { marginTop: 4 }, children: [
4794
+ /* @__PURE__ */ jsxs11(
4438
4795
  "button",
4439
4796
  {
4440
4797
  onClick: () => setShowDetails((v) => !v),
@@ -4453,22 +4810,22 @@ function GEOCard({ geo, publication }) {
4453
4810
  color: GEO_TEAL
4454
4811
  },
4455
4812
  children: [
4456
- /* @__PURE__ */ jsxs10("span", { children: [
4813
+ /* @__PURE__ */ jsxs11("span", { children: [
4457
4814
  "Short-answer paragraphs: ",
4458
4815
  goodCount,
4459
4816
  "/",
4460
4817
  totalHeadings,
4461
4818
  " headings have one"
4462
4819
  ] }),
4463
- /* @__PURE__ */ jsx11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx11("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
4820
+ /* @__PURE__ */ jsx12("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx12("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
4464
4821
  ]
4465
4822
  }
4466
4823
  ),
4467
- showDetails && /* @__PURE__ */ jsxs10("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
4468
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 4 }, children: "Aim for a 40-60 word answer right after each heading. That's the chunk AI engines extract." }),
4824
+ showDetails && /* @__PURE__ */ jsxs11("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
4825
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 4 }, children: "Aim for a 40-60 word answer right after each heading. That's the chunk AI engines extract." }),
4469
4826
  geo.headingAudit.map((h, i) => {
4470
4827
  const c = h.status === "good" ? { bg: "rgba(22,163,74,0.08)", color: "#16a34a", label: `${h.words} words \u2713` } : h.status === "too-short" ? { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: `${h.words} words - too short` } : h.status === "too-long" ? { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: `${h.words} words - condense to 40-60` } : { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: "no body content" };
4471
- return /* @__PURE__ */ jsxs10(
4828
+ return /* @__PURE__ */ jsxs11(
4472
4829
  "div",
4473
4830
  {
4474
4831
  style: {
@@ -4482,8 +4839,8 @@ function GEOCard({ geo, publication }) {
4482
4839
  gap: 8
4483
4840
  },
4484
4841
  children: [
4485
- /* @__PURE__ */ jsx11("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
4486
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
4842
+ /* @__PURE__ */ jsx12("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
4843
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
4487
4844
  ]
4488
4845
  },
4489
4846
  i
@@ -4520,8 +4877,8 @@ function AEOTab({
4520
4877
  originalHeading: void 0,
4521
4878
  rationale: h.rationale
4522
4879
  })) ?? [];
4523
- return /* @__PURE__ */ jsxs10("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4524
- aeoContentChanged && /* @__PURE__ */ jsxs10(
4880
+ return /* @__PURE__ */ jsxs11("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4881
+ aeoContentChanged && /* @__PURE__ */ jsxs11(
4525
4882
  "div",
4526
4883
  {
4527
4884
  onClick: runDeepAnalysis,
@@ -4544,30 +4901,30 @@ function AEOTab({
4544
4901
  cursor: "pointer"
4545
4902
  },
4546
4903
  children: [
4547
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
4548
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
4904
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
4905
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
4549
4906
  ]
4550
4907
  }
4551
4908
  ),
4552
- hasEnoughTextForGEO && /* @__PURE__ */ jsx11(GEOCard, { geo, publication }),
4553
- hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ jsx11("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
4554
- /* @__PURE__ */ jsx11("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
4909
+ hasEnoughTextForGEO && /* @__PURE__ */ jsx12(GEOCard, { geo, publication }),
4910
+ hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ jsx12("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsxs11("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
4911
+ /* @__PURE__ */ jsx12("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
4555
4912
  " needs at least 150 words to read fact density.",
4556
- /* @__PURE__ */ jsx11("br", {}),
4557
- /* @__PURE__ */ jsxs10("span", { style: { color: "#4b5563" }, children: [
4913
+ /* @__PURE__ */ jsx12("br", {}),
4914
+ /* @__PURE__ */ jsxs11("span", { style: { color: "#4b5563" }, children: [
4558
4915
  "Current: ",
4559
4916
  geoWordCount,
4560
4917
  " word",
4561
4918
  geoWordCount === 1 ? "" : "s"
4562
4919
  ] })
4563
4920
  ] }) }),
4564
- !deepAnalysis && isDeepLoading && /* @__PURE__ */ jsxs10("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
4565
- /* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4566
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
4921
+ !deepAnalysis && isDeepLoading && /* @__PURE__ */ jsxs11("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
4922
+ /* @__PURE__ */ jsx12(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4923
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
4567
4924
  ] }),
4568
- !deepAnalysis && !isDeepLoading && /* @__PURE__ */ jsxs10("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
4569
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
4570
- /* @__PURE__ */ jsx11(
4925
+ !deepAnalysis && !isDeepLoading && /* @__PURE__ */ jsxs11("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
4926
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
4927
+ /* @__PURE__ */ jsx12(
4571
4928
  "button",
4572
4929
  {
4573
4930
  onClick: runDeepAnalysis,
@@ -4587,11 +4944,11 @@ function AEOTab({
4587
4944
  }
4588
4945
  )
4589
4946
  ] }),
4590
- deepAnalysis && !aeo && /* @__PURE__ */ jsx11("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
4591
- questionHeadings.length > 0 && /* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
4592
- /* @__PURE__ */ jsx11(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
4593
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
4594
- /* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ jsxs10(
4947
+ deepAnalysis && !aeo && /* @__PURE__ */ jsx12("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsx12("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
4948
+ questionHeadings.length > 0 && /* @__PURE__ */ jsxs11("div", { style: cardStyle3, children: [
4949
+ /* @__PURE__ */ jsx12(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
4950
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
4951
+ /* @__PURE__ */ jsx12("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ jsxs11(
4595
4952
  "div",
4596
4953
  {
4597
4954
  style: {
@@ -4601,26 +4958,26 @@ function AEOTab({
4601
4958
  borderLeft: `3px solid ${AEO_PURPLE}`
4602
4959
  },
4603
4960
  children: [
4604
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4605
- /* @__PURE__ */ jsxs10("div", { style: { flex: 1 }, children: [
4606
- h.originalHeading && /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
4607
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
4961
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4962
+ /* @__PURE__ */ jsxs11("div", { style: { flex: 1 }, children: [
4963
+ h.originalHeading && /* @__PURE__ */ jsx12("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
4964
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
4608
4965
  ] }),
4609
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4610
- /* @__PURE__ */ jsx11(CopyButton, { text: h.heading }),
4611
- /* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
4966
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4967
+ /* @__PURE__ */ jsx12(CopyButton, { text: h.heading }),
4968
+ /* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
4612
4969
  ] })
4613
4970
  ] }),
4614
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
4971
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
4615
4972
  ]
4616
4973
  },
4617
4974
  i
4618
4975
  )) })
4619
4976
  ] }),
4620
- /* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
4621
- /* @__PURE__ */ jsx11(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
4622
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10 }, children: "Short, citable blocks to use inside or alongside the article - takeaways, infographic ideas, and bullet points." }),
4623
- !contentSuggestions && !isCSLoading && /* @__PURE__ */ jsx11(
4977
+ /* @__PURE__ */ jsxs11("div", { style: cardStyle3, children: [
4978
+ /* @__PURE__ */ jsx12(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
4979
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10 }, children: "Short, citable blocks to use inside or alongside the article - takeaways, infographic ideas, and bullet points." }),
4980
+ !contentSuggestions && !isCSLoading && /* @__PURE__ */ jsx12(
4624
4981
  "button",
4625
4982
  {
4626
4983
  onClick: loadContentSuggestions,
@@ -4644,15 +5001,15 @@ function AEOTab({
4644
5001
  children: "Generate suggestions"
4645
5002
  }
4646
5003
  ),
4647
- isCSLoading && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
4648
- /* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4649
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
5004
+ isCSLoading && /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
5005
+ /* @__PURE__ */ jsx12(LoadingBars, { size: "xs", color: AEO_PURPLE }),
5006
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
4650
5007
  ] }),
4651
- csError && /* @__PURE__ */ jsx11("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
4652
- contentSuggestions && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
4653
- contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
4654
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
4655
- /* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ jsxs10(
5008
+ csError && /* @__PURE__ */ jsx12("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
5009
+ contentSuggestions && /* @__PURE__ */ jsxs11("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
5010
+ contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ jsxs11("div", { children: [
5011
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
5012
+ /* @__PURE__ */ jsx12("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ jsxs11(
4656
5013
  "div",
4657
5014
  {
4658
5015
  style: {
@@ -4665,19 +5022,19 @@ function AEOTab({
4665
5022
  alignItems: "flex-start"
4666
5023
  },
4667
5024
  children: [
4668
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
4669
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4670
- /* @__PURE__ */ jsx11(CopyButton, { text: kt }),
4671
- /* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
5025
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
5026
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
5027
+ /* @__PURE__ */ jsx12(CopyButton, { text: kt }),
5028
+ /* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
4672
5029
  ] })
4673
5030
  ]
4674
5031
  },
4675
5032
  i
4676
5033
  )) })
4677
5034
  ] }),
4678
- contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
4679
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
4680
- /* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ jsxs10(
5035
+ contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ jsxs11("div", { children: [
5036
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
5037
+ /* @__PURE__ */ jsx12("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ jsxs11(
4681
5038
  "div",
4682
5039
  {
4683
5040
  style: {
@@ -4687,23 +5044,23 @@ function AEOTab({
4687
5044
  borderLeft: `2px solid ${AEO_PURPLE}`
4688
5045
  },
4689
5046
  children: [
4690
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4691
- /* @__PURE__ */ jsx11("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
4692
- /* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
5047
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
5048
+ /* @__PURE__ */ jsx12("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
5049
+ /* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
4693
5050
  ] }),
4694
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
5051
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
4695
5052
  ]
4696
5053
  },
4697
5054
  i
4698
5055
  )) })
4699
5056
  ] }),
4700
- contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
4701
- /* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
4702
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4703
- /* @__PURE__ */ jsx11("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ jsx11("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
4704
- /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4705
- /* @__PURE__ */ jsx11(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
4706
- /* @__PURE__ */ jsx11(
5057
+ contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ jsxs11("div", { children: [
5058
+ /* @__PURE__ */ jsx12("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
5059
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
5060
+ /* @__PURE__ */ jsx12("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ jsx12("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
5061
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
5062
+ /* @__PURE__ */ jsx12(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
5063
+ /* @__PURE__ */ jsx12(
4707
5064
  FeedbackButton,
4708
5065
  {
4709
5066
  suggestionType: "aeo_bullets",
@@ -4714,7 +5071,7 @@ function AEOTab({
4714
5071
  ] })
4715
5072
  ] })
4716
5073
  ] }),
4717
- /* @__PURE__ */ jsx11(
5074
+ /* @__PURE__ */ jsx12(
4718
5075
  "button",
4719
5076
  {
4720
5077
  onClick: loadContentSuggestions,
@@ -4743,8 +5100,8 @@ function AEOTab({
4743
5100
  }
4744
5101
 
4745
5102
  // src/components/ScoreDonut.tsx
4746
- import { useState as useState14 } from "react";
4747
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
5103
+ import { useState as useState15 } from "react";
5104
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
4748
5105
  var W = { topic: 0.6, freshness: 0.25, sectionFit: 0.15 };
4749
5106
  var COLORS = { topic: MJH_BLUE, freshness: MJH_GOLD, sectionFit: "#9B59B6" };
4750
5107
  var TRACK = "#eef2f7";
@@ -4756,7 +5113,7 @@ function ScoreDonut({
4756
5113
  sectionFit,
4757
5114
  composite
4758
5115
  }) {
4759
- const [hovered, setHovered] = useState14(false);
5116
+ const [hovered, setHovered] = useState15(false);
4760
5117
  const radius = (size - strokeWidth) / 2;
4761
5118
  const circumference = 2 * Math.PI * radius;
4762
5119
  const cTopic = topic * W.topic;
@@ -4769,7 +5126,7 @@ function ScoreDonut({
4769
5126
  const topicLen = seg(cTopic);
4770
5127
  const freshLen = seg(cFresh);
4771
5128
  const sectionLen = seg(cSection);
4772
- const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ jsx12(
5129
+ const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ jsx13(
4773
5130
  "circle",
4774
5131
  {
4775
5132
  cx: size / 2,
@@ -4783,20 +5140,20 @@ function ScoreDonut({
4783
5140
  strokeDashoffset: -offset
4784
5141
  }
4785
5142
  );
4786
- return /* @__PURE__ */ jsxs11(
5143
+ return /* @__PURE__ */ jsxs12(
4787
5144
  "div",
4788
5145
  {
4789
5146
  style: { position: "relative", width: size, height: size, flexShrink: 0 },
4790
5147
  onMouseEnter: () => setHovered(true),
4791
5148
  onMouseLeave: () => setHovered(false),
4792
5149
  children: [
4793
- /* @__PURE__ */ jsxs11("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
4794
- /* @__PURE__ */ jsx12("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
4795
- /* @__PURE__ */ jsx12(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
4796
- /* @__PURE__ */ jsx12(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
4797
- /* @__PURE__ */ jsx12(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
5150
+ /* @__PURE__ */ jsxs12("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
5151
+ /* @__PURE__ */ jsx13("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
5152
+ /* @__PURE__ */ jsx13(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
5153
+ /* @__PURE__ */ jsx13(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
5154
+ /* @__PURE__ */ jsx13(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
4798
5155
  ] }),
4799
- /* @__PURE__ */ jsxs11(
5156
+ /* @__PURE__ */ jsxs12(
4800
5157
  "div",
4801
5158
  {
4802
5159
  style: {
@@ -4810,15 +5167,15 @@ function ScoreDonut({
4810
5167
  lineHeight: 1
4811
5168
  },
4812
5169
  children: [
4813
- /* @__PURE__ */ jsxs11("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
5170
+ /* @__PURE__ */ jsxs12("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
4814
5171
  compositeValue,
4815
5172
  "%"
4816
5173
  ] }),
4817
- /* @__PURE__ */ jsx12("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
5174
+ /* @__PURE__ */ jsx13("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
4818
5175
  ]
4819
5176
  }
4820
5177
  ),
4821
- hovered && /* @__PURE__ */ jsxs11(
5178
+ hovered && /* @__PURE__ */ jsxs12(
4822
5179
  "div",
4823
5180
  {
4824
5181
  role: "tooltip",
@@ -4839,9 +5196,9 @@ function ScoreDonut({
4839
5196
  pointerEvents: "none"
4840
5197
  },
4841
5198
  children: [
4842
- /* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
4843
- /* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
4844
- /* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
5199
+ /* @__PURE__ */ jsx13(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
5200
+ /* @__PURE__ */ jsx13(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
5201
+ /* @__PURE__ */ jsx13(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
4845
5202
  ]
4846
5203
  }
4847
5204
  )
@@ -4850,31 +5207,31 @@ function ScoreDonut({
4850
5207
  );
4851
5208
  }
4852
5209
  function SubScoreRow({ color, label, value }) {
4853
- return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
4854
- /* @__PURE__ */ jsx12("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
4855
- /* @__PURE__ */ jsx12("span", { style: { flex: 1 }, children: label }),
4856
- /* @__PURE__ */ jsxs11("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
5210
+ return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
5211
+ /* @__PURE__ */ jsx13("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
5212
+ /* @__PURE__ */ jsx13("span", { style: { flex: 1 }, children: label }),
5213
+ /* @__PURE__ */ jsxs12("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
4857
5214
  Math.round(value),
4858
5215
  "/100"
4859
5216
  ] })
4860
5217
  ] });
4861
5218
  }
4862
5219
  function ScoreDonutLegend() {
4863
- return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
4864
- /* @__PURE__ */ jsx12(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
4865
- /* @__PURE__ */ jsx12(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
4866
- /* @__PURE__ */ jsx12(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
5220
+ return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
5221
+ /* @__PURE__ */ jsx13(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
5222
+ /* @__PURE__ */ jsx13(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
5223
+ /* @__PURE__ */ jsx13(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
4867
5224
  ] });
4868
5225
  }
4869
5226
  function LegendDot({ color, label }) {
4870
- return /* @__PURE__ */ jsxs11("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
4871
- /* @__PURE__ */ jsx12("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
5227
+ return /* @__PURE__ */ jsxs12("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
5228
+ /* @__PURE__ */ jsx13("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
4872
5229
  label
4873
5230
  ] });
4874
5231
  }
4875
5232
 
4876
5233
  // src/components/tabs/LinkingTab.tsx
4877
- import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
5234
+ import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
4878
5235
  function buildLiveUrl(publication, slug) {
4879
5236
  if (!slug) return null;
4880
5237
  const pub = (publication || "").trim().toLowerCase();
@@ -4890,7 +5247,7 @@ function buildSanityUrl(baseUrl, id, type) {
4890
5247
  return `${base}/intent/edit/id=${encodeURIComponent(cleanId)}${typePart}/`;
4891
5248
  }
4892
5249
  function LinkChip({ href, label, color }) {
4893
- return /* @__PURE__ */ jsxs12(
5250
+ return /* @__PURE__ */ jsxs13(
4894
5251
  "a",
4895
5252
  {
4896
5253
  href,
@@ -4912,14 +5269,38 @@ function LinkChip({ href, label, color }) {
4912
5269
  },
4913
5270
  children: [
4914
5271
  label,
4915
- /* @__PURE__ */ jsxs12("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
4916
- /* @__PURE__ */ jsx13("path", { d: "M12.5 2a.75.75 0 000 1.5h2.44l-6.97 6.97a.75.75 0 101.06 1.06L16 4.56V7a.75.75 0 001.5 0V2.75A.75.75 0 0016.75 2H12.5z" }),
4917
- /* @__PURE__ */ jsx13("path", { d: "M4.75 4.5A2.75 2.75 0 002 7.25v8A2.75 2.75 0 004.75 18h8A2.75 2.75 0 0015.5 15.25v-3a.75.75 0 00-1.5 0v3c0 .69-.56 1.25-1.25 1.25h-8c-.69 0-1.25-.56-1.25-1.25v-8c0-.69.56-1.25 1.25-1.25h3a.75.75 0 000-1.5h-3z" })
5272
+ /* @__PURE__ */ jsxs13("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
5273
+ /* @__PURE__ */ jsx14("path", { d: "M12.5 2a.75.75 0 000 1.5h2.44l-6.97 6.97a.75.75 0 101.06 1.06L16 4.56V7a.75.75 0 001.5 0V2.75A.75.75 0 0016.75 2H12.5z" }),
5274
+ /* @__PURE__ */ jsx14("path", { d: "M4.75 4.5A2.75 2.75 0 002 7.25v8A2.75 2.75 0 004.75 18h8A2.75 2.75 0 0015.5 15.25v-3a.75.75 0 00-1.5 0v3c0 .69-.56 1.25-1.25 1.25h-8c-.69 0-1.25-.56-1.25-1.25v-8c0-.69.56-1.25 1.25-1.25h3a.75.75 0 000-1.5h-3z" })
4918
5275
  ] })
4919
5276
  ]
4920
5277
  }
4921
5278
  );
4922
5279
  }
5280
+ function ClickableBadge({ clickable }) {
5281
+ return /* @__PURE__ */ jsxs13(
5282
+ "span",
5283
+ {
5284
+ style: {
5285
+ fontSize: 9,
5286
+ fontWeight: 700,
5287
+ textTransform: "uppercase",
5288
+ letterSpacing: "0.04em",
5289
+ padding: "2px 7px",
5290
+ borderRadius: 99,
5291
+ display: "inline-flex",
5292
+ alignItems: "center",
5293
+ gap: 4,
5294
+ background: clickable ? "rgba(22,163,74,0.12)" : "rgba(0,0,0,0.05)",
5295
+ color: clickable ? "#16a34a" : "#9ca3af"
5296
+ },
5297
+ children: [
5298
+ /* @__PURE__ */ jsx14("span", { style: { width: 5, height: 5, borderRadius: "50%", background: "currentColor" } }),
5299
+ clickable ? "Clickable link" : "No live link"
5300
+ ]
5301
+ }
5302
+ );
5303
+ }
4923
5304
  var cardStyle4 = {
4924
5305
  borderRadius: 14,
4925
5306
  background: "rgba(255,255,255,0.55)",
@@ -4929,7 +5310,7 @@ var cardStyle4 = {
4929
5310
  padding: "14px"
4930
5311
  };
4931
5312
  function AiPill2() {
4932
- return /* @__PURE__ */ jsx13(
5313
+ return /* @__PURE__ */ jsx14(
4933
5314
  "span",
4934
5315
  {
4935
5316
  style: {
@@ -4953,10 +5334,10 @@ function SectionHeader3({
4953
5334
  ai,
4954
5335
  action
4955
5336
  }) {
4956
- return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
4957
- /* @__PURE__ */ jsx13("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4958
- /* @__PURE__ */ jsx13("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4959
- ai && /* @__PURE__ */ jsx13(AiPill2, {}),
5337
+ return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
5338
+ /* @__PURE__ */ jsx14("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
5339
+ /* @__PURE__ */ jsx14("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
5340
+ ai && /* @__PURE__ */ jsx14(AiPill2, {}),
4960
5341
  action
4961
5342
  ] });
4962
5343
  }
@@ -4977,7 +5358,7 @@ function freshnessChip(label, score) {
4977
5358
  };
4978
5359
  const c = map[label];
4979
5360
  if (!c) return null;
4980
- return /* @__PURE__ */ jsx13(
5361
+ return /* @__PURE__ */ jsx14(
4981
5362
  "span",
4982
5363
  {
4983
5364
  style: {
@@ -4997,8 +5378,8 @@ function freshnessChip(label, score) {
4997
5378
  );
4998
5379
  }
4999
5380
  function RefreshIcon({ spinning }) {
5000
- if (spinning) return /* @__PURE__ */ jsx13(LoadingBars, { size: "xs", color: "#9ca3af" });
5001
- return /* @__PURE__ */ jsx13("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx13("path", { fillRule: "evenodd", d: "M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H4.598a.75.75 0 00-.75.75v3.634a.75.75 0 001.5 0v-2.033l.312.311a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm-10.624-2.85a5.5 5.5 0 019.201-2.466l.312.311h-2.433a.75.75 0 000 1.5h3.634a.75.75 0 00.75-.75V3.535a.75.75 0 00-1.5 0v2.033l-.312-.311A7 7 0 002.628 8.395a.75.75 0 001.449.39z", clipRule: "evenodd" }) });
5381
+ if (spinning) return /* @__PURE__ */ jsx14(LoadingBars, { size: "xs", color: "#9ca3af" });
5382
+ return /* @__PURE__ */ jsx14("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx14("path", { fillRule: "evenodd", d: "M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H4.598a.75.75 0 00-.75.75v3.634a.75.75 0 001.5 0v-2.033l.312.311a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm-10.624-2.85a5.5 5.5 0 019.201-2.466l.312.311h-2.433a.75.75 0 000 1.5h3.634a.75.75 0 00.75-.75V3.535a.75.75 0 00-1.5 0v2.033l-.312-.311A7 7 0 002.628 8.395a.75.75 0 001.449.39z", clipRule: "evenodd" }) });
5002
5383
  }
5003
5384
  function LinkingTab({
5004
5385
  analysis,
@@ -5014,21 +5395,21 @@ function LinkingTab({
5014
5395
  documentType
5015
5396
  }) {
5016
5397
  if (!analysis) {
5017
- return /* @__PURE__ */ jsxs12("div", { style: { padding: 24, textAlign: "center" }, children: [
5018
- /* @__PURE__ */ jsx13("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
5019
- /* @__PURE__ */ jsx13("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Linking reads the article keywords and topic to find related published articles. It starts on its own once the Keywords tab finishes." })
5398
+ return /* @__PURE__ */ jsxs13("div", { style: { padding: 24, textAlign: "center" }, children: [
5399
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
5400
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Linking reads the article keywords and topic to find related published articles. It starts on its own once the Keywords tab finishes." })
5020
5401
  ] });
5021
5402
  }
5022
5403
  const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
5023
5404
  const recommendedMin = Math.max(1, Math.round(wordCount2 / 1e3 * 2));
5024
5405
  const recommendedMax = Math.max(2, Math.round(wordCount2 / 1e3 * 5));
5025
- return /* @__PURE__ */ jsx13("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ jsxs12("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
5026
- /* @__PURE__ */ jsx13(
5406
+ return /* @__PURE__ */ jsx14("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ jsxs13("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
5407
+ /* @__PURE__ */ jsx14(
5027
5408
  SectionHeader3,
5028
5409
  {
5029
5410
  label: "Suggested Links",
5030
5411
  iconColor: MJH_BLUE,
5031
- action: /* @__PURE__ */ jsx13(
5412
+ action: /* @__PURE__ */ jsx14(
5032
5413
  "button",
5033
5414
  {
5034
5415
  onClick: onRefresh,
@@ -5043,20 +5424,20 @@ function LinkingTab({
5043
5424
  fontSize: 10
5044
5425
  },
5045
5426
  title: "Refresh",
5046
- children: /* @__PURE__ */ jsx13(RefreshIcon, { spinning: isLoading })
5427
+ children: /* @__PURE__ */ jsx14(RefreshIcon, { spinning: isLoading })
5047
5428
  }
5048
5429
  )
5049
5430
  }
5050
5431
  ),
5051
- /* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
5432
+ /* @__PURE__ */ jsxs13("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
5052
5433
  "Other articles on this site that fit this topic.",
5053
- wordCount2 > 0 && /* @__PURE__ */ jsxs12(Fragment6, { children: [
5434
+ wordCount2 > 0 && /* @__PURE__ */ jsxs13(Fragment7, { children: [
5054
5435
  " ",
5055
5436
  "For a ",
5056
5437
  wordCount2.toLocaleString(),
5057
5438
  "-word article, aim for",
5058
5439
  " ",
5059
- /* @__PURE__ */ jsxs12("strong", { children: [
5440
+ /* @__PURE__ */ jsxs13("strong", { children: [
5060
5441
  recommendedMin,
5061
5442
  "-",
5062
5443
  recommendedMax,
@@ -5065,17 +5446,17 @@ function LinkingTab({
5065
5446
  "."
5066
5447
  ] })
5067
5448
  ] }),
5068
- /* @__PURE__ */ jsxs12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
5449
+ /* @__PURE__ */ jsxs13("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
5069
5450
  "Each suggestion gets a 0-100% match score from three signals - ",
5070
- /* @__PURE__ */ jsx13("strong", { children: "topic match" }),
5451
+ /* @__PURE__ */ jsx14("strong", { children: "topic match" }),
5071
5452
  ", ",
5072
- /* @__PURE__ */ jsx13("strong", { children: "freshness" }),
5453
+ /* @__PURE__ */ jsx14("strong", { children: "freshness" }),
5073
5454
  ", and ",
5074
- /* @__PURE__ */ jsx13("strong", { children: "section fit" }),
5455
+ /* @__PURE__ */ jsx14("strong", { children: "section fit" }),
5075
5456
  " (where in your article the link belongs). The percentage on each card is the weighted total:"
5076
5457
  ] }),
5077
- /* @__PURE__ */ jsx13("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ jsx13(ScoreDonutLegend, {}) }),
5078
- isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ jsxs12(
5458
+ /* @__PURE__ */ jsx14("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ jsx14(ScoreDonutLegend, {}) }),
5459
+ isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ jsxs13(
5079
5460
  "div",
5080
5461
  {
5081
5462
  role: "button",
@@ -5100,16 +5481,16 @@ function LinkingTab({
5100
5481
  cursor: "pointer"
5101
5482
  },
5102
5483
  children: [
5103
- /* @__PURE__ */ jsx13("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
5104
- /* @__PURE__ */ jsx13("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
5484
+ /* @__PURE__ */ jsx14("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
5485
+ /* @__PURE__ */ jsx14("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
5105
5486
  ]
5106
5487
  }
5107
5488
  ),
5108
- isLoading && suggestions.length === 0 && /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5109
- /* @__PURE__ */ jsx13(LoadingBars, { size: "xs", color: MJH_BLUE }),
5110
- /* @__PURE__ */ jsx13("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
5489
+ isLoading && suggestions.length === 0 && /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5490
+ /* @__PURE__ */ jsx14(LoadingBars, { size: "xs", color: MJH_BLUE }),
5491
+ /* @__PURE__ */ jsx14("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
5111
5492
  ] }),
5112
- !isLoading && error && /* @__PURE__ */ jsxs12(
5493
+ !isLoading && error && /* @__PURE__ */ jsxs13(
5113
5494
  "div",
5114
5495
  {
5115
5496
  style: {
@@ -5120,9 +5501,9 @@ function LinkingTab({
5120
5501
  textAlign: "center"
5121
5502
  },
5122
5503
  children: [
5123
- /* @__PURE__ */ jsx13("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
5124
- /* @__PURE__ */ jsx13("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
5125
- /* @__PURE__ */ jsx13(
5504
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
5505
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
5506
+ /* @__PURE__ */ jsx14(
5126
5507
  "button",
5127
5508
  {
5128
5509
  onClick: onRefresh,
@@ -5142,120 +5523,178 @@ function LinkingTab({
5142
5523
  ]
5143
5524
  }
5144
5525
  ),
5145
- !isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", padding: "10px 12px", lineHeight: 1.55, background: "rgba(0,93,172,0.04)", borderRadius: 8, border: "1px solid rgba(0,93,172,0.12)" }, children: [
5146
- /* @__PURE__ */ jsx13("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
5147
- /* @__PURE__ */ jsx13("div", { style: { color: "#4b5563" }, children: "Linking searched your publication for articles on this topic and did not find a strong match. As more related content is published, suggestions will appear here." })
5526
+ !isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ jsxs13("div", { style: { fontSize: 11, color: "#1f2937", padding: "10px 12px", lineHeight: 1.55, background: "rgba(0,93,172,0.04)", borderRadius: 8, border: "1px solid rgba(0,93,172,0.12)" }, children: [
5527
+ /* @__PURE__ */ jsx14("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
5528
+ /* @__PURE__ */ jsx14("div", { style: { color: "#4b5563" }, children: "Linking searched your publication for articles on this topic and did not find a strong match. As more related content is published, suggestions will appear here." })
5148
5529
  ] }),
5149
- suggestions.length > 0 && /* @__PURE__ */ jsx13("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => /* @__PURE__ */ jsxs12(
5150
- "div",
5151
- {
5152
- style: {
5153
- padding: "10px 12px",
5154
- background: "rgba(0,93,172,0.03)",
5155
- borderRadius: 10,
5156
- borderLeft: `2px solid ${MJH_BLUE}`,
5157
- display: "flex",
5158
- gap: 12,
5159
- alignItems: "flex-start"
5160
- },
5161
- children: [
5162
- /* @__PURE__ */ jsx13(
5163
- ScoreDonut,
5164
- {
5165
- size: 64,
5166
- topic: Math.max(0, Math.min(100, s.topicScore)),
5167
- freshness: Math.max(0, Math.min(100, s.freshnessScore)),
5168
- sectionFit: Math.max(0, Math.min(100, s.sectionFitScore)),
5169
- composite: Math.max(0, Math.min(100, s.compositeScore))
5170
- }
5171
- ),
5172
- /* @__PURE__ */ jsxs12("div", { style: { flex: 1, minWidth: 0 }, children: [
5173
- /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
5174
- freshnessChip(s.freshnessLabel, s.freshnessScore),
5175
- s.publishedAt && /* @__PURE__ */ jsx13("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) })
5176
- ] }),
5177
- /* @__PURE__ */ jsx13("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
5178
- /* @__PURE__ */ jsxs12("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
5179
- "/",
5180
- s.slug
5181
- ] }),
5182
- (() => {
5183
- const liveUrl = buildLiveUrl(publication, s.slug);
5184
- const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id);
5185
- if (!liveUrl && !sanityUrl) return null;
5186
- return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
5187
- sanityUrl && /* @__PURE__ */ jsx13(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
5188
- liveUrl && /* @__PURE__ */ jsx13(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
5189
- ] });
5190
- })(),
5191
- s.relevanceReason && /* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
5192
- /* @__PURE__ */ jsx13("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
5193
- " ",
5194
- /* @__PURE__ */ jsx13("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
5530
+ suggestions.length > 0 && /* @__PURE__ */ jsx14("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => {
5531
+ const liveUrl = buildLiveUrl(publication, s.slug);
5532
+ const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id);
5533
+ return /* @__PURE__ */ jsxs13(
5534
+ "div",
5535
+ {
5536
+ style: {
5537
+ padding: "10px 12px",
5538
+ background: "rgba(0,93,172,0.03)",
5539
+ borderRadius: 10,
5540
+ borderLeft: `2px solid ${MJH_BLUE}`,
5541
+ display: "flex",
5542
+ gap: 12,
5543
+ alignItems: "flex-start"
5544
+ },
5545
+ children: [
5546
+ /* @__PURE__ */ jsx14(
5547
+ ScoreDonut,
5548
+ {
5549
+ size: 64,
5550
+ topic: Math.max(0, Math.min(100, s.topicScore)),
5551
+ freshness: Math.max(0, Math.min(100, s.freshnessScore)),
5552
+ sectionFit: Math.max(0, Math.min(100, s.sectionFitScore)),
5553
+ composite: Math.max(0, Math.min(100, s.compositeScore))
5554
+ }
5555
+ ),
5556
+ /* @__PURE__ */ jsxs13("div", { style: { flex: 1, minWidth: 0 }, children: [
5557
+ /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
5558
+ freshnessChip(s.freshnessLabel, s.freshnessScore),
5559
+ s.publishedAt && /* @__PURE__ */ jsx14("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) }),
5560
+ /* @__PURE__ */ jsx14(ClickableBadge, { clickable: !!liveUrl })
5561
+ ] }),
5562
+ /* @__PURE__ */ jsx14("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
5563
+ /* @__PURE__ */ jsxs13("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
5564
+ "/",
5565
+ s.slug
5566
+ ] }),
5567
+ (liveUrl || sanityUrl) && /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
5568
+ sanityUrl && /* @__PURE__ */ jsx14(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
5569
+ liveUrl && /* @__PURE__ */ jsx14(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
5570
+ ] }),
5571
+ s.relevanceReason && /* @__PURE__ */ jsxs13("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
5572
+ /* @__PURE__ */ jsx14("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
5573
+ " ",
5574
+ /* @__PURE__ */ jsx14("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
5575
+ ] }),
5576
+ s.anchorQuote && /* @__PURE__ */ jsxs13(
5577
+ "div",
5578
+ {
5579
+ style: {
5580
+ marginTop: 4,
5581
+ padding: "6px 9px",
5582
+ background: "rgba(0,0,0,0.025)",
5583
+ borderRadius: 6,
5584
+ borderLeft: "2px solid #cbd5e1",
5585
+ fontSize: 11,
5586
+ color: "#1f2937",
5587
+ lineHeight: 1.5
5588
+ },
5589
+ children: [
5590
+ /* @__PURE__ */ jsxs13("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
5591
+ "Where to link from - paragraph ",
5592
+ s.anchorParagraph
5593
+ ] }),
5594
+ /* @__PURE__ */ jsxs13("div", { style: { fontStyle: "italic" }, children: [
5595
+ '"',
5596
+ s.anchorQuote,
5597
+ '"'
5598
+ ] }),
5599
+ s.anchorReason && /* @__PURE__ */ jsx14("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
5600
+ ]
5601
+ }
5602
+ )
5195
5603
  ] }),
5196
- s.anchorQuote && /* @__PURE__ */ jsxs12(
5197
- "div",
5604
+ /* @__PURE__ */ jsx14("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx14(
5605
+ FeedbackButton,
5198
5606
  {
5199
- style: {
5200
- marginTop: 4,
5201
- padding: "6px 9px",
5202
- background: "rgba(0,0,0,0.025)",
5203
- borderRadius: 6,
5204
- borderLeft: "2px solid #cbd5e1",
5205
- fontSize: 11,
5206
- color: "#1f2937",
5207
- lineHeight: 1.5
5208
- },
5209
- children: [
5210
- /* @__PURE__ */ jsxs12("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
5211
- "Where to link from - paragraph ",
5212
- s.anchorParagraph
5213
- ] }),
5214
- /* @__PURE__ */ jsxs12("div", { style: { fontStyle: "italic" }, children: [
5215
- '"',
5216
- s.anchorQuote,
5217
- '"'
5218
- ] }),
5219
- s.anchorReason && /* @__PURE__ */ jsx13("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
5220
- ]
5607
+ suggestionType: "internal_link",
5608
+ suggestionText: s.title,
5609
+ publication,
5610
+ documentId
5221
5611
  }
5222
- )
5223
- ] }),
5224
- /* @__PURE__ */ jsx13("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx13(
5225
- FeedbackButton,
5226
- {
5227
- suggestionType: "internal_link",
5228
- suggestionText: s.title,
5229
- publication,
5230
- documentId
5231
- }
5232
- ) })
5233
- ]
5234
- },
5235
- s._id
5236
- )) })
5612
+ ) })
5613
+ ]
5614
+ },
5615
+ s._id
5616
+ );
5617
+ }) })
5237
5618
  ] }) });
5238
5619
  }
5239
5620
 
5240
5621
  // src/components/tabs/MetaTab.tsx
5241
5622
  import { useMemo as useMemo3 } from "react";
5242
- import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
5243
- var cardStyle5 = {
5244
- borderRadius: 14,
5245
- background: "rgba(255,255,255,0.55)",
5246
- backdropFilter: "blur(16px) saturate(170%)",
5247
- WebkitBackdropFilter: "blur(16px) saturate(170%)",
5248
- boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.85), inset 1.5px 2px 1px -1px rgba(255,255,255,1), inset -2px -3px 2px -1px rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.07), 0 10px 26px rgba(0,0,0,0.08)",
5249
- padding: "14px"
5250
- };
5251
- function StatusBadge({ status }) {
5252
- const map = {
5253
- good: { bg: "rgba(22,163,74,0.12)", color: "#16a34a", label: "Good" },
5254
- warning: { bg: "rgba(230,192,27,0.18)", color: "#8B7310", label: "Review" },
5623
+ import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
5624
+ var GOOGLE_EEAT_URL = "https://developers.google.com/search/docs/fundamentals/creating-helpful-content#eat";
5625
+ function ExternalLinkChip({ href, label }) {
5626
+ return /* @__PURE__ */ jsxs14(
5627
+ "a",
5628
+ {
5629
+ href,
5630
+ target: "_blank",
5631
+ rel: "noopener noreferrer",
5632
+ style: {
5633
+ display: "inline-flex",
5634
+ alignItems: "center",
5635
+ gap: 4,
5636
+ marginTop: 8,
5637
+ padding: "3px 9px",
5638
+ borderRadius: 99,
5639
+ fontSize: 10.5,
5640
+ fontWeight: 700,
5641
+ color: MJH_BLUE,
5642
+ background: "rgba(255,255,255,0.7)",
5643
+ border: `1px solid ${MJH_BLUE}33`,
5644
+ textDecoration: "none",
5645
+ lineHeight: 1.2
5646
+ },
5647
+ children: [
5648
+ label,
5649
+ /* @__PURE__ */ jsxs14("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
5650
+ /* @__PURE__ */ jsx15("path", { d: "M12.5 2a.75.75 0 000 1.5h2.44l-6.97 6.97a.75.75 0 101.06 1.06L16 4.56V7a.75.75 0 001.5 0V2.75A.75.75 0 0016.75 2H12.5z" }),
5651
+ /* @__PURE__ */ jsx15("path", { d: "M4.75 4.5A2.75 2.75 0 002 7.25v8A2.75 2.75 0 004.75 18h8A2.75 2.75 0 0015.5 15.25v-3a.75.75 0 00-1.5 0v3c0 .69-.56 1.25-1.25 1.25h-8c-.69 0-1.25-.56-1.25-1.25v-8c0-.69.56-1.25 1.25-1.25h3a.75.75 0 000-1.5h-3z" })
5652
+ ] })
5653
+ ]
5654
+ }
5655
+ );
5656
+ }
5657
+ function FreshnessNotice() {
5658
+ return /* @__PURE__ */ jsxs14(
5659
+ "div",
5660
+ {
5661
+ style: {
5662
+ padding: "9px 12px",
5663
+ background: "rgba(0,93,172,0.05)",
5664
+ border: "1px solid rgba(0,93,172,0.15)",
5665
+ borderLeft: `3px solid ${MJH_BLUE}`,
5666
+ borderRadius: 8,
5667
+ fontSize: 11,
5668
+ color: "#1f2937",
5669
+ lineHeight: 1.5
5670
+ },
5671
+ children: [
5672
+ /* @__PURE__ */ jsx15("span", { style: { fontWeight: 700, color: MJH_BLUE }, children: "Keep it fresh. " }),
5673
+ "Planning to update this article after it's published? Set the ",
5674
+ /* @__PURE__ */ jsx15("strong", { children: "Updated on" }),
5675
+ " date in Sanity (e.g. \u201CUpdated: February 19, 2026\u201D). It surfaces the article in ",
5676
+ /* @__PURE__ */ jsx15("strong", { children: "Latest Updated Articles" }),
5677
+ " and increases its visibility in search engine results."
5678
+ ]
5679
+ }
5680
+ );
5681
+ }
5682
+ var cardStyle5 = {
5683
+ borderRadius: 14,
5684
+ background: "rgba(255,255,255,0.55)",
5685
+ backdropFilter: "blur(16px) saturate(170%)",
5686
+ WebkitBackdropFilter: "blur(16px) saturate(170%)",
5687
+ boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.85), inset 1.5px 2px 1px -1px rgba(255,255,255,1), inset -2px -3px 2px -1px rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.07), 0 10px 26px rgba(0,0,0,0.08)",
5688
+ padding: "14px"
5689
+ };
5690
+ function StatusBadge({ status }) {
5691
+ const map = {
5692
+ good: { bg: "rgba(22,163,74,0.12)", color: "#16a34a", label: "Good" },
5693
+ warning: { bg: "rgba(230,192,27,0.18)", color: "#8B7310", label: "Review" },
5255
5694
  error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
5256
5695
  };
5257
5696
  const c = map[status];
5258
- return /* @__PURE__ */ jsx14(
5697
+ return /* @__PURE__ */ jsx15(
5259
5698
  "span",
5260
5699
  {
5261
5700
  style: {
@@ -5274,12 +5713,12 @@ function StatusBadge({ status }) {
5274
5713
  );
5275
5714
  }
5276
5715
  function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
5277
- return /* @__PURE__ */ jsxs13("div", { id: anchorId, style: cardStyle5, children: [
5278
- /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5279
- /* @__PURE__ */ jsx14("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5280
- /* @__PURE__ */ jsx14(StatusBadge, { status })
5716
+ return /* @__PURE__ */ jsxs14("div", { id: anchorId, style: cardStyle5, children: [
5717
+ /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5718
+ /* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5719
+ /* @__PURE__ */ jsx15(StatusBadge, { status })
5281
5720
  ] }),
5282
- /* @__PURE__ */ jsx14(
5721
+ /* @__PURE__ */ jsx15(
5283
5722
  "div",
5284
5723
  {
5285
5724
  style: {
@@ -5292,7 +5731,7 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
5292
5731
  children: value
5293
5732
  }
5294
5733
  ),
5295
- recommendation && /* @__PURE__ */ jsx14(
5734
+ recommendation && /* @__PURE__ */ jsx15(
5296
5735
  "div",
5297
5736
  {
5298
5737
  style: {
@@ -5441,41 +5880,66 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
5441
5880
  } else {
5442
5881
  items.push({ label: "Author Byline", value: `${author}, ${creds}`, status: "good" });
5443
5882
  }
5444
- const published = documentFields?.publishedAt;
5445
- const updated = documentFields?.updatedAt;
5446
- const reviewed = documentFields?.lastReviewedAt;
5447
- const daysPub = daysSince(published);
5448
- const daysUpd = daysSince(updated);
5449
- const daysRev = daysSince(reviewed);
5450
- const freshness = Math.min(...[daysUpd, daysRev, daysPub].filter((d) => d !== null));
5451
- if (!published) {
5452
- items.push({ label: "Publish Date", value: "Missing", status: "error", recommendation: "Add a visible publish date. Required for healthcare content to be cited by Google and AI search." });
5453
- } else if (daysPub === null) {
5454
- items.push({ label: "Publish Date", value: "Unrecognized format", status: "warning", recommendation: "A publish date is set but couldn't be read as a valid date. Check the field value." });
5883
+ items[0].footer = /* @__PURE__ */ jsx15(ExternalLinkChip, { href: GOOGLE_EEAT_URL, label: "Google's E-E-A-T guidelines" });
5884
+ const factChecker = documentFields?.factCheckerName;
5885
+ const factCheckerRef = documentFields?.factCheckerIsReference;
5886
+ if (factChecker) {
5887
+ items.push({ label: "Fact-Checker", value: factChecker, status: "good" });
5888
+ } else if (factCheckerRef) {
5889
+ items.push({ label: "Fact-Checker", value: "Set (reference)", status: "good", recommendation: "A fact-checker is linked as a reference. Open the linked person to confirm the name shows on the published page." });
5455
5890
  } else {
5456
- items.push({ label: "Publish Date", value: formatDateShort(published), status: "good" });
5891
+ items.push({ label: "Fact-Checker", value: "Not set", status: "warning", recommendation: 'Add a second named person as a fact-checker, separate from the author. A visible "Fact checked by" line is a strong trust signal for healthcare content.' });
5457
5892
  }
5458
- if (Number.isFinite(freshness)) {
5459
- if (freshness <= 14) {
5460
- items.push({ label: "Last Updated", value: `${freshness} day${freshness === 1 ? "" : "s"} ago`, status: "good" });
5461
- } else if (freshness <= 90) {
5462
- items.push({ label: "Last Updated", value: `${freshness} days ago`, status: "warning", recommendation: "Articles older than two weeks get cited less by AI search. If the content is still accurate, refresh stats or add a last-reviewed date." });
5893
+ const dated = [];
5894
+ const addDate = (verb, days) => {
5895
+ if (days !== null) dated.push({ verb, days });
5896
+ };
5897
+ addDate("Updated", daysSince(documentFields?.updatedAt));
5898
+ addDate("Reviewed", daysSince(documentFields?.lastReviewedAt));
5899
+ addDate("Published", daysSince(documentFields?.publishedAt));
5900
+ if (dated.length > 0) {
5901
+ const freshest = dated.reduce((a, b) => b.days < a.days ? b : a);
5902
+ const days = freshest.days;
5903
+ const ago = days <= 0 ? "today" : days === 1 ? "1 day ago" : `${days} days ago`;
5904
+ const value = `${freshest.verb} ${ago}`;
5905
+ if (days <= 14) {
5906
+ items.push({ label: "Content Freshness", value, status: "good", recommendation: "Recent content gets cited and ranked more. Re-set the Updated-on date whenever you revise to keep it fresh." });
5907
+ } else if (days <= 90) {
5908
+ items.push({ label: "Content Freshness", value, status: "warning", recommendation: "Content older than two weeks gets cited less by AI search. If it's still accurate, refresh a stat and set the Updated-on date in Sanity." });
5463
5909
  } else {
5464
- items.push({ label: "Last Updated", value: `${freshness} days ago`, status: "error", recommendation: "Older than 90 days. Review the facts, update what's stale, and timestamp the refresh." });
5910
+ items.push({ label: "Content Freshness", value, status: "error", recommendation: "Over 90 days old. Review the facts, update what's stale, and set the Updated-on date in Sanity." });
5465
5911
  }
5466
5912
  }
5467
5913
  return items;
5468
5914
  }, [documentFields]);
5915
+ const publishDateItem = useMemo3(() => {
5916
+ const published = documentFields?.publishedAt;
5917
+ const daysPub = daysSince(published);
5918
+ if (!published) return { label: "Publish Date", value: "Missing", status: "error", recommendation: "Add a visible publish date. Required for healthcare content to be cited by Google and AI search." };
5919
+ if (daysPub === null) return { label: "Publish Date", value: "Unrecognized format", status: "warning", recommendation: "A publish date is set but couldn't be read as a valid date. Check the field value." };
5920
+ return { label: "Publish Date", value: formatDateShort(published), status: "good" };
5921
+ }, [documentFields]);
5469
5922
  const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.metaDescription !== void 0 || documentFields.slug !== void 0);
5470
5923
  if (isLoading && !hasAnyField) {
5471
- return /* @__PURE__ */ jsxs13("div", { style: { padding: 24, textAlign: "center" }, children: [
5472
- /* @__PURE__ */ jsx14("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
5473
- /* @__PURE__ */ jsx14("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
5924
+ return /* @__PURE__ */ jsxs14("div", { style: { padding: 24, textAlign: "center" }, children: [
5925
+ /* @__PURE__ */ jsx15("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
5926
+ /* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
5474
5927
  ] });
5475
5928
  }
5476
5929
  const auditAnchors = ["anchor-meta-title", "anchor-meta-description"];
5477
- return /* @__PURE__ */ jsxs13("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
5478
- audits.map((a, i) => /* @__PURE__ */ jsx14(
5930
+ return /* @__PURE__ */ jsxs14("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
5931
+ /* @__PURE__ */ jsx15(FreshnessNotice, {}),
5932
+ /* @__PURE__ */ jsx15(
5933
+ AuditCard,
5934
+ {
5935
+ anchorId: "anchor-publish-date",
5936
+ label: publishDateItem.label,
5937
+ value: publishDateItem.value,
5938
+ status: publishDateItem.status,
5939
+ recommendation: publishDateItem.recommendation
5940
+ }
5941
+ ),
5942
+ audits.map((a, i) => /* @__PURE__ */ jsx15(
5479
5943
  AuditCard,
5480
5944
  {
5481
5945
  anchorId: auditAnchors[i],
@@ -5486,20 +5950,21 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
5486
5950
  },
5487
5951
  i
5488
5952
  )),
5489
- eeatItems.length > 0 && /* @__PURE__ */ jsxs13(Fragment7, { children: [
5490
- /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
5491
- /* @__PURE__ */ jsx14("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
5492
- /* @__PURE__ */ jsx14("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
5493
- /* @__PURE__ */ jsx14("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
5953
+ eeatItems.length > 0 && /* @__PURE__ */ jsxs14(Fragment8, { children: [
5954
+ /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
5955
+ /* @__PURE__ */ jsx15("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
5956
+ /* @__PURE__ */ jsx15("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
5957
+ /* @__PURE__ */ jsx15("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
5494
5958
  ] }),
5495
- /* @__PURE__ */ jsx14("div", { style: { fontSize: 10, color: "#4b5563", padding: "0 4px", marginTop: -4 }, children: "Google looks for a named author with credentials and recent updates on healthcare content." }),
5496
- eeatItems.map((item, i) => /* @__PURE__ */ jsx14(
5959
+ /* @__PURE__ */ jsx15("div", { style: { fontSize: 10, color: "#4b5563", padding: "0 4px", marginTop: -4 }, children: "Google looks for a named author with credentials and recent updates on healthcare content." }),
5960
+ eeatItems.map((item, i) => /* @__PURE__ */ jsx15(
5497
5961
  AuditCard,
5498
5962
  {
5499
5963
  label: item.label,
5500
5964
  value: item.value,
5501
5965
  status: item.status,
5502
- recommendation: item.recommendation
5966
+ recommendation: item.recommendation,
5967
+ footer: item.footer
5503
5968
  },
5504
5969
  `eeat-${i}`
5505
5970
  ))
@@ -5508,8 +5973,8 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
5508
5973
  }
5509
5974
 
5510
5975
  // src/components/tabs/TechnicalTab.tsx
5511
- import { useMemo as useMemo4, useState as useState15 } from "react";
5512
- import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
5976
+ import { useMemo as useMemo4, useState as useState16 } from "react";
5977
+ import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
5513
5978
  function urlAudit(slug, primaryKeyword, secondaryKeyword) {
5514
5979
  const SHORT_DESC = "Keep the URL short and descriptive - concise URLs are easier to read - and avoid trailing, duplicate, or excessive spaces.";
5515
5980
  if (!slug) {
@@ -5544,28 +6009,28 @@ function urlAudit(slug, primaryKeyword, secondaryKeyword) {
5544
6009
  return { label: "URL Slug", value: `/${slug}`, status: "good" };
5545
6010
  }
5546
6011
  function SlugRedirectNotice() {
5547
- const [expanded, setExpanded] = useState15(false);
5548
- return /* @__PURE__ */ jsx15("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ jsxs14("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
5549
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
5550
- /* @__PURE__ */ jsx15("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ jsx15("path", { fillRule: "evenodd", d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" }) }),
5551
- /* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
6012
+ const [expanded, setExpanded] = useState16(false);
6013
+ return /* @__PURE__ */ jsx16("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ jsxs15("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
6014
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
6015
+ /* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ jsx16("path", { fillRule: "evenodd", d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" }) }),
6016
+ /* @__PURE__ */ jsx16("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
5552
6017
  ] }),
5553
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: "If the page has been published and indexed, you MUST add a 301 redirect from the old slug to the new one before changing it. For a brand-new page that's never been published, no redirect needed." }),
5554
- /* @__PURE__ */ jsxs14(
6018
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: "If the page has been published and indexed, you MUST add a 301 redirect from the old slug to the new one before changing it. For a brand-new page that's never been published, no redirect needed." }),
6019
+ /* @__PURE__ */ jsxs15(
5555
6020
  "button",
5556
6021
  {
5557
6022
  onClick: () => setExpanded((v) => !v),
5558
6023
  style: { display: "flex", alignItems: "center", gap: 3, marginTop: 6, padding: 0, background: "none", border: "none", cursor: "pointer", fontSize: 10.5, fontWeight: 700, color: "#b45309", fontFamily: "inherit" },
5559
6024
  children: [
5560
6025
  expanded ? "Show less" : "Learn more",
5561
- /* @__PURE__ */ jsx15("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx15("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
6026
+ /* @__PURE__ */ jsx16("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx16("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
5562
6027
  ]
5563
6028
  }
5564
6029
  ),
5565
- expanded && /* @__PURE__ */ jsxs14("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
5566
- /* @__PURE__ */ jsx15("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
5567
- /* @__PURE__ */ jsx15("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
5568
- /* @__PURE__ */ jsx15("li", { children: "Set this up using vanity redirects in Sanity." })
6030
+ expanded && /* @__PURE__ */ jsxs15("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
6031
+ /* @__PURE__ */ jsx16("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
6032
+ /* @__PURE__ */ jsx16("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
6033
+ /* @__PURE__ */ jsx16("li", { children: "Set this up using vanity redirects in Sanity." })
5569
6034
  ] })
5570
6035
  ] }) });
5571
6036
  }
@@ -5584,7 +6049,7 @@ function StatusBadge2({ status }) {
5584
6049
  error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
5585
6050
  };
5586
6051
  const c = map[status];
5587
- return /* @__PURE__ */ jsx15(
6052
+ return /* @__PURE__ */ jsx16(
5588
6053
  "span",
5589
6054
  {
5590
6055
  style: {
@@ -5610,12 +6075,12 @@ function AuditCard2({
5610
6075
  anchorId,
5611
6076
  footer
5612
6077
  }) {
5613
- return /* @__PURE__ */ jsxs14("div", { id: anchorId, style: cardStyle6, children: [
5614
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5615
- /* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5616
- /* @__PURE__ */ jsx15(StatusBadge2, { status })
6078
+ return /* @__PURE__ */ jsxs15("div", { id: anchorId, style: cardStyle6, children: [
6079
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
6080
+ /* @__PURE__ */ jsx16("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
6081
+ /* @__PURE__ */ jsx16(StatusBadge2, { status })
5617
6082
  ] }),
5618
- /* @__PURE__ */ jsx15(
6083
+ /* @__PURE__ */ jsx16(
5619
6084
  "div",
5620
6085
  {
5621
6086
  style: {
@@ -5628,7 +6093,7 @@ function AuditCard2({
5628
6093
  children: value
5629
6094
  }
5630
6095
  ),
5631
- recommendation && /* @__PURE__ */ jsx15(
6096
+ recommendation && /* @__PURE__ */ jsx16(
5632
6097
  "div",
5633
6098
  {
5634
6099
  style: {
@@ -5760,7 +6225,7 @@ function imageTitleAudit(titles, imageCount) {
5760
6225
  status: "good"
5761
6226
  };
5762
6227
  }
5763
- function computeHeadingStructureAudits(headings, wordCount2) {
6228
+ function computeHeadingStructureAudits(headings, wordCount2, primaryKeyword, secondaryKeyword, unstyledHeadings) {
5764
6229
  const audits = [];
5765
6230
  const sectionCount = headings.filter((h) => h.level === 2 || h.level === 3).length;
5766
6231
  let densityFired = false;
@@ -5789,26 +6254,27 @@ function computeHeadingStructureAudits(headings, wordCount2) {
5789
6254
  });
5790
6255
  densityFired = true;
5791
6256
  }
6257
+ if (unstyledHeadings && unstyledHeadings.length > 0) {
6258
+ const n = unstyledHeadings.length;
6259
+ const examples = unstyledHeadings.slice(0, 2).map((t) => `"${t}"`).join(", ");
6260
+ audits.push({
6261
+ label: "Looks Like a Heading",
6262
+ value: `${n} line${n === 1 ? "" : "s"} read${n === 1 ? "s" : ""} like a heading but ${n === 1 ? "isn't" : "aren't"} styled`,
6263
+ status: "warning",
6264
+ recommendation: `${examples}${n > 2 ? ", and more," : ""} ${n === 1 ? "looks" : "look"} like a section heading typed as plain text. In Sanity, select the line and apply the "Heading 2" style so it counts as a real heading.`
6265
+ });
6266
+ }
5792
6267
  if (headings.length === 0) {
5793
6268
  if (!densityFired) {
5794
6269
  audits.push({
5795
6270
  label: "Heading Structure",
5796
6271
  value: "No headings in body",
5797
6272
  status: "warning",
5798
- recommendation: "Add H2 headings to break the article into scannable sections."
6273
+ recommendation: "Consider adding H2-H6 subheadings to structure the article into scannable sections."
5799
6274
  });
5800
6275
  }
5801
6276
  return audits;
5802
6277
  }
5803
- const h1s = headings.filter((h) => h.level === 1);
5804
- if (h1s.length > 0) {
5805
- audits.push({
5806
- label: "H1 in body",
5807
- value: `${h1s.length} H1 heading${h1s.length === 1 ? "" : "s"} in the body`,
5808
- status: "warning",
5809
- recommendation: "The article title is your H1. Body headings should start at H2 so the outline isn't ambiguous."
5810
- });
5811
- }
5812
6278
  let prevLevel = 0;
5813
6279
  const skips = [];
5814
6280
  for (const h of headings) {
@@ -5842,266 +6308,171 @@ function computeHeadingStructureAudits(headings, wordCount2) {
5842
6308
  status: "good"
5843
6309
  });
5844
6310
  }
6311
+ const subheads = headings.filter((h) => h.level >= 2);
6312
+ const subheadingText = subheads.map((h) => h.text).join(" ");
6313
+ const hasPrimaryInHeads = primaryKeyword ? containsKeywordTokens(subheadingText, primaryKeyword) : false;
6314
+ const hasSecondaryInHeads = secondaryKeyword ? containsKeywordTokens(subheadingText, secondaryKeyword) : false;
6315
+ if (subheads.length > 0 && (primaryKeyword || secondaryKeyword) && !hasPrimaryInHeads && !hasSecondaryInHeads) {
6316
+ const kw = [
6317
+ primaryKeyword ? `primary keyword "${primaryKeyword}"` : "",
6318
+ secondaryKeyword ? `secondary keyword "${secondaryKeyword}"` : ""
6319
+ ].filter(Boolean).join(" or ");
6320
+ audits.push({
6321
+ label: "Keywords in Headings",
6322
+ value: "No subheading uses your target keyword",
6323
+ status: "warning",
6324
+ recommendation: `Work your ${kw} into at least one H2 or H3. Keywords in headers reinforce relevance for readers and search engines.`
6325
+ });
6326
+ }
5845
6327
  return audits;
5846
6328
  }
6329
+ function HealthBadge({ result }) {
6330
+ const map = {
6331
+ ok: { color: "#16a34a", label: "OK" },
6332
+ redirect: { color: "#8B7310", label: result.status > 0 ? String(result.status) : "REDIR" },
6333
+ broken: { color: "#dc2626", label: result.status > 0 ? String(result.status) : "404" },
6334
+ unverified: { color: "#b45309", label: result.status > 0 ? String(result.status) : "BLOCKED" },
6335
+ error: { color: "#dc2626", label: "ERR" }
6336
+ };
6337
+ const c = map[result.category];
6338
+ return /* @__PURE__ */ jsx16("span", { style: { fontSize: 9, fontWeight: 700, letterSpacing: "0.04em", padding: "2px 6px", borderRadius: 99, background: "#ffffff", color: c.color, fontVariantNumeric: "tabular-nums", flexShrink: 0, marginTop: 1 }, children: c.label });
6339
+ }
5847
6340
  function LinkCheckCard({
5848
6341
  urls,
6342
+ linksDetailed,
5849
6343
  results,
5850
6344
  isLoading,
5851
6345
  error,
5852
6346
  hasRun,
5853
6347
  onCheck
5854
6348
  }) {
5855
- const counts = useMemo4(() => {
5856
- const total = results.length;
5857
- const valid = results.filter((r) => r.category === "ok").length;
5858
- const redirects = results.filter((r) => r.category === "redirect").length;
5859
- const broken = results.filter((r) => r.category === "broken").length;
5860
- const errored = results.filter((r) => r.category === "error").length;
5861
- const unverified = results.filter((r) => r.category === "unverified").length;
5862
- const issues = results.filter((r) => r.category !== "ok");
5863
- return { total, valid, redirects, broken, errored, unverified, issues };
5864
- }, [results]);
5865
- return /* @__PURE__ */ jsxs14("div", { id: "anchor-link-check", style: cardStyle6, children: [
5866
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5867
- /* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
5868
- hasRun && !isLoading && /* @__PURE__ */ jsx15(
5869
- "button",
5870
- {
5871
- onClick: onCheck,
5872
- style: {
5873
- background: "none",
5874
- border: "none",
5875
- fontSize: 10,
5876
- fontWeight: 600,
5877
- color: MJH_BLUE,
5878
- cursor: "pointer",
5879
- padding: "2px 4px"
5880
- },
5881
- title: "Run again",
5882
- children: "Re-check"
5883
- }
5884
- )
5885
- ] }),
5886
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginBottom: 10 }, children: urls.length === 0 ? "No external links found in the body." : `${urls.length} link${urls.length === 1 ? "" : "s"} found in the body.` }),
5887
- urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */ jsxs14(
5888
- "button",
6349
+ const [openBucket, setOpenBucket] = useState16(null);
6350
+ const haveTypes = !!linksDetailed;
6351
+ const detailByUrl = useMemo4(
6352
+ () => new Map((linksDetailed || []).map((d) => [d.url, d])),
6353
+ [linksDetailed]
6354
+ );
6355
+ const resultByUrl = useMemo4(() => new Map(results.map((r) => [r.url, r])), [results]);
6356
+ const blockedUrls = results.filter((r) => r.category === "unverified").map((r) => r.url);
6357
+ const tiles = useMemo4(() => {
6358
+ const hyper = (linksDetailed || []).filter((l) => l.hyperlinked).map((l) => l.url);
6359
+ const plain = (linksDetailed || []).filter((l) => !l.hyperlinked).map((l) => l.url);
6360
+ const working = results.filter((r) => r.category === "ok" || r.category === "redirect").map((r) => r.url);
6361
+ const broken = results.filter((r) => r.category === "broken" || r.category === "error").map((r) => r.url);
6362
+ const t = [];
6363
+ if (hasRun) t.push({ key: "working", label: "Working", color: "#16a34a", urls: working });
6364
+ if (haveTypes) t.push({ key: "linked", label: "Linked", color: "#16a34a", urls: hyper });
6365
+ if (hasRun) t.push({ key: "broken", label: "Broken", color: "#dc2626", urls: broken });
6366
+ if (haveTypes) t.push({ key: "notlinked", label: "Not linked", color: "#dc2626", urls: plain, note: "Not links yet - hyperlink these so readers can click them and search engines can follow them." });
6367
+ return t;
6368
+ }, [haveTypes, linksDetailed, hasRun, results]);
6369
+ const open = tiles.find((t) => t.key === openBucket) || null;
6370
+ const renderLinkRow = (url) => {
6371
+ const d = detailByUrl.get(url);
6372
+ const r = resultByUrl.get(url);
6373
+ return /* @__PURE__ */ jsxs15(
6374
+ "a",
5889
6375
  {
5890
- onClick: onCheck,
5891
- style: {
5892
- width: "100%",
5893
- padding: "8px 12px",
5894
- fontSize: 11,
5895
- fontWeight: 700,
5896
- color: "#1f2937",
5897
- background: MJH_GOLD,
5898
- border: "none",
5899
- borderRadius: 6,
5900
- cursor: "pointer",
5901
- letterSpacing: "0.01em"
5902
- },
6376
+ href: url,
6377
+ target: "_blank",
6378
+ rel: "noopener noreferrer",
6379
+ style: { display: "flex", gap: 8, alignItems: "flex-start", padding: "6px 8px", background: "rgba(0,0,0,0.025)", borderRadius: 6, textDecoration: "none", marginTop: 4 },
5903
6380
  children: [
5904
- "Check ",
5905
- urls.length,
5906
- " link",
5907
- urls.length === 1 ? "" : "s",
5908
- " for 404s"
6381
+ r && /* @__PURE__ */ jsx16(HealthBadge, { result: r }),
6382
+ /* @__PURE__ */ jsxs15("div", { style: { minWidth: 0, flex: 1 }, children: [
6383
+ d?.anchorText && /* @__PURE__ */ jsxs15("div", { style: { fontSize: 11, color: "#1f2937", fontWeight: 600, lineHeight: 1.3, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
6384
+ "\u201C",
6385
+ d.anchorText,
6386
+ "\u201D"
6387
+ ] }),
6388
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", wordBreak: "break-all", lineHeight: 1.35 }, children: url })
6389
+ ] })
5909
6390
  ]
5910
- }
5911
- ),
5912
- isLoading && /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5913
- /* @__PURE__ */ jsx15(LoadingBars, { size: "xs", color: MJH_BLUE }),
5914
- /* @__PURE__ */ jsxs14("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
5915
- "Checking ",
6391
+ },
6392
+ url
6393
+ );
6394
+ };
6395
+ return /* @__PURE__ */ jsxs15("div", { id: "anchor-link-check", style: cardStyle6, children: [
6396
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
6397
+ /* @__PURE__ */ jsx16("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
6398
+ hasRun && !isLoading && /* @__PURE__ */ jsx16("button", { onClick: onCheck, style: { background: "none", border: "none", fontSize: 10, fontWeight: 600, color: MJH_BLUE, cursor: "pointer", padding: "2px 4px" }, title: "Run again", children: "Re-check" })
6399
+ ] }),
6400
+ urls.length === 0 ? /* @__PURE__ */ jsx16("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: "No links found in the body." }) : /* @__PURE__ */ jsxs15(Fragment9, { children: [
6401
+ /* @__PURE__ */ jsxs15("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5, marginBottom: 10 }, children: [
5916
6402
  urls.length,
5917
6403
  " link",
5918
6404
  urls.length === 1 ? "" : "s",
5919
- "..."
5920
- ] })
5921
- ] }),
5922
- error && !isLoading && /* @__PURE__ */ jsxs14(
5923
- "div",
5924
- {
5925
- style: {
5926
- padding: "10px 12px",
5927
- background: "rgba(220,38,38,0.04)",
5928
- border: "1px solid rgba(220,38,38,0.18)",
5929
- borderRadius: 8,
5930
- fontSize: 11,
5931
- color: "#b91c1c",
5932
- lineHeight: 1.5
5933
- },
5934
- children: [
5935
- error,
5936
- /* @__PURE__ */ jsx15(
5937
- "button",
5938
- {
5939
- onClick: onCheck,
5940
- style: {
5941
- display: "block",
5942
- marginTop: 6,
5943
- padding: "4px 10px",
5944
- fontSize: 11,
5945
- fontWeight: 700,
5946
- color: "#ffffff",
5947
- background: "#dc2626",
5948
- border: "none",
5949
- borderRadius: 5,
5950
- cursor: "pointer"
5951
- },
5952
- children: "Try again"
5953
- }
5954
- )
5955
- ]
5956
- }
5957
- ),
5958
- hasRun && !isLoading && !error && /* @__PURE__ */ jsxs14(Fragment8, { children: [
5959
- /* @__PURE__ */ jsxs14("div", { style: { display: "grid", gridTemplateColumns: counts.unverified > 0 ? "repeat(5, 1fr)" : "repeat(4, 1fr)", gap: 6 }, children: [
5960
- /* @__PURE__ */ jsx15(StatTile, { label: "Checked", value: counts.total, color: "#475569" }),
5961
- /* @__PURE__ */ jsx15(StatTile, { label: "Valid", value: counts.valid, color: "#16a34a" }),
5962
- /* @__PURE__ */ jsx15(StatTile, { label: "Redirects", value: counts.redirects, color: "#8B7310" }),
5963
- /* @__PURE__ */ jsx15(StatTile, { label: "Broken", value: counts.broken + counts.errored, color: "#dc2626" }),
5964
- counts.unverified > 0 && /* @__PURE__ */ jsx15(StatTile, { label: "Blocked", value: counts.unverified, color: "#b45309" })
6405
+ " in the body.",
6406
+ tiles.length > 0 ? " Tap a box to see which." : ""
5965
6407
  ] }),
5966
- counts.unverified > 0 && /* @__PURE__ */ jsxs14(
5967
- "div",
5968
- {
5969
- style: {
5970
- marginTop: 8,
5971
- padding: "6px 10px",
5972
- background: "rgba(245,158,11,0.08)",
5973
- border: "1px solid rgba(245,158,11,0.25)",
5974
- borderRadius: 6,
5975
- fontSize: 10.5,
5976
- color: "#92400e",
5977
- lineHeight: 1.45
6408
+ tiles.length > 0 && /* @__PURE__ */ jsx16("div", { style: { display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 6 }, children: tiles.map((t) => {
6409
+ const empty = t.urls.length === 0;
6410
+ const active = openBucket === t.key && !empty;
6411
+ return /* @__PURE__ */ jsxs15(
6412
+ "button",
6413
+ {
6414
+ type: "button",
6415
+ onClick: () => !empty && setOpenBucket(active ? null : t.key),
6416
+ "aria-expanded": active,
6417
+ "aria-label": `${t.urls.length} ${t.label} links`,
6418
+ style: {
6419
+ padding: "8px 4px",
6420
+ background: active ? "rgba(0,93,172,0.08)" : "rgba(0,0,0,0.025)",
6421
+ border: active ? `1px solid ${MJH_BLUE}55` : "1px solid transparent",
6422
+ borderRadius: 8,
6423
+ textAlign: "center",
6424
+ cursor: empty ? "default" : "pointer",
6425
+ opacity: empty ? 0.5 : 1
6426
+ },
6427
+ children: [
6428
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 18, fontWeight: 700, color: t.color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: t.urls.length }),
6429
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginTop: 4 }, children: t.label })
6430
+ ]
5978
6431
  },
6432
+ t.key
6433
+ );
6434
+ }) }),
6435
+ open && open.urls.length > 0 && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 8 }, children: [
6436
+ open.note && /* @__PURE__ */ jsx16("div", { style: { fontSize: 10.5, color: "#92400e", background: "rgba(245,158,11,0.08)", border: "1px solid rgba(245,158,11,0.25)", borderRadius: 6, padding: "6px 9px", lineHeight: 1.45, marginBottom: 2 }, children: open.note }),
6437
+ open.urls.map(renderLinkRow)
6438
+ ] }),
6439
+ hasRun && blockedUrls.length > 0 && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 8, padding: "6px 10px", background: "rgba(245,158,11,0.08)", border: "1px solid rgba(245,158,11,0.25)", borderRadius: 6, fontSize: 10.5, color: "#92400e", lineHeight: 1.45 }, children: [
6440
+ blockedUrls.length,
6441
+ " link",
6442
+ blockedUrls.length === 1 ? "" : "s",
6443
+ " couldn't be auto-checked (the destination blocks our checker) - open them to confirm."
6444
+ ] }),
6445
+ !hasRun && !isLoading && /* @__PURE__ */ jsxs15(
6446
+ "button",
6447
+ {
6448
+ onClick: onCheck,
6449
+ style: { width: "100%", marginTop: 10, padding: "8px 12px", fontSize: 11, fontWeight: 700, color: "#1f2937", background: MJH_GOLD, border: "none", borderRadius: 6, cursor: "pointer", letterSpacing: "0.01em" },
5979
6450
  children: [
5980
- counts.unverified,
6451
+ "Check ",
6452
+ urls.length,
5981
6453
  " link",
5982
- counts.unverified === 1 ? "" : "s",
5983
- " were blocked from our auto-check (likely anti-bot rules on the destination site). They may still work fine for human readers - click each to confirm."
6454
+ urls.length === 1 ? "" : "s",
6455
+ " for broken / redirects"
5984
6456
  ]
5985
6457
  }
5986
6458
  ),
5987
- counts.issues.length > 0 ? /* @__PURE__ */ jsxs14("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 6 }, children: [
5988
- /* @__PURE__ */ jsxs14("div", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em" }, children: [
5989
- counts.issues.length,
6459
+ isLoading && /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
6460
+ /* @__PURE__ */ jsx16(LoadingBars, { size: "xs", color: MJH_BLUE }),
6461
+ /* @__PURE__ */ jsxs15("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
6462
+ "Checking ",
6463
+ urls.length,
5990
6464
  " link",
5991
- counts.issues.length === 1 ? "" : "s",
5992
- " need",
5993
- counts.issues.length === 1 ? "s" : "",
5994
- " attention"
5995
- ] }),
5996
- counts.issues.map((r) => /* @__PURE__ */ jsx15(LinkIssueRow, { result: r }, r.url))
5997
- ] }) : /* @__PURE__ */ jsxs14(
5998
- "div",
5999
- {
6000
- style: {
6001
- marginTop: 12,
6002
- padding: "8px 10px",
6003
- background: "rgba(22,163,74,0.05)",
6004
- border: "1px solid rgba(22,163,74,0.15)",
6005
- borderRadius: 8,
6006
- fontSize: 11,
6007
- color: "#16a34a",
6008
- fontWeight: 600,
6009
- textAlign: "center"
6010
- },
6011
- children: [
6012
- "All ",
6013
- counts.total,
6014
- " link",
6015
- counts.total === 1 ? "" : "s",
6016
- " resolve cleanly."
6017
- ]
6018
- }
6019
- )
6465
+ urls.length === 1 ? "" : "s",
6466
+ "..."
6467
+ ] })
6468
+ ] }),
6469
+ error && !isLoading && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 10, padding: "10px 12px", background: "rgba(220,38,38,0.04)", border: "1px solid rgba(220,38,38,0.18)", borderRadius: 8, fontSize: 11, color: "#b91c1c", lineHeight: 1.5 }, children: [
6470
+ error,
6471
+ /* @__PURE__ */ jsx16("button", { onClick: onCheck, style: { display: "block", marginTop: 6, padding: "4px 10px", fontSize: 11, fontWeight: 700, color: "#ffffff", background: "#dc2626", border: "none", borderRadius: 5, cursor: "pointer" }, children: "Try again" })
6472
+ ] })
6020
6473
  ] })
6021
6474
  ] });
6022
6475
  }
6023
- function StatTile({ label, value, color }) {
6024
- return /* @__PURE__ */ jsxs14(
6025
- "div",
6026
- {
6027
- style: {
6028
- padding: "8px 4px",
6029
- background: "rgba(0,0,0,0.025)",
6030
- borderRadius: 8,
6031
- textAlign: "center"
6032
- },
6033
- children: [
6034
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 18, fontWeight: 700, color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: value }),
6035
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", marginTop: 4 }, children: label })
6036
- ]
6037
- }
6038
- );
6039
- }
6040
- function LinkIssueRow({ result }) {
6041
- const map = {
6042
- ok: { bg: "rgba(22,163,74,0.06)", color: "#16a34a", label: "OK" },
6043
- redirect: { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: result.status > 0 ? String(result.status) : "REDIR" },
6044
- broken: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: result.status > 0 ? String(result.status) : "404" },
6045
- // Amber for unverified - the link may work fine, our server just couldn't confirm.
6046
- unverified: { bg: "rgba(245,158,11,0.10)", color: "#b45309", label: result.status > 0 ? String(result.status) : "BLOCKED" },
6047
- error: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: "ERR" }
6048
- };
6049
- const c = map[result.category];
6050
- const tooltip = result.category === "unverified" ? `${result.url} (couldn't auto-check; likely anti-bot blocking - open manually to verify)` : result.error ? `${result.url} (${result.error})` : result.url;
6051
- return /* @__PURE__ */ jsxs14(
6052
- "a",
6053
- {
6054
- href: result.url,
6055
- target: "_blank",
6056
- rel: "noopener noreferrer",
6057
- style: {
6058
- display: "flex",
6059
- alignItems: "center",
6060
- gap: 8,
6061
- padding: "6px 10px",
6062
- background: c.bg,
6063
- borderRadius: 6,
6064
- textDecoration: "none"
6065
- },
6066
- children: [
6067
- /* @__PURE__ */ jsx15(
6068
- "span",
6069
- {
6070
- style: {
6071
- fontSize: 9,
6072
- fontWeight: 700,
6073
- letterSpacing: "0.04em",
6074
- padding: "2px 6px",
6075
- borderRadius: 99,
6076
- background: "#ffffff",
6077
- color: c.color,
6078
- fontVariantNumeric: "tabular-nums",
6079
- flexShrink: 0
6080
- },
6081
- children: c.label
6082
- }
6083
- ),
6084
- /* @__PURE__ */ jsx15(
6085
- "span",
6086
- {
6087
- style: {
6088
- fontSize: 11,
6089
- color: "#1f2937",
6090
- fontFamily: "ui-monospace, SFMono-Regular, monospace",
6091
- flex: 1,
6092
- minWidth: 0,
6093
- overflow: "hidden",
6094
- textOverflow: "ellipsis",
6095
- whiteSpace: "nowrap"
6096
- },
6097
- title: tooltip,
6098
- children: result.url
6099
- }
6100
- )
6101
- ]
6102
- }
6103
- );
6104
- }
6105
6476
  function TechnicalTab({
6106
6477
  text,
6107
6478
  documentFields,
@@ -6126,8 +6497,8 @@ function TechnicalTab({
6126
6497
  );
6127
6498
  const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
6128
6499
  const structureAudits = useMemo4(
6129
- () => computeHeadingStructureAudits(headingsForStructure, wordCount2),
6130
- [headingsForStructure, wordCount2]
6500
+ () => computeHeadingStructureAudits(headingsForStructure, wordCount2, primaryKeyword, secondaryKeyword, documentFields?.unstyledHeadings),
6501
+ [headingsForStructure, wordCount2, primaryKeyword, secondaryKeyword, documentFields?.unstyledHeadings]
6131
6502
  );
6132
6503
  const imageNames = documentFields?.imageNames || [];
6133
6504
  const { filenames: imageFilenames, altTexts: imageAltTexts } = useMemo4(
@@ -6168,15 +6539,16 @@ function TechnicalTab({
6168
6539
  recommendation: "Above the 450-word floor. For competitive clinical content, push past 1,500 words."
6169
6540
  } : { label: "Word Count", value: `${wordCount2} words`, status: "good" };
6170
6541
  const bodyLinks = documentFields?.bodyLinks || [];
6542
+ const bodyLinksDetailed = documentFields?.bodyLinksDetailed;
6171
6543
  const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.headings && documentFields.headings.length > 0 || documentFields.imageNames && documentFields.imageNames.length > 0 || wordCount2 > 0);
6172
6544
  if (isLoading && !hasAnyField) {
6173
- return /* @__PURE__ */ jsxs14("div", { style: { padding: 24, textAlign: "center" }, children: [
6174
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
6175
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
6545
+ return /* @__PURE__ */ jsxs15("div", { style: { padding: 24, textAlign: "center" }, children: [
6546
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
6547
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
6176
6548
  ] });
6177
6549
  }
6178
- return /* @__PURE__ */ jsxs14("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
6179
- /* @__PURE__ */ jsx15(
6550
+ return /* @__PURE__ */ jsxs15("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
6551
+ /* @__PURE__ */ jsx16(
6180
6552
  AuditCard2,
6181
6553
  {
6182
6554
  anchorId: "anchor-url-slug",
@@ -6184,10 +6556,22 @@ function TechnicalTab({
6184
6556
  value: urlSlugAudit.value,
6185
6557
  status: urlSlugAudit.status,
6186
6558
  recommendation: urlSlugAudit.recommendation,
6187
- footer: /* @__PURE__ */ jsx15(SlugRedirectNotice, {})
6559
+ footer: /* @__PURE__ */ jsx16(SlugRedirectNotice, {})
6188
6560
  }
6189
6561
  ),
6190
- wordAudit && /* @__PURE__ */ jsx15(
6562
+ /* @__PURE__ */ jsx16(
6563
+ LinkCheckCard,
6564
+ {
6565
+ urls: bodyLinks,
6566
+ linksDetailed: bodyLinksDetailed,
6567
+ results: linkCheckResults,
6568
+ isLoading: isLinkCheckLoading,
6569
+ error: linkCheckError,
6570
+ hasRun: hasRunLinkCheck,
6571
+ onCheck: onCheckLinks
6572
+ }
6573
+ ),
6574
+ wordAudit && /* @__PURE__ */ jsx16(
6191
6575
  AuditCard2,
6192
6576
  {
6193
6577
  anchorId: "anchor-word-count",
@@ -6197,48 +6581,63 @@ function TechnicalTab({
6197
6581
  recommendation: wordAudit.recommendation
6198
6582
  }
6199
6583
  ),
6200
- structureAudits.map((a, i) => /* @__PURE__ */ jsx15(
6201
- AuditCard2,
6202
- {
6203
- anchorId: i === 0 ? "anchor-headings-structure" : void 0,
6204
- label: a.label,
6205
- value: a.value,
6206
- status: a.status,
6207
- recommendation: a.recommendation
6208
- },
6209
- `structure-${i}`
6210
- )),
6211
- headings.length > 0 && /* @__PURE__ */ jsxs14("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
6212
- /* @__PURE__ */ jsx15("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
6213
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
6214
- (headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */ jsxs14(
6215
- "div",
6216
- {
6217
- style: {
6218
- fontSize: 11,
6219
- color: h.text ? "#4b5563" : "#dc2626",
6220
- fontStyle: h.text ? "normal" : "italic",
6221
- lineHeight: 1.4,
6222
- paddingLeft: Math.max(0, (h.level - 2) * 12)
6584
+ (() => {
6585
+ const structIdx = structureAudits.findIndex(
6586
+ (a) => a.label !== "Keywords in Headings" && a.label !== "Looks Like a Heading"
6587
+ );
6588
+ return structureAudits.map((a, i) => /* @__PURE__ */ jsx16(
6589
+ AuditCard2,
6590
+ {
6591
+ anchorId: a.label === "Keywords in Headings" ? "anchor-headings-keyword" : a.label === "Looks Like a Heading" ? "anchor-headings-unstyled" : i === structIdx ? "anchor-headings-structure" : void 0,
6592
+ label: a.label,
6593
+ value: a.value,
6594
+ status: a.status,
6595
+ recommendation: a.recommendation
6596
+ },
6597
+ `structure-${i}`
6598
+ ));
6599
+ })(),
6600
+ (headings.length > 0 || !!documentFields?.title) && /* @__PURE__ */ jsxs15("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
6601
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
6602
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
6603
+ documentFields?.title && /* @__PURE__ */ jsxs15("div", { style: { fontSize: 11, color: MJH_BLUE, fontWeight: 700, lineHeight: 1.4 }, children: [
6604
+ /* @__PURE__ */ jsx16("span", { style: { fontSize: 9, fontWeight: 700, color: MJH_BLUE, marginRight: 6 }, children: "H1" }),
6605
+ documentFields.title,
6606
+ /* @__PURE__ */ jsx16("span", { style: { fontSize: 9, color: "#6b7280", fontWeight: 500, marginLeft: 6 }, children: "(article title)" })
6607
+ ] }),
6608
+ (headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => {
6609
+ const isH1 = h.level === 1;
6610
+ return /* @__PURE__ */ jsxs15(
6611
+ "div",
6612
+ {
6613
+ style: {
6614
+ fontSize: 11,
6615
+ color: !h.text ? "#dc2626" : isH1 ? MJH_BLUE : "#4b5563",
6616
+ fontWeight: isH1 ? 700 : 400,
6617
+ fontStyle: h.text ? "normal" : "italic",
6618
+ lineHeight: 1.4,
6619
+ paddingLeft: Math.max(0, (h.level - 2) * 12)
6620
+ },
6621
+ children: [
6622
+ /* @__PURE__ */ jsxs15("span", { style: { fontSize: 9, fontWeight: 700, color: isH1 ? MJH_BLUE : "#4b5563", marginRight: 6 }, children: [
6623
+ "H",
6624
+ h.level
6625
+ ] }),
6626
+ h.text || "(empty)"
6627
+ ]
6223
6628
  },
6224
- children: [
6225
- /* @__PURE__ */ jsxs14("span", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", marginRight: 6 }, children: [
6226
- "H",
6227
- h.level
6228
- ] }),
6229
- h.text || "(empty)"
6230
- ]
6231
- },
6232
- i
6233
- )),
6234
- (headingsDetailed ?? headings).length > 12 && /* @__PURE__ */ jsxs14("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
6629
+ i
6630
+ );
6631
+ }),
6632
+ (headingsDetailed ?? headings).length > 12 && /* @__PURE__ */ jsxs15("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
6235
6633
  "+ ",
6236
6634
  (headingsDetailed ?? headings).length - 12,
6237
6635
  " more"
6238
6636
  ] })
6239
- ] })
6637
+ ] }),
6638
+ /* @__PURE__ */ jsx16("div", { style: { fontSize: 10, color: "#6b7280", marginTop: 8, lineHeight: 1.4 }, children: headings.length > 0 ? "The title above is your H1; the tool scans the H2-H6 tags below it. Tip: work your primary and/or secondary keyword into a header where it reads naturally." : "The title above is your H1, and there are no H2-H6 subheadings yet. Tip: work your primary and/or secondary keyword into the title where it reads naturally." })
6240
6639
  ] }),
6241
- imagesAudit && /* @__PURE__ */ jsx15(
6640
+ imagesAudit && /* @__PURE__ */ jsx16(
6242
6641
  AuditCard2,
6243
6642
  {
6244
6643
  anchorId: "anchor-images",
@@ -6248,7 +6647,7 @@ function TechnicalTab({
6248
6647
  recommendation: imagesAudit.recommendation
6249
6648
  }
6250
6649
  ),
6251
- filenameAudit && /* @__PURE__ */ jsx15(
6650
+ filenameAudit && /* @__PURE__ */ jsx16(
6252
6651
  AuditCard2,
6253
6652
  {
6254
6653
  anchorId: "anchor-image-filenames",
@@ -6258,7 +6657,7 @@ function TechnicalTab({
6258
6657
  recommendation: filenameAudit.recommendation
6259
6658
  }
6260
6659
  ),
6261
- altTextAudit && /* @__PURE__ */ jsx15(
6660
+ altTextAudit && /* @__PURE__ */ jsx16(
6262
6661
  AuditCard2,
6263
6662
  {
6264
6663
  anchorId: "anchor-image-alt",
@@ -6268,7 +6667,7 @@ function TechnicalTab({
6268
6667
  recommendation: altTextAudit.recommendation
6269
6668
  }
6270
6669
  ),
6271
- imgTitleAudit && /* @__PURE__ */ jsx15(
6670
+ imgTitleAudit && /* @__PURE__ */ jsx16(
6272
6671
  AuditCard2,
6273
6672
  {
6274
6673
  anchorId: "anchor-image-titles",
@@ -6277,28 +6676,17 @@ function TechnicalTab({
6277
6676
  status: imgTitleAudit.status,
6278
6677
  recommendation: imgTitleAudit.recommendation
6279
6678
  }
6280
- ),
6281
- /* @__PURE__ */ jsx15(
6282
- LinkCheckCard,
6283
- {
6284
- urls: bodyLinks,
6285
- results: linkCheckResults,
6286
- isLoading: isLinkCheckLoading,
6287
- error: linkCheckError,
6288
- hasRun: hasRunLinkCheck,
6289
- onCheck: onCheckLinks
6290
- }
6291
6679
  )
6292
6680
  ] });
6293
6681
  }
6294
6682
 
6295
6683
  // src/components/SEOCopilotPanel.tsx
6296
- import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
6684
+ import { Fragment as Fragment10, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
6297
6685
  function LogoIcon2() {
6298
- return /* @__PURE__ */ jsxs15("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
6299
- /* @__PURE__ */ jsx16("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
6300
- /* @__PURE__ */ jsx16("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
6301
- /* @__PURE__ */ jsx16("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
6686
+ return /* @__PURE__ */ jsxs16("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
6687
+ /* @__PURE__ */ jsx17("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
6688
+ /* @__PURE__ */ jsx17("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
6689
+ /* @__PURE__ */ jsx17("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
6302
6690
  ] });
6303
6691
  }
6304
6692
  function PanelContent({
@@ -6340,14 +6728,14 @@ function PanelContent({
6340
6728
  const keywordAnalysisState = externalAnalysis;
6341
6729
  const effectivePrimary = selectedPrimary || externalAnalysis.analysis?.primaryKeyword?.term || "";
6342
6730
  const effectiveSecondary = selectedSecondary || "";
6343
- const containerRef = useRef11(null);
6344
- const dragging = useRef11(false);
6731
+ const containerRef = useRef12(null);
6732
+ const dragging = useRef12(false);
6345
6733
  const onMouseDown = useCallback5(() => {
6346
6734
  dragging.current = true;
6347
6735
  document.body.style.cursor = "row-resize";
6348
6736
  document.body.style.userSelect = "none";
6349
6737
  }, []);
6350
- useEffect11(() => {
6738
+ useEffect12(() => {
6351
6739
  const onMouseMove = (e) => {
6352
6740
  if (!dragging.current || !containerRef.current) return;
6353
6741
  const rect = containerRef.current.getBoundingClientRect();
@@ -6370,11 +6758,11 @@ function PanelContent({
6370
6758
  const onboardSite = publication || "default";
6371
6759
  const onboardKey = `seo-copilot-onboarded-${onboardSite}`;
6372
6760
  const onboardSessionKey = `seo-copilot-onboard-shown-${onboardSite}`;
6373
- const [popupMode, setPopupMode] = useState16("hidden");
6374
- const [popupClosing, setPopupClosing] = useState16(false);
6375
- const onboardTimerRef = useRef11(null);
6376
- const onboardFadeRef = useRef11(null);
6377
- useEffect11(() => {
6761
+ const [popupMode, setPopupMode] = useState17("hidden");
6762
+ const [popupClosing, setPopupClosing] = useState17(false);
6763
+ const onboardTimerRef = useRef12(null);
6764
+ const onboardFadeRef = useRef12(null);
6765
+ useEffect12(() => {
6378
6766
  let onboarded = false;
6379
6767
  let shownThisSession = false;
6380
6768
  try {
@@ -6446,7 +6834,7 @@ function PanelContent({
6446
6834
  { id: "meta", label: "Meta", beta: true },
6447
6835
  { id: "technical", label: "Other Recs", beta: true, loading: technicalOps.isLinkCheckLoading }
6448
6836
  ];
6449
- return /* @__PURE__ */ jsxs15(
6837
+ return /* @__PURE__ */ jsxs16(
6450
6838
  "div",
6451
6839
  {
6452
6840
  className: "seo-copilot-panel",
@@ -6461,9 +6849,9 @@ function PanelContent({
6461
6849
  position: "relative"
6462
6850
  },
6463
6851
  children: [
6464
- /* @__PURE__ */ jsx16("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
6465
- popupMode !== "hidden" && /* @__PURE__ */ jsx16(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
6466
- /* @__PURE__ */ jsxs15(
6852
+ /* @__PURE__ */ jsx17("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
6853
+ popupMode !== "hidden" && /* @__PURE__ */ jsx17(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
6854
+ /* @__PURE__ */ jsxs16(
6467
6855
  "div",
6468
6856
  {
6469
6857
  onMouseDown: isFloating ? onDragStart : void 0,
@@ -6481,16 +6869,26 @@ function PanelContent({
6481
6869
  flexShrink: 0
6482
6870
  },
6483
6871
  children: [
6484
- /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
6485
- /* @__PURE__ */ jsx16(LogoIcon2, {}),
6486
- /* @__PURE__ */ jsxs15("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
6487
- /* @__PURE__ */ jsx16("span", { style: { color: MJH_GOLD }, children: "SEO" }),
6488
- /* @__PURE__ */ jsx16("span", { style: { color: MJH_SLATE }, children: " copilot" })
6872
+ /* @__PURE__ */ jsxs16("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
6873
+ /* @__PURE__ */ jsx17(LogoIcon2, {}),
6874
+ /* @__PURE__ */ jsxs16("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
6875
+ /* @__PURE__ */ jsx17("span", { style: { color: MJH_GOLD }, children: "SEO" }),
6876
+ /* @__PURE__ */ jsx17("span", { style: { color: MJH_SLATE }, children: " copilot" })
6489
6877
  ] })
6490
6878
  ] }),
6491
- /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
6492
- /* @__PURE__ */ jsx16(OnboardingInfoButton, { onClick: openPopupPersistent }),
6493
- isFloating && onToggleFullscreen && /* @__PURE__ */ jsx16(
6879
+ /* @__PURE__ */ jsxs16("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
6880
+ /* @__PURE__ */ jsx17(OnboardingInfoButton, { onClick: openPopupPersistent }),
6881
+ /* @__PURE__ */ jsx17(
6882
+ ReportProblemButton,
6883
+ {
6884
+ activeTab,
6885
+ publication,
6886
+ documentId,
6887
+ documentType,
6888
+ primaryKeyword: effectivePrimary
6889
+ }
6890
+ ),
6891
+ isFloating && onToggleFullscreen && /* @__PURE__ */ jsx17(
6494
6892
  "button",
6495
6893
  {
6496
6894
  onClick: (e) => {
@@ -6512,16 +6910,16 @@ function PanelContent({
6512
6910
  fontWeight: 600,
6513
6911
  transition: "all 150ms"
6514
6912
  },
6515
- children: isFullscreen ? /* @__PURE__ */ jsxs15(Fragment9, { children: [
6516
- /* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M3.28 2.22a.75.75 0 00-1.06 1.06L5.44 6.5H3.75a.75.75 0 000 1.5h4.5A.75.75 0 009 7.25v-4.5a.75.75 0 00-1.5 0v1.69L4.28 1.22a.75.75 0 00-1 1zM16.72 17.78a.75.75 0 001.06-1.06L14.56 13.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5a.75.75 0 001.5 0v-1.69l3.22 3.22z" }) }),
6913
+ children: isFullscreen ? /* @__PURE__ */ jsxs16(Fragment10, { children: [
6914
+ /* @__PURE__ */ jsx17("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17("path", { d: "M3.28 2.22a.75.75 0 00-1.06 1.06L5.44 6.5H3.75a.75.75 0 000 1.5h4.5A.75.75 0 009 7.25v-4.5a.75.75 0 00-1.5 0v1.69L4.28 1.22a.75.75 0 00-1 1zM16.72 17.78a.75.75 0 001.06-1.06L14.56 13.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5a.75.75 0 001.5 0v-1.69l3.22 3.22z" }) }),
6517
6915
  "Exit fullscreen"
6518
- ] }) : /* @__PURE__ */ jsxs15(Fragment9, { children: [
6519
- /* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M13.28 7.78l3.22-3.22v1.69a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h1.69l-3.22 3.22a.75.75 0 001.06 1.06zM2 17.25a.75.75 0 001.5 0v-1.69l3.22 3.22a.75.75 0 001.06-1.06L4.56 14.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5z" }) }),
6916
+ ] }) : /* @__PURE__ */ jsxs16(Fragment10, { children: [
6917
+ /* @__PURE__ */ jsx17("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17("path", { d: "M13.28 7.78l3.22-3.22v1.69a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h1.69l-3.22 3.22a.75.75 0 001.06 1.06zM2 17.25a.75.75 0 001.5 0v-1.69l3.22 3.22a.75.75 0 001.06-1.06L4.56 14.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5z" }) }),
6520
6918
  "Fullscreen"
6521
6919
  ] })
6522
6920
  }
6523
6921
  ),
6524
- isFloating && onToggleFloat && /* @__PURE__ */ jsxs15(
6922
+ isFloating && onToggleFloat && /* @__PURE__ */ jsxs16(
6525
6923
  "button",
6526
6924
  {
6527
6925
  onClick: (e) => {
@@ -6544,7 +6942,7 @@ function PanelContent({
6544
6942
  transition: "all 150ms"
6545
6943
  },
6546
6944
  children: [
6547
- /* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16(
6945
+ /* @__PURE__ */ jsx17("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17(
6548
6946
  "path",
6549
6947
  {
6550
6948
  fillRule: "evenodd",
@@ -6556,7 +6954,7 @@ function PanelContent({
6556
6954
  ]
6557
6955
  }
6558
6956
  ),
6559
- !isFloating && onToggleFloat && /* @__PURE__ */ jsx16(
6957
+ !isFloating && onToggleFloat && /* @__PURE__ */ jsx17(
6560
6958
  "button",
6561
6959
  {
6562
6960
  onClick: (e) => {
@@ -6575,13 +6973,13 @@ function PanelContent({
6575
6973
  transition: "color 150ms"
6576
6974
  },
6577
6975
  title: "Pop out",
6578
- children: /* @__PURE__ */ jsxs15("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
6579
- /* @__PURE__ */ jsx16("path", { d: "M4.25 5.5a.75.75 0 00-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-4a.75.75 0 011.5 0v4A2.25 2.25 0 0112.75 17h-8.5A2.25 2.25 0 012 14.75v-8.5A2.25 2.25 0 014.25 4h5a.75.75 0 010 1.5h-5z" }),
6580
- /* @__PURE__ */ jsx16("path", { d: "M6.194 12.753a.75.75 0 001.06.053L16.5 4.44v2.81a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.553l-9.056 8.194a.75.75 0 00-.053 1.06z" })
6976
+ children: /* @__PURE__ */ jsxs16("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
6977
+ /* @__PURE__ */ jsx17("path", { d: "M4.25 5.5a.75.75 0 00-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-4a.75.75 0 011.5 0v4A2.25 2.25 0 0112.75 17h-8.5A2.25 2.25 0 012 14.75v-8.5A2.25 2.25 0 014.25 4h5a.75.75 0 010 1.5h-5z" }),
6978
+ /* @__PURE__ */ jsx17("path", { d: "M6.194 12.753a.75.75 0 001.06.053L16.5 4.44v2.81a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.553l-9.056 8.194a.75.75 0 00-.053 1.06z" })
6581
6979
  ] })
6582
6980
  }
6583
6981
  ),
6584
- isLoading && /* @__PURE__ */ jsx16(
6982
+ isLoading && /* @__PURE__ */ jsx17(
6585
6983
  "div",
6586
6984
  {
6587
6985
  style: {
@@ -6593,7 +6991,7 @@ function PanelContent({
6593
6991
  }
6594
6992
  }
6595
6993
  ),
6596
- onClose && /* @__PURE__ */ jsx16(
6994
+ onClose && /* @__PURE__ */ jsx17(
6597
6995
  "button",
6598
6996
  {
6599
6997
  onClick: (e) => {
@@ -6612,11 +7010,11 @@ function PanelContent({
6612
7010
  transition: "color 150ms"
6613
7011
  },
6614
7012
  title: "Close",
6615
- children: /* @__PURE__ */ jsx16("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
7013
+ children: /* @__PURE__ */ jsx17("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
6616
7014
  }
6617
7015
  )
6618
7016
  ] }),
6619
- /* @__PURE__ */ jsx16(
7017
+ /* @__PURE__ */ jsx17(
6620
7018
  "div",
6621
7019
  {
6622
7020
  style: {
@@ -6635,8 +7033,8 @@ function PanelContent({
6635
7033
  ]
6636
7034
  }
6637
7035
  ),
6638
- /* @__PURE__ */ jsx16(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
6639
- /* @__PURE__ */ jsx16(
7036
+ /* @__PURE__ */ jsx17(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
7037
+ /* @__PURE__ */ jsx17(
6640
7038
  "div",
6641
7039
  {
6642
7040
  style: {
@@ -6652,8 +7050,8 @@ function PanelContent({
6652
7050
  children: "Recommendations are generated by AI. Verify details before publishing."
6653
7051
  }
6654
7052
  ),
6655
- /* @__PURE__ */ jsxs15("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
6656
- /* @__PURE__ */ jsxs15(
7053
+ /* @__PURE__ */ jsxs16("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
7054
+ /* @__PURE__ */ jsxs16(
6657
7055
  "div",
6658
7056
  {
6659
7057
  style: {
@@ -6664,7 +7062,7 @@ function PanelContent({
6664
7062
  background: RECS_ZONE_BG
6665
7063
  },
6666
7064
  children: [
6667
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
7065
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
6668
7066
  KeywordPanel,
6669
7067
  {
6670
7068
  text,
@@ -6680,7 +7078,7 @@ function PanelContent({
6680
7078
  },
6681
7079
  documentId || "default"
6682
7080
  ) }),
6683
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
7081
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
6684
7082
  SummaryTab,
6685
7083
  {
6686
7084
  text,
@@ -6696,7 +7094,7 @@ function PanelContent({
6696
7094
  onItemClick: summaryOps.onItemClick
6697
7095
  }
6698
7096
  ) }),
6699
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
7097
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
6700
7098
  AEOTab,
6701
7099
  {
6702
7100
  text,
@@ -6712,7 +7110,7 @@ function PanelContent({
6712
7110
  loadContentSuggestions: aeoOps.loadContentSuggestions
6713
7111
  }
6714
7112
  ) }),
6715
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
7113
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
6716
7114
  LinkingTab,
6717
7115
  {
6718
7116
  analysis: keywordAnalysisState.analysis,
@@ -6728,8 +7126,8 @@ function PanelContent({
6728
7126
  documentType
6729
7127
  }
6730
7128
  ) }),
6731
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
6732
- /* @__PURE__ */ jsx16("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
7129
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
7130
+ /* @__PURE__ */ jsx17("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
6733
7131
  TechnicalTab,
6734
7132
  {
6735
7133
  text,
@@ -6747,7 +7145,7 @@ function PanelContent({
6747
7145
  ]
6748
7146
  }
6749
7147
  ),
6750
- chatOpen && /* @__PURE__ */ jsx16(
7148
+ chatOpen && /* @__PURE__ */ jsx17(
6751
7149
  "div",
6752
7150
  {
6753
7151
  onMouseDown,
@@ -6760,10 +7158,10 @@ function PanelContent({
6760
7158
  justifyContent: "center",
6761
7159
  flexShrink: 0
6762
7160
  },
6763
- children: /* @__PURE__ */ jsx16("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
7161
+ children: /* @__PURE__ */ jsx17("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
6764
7162
  }
6765
7163
  ),
6766
- /* @__PURE__ */ jsxs15(
7164
+ /* @__PURE__ */ jsxs16(
6767
7165
  "div",
6768
7166
  {
6769
7167
  style: {
@@ -6776,7 +7174,7 @@ function PanelContent({
6776
7174
  background: CHAT_ZONE_BG
6777
7175
  },
6778
7176
  children: [
6779
- /* @__PURE__ */ jsxs15(
7177
+ /* @__PURE__ */ jsxs16(
6780
7178
  "button",
6781
7179
  {
6782
7180
  onClick: () => onChatOpenChange(!chatOpen),
@@ -6797,7 +7195,7 @@ function PanelContent({
6797
7195
  flexShrink: 0
6798
7196
  },
6799
7197
  children: [
6800
- /* @__PURE__ */ jsx16(
7198
+ /* @__PURE__ */ jsx17(
6801
7199
  "span",
6802
7200
  {
6803
7201
  style: {
@@ -6810,7 +7208,7 @@ function PanelContent({
6810
7208
  children: "Chat"
6811
7209
  }
6812
7210
  ),
6813
- /* @__PURE__ */ jsx16(
7211
+ /* @__PURE__ */ jsx17(
6814
7212
  "svg",
6815
7213
  {
6816
7214
  width: "12",
@@ -6818,7 +7216,7 @@ function PanelContent({
6818
7216
  viewBox: "0 0 20 20",
6819
7217
  fill: "rgba(0,0,0,0.55)",
6820
7218
  style: { transform: chatOpen ? "rotate(0deg)" : "rotate(-90deg)", transition: "transform 200ms" },
6821
- children: /* @__PURE__ */ jsx16(
7219
+ children: /* @__PURE__ */ jsx17(
6822
7220
  "path",
6823
7221
  {
6824
7222
  fillRule: "evenodd",
@@ -6831,7 +7229,7 @@ function PanelContent({
6831
7229
  ]
6832
7230
  }
6833
7231
  ),
6834
- /* @__PURE__ */ jsx16(
7232
+ /* @__PURE__ */ jsx17(
6835
7233
  "div",
6836
7234
  {
6837
7235
  style: {
@@ -6841,7 +7239,7 @@ function PanelContent({
6841
7239
  flexDirection: "column",
6842
7240
  minHeight: 0
6843
7241
  },
6844
- children: /* @__PURE__ */ jsx16(
7242
+ children: /* @__PURE__ */ jsx17(
6845
7243
  ChatPanel,
6846
7244
  {
6847
7245
  messages: chatState.messages,
@@ -6872,10 +7270,10 @@ function SEOCopilotInner({ config, onClose }) {
6872
7270
  "seo-copilot-ui-float-size",
6873
7271
  { width: 380, height: typeof window !== "undefined" ? Math.round(window.innerHeight * 0.8) : 600 }
6874
7272
  );
6875
- const dragOffset = useRef11(null);
6876
- const resizeStart = useRef11(null);
6877
- const activeDragCleanupRef = useRef11(null);
6878
- const activeResizeCleanupRef = useRef11(null);
7273
+ const dragOffset = useRef12(null);
7274
+ const resizeStart = useRef12(null);
7275
+ const activeDragCleanupRef = useRef12(null);
7276
+ const activeResizeCleanupRef = useRef12(null);
6879
7277
  const { text, isLoading: docLoading, documentFields, documentId, documentType } = useDocumentContent();
6880
7278
  const { apiUrl } = useConfig();
6881
7279
  const workspace = useWorkspace();
@@ -6894,7 +7292,7 @@ function SEOCopilotInner({ config, onClose }) {
6894
7292
  }
6895
7293
  return [];
6896
7294
  }, [seedCacheKey]);
6897
- const [seedKeywords, setSeedKeywordsRaw] = useState16(loadSeedsFromCache);
7295
+ const [seedKeywords, setSeedKeywordsRaw] = useState17(loadSeedsFromCache);
6898
7296
  const setSeedKeywords = useCallback5(
6899
7297
  (seeds) => {
6900
7298
  setSeedKeywordsRaw(seeds);
@@ -6910,20 +7308,20 @@ function SEOCopilotInner({ config, onClose }) {
6910
7308
  const [selectedPrimary, setSelectedPrimary] = usePersistentState(selectedPrimaryKey, void 0);
6911
7309
  const selectedSecondaryKey = documentId ? `seo-copilot-secondary-${documentId}` : "seo-copilot-secondary-default";
6912
7310
  const [selectedSecondary, setSelectedSecondary] = usePersistentState(selectedSecondaryKey, "");
6913
- const seedsInitializedRef = useRef11(false);
6914
- useEffect11(() => {
7311
+ const seedsInitializedRef = useRef12(false);
7312
+ useEffect12(() => {
6915
7313
  if (!seedsInitializedRef.current) {
6916
7314
  seedsInitializedRef.current = true;
6917
7315
  return;
6918
7316
  }
6919
7317
  setSeedKeywordsRaw(loadSeedsFromCache());
6920
7318
  }, [documentId, loadSeedsFromCache]);
6921
- const [activeTab, setActiveTab] = useState16("keywords");
7319
+ const [activeTab, setActiveTab] = useState17("keywords");
6922
7320
  const [chatOpen, setChatOpen] = usePersistentState("seo-copilot-ui-chat-open-v35", false);
6923
7321
  const [splitPercent, setSplitPercent] = usePersistentState("seo-copilot-ui-split", 70);
6924
7322
  const keywordAnalysisState = useKeywordAnalysis(text, apiUrl, effectivePublication, seedKeywords, documentFields, selectedPrimary, documentId, selectedSecondary);
6925
7323
  const effectivePrimary = selectedPrimary || keywordAnalysisState.analysis?.primaryKeyword?.term || "";
6926
- useEffect11(() => {
7324
+ useEffect12(() => {
6927
7325
  if (selectedSecondary && effectivePrimary && selectedSecondary.toLowerCase() === effectivePrimary.toLowerCase()) {
6928
7326
  setSelectedSecondary("");
6929
7327
  }
@@ -6946,12 +7344,12 @@ function SEOCopilotInner({ config, onClose }) {
6946
7344
  const chatHookState = useSEOChat(apiUrl, text, effectivePublication, keywordPanelData, documentId);
6947
7345
  const contentSuggestionsKey = documentId ? `seo-copilot-content-suggestions-${documentId}` : "seo-copilot-content-suggestions-default";
6948
7346
  const [contentSuggestions, setContentSuggestions] = usePersistentState(contentSuggestionsKey, null);
6949
- const [isCSLoading, setIsCSLoading] = useState16(false);
6950
- const [csError, setCsError] = useState16(null);
6951
- const aeoOpVersionRef = useRef11(0);
6952
- const csAbortRef = useRef11(null);
6953
- const didInitAeoRef = useRef11(false);
6954
- useEffect11(() => {
7347
+ const [isCSLoading, setIsCSLoading] = useState17(false);
7348
+ const [csError, setCsError] = useState17(null);
7349
+ const aeoOpVersionRef = useRef12(0);
7350
+ const csAbortRef = useRef12(null);
7351
+ const didInitAeoRef = useRef12(false);
7352
+ useEffect12(() => {
6955
7353
  if (!didInitAeoRef.current) {
6956
7354
  didInitAeoRef.current = true;
6957
7355
  return;
@@ -6985,14 +7383,14 @@ function SEOCopilotInner({ config, onClose }) {
6985
7383
  }, [apiUrl, text, effectivePrimary, effectivePublication]);
6986
7384
  const linkingKey = documentId ? `seo-copilot-linking-${documentId}` : "seo-copilot-linking-default";
6987
7385
  const [linkingSuggestions, setLinkingSuggestions] = usePersistentState(linkingKey, []);
6988
- const [isLinkingLoading, setIsLinkingLoading] = useState16(false);
6989
- const [linkingError, setLinkingError] = useState16(null);
6990
- const [linkingFetchedText, setLinkingFetchedText] = useState16("");
6991
- const linkingVersionRef = useRef11(0);
6992
- const linkingAbortRef = useRef11(null);
6993
- const didInitLinkingRef = useRef11(false);
6994
- const lastLinkingFetchKey = useRef11("");
6995
- useEffect11(() => {
7386
+ const [isLinkingLoading, setIsLinkingLoading] = useState17(false);
7387
+ const [linkingError, setLinkingError] = useState17(null);
7388
+ const [linkingFetchedText, setLinkingFetchedText] = useState17("");
7389
+ const linkingVersionRef = useRef12(0);
7390
+ const linkingAbortRef = useRef12(null);
7391
+ const didInitLinkingRef = useRef12(false);
7392
+ const lastLinkingFetchKey = useRef12("");
7393
+ useEffect12(() => {
6996
7394
  if (!didInitLinkingRef.current) {
6997
7395
  didInitLinkingRef.current = true;
6998
7396
  return;
@@ -7042,7 +7440,7 @@ function SEOCopilotInner({ config, onClose }) {
7042
7440
  if (Math.abs(text.length - linkingFetchedText.length) > 150) return true;
7043
7441
  return text.slice(0, 300) !== linkingFetchedText.slice(0, 300);
7044
7442
  }, [text, linkingFetchedText, linkingSuggestions.length]);
7045
- useEffect11(() => {
7443
+ useEffect12(() => {
7046
7444
  if (!text || text.trim().length < 50 || !effectivePrimary) return;
7047
7445
  const fetchKey = `${documentId || "_"}|${effectivePrimary}|${supportingKeywordsForLinking.join(",")}`;
7048
7446
  if (fetchKey === lastLinkingFetchKey.current) return;
@@ -7056,11 +7454,11 @@ function SEOCopilotInner({ config, onClose }) {
7056
7454
  const linkCheckKey = documentId ? `seo-copilot-link-check-${documentId}` : "seo-copilot-link-check-default";
7057
7455
  const [linkCheckResults, setLinkCheckResults] = usePersistentState(linkCheckKey, []);
7058
7456
  const [hasRunLinkCheck, setHasRunLinkCheck] = usePersistentState(`${linkCheckKey}-ran`, false);
7059
- const [isLinkCheckLoading, setIsLinkCheckLoading] = useState16(false);
7060
- const [linkCheckError, setLinkCheckError] = useState16(null);
7061
- const linkCheckVersionRef = useRef11(0);
7062
- const didInitLinkCheckRef = useRef11(false);
7063
- useEffect11(() => {
7457
+ const [isLinkCheckLoading, setIsLinkCheckLoading] = useState17(false);
7458
+ const [linkCheckError, setLinkCheckError] = useState17(null);
7459
+ const linkCheckVersionRef = useRef12(0);
7460
+ const didInitLinkCheckRef = useRef12(false);
7461
+ useEffect12(() => {
7064
7462
  if (!didInitLinkCheckRef.current) {
7065
7463
  didInitLinkCheckRef.current = true;
7066
7464
  return;
@@ -7095,7 +7493,7 @@ function SEOCopilotInner({ config, onClose }) {
7095
7493
  if (linkCheckVersionRef.current !== myVersion) return;
7096
7494
  setIsLinkCheckLoading(false);
7097
7495
  }, [apiUrl, documentFields?.bodyLinks, setHasRunLinkCheck, setLinkCheckResults]);
7098
- useEffect11(() => {
7496
+ useEffect12(() => {
7099
7497
  return () => {
7100
7498
  activeDragCleanupRef.current?.();
7101
7499
  activeResizeCleanupRef.current?.();
@@ -7109,10 +7507,10 @@ function SEOCopilotInner({ config, onClose }) {
7109
7507
  if (text && text.trim().length >= 50 && effectivePrimary) refreshLinkingSuggestions();
7110
7508
  if ((documentFields?.bodyLinks || []).length > 0) runLinkCheck();
7111
7509
  };
7112
- const runAllRef = useRef11(runAllAnalyses);
7510
+ const runAllRef = useRef12(runAllAnalyses);
7113
7511
  runAllRef.current = runAllAnalyses;
7114
- const secAutoRunRef = useRef11({ doc: documentId, sec: selectedSecondary, init: true });
7115
- useEffect11(() => {
7512
+ const secAutoRunRef = useRef12({ doc: documentId, sec: selectedSecondary, init: true });
7513
+ useEffect12(() => {
7116
7514
  const prev = secAutoRunRef.current;
7117
7515
  const docChanged = prev.doc !== documentId;
7118
7516
  const secChanged = prev.sec !== selectedSecondary;
@@ -7187,7 +7585,7 @@ function SEOCopilotInner({ config, onClose }) {
7187
7585
  },
7188
7586
  [floatSize]
7189
7587
  );
7190
- const panelContent = /* @__PURE__ */ jsx16(
7588
+ const panelContent = /* @__PURE__ */ jsx17(
7191
7589
  PanelContent,
7192
7590
  {
7193
7591
  initialPublication: effectivePublication,
@@ -7269,7 +7667,7 @@ function SEOCopilotInner({ config, onClose }) {
7269
7667
  }
7270
7668
  }
7271
7669
  );
7272
- const floatingPanel = /* @__PURE__ */ jsxs15(
7670
+ const floatingPanel = /* @__PURE__ */ jsxs16(
7273
7671
  "div",
7274
7672
  {
7275
7673
  style: {
@@ -7287,7 +7685,7 @@ function SEOCopilotInner({ config, onClose }) {
7287
7685
  },
7288
7686
  children: [
7289
7687
  panelContent,
7290
- !isFullscreen && /* @__PURE__ */ jsx16(
7688
+ !isFullscreen && /* @__PURE__ */ jsx17(
7291
7689
  "div",
7292
7690
  {
7293
7691
  onMouseDown: handleResizeStart,
@@ -7302,9 +7700,9 @@ function SEOCopilotInner({ config, onClose }) {
7302
7700
  alignItems: "center",
7303
7701
  justifyContent: "center"
7304
7702
  },
7305
- children: /* @__PURE__ */ jsxs15("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
7306
- /* @__PURE__ */ jsx16("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
7307
- /* @__PURE__ */ jsx16("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
7703
+ children: /* @__PURE__ */ jsxs16("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
7704
+ /* @__PURE__ */ jsx17("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
7705
+ /* @__PURE__ */ jsx17("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
7308
7706
  ] })
7309
7707
  }
7310
7708
  )
@@ -7312,8 +7710,8 @@ function SEOCopilotInner({ config, onClose }) {
7312
7710
  }
7313
7711
  );
7314
7712
  if (isFloating) {
7315
- return /* @__PURE__ */ jsxs15(Fragment9, { children: [
7316
- /* @__PURE__ */ jsx16(
7713
+ return /* @__PURE__ */ jsxs16(Fragment10, { children: [
7714
+ /* @__PURE__ */ jsx17(
7317
7715
  "div",
7318
7716
  {
7319
7717
  style: {
@@ -7323,30 +7721,30 @@ function SEOCopilotInner({ config, onClose }) {
7323
7721
  alignItems: "center",
7324
7722
  justifyContent: "center"
7325
7723
  },
7326
- children: /* @__PURE__ */ jsx16("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
7724
+ children: /* @__PURE__ */ jsx17("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
7327
7725
  }
7328
7726
  ),
7329
7727
  typeof document !== "undefined" && createPortal(floatingPanel, document.body)
7330
7728
  ] });
7331
7729
  }
7332
- return /* @__PURE__ */ jsx16("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
7730
+ return /* @__PURE__ */ jsx17("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
7333
7731
  }
7334
7732
  function SEOCopilotPanel({ config, onClose }) {
7335
- return /* @__PURE__ */ jsx16(
7733
+ return /* @__PURE__ */ jsx17(
7336
7734
  Suspense,
7337
7735
  {
7338
- fallback: /* @__PURE__ */ jsxs15("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
7339
- /* @__PURE__ */ jsx16(LoadingBars, {}),
7340
- /* @__PURE__ */ jsx16("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
7736
+ fallback: /* @__PURE__ */ jsxs16("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
7737
+ /* @__PURE__ */ jsx17(LoadingBars, {}),
7738
+ /* @__PURE__ */ jsx17("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
7341
7739
  ] }),
7342
- children: /* @__PURE__ */ jsx16(ConfigProvider, { config, children: /* @__PURE__ */ jsx16(SEOCopilotInner, { config, onClose }) })
7740
+ children: /* @__PURE__ */ jsx17(ConfigProvider, { config, children: /* @__PURE__ */ jsx17(SEOCopilotInner, { config, onClose }) })
7343
7741
  }
7344
7742
  );
7345
7743
  }
7346
7744
  function LoadingBars({ size = "sm", color = MJH_GOLD }) {
7347
7745
  const barWidth = size === "xs" ? 4 : 6;
7348
7746
  const containerHeight = size === "xs" ? 10 : 14;
7349
- return /* @__PURE__ */ jsx16("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx16(
7747
+ return /* @__PURE__ */ jsx17("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx17(
7350
7748
  "div",
7351
7749
  {
7352
7750
  style: {
@@ -7421,14 +7819,16 @@ function seoCopilotInspector(config) {
7421
7819
  }
7422
7820
 
7423
7821
  // src/index.ts
7424
- var seoCopilot = definePlugin((config) => ({
7425
- name: "seo-copilot",
7426
- document: {
7427
- inspectors: (prev) => {
7428
- return [...prev, seoCopilotInspector(config)];
7822
+ var seoCopilot = definePlugin((config) => {
7823
+ return {
7824
+ name: "seo-copilot",
7825
+ document: {
7826
+ inspectors: (prev) => {
7827
+ return [...prev, seoCopilotInspector(config)];
7828
+ }
7429
7829
  }
7430
- }
7431
- }));
7830
+ };
7831
+ });
7432
7832
  export {
7433
7833
  seoCopilot
7434
7834
  };