sanity-plugin-seo-copilot 0.2.5 → 0.2.10

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.js CHANGED
@@ -149,7 +149,14 @@ function detectAuthor(val) {
149
149
  "Authors"
150
150
  // PascalCase variants
151
151
  ];
152
- for (const f of candidateFields) {
152
+ const dynamic = Object.keys(val).filter(
153
+ // Author/byline-ish names, but never fact-check/reviewer fields, nor image/url/
154
+ // id sidecars (e.g. authorPhoto, authorImageUrl, authorId) that could otherwise
155
+ // be mistaken for a reference-typed author.
156
+ (k) => /author|byline/i.test(k) && !/fact|check|review|photo|image|avatar|picture|url|link|count|id$/i.test(k)
157
+ );
158
+ const fields = Array.from(/* @__PURE__ */ new Set([...candidateFields, ...dynamic]));
159
+ for (const f of fields) {
153
160
  const raw = val[f];
154
161
  if (!raw) continue;
155
162
  const first = Array.isArray(raw) ? raw[0] : raw;
@@ -161,8 +168,8 @@ function detectAuthor(val) {
161
168
  }
162
169
  if (typeof first === "object" && first !== null) {
163
170
  const o = first;
164
- const name = o.name || o.fullName || o.displayName;
165
- const creds = o.credentials || o.title || o.suffix;
171
+ const name = [o.name, o.fullName, o.displayName].find((v) => typeof v === "string" && v.trim().length > 0);
172
+ const creds = [o.credentials, o.title, o.suffix].find((v) => typeof v === "string" && v.trim().length > 0);
166
173
  const slug = o.slug?.current;
167
174
  const bio = o.bioUrl || (slug ? `/author/${slug}` : void 0);
168
175
  if (name) {
@@ -210,14 +217,14 @@ function extractImageMeta(value) {
210
217
  }
211
218
  function buildDocumentFields(value) {
212
219
  const val = value;
213
- const title = val?.title;
220
+ const title = typeof val?.title === "string" ? val.title : void 0;
214
221
  const body = val?.body;
215
222
  const { authorName, authorCredentials, authorBioUrl, authorIsReference } = detectAuthor(val);
216
223
  const imageMeta = val ? extractImageMeta(val) : { names: [], titles: [], count: 0 };
217
224
  return {
218
225
  title: title || void 0,
219
226
  // MJH uses `summary`; standard Sanity SEO plugins use `metaDescription`
220
- metaDescription: val?.metaDescription || val?.summary || val?.description || val?.seoDescription,
227
+ metaDescription: [val?.metaDescription, val?.summary, val?.description, val?.seoDescription].find((v) => typeof v === "string" && v.trim().length > 0),
221
228
  slug: detectSlug(val),
222
229
  imageNames: imageMeta.names,
223
230
  imageTitles: imageMeta.titles,
@@ -225,18 +232,18 @@ function buildDocumentFields(value) {
225
232
  headings: extractHeadings(body),
226
233
  headingsDetailed: extractHeadingsDetailed(body),
227
234
  bodyLinks: extractBodyLinks(body),
228
- contentCategory: val?.contentCategory || val?.category,
235
+ contentCategory: typeof val?.contentCategory === "string" ? val.contentCategory : typeof val?.category === "string" ? val.category : void 0,
229
236
  contentPlacement: Array.isArray(val?.contentPlacement) ? val.contentPlacement : void 0,
230
237
  authorName,
231
238
  authorCredentials,
232
239
  authorBioUrl,
233
240
  authorIsReference,
234
241
  // `published` is MJH's date field; `publishedAt`/`publishDate` cover other schemas
235
- publishedAt: val?.published || val?.publishedAt || val?.publishDate || val?._createdAt,
242
+ publishedAt: [val?.publishedAt, val?.publishDate, val?.published, val?._createdAt].find((v) => typeof v === "string" && v.trim().length > 0),
236
243
  // `updatedOn` is MJH's "Updated On" field. `updatedAt` is the standard Sanity convention.
237
244
  // `_updatedAt` is the Sanity-managed timestamp as a final fallback.
238
- updatedAt: val?.updatedOn || val?.updatedAt || val?._updatedAt,
239
- lastReviewedAt: val?.lastReviewedAt || val?.lastReviewed || val?.medicallyReviewedAt
245
+ updatedAt: [val?.updatedOn, val?.updatedAt, val?._updatedAt].find((v) => typeof v === "string" && v.trim().length > 0),
246
+ lastReviewedAt: [val?.lastReviewedAt, val?.lastReviewed, val?.medicallyReviewedAt].find((v) => typeof v === "string" && v.trim().length > 0)
240
247
  };
241
248
  }
242
249
 
@@ -244,6 +251,7 @@ function buildDocumentFields(value) {
244
251
  function useDocumentContent() {
245
252
  const { value, ready } = (0, import_structure.useDocumentPane)();
246
253
  const documentId = value?._id || void 0;
254
+ const documentType = value?._type || void 0;
247
255
  const title = value?.title;
248
256
  const body = value?.body;
249
257
  const [debouncedText, setDebouncedText] = (0, import_react.useState)("");
@@ -271,7 +279,7 @@ function useDocumentContent() {
271
279
  if (timerRef.current) clearTimeout(timerRef.current);
272
280
  };
273
281
  }, [title, body, value]);
274
- return { text: debouncedText, isLoading, documentFields, documentId };
282
+ return { text: debouncedText, isLoading, documentFields, documentId, documentType };
275
283
  }
276
284
 
277
285
  // src/hooks/useKeywordAnalysis.ts
@@ -294,28 +302,34 @@ function safeParseJson(text) {
294
302
  throw new Error("Invalid JSON response from server");
295
303
  }
296
304
  }
297
- async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword) {
305
+ async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword, signal) {
298
306
  const response = await fetch(`${apiUrl}/api/seo-copilot/analyze`, {
299
307
  method: "POST",
300
308
  headers: { "Content-Type": "application/json" },
301
- body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword })
309
+ body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword }),
310
+ signal
302
311
  });
303
312
  const text = await response.text();
304
313
  if (!response.ok) {
305
314
  const err = safeParseJson(text);
306
- throw new Error(err.error || `HTTP ${response.status}`);
315
+ if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
316
+ if (response.status >= 500) throw new Error("Could not reach the SEO service.");
317
+ throw new Error("Something went wrong analyzing this document.");
307
318
  }
308
319
  return safeParseJson(text);
309
320
  }
310
- async function fetchChatStream(apiUrl, messages, documentContext, publication, keywordPanelData) {
321
+ async function fetchChatStream(apiUrl, messages, documentContext, publication, keywordPanelData, signal) {
311
322
  const response = await fetch(`${apiUrl}/api/seo-copilot/chat`, {
312
323
  method: "POST",
313
324
  headers: { "Content-Type": "application/json" },
314
- body: JSON.stringify({ messages, documentContext, publication, keywordPanelData })
325
+ body: JSON.stringify({ messages, documentContext, publication, keywordPanelData }),
326
+ signal
315
327
  });
316
328
  if (!response.ok) {
317
329
  const err = await response.json().catch(() => ({ error: "Request failed" }));
318
- throw new Error(err.error || `HTTP ${response.status}`);
330
+ if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
331
+ if (response.status >= 500) throw new Error("Could not reach the SEO service.");
332
+ throw new Error("Something went wrong. Please try again.");
319
333
  }
320
334
  return response.body;
321
335
  }
@@ -326,15 +340,18 @@ async function submitFeedback(apiUrl, data) {
326
340
  body: JSON.stringify(data)
327
341
  });
328
342
  }
329
- async function lookupKeywords(apiUrl, keywords) {
343
+ async function lookupKeywords(apiUrl, keywords, signal) {
330
344
  const response = await fetch(`${apiUrl}/api/seo-copilot/keywords`, {
331
345
  method: "POST",
332
346
  headers: { "Content-Type": "application/json" },
333
- body: JSON.stringify({ keywords })
347
+ body: JSON.stringify({ keywords }),
348
+ signal
334
349
  });
335
350
  if (!response.ok) {
336
351
  const err = await response.json().catch(() => ({ error: "Request failed" }));
337
- throw new Error(err.error || `HTTP ${response.status}`);
352
+ if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
353
+ if (response.status >= 500) throw new Error("Could not reach the SEO service.");
354
+ throw new Error("Something went wrong. Please try again.");
338
355
  }
339
356
  return response.json();
340
357
  }
@@ -350,13 +367,14 @@ async function loadChatHistory(apiUrl, userId, documentId) {
350
367
  return [];
351
368
  }
352
369
  }
353
- async function fetchContentSuggestions(apiUrl, content, primaryKeyword, publication) {
370
+ async function fetchContentSuggestions(apiUrl, content, primaryKeyword, publication, signal) {
354
371
  const empty = { keyTakeaways: [], infographicOpportunities: [], bulletListItems: [] };
355
372
  try {
356
373
  const res = await fetch(`${apiUrl}/api/seo-copilot/content-suggestions`, {
357
374
  method: "POST",
358
375
  headers: { "Content-Type": "application/json" },
359
- body: JSON.stringify({ content, primaryKeyword, publication })
376
+ body: JSON.stringify({ content, primaryKeyword, publication }),
377
+ signal
360
378
  });
361
379
  if (!res.ok) return empty;
362
380
  const data = await res.json().catch(() => null);
@@ -370,13 +388,14 @@ async function fetchContentSuggestions(apiUrl, content, primaryKeyword, publicat
370
388
  return empty;
371
389
  }
372
390
  }
373
- async function fetchLinkingSuggestions(apiUrl, content, primaryKeyword, supportingKeywords, currentDocumentId, publication) {
391
+ async function fetchLinkingSuggestions(apiUrl, content, primaryKeyword, supportingKeywords, currentDocumentId, publication, signal) {
374
392
  if (!content || content.trim().length < 50) return [];
375
393
  try {
376
394
  const res = await fetch(`${apiUrl}/api/seo-copilot/linking-suggestions`, {
377
395
  method: "POST",
378
396
  headers: { "Content-Type": "application/json" },
379
- body: JSON.stringify({ content, primaryKeyword, supportingKeywords, currentDocumentId, publication })
397
+ body: JSON.stringify({ content, primaryKeyword, supportingKeywords, currentDocumentId, publication }),
398
+ signal
380
399
  });
381
400
  if (!res.ok) return [];
382
401
  const data = await res.json().catch(() => null);
@@ -471,6 +490,10 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
471
490
  return;
472
491
  }
473
492
  docVersionRef.current += 1;
493
+ volumeAbortRef.current?.abort();
494
+ volumeAbortRef.current = null;
495
+ deepAbortRef.current?.abort();
496
+ deepAbortRef.current = null;
474
497
  const fresh = loadCached();
475
498
  cached.current = fresh;
476
499
  setAnalysisRaw(fresh.analysis);
@@ -508,43 +531,12 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
508
531
  }, [text, deepAnalysis, aeoTextSnapshot]);
509
532
  const lastAnalysisRef = (0, import_react2.useRef)(null);
510
533
  const docVersionRef = (0, import_react2.useRef)(0);
511
- (0, import_react2.useEffect)(() => {
512
- if ((!text || text.trim().length < 20) && (!effectiveSeeds || effectiveSeeds.length === 0)) {
513
- setAnalysis(null);
514
- return;
515
- }
516
- let cancelled = false;
517
- setIsLoading(true);
518
- setError(null);
519
- fetchAnalysis(apiUrl, text, "realtime", publication, effectiveSeeds, documentFields, focusPrimary).then((result) => {
520
- if (cancelled) return;
521
- const analysisResult = result;
522
- lastAnalysisRef.current = analysisResult;
523
- setAnalysis(analysisResult);
524
- setIsLoading(false);
525
- const candidateTerms = (analysisResult.primaryKeywordCandidates || []).map((c) => c.term);
526
- const allTerms = [
527
- .../* @__PURE__ */ new Set([
528
- ...candidateTerms,
529
- analysisResult.primaryKeyword.term,
530
- ...(analysisResult.supportingKeywords || []).map((kw) => kw.term),
531
- ...analysisResult.missingKeywords.map((kw) => kw.term)
532
- ])
533
- ];
534
- const uncachedTerms = allTerms.filter((t) => !volumeMapRef.current.has(t.toLowerCase()));
535
- if (uncachedTerms.length > 0) {
536
- doVolumeLookup(analysisResult, uncachedTerms);
537
- }
538
- }).catch((err) => {
539
- if (!cancelled) {
540
- setError(err.message);
541
- setIsLoading(false);
542
- }
543
- });
544
- return () => {
545
- cancelled = true;
546
- };
547
- }, [text, apiUrl, publication, effectiveSeeds?.join(","), focusPrimary]);
534
+ const volumeAbortRef = (0, import_react2.useRef)(null);
535
+ const deepAbortRef = (0, import_react2.useRef)(null);
536
+ (0, import_react2.useEffect)(() => () => {
537
+ volumeAbortRef.current?.abort();
538
+ deepAbortRef.current?.abort();
539
+ }, []);
548
540
  const doVolumeLookup = (0, import_react2.useCallback)((analysisResult, terms) => {
549
541
  setIsVolumesLoading(true);
550
542
  const myVersion = docVersionRef.current;
@@ -563,7 +555,10 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
563
555
  setIsVolumesLoading(false);
564
556
  return;
565
557
  }
566
- lookupKeywords(apiUrl, lookupTerms).then(({ results }) => {
558
+ volumeAbortRef.current?.abort();
559
+ const controller = new AbortController();
560
+ volumeAbortRef.current = controller;
561
+ lookupKeywords(apiUrl, lookupTerms, controller.signal).then(({ results }) => {
567
562
  if (docVersionRef.current !== myVersion) return;
568
563
  results.forEach((r) => volumeMapRef.current.set(r.keyword.toLowerCase(), r));
569
564
  const current = lastAnalysisRef.current || analysisResult;
@@ -576,11 +571,56 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
576
571
  } catch {
577
572
  }
578
573
  setIsVolumesLoading(false);
579
- }).catch(() => {
574
+ }).catch((err) => {
575
+ if (err instanceof Error && err.name === "AbortError") return;
580
576
  if (docVersionRef.current !== myVersion) return;
581
577
  setIsVolumesLoading(false);
582
578
  });
583
579
  }, [apiUrl, cacheKey]);
580
+ const doVolumeLookupRef = (0, import_react2.useRef)(doVolumeLookup);
581
+ (0, import_react2.useEffect)(() => {
582
+ doVolumeLookupRef.current = doVolumeLookup;
583
+ }, [doVolumeLookup]);
584
+ (0, import_react2.useEffect)(() => {
585
+ if ((!text || text.trim().length < 20) && (!effectiveSeeds || effectiveSeeds.length === 0)) {
586
+ setAnalysis(null);
587
+ return;
588
+ }
589
+ let cancelled = false;
590
+ const controller = new AbortController();
591
+ setIsLoading(true);
592
+ setError(null);
593
+ fetchAnalysis(apiUrl, text, "realtime", publication, effectiveSeeds, documentFields, focusPrimary, controller.signal).then((result) => {
594
+ if (cancelled) return;
595
+ const analysisResult = result;
596
+ lastAnalysisRef.current = analysisResult;
597
+ setAnalysis(analysisResult);
598
+ setIsLoading(false);
599
+ const candidateTerms = (analysisResult.primaryKeywordCandidates || []).map((c) => c.term);
600
+ const allTerms = [
601
+ .../* @__PURE__ */ new Set([
602
+ ...candidateTerms,
603
+ analysisResult.primaryKeyword.term,
604
+ ...(analysisResult.supportingKeywords || []).map((kw) => kw.term),
605
+ ...analysisResult.missingKeywords.map((kw) => kw.term)
606
+ ])
607
+ ];
608
+ const uncachedTerms = allTerms.filter((t) => !volumeMapRef.current.has(t.toLowerCase()));
609
+ if (uncachedTerms.length > 0) {
610
+ doVolumeLookupRef.current(analysisResult, uncachedTerms);
611
+ }
612
+ }).catch((err) => {
613
+ if (err instanceof Error && err.name === "AbortError") return;
614
+ if (!cancelled) {
615
+ setError(err.message);
616
+ setIsLoading(false);
617
+ }
618
+ });
619
+ return () => {
620
+ cancelled = true;
621
+ controller.abort();
622
+ };
623
+ }, [text, apiUrl, publication, effectiveSeeds?.join(","), focusPrimary, JSON.stringify(documentFields)]);
584
624
  const refreshVolumes = (0, import_react2.useCallback)(() => {
585
625
  const current = lastAnalysisRef.current || analysis;
586
626
  if (!current) return;
@@ -593,16 +633,20 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
593
633
  setAeoContentChanged(false);
594
634
  setAeoTextSnapshot(text);
595
635
  const myVersion = docVersionRef.current;
596
- fetchAnalysis(apiUrl, text, "deep", publication, effectiveSeeds, documentFields, focusPrimary).then((result) => {
636
+ deepAbortRef.current?.abort();
637
+ const deepController = new AbortController();
638
+ deepAbortRef.current = deepController;
639
+ fetchAnalysis(apiUrl, text, "deep", publication, effectiveSeeds, documentFields, focusPrimary, deepController.signal).then((result) => {
597
640
  if (docVersionRef.current !== myVersion) return;
598
641
  setDeepAnalysis(result);
599
642
  setIsDeepLoading(false);
600
643
  }).catch((err) => {
644
+ if (deepController.signal.aborted || err?.name === "AbortError") return;
601
645
  if (docVersionRef.current !== myVersion) return;
602
646
  setError(err.message);
603
647
  setIsDeepLoading(false);
604
648
  });
605
- }, [text, apiUrl, publication, effectiveSeeds?.join(","), documentFields]);
649
+ }, [text, apiUrl, publication, effectiveSeeds?.join(","), documentFields, focusPrimary]);
606
650
  return {
607
651
  analysis,
608
652
  isLoading,
@@ -620,6 +664,7 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
620
664
  var import_react3 = require("react");
621
665
  var import_sanity = require("sanity");
622
666
  function getLocalUserId() {
667
+ if (typeof window === "undefined") return "anonymous";
623
668
  const key = "seo-copilot-user-id";
624
669
  try {
625
670
  let id = localStorage.getItem(key);
@@ -643,16 +688,10 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
643
688
  }
644
689
  }, [chatCacheKey]);
645
690
  const [messages, setMessagesRaw] = (0, import_react3.useState)(loadCachedMessages);
691
+ const messagesRef = (0, import_react3.useRef)([]);
646
692
  const setMessages = (0, import_react3.useCallback)((msgs) => {
647
- setMessagesRaw((prev) => {
648
- const next = typeof msgs === "function" ? msgs(prev) : msgs;
649
- try {
650
- localStorage.setItem(chatCacheKey, JSON.stringify(next));
651
- } catch {
652
- }
653
- return next;
654
- });
655
- }, [chatCacheKey]);
693
+ setMessagesRaw(msgs);
694
+ }, []);
656
695
  const [isStreaming, setIsStreaming] = (0, import_react3.useState)(false);
657
696
  const [historyLoaded, setHistoryLoaded] = (0, import_react3.useState)(false);
658
697
  const sanityUser = (0, import_sanity.useCurrentUser)();
@@ -662,6 +701,25 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
662
701
  userId.current = sanityUser.id;
663
702
  }
664
703
  }, [sanityUser?.id]);
704
+ (0, import_react3.useEffect)(() => {
705
+ messagesRef.current = messages;
706
+ }, [messages]);
707
+ (0, import_react3.useEffect)(() => {
708
+ const timer = setTimeout(() => {
709
+ try {
710
+ localStorage.setItem(chatCacheKey, JSON.stringify(messages));
711
+ } catch {
712
+ }
713
+ }, 500);
714
+ return () => clearTimeout(timer);
715
+ }, [messages, chatCacheKey]);
716
+ const streamAbortRef = (0, import_react3.useRef)(null);
717
+ (0, import_react3.useEffect)(() => {
718
+ return () => {
719
+ streamAbortRef.current?.abort();
720
+ if (saveTimerRef.current) clearTimeout(saveTimerRef.current);
721
+ };
722
+ }, []);
665
723
  const saveTimerRef = (0, import_react3.useRef)(null);
666
724
  const opVersionRef = (0, import_react3.useRef)(0);
667
725
  const didInitRef = (0, import_react3.useRef)(false);
@@ -671,6 +729,8 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
671
729
  return;
672
730
  }
673
731
  opVersionRef.current += 1;
732
+ streamAbortRef.current?.abort();
733
+ streamAbortRef.current = null;
674
734
  setMessagesRaw(loadCachedMessages());
675
735
  setIsStreaming(false);
676
736
  setHistoryLoaded(false);
@@ -705,16 +765,19 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
705
765
  async (text) => {
706
766
  const myVersion = opVersionRef.current;
707
767
  const userMessage = { role: "user", content: text };
708
- const updatedMessages = [...messages, userMessage];
768
+ const updatedMessages = [...messagesRef.current, userMessage];
709
769
  setMessages(updatedMessages);
710
770
  setIsStreaming(true);
771
+ const controller = new AbortController();
772
+ streamAbortRef.current = controller;
711
773
  try {
712
774
  const stream = await fetchChatStream(
713
775
  apiUrl,
714
776
  updatedMessages,
715
777
  documentText,
716
778
  publication,
717
- keywordPanelData
779
+ keywordPanelData,
780
+ controller.signal
718
781
  );
719
782
  if (!stream) {
720
783
  setIsStreaming(false);
@@ -774,6 +837,10 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
774
837
  scheduleSave(finalMessages);
775
838
  }
776
839
  } catch (err) {
840
+ if (err instanceof Error && err.name === "AbortError") {
841
+ setIsStreaming(false);
842
+ return;
843
+ }
777
844
  if (opVersionRef.current !== myVersion) {
778
845
  setIsStreaming(false);
779
846
  return;
@@ -786,7 +853,7 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
786
853
  }
787
854
  if (opVersionRef.current === myVersion) setIsStreaming(false);
788
855
  },
789
- [messages, apiUrl, documentText, publication, keywordPanelData, scheduleSave]
856
+ [apiUrl, documentText, publication, keywordPanelData, scheduleSave]
790
857
  );
791
858
  const clearChat = (0, import_react3.useCallback)(() => {
792
859
  setMessages([]);
@@ -916,6 +983,14 @@ var INJECTED_CSS = `
916
983
  0%, 100% { opacity: 0.5; }
917
984
  50% { opacity: 1; }
918
985
  }
986
+ @keyframes onboard-in {
987
+ from { opacity: 0; transform: translateY(-6px) scale(0.97); }
988
+ to { opacity: 1; transform: translateY(0) scale(1); }
989
+ }
990
+ @keyframes onboard-out {
991
+ from { opacity: 1; transform: translateY(0) scale(1); }
992
+ to { opacity: 0; transform: translateY(-6px) scale(0.97); }
993
+ }
919
994
  .prose-chat { font-size: 12.5px; line-height: 1.65; color: #475569; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; }
920
995
  .prose-chat h1 { font-size: 14px; font-weight: 700; color: #1e293b; margin: 10px 0 5px 0; line-height: 1.35; }
921
996
  .prose-chat h2, .prose-chat h3 { font-size: 13px; font-weight: 700; color: #1e293b; margin: 10px 0 5px 0; line-height: 1.35; }
@@ -1127,6 +1202,12 @@ function FeedbackButton({ suggestionType, suggestionText, documentId, publicatio
1127
1202
  const [submitted, setSubmitted] = (0, import_react7.useState)(false);
1128
1203
  const popupRef = (0, import_react7.useRef)(null);
1129
1204
  const inputRef = (0, import_react7.useRef)(null);
1205
+ const submitTimerRef = (0, import_react7.useRef)(null);
1206
+ (0, import_react7.useEffect)(() => {
1207
+ return () => {
1208
+ if (submitTimerRef.current) clearTimeout(submitTimerRef.current);
1209
+ };
1210
+ }, []);
1130
1211
  (0, import_react7.useEffect)(() => {
1131
1212
  if (!showReasonPopup) return;
1132
1213
  const handler = (e) => {
@@ -1193,7 +1274,7 @@ function FeedbackButton({ suggestionType, suggestionText, documentId, publicatio
1193
1274
  }
1194
1275
  }
1195
1276
  setSubmitted(true);
1196
- setTimeout(() => {
1277
+ submitTimerRef.current = setTimeout(() => {
1197
1278
  setShowReasonPopup(false);
1198
1279
  setReason("");
1199
1280
  }, 1e3);
@@ -1399,11 +1480,13 @@ function buildSuggestedKeywords(supporting, missing, documentText, documentField
1399
1480
  const merged = [];
1400
1481
  const lowerText = documentText.toLowerCase();
1401
1482
  for (const kw of supporting) {
1483
+ if (kw == null || typeof kw.term !== "string") continue;
1402
1484
  const actuallyInContent = lowerText.includes(kw.term.toLowerCase());
1403
1485
  const livePlacement = computePlacementClient(kw.term, documentText, documentFields);
1404
1486
  merged.push({ term: kw.term, volume: kw.volume ?? 0, inContent: actuallyInContent, placement: livePlacement });
1405
1487
  }
1406
1488
  for (const kw of missing) {
1489
+ if (kw == null || typeof kw.term !== "string") continue;
1407
1490
  const actuallyInContent = lowerText.includes(kw.term.toLowerCase());
1408
1491
  const livePlacement = computePlacementClient(kw.term, documentText, documentFields);
1409
1492
  merged.push({ term: kw.term, volume: kw.volume ?? 0, inContent: actuallyInContent, reason: kw.reason, placement: livePlacement });
@@ -1454,7 +1537,7 @@ function LightbulbButton({ onClick, isLoading }) {
1454
1537
  whiteSpace: "nowrap",
1455
1538
  pointerEvents: "none",
1456
1539
  zIndex: 10
1457
- }, children: "Suggest a fix" })
1540
+ }, children: "See suggestion" })
1458
1541
  ]
1459
1542
  }
1460
1543
  );
@@ -1657,6 +1740,119 @@ function PrimaryKeywordSelector({
1657
1740
  }) })
1658
1741
  ] });
1659
1742
  }
1743
+ function SecondaryKeywordSelector({
1744
+ options,
1745
+ selectedTerm,
1746
+ onSelect
1747
+ }) {
1748
+ const [customInputOpen, setCustomInputOpen] = (0, import_react9.useState)(false);
1749
+ const [customValue, setCustomValue] = (0, import_react9.useState)("");
1750
+ const handleCustomSubmit = () => {
1751
+ const trimmed = customValue.trim();
1752
+ if (trimmed) {
1753
+ onSelect(trimmed);
1754
+ setCustomValue("");
1755
+ setCustomInputOpen(false);
1756
+ }
1757
+ };
1758
+ const opts = selectedTerm && !options.some((o) => o.term.toLowerCase() === selectedTerm.toLowerCase()) ? [...options, { term: selectedTerm, volume: null }] : options;
1759
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: cardStyle, children: [
1760
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1761
+ SectionHeader,
1762
+ {
1763
+ label: "Secondary Keyword",
1764
+ iconColor: MJH_BLUE,
1765
+ actionButton: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
1766
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: 9, fontWeight: 700, letterSpacing: "0.05em", textTransform: "uppercase", color: "#9ca3af" }, children: "Optional" }),
1767
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PencilButton, { onClick: () => setCustomInputOpen(!customInputOpen), active: customInputOpen })
1768
+ ] })
1769
+ }
1770
+ ),
1771
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5, marginBottom: 8 }, children: "Pick one more keyword to optimize for. Copilot then checks your title, meta, URL, headings, and images against both keywords." }),
1772
+ customInputOpen && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginBottom: 8, display: "flex", gap: 6 }, children: [
1773
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1774
+ "input",
1775
+ {
1776
+ type: "text",
1777
+ value: customValue,
1778
+ onChange: (e) => setCustomValue(e.target.value),
1779
+ onKeyDown: (e) => {
1780
+ if (e.key === "Enter") handleCustomSubmit();
1781
+ },
1782
+ placeholder: "Type a custom secondary keyword",
1783
+ autoFocus: true,
1784
+ style: { flex: 1, padding: "5px 8px", fontSize: 12, borderRadius: 8, border: "1px solid #e5e7eb", outline: "none", fontFamily: "inherit" }
1785
+ }
1786
+ ),
1787
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1788
+ "button",
1789
+ {
1790
+ onClick: handleCustomSubmit,
1791
+ disabled: !customValue.trim(),
1792
+ style: {
1793
+ padding: "5px 10px",
1794
+ fontSize: 11,
1795
+ fontWeight: 600,
1796
+ borderRadius: 6,
1797
+ border: "none",
1798
+ background: customValue.trim() ? MJH_BLUE : "#e5e7eb",
1799
+ color: customValue.trim() ? "#ffffff" : "#9ca3af",
1800
+ cursor: customValue.trim() ? "pointer" : "not-allowed"
1801
+ },
1802
+ children: "Set"
1803
+ }
1804
+ )
1805
+ ] }),
1806
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
1807
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SecondaryOptionRow, { term: "", label: "None", selected: !selectedTerm, onSelect: () => onSelect("") }),
1808
+ opts.map((o) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1809
+ SecondaryOptionRow,
1810
+ {
1811
+ term: o.term,
1812
+ label: o.term,
1813
+ volume: o.volume,
1814
+ selected: o.term === selectedTerm,
1815
+ onSelect: () => onSelect(o.term)
1816
+ },
1817
+ o.term
1818
+ ))
1819
+ ] })
1820
+ ] });
1821
+ }
1822
+ function SecondaryOptionRow({ term, label, volume, selected, onSelect }) {
1823
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1824
+ "div",
1825
+ {
1826
+ onClick: onSelect,
1827
+ style: {
1828
+ display: "flex",
1829
+ alignItems: "center",
1830
+ gap: 8,
1831
+ padding: "6px 8px",
1832
+ borderRadius: 8,
1833
+ cursor: "pointer",
1834
+ background: selected ? "rgba(0,93,172,0.06)" : "transparent",
1835
+ border: selected ? "1px solid rgba(0,93,172,0.2)" : "1px solid transparent",
1836
+ transition: "all 150ms"
1837
+ },
1838
+ children: [
1839
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: {
1840
+ width: 14,
1841
+ height: 14,
1842
+ borderRadius: "50%",
1843
+ border: selected ? "none" : "2px solid #d1d5db",
1844
+ background: selected ? MJH_BLUE : "transparent",
1845
+ flexShrink: 0,
1846
+ display: "flex",
1847
+ alignItems: "center",
1848
+ justifyContent: "center"
1849
+ }, children: selected && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { width: 6, height: 6, borderRadius: "50%", background: "#ffffff" } }) }),
1850
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: 12, fontWeight: selected ? 600 : 400, color: term ? selected ? "#00468a" : "#374151" : "#6b7280", flex: 1, minWidth: 0 }, children: label }),
1851
+ volume != null && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: volume === 0 ? "N/A" : `${abbrevVol(volume)}/mo` })
1852
+ ]
1853
+ }
1854
+ );
1855
+ }
1660
1856
  var PLACEMENT_FILTERS = [
1661
1857
  { key: "inBody", label: "Body", letter: "B" },
1662
1858
  { key: "inTitle", label: "Title", letter: "T" },
@@ -1669,8 +1865,8 @@ function computePlacementClient(term, content, fields) {
1669
1865
  const lower = term.toLowerCase();
1670
1866
  return {
1671
1867
  inBody: content.toLowerCase().includes(lower),
1672
- inTitle: fields?.title?.toLowerCase().includes(lower) ?? false,
1673
- inMetaDescription: fields?.metaDescription?.toLowerCase().includes(lower) ?? false,
1868
+ inTitle: typeof fields?.title === "string" ? fields.title.toLowerCase().includes(lower) : false,
1869
+ inMetaDescription: typeof fields?.metaDescription === "string" ? fields.metaDescription.toLowerCase().includes(lower) : false,
1674
1870
  inImages: fields?.imageNames?.some((name) => name.toLowerCase().includes(lower)) ?? false,
1675
1871
  inUrl: fields?.slug?.toLowerCase().includes(lower) ?? false
1676
1872
  };
@@ -1740,7 +1936,9 @@ function SuggestedKeywordsCard({
1740
1936
  const res = await fetch(`${apiUrl}/api/seo-copilot/keyword-help`, {
1741
1937
  method: "POST",
1742
1938
  headers: { "Content-Type": "application/json" },
1743
- body: JSON.stringify({ keyword: term, content: text, publication, previousSuggestions })
1939
+ // Clip to 5,000 chars: the backend only reads the first 4,000 anyway, so sending
1940
+ // the full article needlessly bloats the request on long pieces.
1941
+ body: JSON.stringify({ keyword: term, content: text.slice(0, 5e3), publication, previousSuggestions })
1744
1942
  });
1745
1943
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
1746
1944
  const data = await res.json();
@@ -2137,6 +2335,8 @@ function KeywordPanel({
2137
2335
  seedKeywords = [],
2138
2336
  onSeedsChange,
2139
2337
  onSelectPrimary,
2338
+ secondaryKeyword = "",
2339
+ onSelectSecondary,
2140
2340
  documentFields,
2141
2341
  documentId,
2142
2342
  externalAnalysis
@@ -2161,8 +2361,9 @@ function KeywordPanel({
2161
2361
  const prevDefaultRef = (0, import_react9.useRef)(defaultSelectedTerm);
2162
2362
  (0, import_react9.useEffect)(() => {
2163
2363
  if (defaultSelectedTerm && defaultSelectedTerm !== prevDefaultRef.current) {
2164
- setSelectedPrimaryTerm((prev) => prev === prevDefaultRef.current ? defaultSelectedTerm : prev);
2364
+ const oldDefault = prevDefaultRef.current;
2165
2365
  prevDefaultRef.current = defaultSelectedTerm;
2366
+ setSelectedPrimaryTerm((prev) => prev === oldDefault ? defaultSelectedTerm : prev);
2166
2367
  }
2167
2368
  }, [defaultSelectedTerm]);
2168
2369
  if ((!text || text.trim().length < 20) && (!seedKeywords || seedKeywords.length === 0)) {
@@ -2196,7 +2397,39 @@ function KeywordPanel({
2196
2397
  placement: computePlacementClient(c.term, text, documentFields)
2197
2398
  }));
2198
2399
  const activeTerm = candidates.find((c) => c.term === selectedPrimaryTerm) ? selectedPrimaryTerm : candidates[0]?.term ?? "";
2400
+ const activeTermLower = activeTerm.toLowerCase();
2401
+ const secondaryOptions = [];
2402
+ const seenSecondary = /* @__PURE__ */ new Set();
2403
+ for (const c of candidates) {
2404
+ const key = c.term.toLowerCase();
2405
+ if (key === activeTermLower) continue;
2406
+ if (!seenSecondary.has(key)) {
2407
+ seenSecondary.add(key);
2408
+ secondaryOptions.push({ term: c.term, volume: c.volume });
2409
+ }
2410
+ }
2411
+ for (const kw of suggestedKeywords) {
2412
+ const key = kw.term.toLowerCase();
2413
+ if (key === activeTermLower) continue;
2414
+ if (!seenSecondary.has(key)) {
2415
+ seenSecondary.add(key);
2416
+ secondaryOptions.push({ term: kw.term, volume: kw.volume });
2417
+ }
2418
+ }
2199
2419
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
2420
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: {
2421
+ ...cardStyle,
2422
+ padding: "11px 13px",
2423
+ background: "rgba(0,93,172,0.05)",
2424
+ boxShadow: "inset 0 0 0 1px rgba(0,93,172,0.12)"
2425
+ }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { fontSize: 11.5, color: "#1f2937", lineHeight: 1.55 }, children: [
2426
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { style: { color: "#00468a" }, children: "Choose your target keywords." }),
2427
+ " Pick one ",
2428
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Primary" }),
2429
+ " keyword (required) and, optionally, one ",
2430
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Secondary" }),
2431
+ " keyword. Copilot optimizes the whole article - title, meta, URL, headings, and images - toward both."
2432
+ ] }) }),
2200
2433
  onSeedsChange && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SeedKeywordInput, { seeds: seedKeywords, onSeedsChange }),
2201
2434
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2202
2435
  PrimaryKeywordSelector,
@@ -2210,6 +2443,14 @@ function KeywordPanel({
2210
2443
  publication
2211
2444
  }
2212
2445
  ),
2446
+ onSelectSecondary && secondaryOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2447
+ SecondaryKeywordSelector,
2448
+ {
2449
+ options: secondaryOptions,
2450
+ selectedTerm: secondaryKeyword,
2451
+ onSelect: (term) => onSelectSecondary(term)
2452
+ }
2453
+ ),
2213
2454
  suggestedKeywords.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2214
2455
  SuggestedKeywordsCard,
2215
2456
  {
@@ -2414,20 +2655,22 @@ function ChatPanel({ messages, isStreaming, sendMessage, clearChat, documentId }
2414
2655
  "button",
2415
2656
  {
2416
2657
  onClick: clearChat,
2417
- onMouseEnter: () => setClearHovered(true),
2658
+ onMouseEnter: () => !isStreaming && setClearHovered(true),
2418
2659
  onMouseLeave: () => setClearHovered(false),
2419
2660
  title: "Clear conversation",
2420
2661
  "aria-label": "Clear conversation",
2662
+ disabled: isStreaming,
2421
2663
  style: {
2422
2664
  background: "none",
2423
2665
  border: "none",
2424
- cursor: "pointer",
2666
+ cursor: isStreaming ? "not-allowed" : "pointer",
2425
2667
  padding: 4,
2426
2668
  display: "flex",
2427
2669
  alignItems: "center",
2428
- color: clearHovered ? "#ef4444" : "#9ca3af",
2670
+ color: isStreaming ? "#d1d5db" : clearHovered ? "#ef4444" : "#9ca3af",
2429
2671
  transition: "color 150ms",
2430
- flexShrink: 0
2672
+ flexShrink: 0,
2673
+ opacity: isStreaming ? 0.4 : 1
2431
2674
  },
2432
2675
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { fillRule: "evenodd", d: "M8.75 1A2.75 2.75 0 006 3.75v.443c-.795.077-1.584.176-2.365.298a.75.75 0 10.23 1.482l.149-.022.841 10.518A2.75 2.75 0 007.596 19h4.807a2.75 2.75 0 002.742-2.53l.841-10.519.149.023a.75.75 0 00.23-1.482A41.03 41.03 0 0014 4.193V3.75A2.75 2.75 0 0011.25 1h-2.5zM10 4c.84 0 1.673.025 2.5.075V3.75c0-.69-.56-1.25-1.25-1.25h-2.5c-.69 0-1.25.56-1.25 1.25v.325C8.327 4.025 9.16 4 10 4zM8.58 7.72a.75.75 0 00-1.5.06l.3 7.5a.75.75 0 101.5-.06l-.3-7.5zm4.34.06a.75.75 0 10-1.5-.06l-.3 7.5a.75.75 0 101.5.06l.3-7.5z", clipRule: "evenodd" }) })
2433
2676
  }
@@ -2606,6 +2849,9 @@ function TabBar({ tabs, activeTab, onTabChange }) {
2606
2849
  const duration = Math.min(560, Math.max(280, Math.round(250 + dist * 0.6)));
2607
2850
  return { ...next, ready: true, duration };
2608
2851
  });
2852
+ return () => {
2853
+ if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
2854
+ };
2609
2855
  }, [activeTab, signature]);
2610
2856
  (0, import_react11.useEffect)(() => {
2611
2857
  const bar = barRef.current;
@@ -2780,12 +3026,127 @@ function TabBar({ tabs, activeTab, onTabChange }) {
2780
3026
  );
2781
3027
  }
2782
3028
 
3029
+ // src/components/OnboardingPopup.tsx
3030
+ var import_jsx_runtime8 = require("react/jsx-runtime");
3031
+ function OnboardingInfoButton({ onClick }) {
3032
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3033
+ "button",
3034
+ {
3035
+ onClick: (e) => {
3036
+ e.stopPropagation();
3037
+ onClick();
3038
+ },
3039
+ onMouseDown: (e) => e.stopPropagation(),
3040
+ style: {
3041
+ background: "rgba(0,93,172,0.08)",
3042
+ border: "none",
3043
+ borderRadius: "50%",
3044
+ width: 20,
3045
+ height: 20,
3046
+ cursor: "pointer",
3047
+ padding: 0,
3048
+ display: "flex",
3049
+ alignItems: "center",
3050
+ justifyContent: "center",
3051
+ color: MJH_BLUE,
3052
+ flexShrink: 0
3053
+ },
3054
+ title: "How SEO Copilot works",
3055
+ "aria-label": "How SEO Copilot works",
3056
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "13", height: "13", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", clipRule: "evenodd" }) })
3057
+ }
3058
+ );
3059
+ }
3060
+ function OnboardingCard({ onDismiss, closing }) {
3061
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
3062
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3063
+ "div",
3064
+ {
3065
+ onClick: onDismiss,
3066
+ style: {
3067
+ position: "absolute",
3068
+ inset: 0,
3069
+ zIndex: 60,
3070
+ background: "transparent",
3071
+ cursor: "pointer"
3072
+ }
3073
+ }
3074
+ ),
3075
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3076
+ "div",
3077
+ {
3078
+ onClick: (e) => e.stopPropagation(),
3079
+ style: {
3080
+ position: "absolute",
3081
+ top: 50,
3082
+ right: 10,
3083
+ left: 10,
3084
+ maxWidth: 320,
3085
+ marginLeft: "auto",
3086
+ zIndex: 61,
3087
+ borderRadius: 18,
3088
+ padding: "14px 16px 16px",
3089
+ // Amorphous blue glass
3090
+ background: "linear-gradient(155deg, rgba(0,93,172,0.16), rgba(0,93,172,0.08))",
3091
+ backdropFilter: "blur(20px) saturate(170%)",
3092
+ WebkitBackdropFilter: "blur(20px) saturate(170%)",
3093
+ boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.55), inset 1.5px 2px 1px -1px rgba(255,255,255,0.9), 0 10px 30px rgba(0,93,172,0.22), 0 2px 8px rgba(0,0,0,0.12)",
3094
+ animation: `${closing ? "onboard-out" : "onboard-in"} ${closing ? 200 : 240}ms ease-out forwards`
3095
+ },
3096
+ children: [
3097
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
3098
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: { fontSize: 13, fontWeight: 800, color: "#00468a", letterSpacing: "-0.01em" }, children: "Welcome to SEO Copilot" }),
3099
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3100
+ "button",
3101
+ {
3102
+ onClick: onDismiss,
3103
+ style: { background: "none", border: "none", cursor: "pointer", padding: 2, display: "flex", color: "#00468a", opacity: 1 },
3104
+ title: "Dismiss",
3105
+ "aria-label": "Dismiss",
3106
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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" }) })
3107
+ }
3108
+ )
3109
+ ] }),
3110
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { fontSize: 11.5, color: "#13335a", lineHeight: 1.6 }, children: [
3111
+ "Start on the ",
3112
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: "Keywords" }),
3113
+ " tab. Choose one ",
3114
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: "Primary" }),
3115
+ " keyword (required) and, optionally, one ",
3116
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: "Secondary" }),
3117
+ " keyword. Copilot then optimizes its recommendations toward both."
3118
+ ] }),
3119
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3120
+ "button",
3121
+ {
3122
+ onClick: onDismiss,
3123
+ style: {
3124
+ marginTop: 12,
3125
+ width: "100%",
3126
+ padding: "7px 12px",
3127
+ fontSize: 11.5,
3128
+ fontWeight: 700,
3129
+ color: "#ffffff",
3130
+ background: MJH_BLUE,
3131
+ border: "none",
3132
+ borderRadius: 8,
3133
+ cursor: "pointer"
3134
+ },
3135
+ children: "Got it"
3136
+ }
3137
+ )
3138
+ ]
3139
+ }
3140
+ )
3141
+ ] });
3142
+ }
3143
+
2783
3144
  // src/components/tabs/SummaryTab.tsx
2784
3145
  var import_react13 = require("react");
2785
3146
 
2786
3147
  // src/components/ShimmerLoader.tsx
2787
3148
  var import_react12 = require("react");
2788
- var import_jsx_runtime8 = require("react/jsx-runtime");
3149
+ var import_jsx_runtime9 = require("react/jsx-runtime");
2789
3150
  var keyframesInjected = false;
2790
3151
  var KEYFRAMES = `
2791
3152
  @keyframes seo-copilot-text-shimmer {
@@ -2794,13 +3155,13 @@ var KEYFRAMES = `
2794
3155
  }
2795
3156
  `;
2796
3157
  function LoaderBars({ color = MJH_GOLD }) {
2797
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3158
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2798
3159
  "div",
2799
3160
  {
2800
3161
  role: "status",
2801
3162
  "aria-label": "Loading",
2802
3163
  style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: 14, flexShrink: 0 },
2803
- children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3164
+ children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2804
3165
  "div",
2805
3166
  {
2806
3167
  style: {
@@ -2830,6 +3191,13 @@ function ShimmerLoader({
2830
3191
  style.dataset.seoCopilotKeyframes = "1";
2831
3192
  style.innerHTML = KEYFRAMES;
2832
3193
  document.head.appendChild(style);
3194
+ return () => {
3195
+ try {
3196
+ document.head.removeChild(style);
3197
+ } catch {
3198
+ }
3199
+ keyframesInjected = false;
3200
+ };
2833
3201
  }
2834
3202
  }, []);
2835
3203
  (0, import_react12.useEffect)(() => {
@@ -2840,7 +3208,7 @@ function ShimmerLoader({
2840
3208
  return () => clearInterval(id);
2841
3209
  }, [messages.length, intervalMs]);
2842
3210
  const text = messages[idx] || messages[0] || "";
2843
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3211
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2844
3212
  "div",
2845
3213
  {
2846
3214
  style: {
@@ -2852,8 +3220,8 @@ function ShimmerLoader({
2852
3220
  letterSpacing: "0.01em"
2853
3221
  },
2854
3222
  children: [
2855
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LoaderBars, { color: iconColor }),
2856
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3223
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LoaderBars, { color: iconColor }),
3224
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2857
3225
  "span",
2858
3226
  {
2859
3227
  style: {
@@ -2883,6 +3251,12 @@ var DEFAULT_GENERATE_ALL_MESSAGES = [
2883
3251
  ];
2884
3252
 
2885
3253
  // src/lib/scoring.ts
3254
+ function countWholeMatches(haystack, needle) {
3255
+ if (!needle) return 0;
3256
+ const esc = needle.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3257
+ const m = haystack.match(new RegExp(`\\b${esc}\\b`, "g"));
3258
+ return m ? m.length : 0;
3259
+ }
2886
3260
  function calculateContentScoreDetailed(content, analysis, documentFields) {
2887
3261
  if (!content || !analysis) {
2888
3262
  return { total: 0, components: [] };
@@ -2892,24 +3266,34 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
2892
3266
  const components = [];
2893
3267
  const primaryTerm = (analysis.primaryKeyword?.term || "").toLowerCase();
2894
3268
  if (primaryTerm) {
2895
- const escaped = primaryTerm.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2896
- const primaryRegex = new RegExp(escaped, "gi");
2897
- const primaryMatches = content.match(primaryRegex);
2898
- const primaryCount = primaryMatches?.length || 0;
3269
+ const tokens = primaryTerm.split(/\s+/).filter((t) => t.length > 1);
3270
+ const phraseCount = countWholeMatches(lowerContent, primaryTerm);
3271
+ let occurrences = phraseCount;
3272
+ let viaTokens = false;
3273
+ if (phraseCount === 0 && tokens.length > 0) {
3274
+ const counts = tokens.map((t) => countWholeMatches(lowerContent, t));
3275
+ if (counts.every((c) => c > 0)) {
3276
+ occurrences = Math.min(...counts);
3277
+ viaTokens = true;
3278
+ }
3279
+ }
2899
3280
  const primaryWordCount = Math.max(1, primaryTerm.split(/\s+/).filter(Boolean).length);
2900
3281
  let pts = 0;
2901
3282
  let detail;
2902
- if (primaryCount === 0) {
3283
+ if (occurrences === 0) {
2903
3284
  detail = `Primary keyword "${primaryTerm}" not found in content`;
2904
3285
  } else {
2905
3286
  pts += 12;
2906
- const density = words > 0 ? primaryCount * primaryWordCount / words * 100 : 0;
3287
+ const density = words > 0 ? (viaTokens ? occurrences : occurrences * primaryWordCount) / words * 100 : 0;
2907
3288
  if (density >= 0.5 && density <= 2.5) {
2908
3289
  pts += 13;
2909
3290
  detail = `Primary keyword present, density ${density.toFixed(2)}% (ideal range)`;
2910
3291
  } else if (density < 0.5) {
2911
3292
  pts += 7;
2912
3293
  detail = `Primary keyword present but density only ${density.toFixed(2)}% - aim for 0.5-2.5%`;
3294
+ } else if (viaTokens && density <= 6) {
3295
+ pts += 11;
3296
+ detail = `Primary keyword strongly represented (${density.toFixed(2)}%)`;
2913
3297
  } else {
2914
3298
  pts += 4;
2915
3299
  detail = `Primary keyword over-used at ${density.toFixed(2)}% density - reduce to 0.5-2.5%`;
@@ -2921,7 +3305,7 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
2921
3305
  }
2922
3306
  const supportingKws = analysis.supportingKeywords || [];
2923
3307
  if (supportingKws.length > 0) {
2924
- const inContentCount = supportingKws.filter((kw) => lowerContent.includes(kw.term.toLowerCase())).length;
3308
+ const inContentCount = supportingKws.filter((kw) => kw != null && typeof kw.term === "string" && lowerContent.includes(kw.term.toLowerCase())).length;
2925
3309
  const coverageRatio = inContentCount / supportingKws.length;
2926
3310
  const pts = Math.round(coverageRatio * 25);
2927
3311
  components.push({
@@ -2953,7 +3337,8 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
2953
3337
  if (documentFields) {
2954
3338
  hasH1orTitle = !!(documentFields.title && documentFields.title.trim());
2955
3339
  const det = documentFields.headingsDetailed;
2956
- hasSubheadings = det ? det.some((h) => h.level >= 2 && h.level <= 4) : (documentFields.headings?.length || 0) > 0;
3340
+ const detHasSub = Array.isArray(det) && det.some((h) => h.level >= 2);
3341
+ hasSubheadings = detHasSub || (documentFields.headings?.length || 0) > 0;
2957
3342
  } else {
2958
3343
  hasH1orTitle = /^#\s|<h1/im.test(content);
2959
3344
  hasSubheadings = /^##\s|^###\s|<h2|<h3/im.test(content);
@@ -2981,8 +3366,7 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
2981
3366
  if (documentFields) {
2982
3367
  qCount = (documentFields.headings || []).filter((h) => h.trim().endsWith("?")).length;
2983
3368
  } else {
2984
- const questionHeadings = content.match(/^#{1,6}\s+.*\?$/gm) || content.match(/<h[1-6][^>]*>.*\?<\/h[1-6]>/gi);
2985
- qCount = questionHeadings?.length || 0;
3369
+ qCount = (content.match(/^#{1,6}\s+.*\?$/gm) || []).length + (content.match(/<h[1-6][^>]*>.*\?<\/h[1-6]>/gi) || []).length;
2986
3370
  }
2987
3371
  let aeoPts = 0;
2988
3372
  if (qCount >= 3) aeoPts = 10;
@@ -2994,17 +3378,40 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
2994
3378
  return { total: Math.min(100, Math.max(0, total)), components };
2995
3379
  }
2996
3380
 
2997
- // src/lib/summary.ts
2998
- function tokensContain(haystack, needle) {
3381
+ // src/lib/utils.ts
3382
+ function containsKeywordTokens(haystack, needle) {
2999
3383
  if (!needle) return true;
3000
3384
  const tokens = needle.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
3001
3385
  if (tokens.length === 0) return true;
3002
3386
  const lower = haystack.toLowerCase();
3003
3387
  return tokens.every((t) => lower.includes(t));
3004
3388
  }
3389
+ function keywordLeadsSlug(slug, primaryKeyword) {
3390
+ if (!primaryKeyword) return true;
3391
+ const slugWords = slug.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
3392
+ const tokens = primaryKeyword.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
3393
+ if (tokens.length === 0 || slugWords.length === 0) return true;
3394
+ let earliest = Infinity;
3395
+ for (const t of tokens) {
3396
+ const idx = slugWords.findIndex((w) => w.includes(t));
3397
+ if (idx >= 0) earliest = Math.min(earliest, idx);
3398
+ }
3399
+ return earliest <= 2;
3400
+ }
3401
+ var KNOWN_MJH_PUBLICATIONS = /* @__PURE__ */ new Set([
3402
+ "onclive",
3403
+ "hcplive",
3404
+ "ajmc",
3405
+ "pharmacytimes",
3406
+ "cancernetwork"
3407
+ ]);
3408
+
3409
+ // src/lib/summary.ts
3005
3410
  function isShortFormContent(documentFields, title) {
3411
+ const cat = (documentFields?.contentCategory || "").toLowerCase().trim();
3412
+ if (/^(videos?|podcasts?|episodes?|webinars?|video series|peer exchange)$/.test(cat)) return true;
3006
3413
  const shortFormCats = /* @__PURE__ */ new Set(["news", "brief", "preview", "recap", "update", "announcement", "roundup", "digest", "interview"]);
3007
- const catTokens = (documentFields?.contentCategory || "").toLowerCase().split(/[^a-z]+/).filter(Boolean);
3414
+ const catTokens = cat.split(/[^a-z]+/).filter(Boolean);
3008
3415
  if (catTokens.some((tok) => shortFormCats.has(tok))) return true;
3009
3416
  const t = (title || "").toLowerCase();
3010
3417
  if (/\b(preview|recap|roundup|digest)\b/.test(t)) return true;
@@ -3014,7 +3421,15 @@ function isShortFormContent(documentFields, title) {
3014
3421
  function buildSummaryItems(input) {
3015
3422
  const items = [];
3016
3423
  const { analysis, deepAnalysis, documentFields, linkingSuggestions, linkCheckResults, text } = input;
3017
- const primaryKeyword = analysis?.primaryKeyword?.term;
3424
+ const primaryKeyword = input.primaryKeyword || analysis?.primaryKeyword?.term;
3425
+ const secondaryKeyword = input.secondaryKeyword || "";
3426
+ const bodyText = (() => {
3427
+ if (!documentFields?.title) return text;
3428
+ if (!text.startsWith(documentFields.title)) return text;
3429
+ const rest = text.slice(documentFields.title.length);
3430
+ if (rest === "" || /^\s/.test(rest)) return rest.trimStart();
3431
+ return text;
3432
+ })();
3018
3433
  const title = documentFields?.title;
3019
3434
  if (!title) {
3020
3435
  items.push({
@@ -3027,7 +3442,7 @@ function buildSummaryItems(input) {
3027
3442
  jumpTo: { tab: "meta", anchorId: "anchor-meta-title" }
3028
3443
  });
3029
3444
  } else if (primaryKeyword) {
3030
- if (!tokensContain(title, primaryKeyword)) {
3445
+ if (!containsKeywordTokens(title, primaryKeyword)) {
3031
3446
  items.push({
3032
3447
  id: "meta-title-no-keyword",
3033
3448
  category: "meta",
@@ -3093,7 +3508,7 @@ function buildSummaryItems(input) {
3093
3508
  jumpTo: { tab: "meta", anchorId: "anchor-meta-description" }
3094
3509
  });
3095
3510
  }
3096
- if (primaryKeyword && !tokensContain(meta, primaryKeyword)) {
3511
+ if (primaryKeyword && !containsKeywordTokens(meta, primaryKeyword)) {
3097
3512
  items.push({
3098
3513
  id: "meta-desc-no-keyword",
3099
3514
  category: "meta",
@@ -3110,39 +3525,40 @@ function buildSummaryItems(input) {
3110
3525
  items.push({
3111
3526
  id: "meta-slug-missing",
3112
3527
  category: "meta",
3113
- severity: "error",
3528
+ severity: "warning",
3114
3529
  label: "URL slug missing",
3115
3530
  description: "No URL slug set.",
3116
- howToFix: "Add a clean, hyphenated slug 3-5 words long that contains the primary keyword.",
3117
- jumpTo: { tab: "meta", anchorId: "anchor-url-slug" }
3531
+ howToFix: "Add a short, descriptive slug that leads with your primary keyword.",
3532
+ jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
3118
3533
  });
3119
3534
  } else {
3120
- if (slug.length > 60) {
3535
+ const slugAsWords = slug.replace(/-/g, " ");
3536
+ if (primaryKeyword && !containsKeywordTokens(slugAsWords, primaryKeyword)) {
3121
3537
  items.push({
3122
- id: "meta-slug-long",
3538
+ id: "meta-slug-no-keyword",
3123
3539
  category: "meta",
3124
- severity: "warning",
3125
- label: "URL slug is long",
3126
- description: `Slug is ${slug.length} characters. 3-5 words is the 2026 sweet spot.`,
3127
- howToFix: "Shorten the slug to keep the URL clean and scannable.",
3128
- jumpTo: { tab: "meta", anchorId: "anchor-url-slug" }
3540
+ severity: "opportunity",
3541
+ label: "Primary keyword not in URL",
3542
+ description: `The URL doesn't include "${primaryKeyword}".`,
3543
+ howToFix: "Work the primary keyword into the URL, ideally at the start. Keep the URL short and descriptive.",
3544
+ jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
3129
3545
  });
3130
- }
3131
- if (primaryKeyword && !tokensContain(slug.replace(/-/g, " "), primaryKeyword)) {
3546
+ } else if (primaryKeyword && !keywordLeadsSlug(slug, primaryKeyword)) {
3132
3547
  items.push({
3133
- id: "meta-slug-no-keyword",
3548
+ id: "meta-slug-keyword-late",
3134
3549
  category: "meta",
3135
3550
  severity: "opportunity",
3136
- label: "Primary keyword not in URL",
3137
- description: `Slug doesn't contain "${primaryKeyword}".`,
3138
- howToFix: "Rework the slug to include the primary keyword (hyphenated). URLs with keywords still get a modest ranking lift.",
3139
- jumpTo: { tab: "meta", anchorId: "anchor-url-slug" }
3551
+ label: "Primary keyword late in URL",
3552
+ description: `"${primaryKeyword}" is in the URL but not near the start.`,
3553
+ howToFix: "Lead the URL with the primary keyword so it stays visible if the address gets shortened.",
3554
+ jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
3140
3555
  });
3141
3556
  }
3142
3557
  }
3143
- const wordCount2 = text ? text.trim().split(/\s+/).filter(Boolean).length : 0;
3558
+ const wordCount2 = bodyText ? bodyText.trim().split(/\s+/).filter(Boolean).length : 0;
3559
+ const isShortForm = isShortFormContent(documentFields, title);
3144
3560
  if (wordCount2 === 0) {
3145
- } else if (wordCount2 < 450) {
3561
+ } else if (wordCount2 < 450 && !isShortForm) {
3146
3562
  items.push({
3147
3563
  id: "content-too-short",
3148
3564
  category: "content",
@@ -3152,7 +3568,7 @@ function buildSummaryItems(input) {
3152
3568
  howToFix: "Add more body text. A link or image on its own doesn't count - the article needs real written substance.",
3153
3569
  jumpTo: { tab: "technical", anchorId: "anchor-word-count" }
3154
3570
  });
3155
- } else if (wordCount2 < 1500 && !isShortFormContent(documentFields, title)) {
3571
+ } else if (wordCount2 < 1500 && !isShortForm) {
3156
3572
  items.push({
3157
3573
  id: "content-short-for-clinical",
3158
3574
  category: "content",
@@ -3166,7 +3582,7 @@ function buildSummaryItems(input) {
3166
3582
  const headings = documentFields?.headings || [];
3167
3583
  const headingsDetailed = documentFields?.headingsDetailed;
3168
3584
  const h2Count = headingsDetailed ? headingsDetailed.filter((h) => h.level === 2 || h.level === 3).length : headings.length;
3169
- if (headings.length === 0 && wordCount2 > 200 && wordCount2 < 1e3) {
3585
+ if (h2Count === 0 && wordCount2 > 200 && wordCount2 < 1e3) {
3170
3586
  items.push({
3171
3587
  id: "headings-missing",
3172
3588
  category: "headings",
@@ -3272,7 +3688,7 @@ function buildSummaryItems(input) {
3272
3688
  if (GENERIC_FN_RE.test(base)) return true;
3273
3689
  if (/_/.test(base) || /\s/.test(base)) return true;
3274
3690
  const words = base.split("-").filter(Boolean);
3275
- return words.length < 2 || words.length > 7;
3691
+ return words.length < 2 || words.length > 5;
3276
3692
  });
3277
3693
  if (badFilenames.length > 0) {
3278
3694
  items.push({
@@ -3290,7 +3706,7 @@ function buildSummaryItems(input) {
3290
3706
  if (!trimmed) return false;
3291
3707
  const len = trimmed.length;
3292
3708
  const wc = trimmed.split(/\s+/).filter(Boolean).length;
3293
- return len > 125 || wc < 2;
3709
+ return len >= 125 || wc < 2;
3294
3710
  });
3295
3711
  if (badAlts.length > 0) {
3296
3712
  items.push({
@@ -3305,7 +3721,7 @@ function buildSummaryItems(input) {
3305
3721
  }
3306
3722
  const imageTitleCount = (documentFields?.imageTitles || []).length;
3307
3723
  const totalImageCount = documentFields?.imageCount ?? 0;
3308
- const missingTitles = totalImageCount > 0 ? totalImageCount - imageTitleCount : 0;
3724
+ const missingTitles = totalImageCount > 0 && imageTitleCount > 0 ? totalImageCount - imageTitleCount : 0;
3309
3725
  if (missingTitles > 0) {
3310
3726
  items.push({
3311
3727
  id: "images-titles-missing",
@@ -3319,7 +3735,7 @@ function buildSummaryItems(input) {
3319
3735
  }
3320
3736
  if (!primaryKeyword) {
3321
3737
  } else {
3322
- if (text && !tokensContain(text, primaryKeyword)) {
3738
+ if (bodyText && !containsKeywordTokens(bodyText, primaryKeyword)) {
3323
3739
  items.push({
3324
3740
  id: "keywords-primary-not-in-body",
3325
3741
  category: "keywords",
@@ -3331,7 +3747,7 @@ function buildSummaryItems(input) {
3331
3747
  });
3332
3748
  }
3333
3749
  const primaryVolume = analysis?.primaryKeyword?.volume;
3334
- if (deepAnalysis && (primaryVolume === 0 || primaryVolume === null)) {
3750
+ if (deepAnalysis && primaryVolume === 0) {
3335
3751
  items.push({
3336
3752
  id: "keywords-primary-zero-volume",
3337
3753
  category: "keywords",
@@ -3343,6 +3759,55 @@ function buildSummaryItems(input) {
3343
3759
  });
3344
3760
  }
3345
3761
  }
3762
+ if (secondaryKeyword) {
3763
+ if (bodyText && !containsKeywordTokens(bodyText, secondaryKeyword)) {
3764
+ items.push({
3765
+ id: "secondary-not-in-body",
3766
+ category: "keywords",
3767
+ severity: "opportunity",
3768
+ label: "Secondary keyword not in body",
3769
+ description: `Your secondary keyword "${secondaryKeyword}" doesn't appear in the article body.`,
3770
+ howToFix: "Work the secondary keyword into a body paragraph or two where it reads naturally.",
3771
+ jumpTo: { tab: "keywords" }
3772
+ });
3773
+ }
3774
+ const titleVal = documentFields?.title;
3775
+ if (titleVal && !containsKeywordTokens(titleVal, secondaryKeyword)) {
3776
+ items.push({
3777
+ id: "secondary-not-in-title",
3778
+ category: "meta",
3779
+ severity: "opportunity",
3780
+ label: "Secondary keyword not in title",
3781
+ description: `The title doesn't include your secondary keyword "${secondaryKeyword}".`,
3782
+ howToFix: "If it fits naturally, include the secondary keyword in the title too - but never at the cost of the primary leading.",
3783
+ jumpTo: { tab: "meta", anchorId: "anchor-meta-title" }
3784
+ });
3785
+ }
3786
+ const metaVal = documentFields?.metaDescription;
3787
+ if (metaVal && !containsKeywordTokens(metaVal, secondaryKeyword)) {
3788
+ items.push({
3789
+ id: "secondary-not-in-meta",
3790
+ category: "meta",
3791
+ severity: "opportunity",
3792
+ label: "Secondary keyword not in meta description",
3793
+ description: `The meta description doesn't include "${secondaryKeyword}".`,
3794
+ howToFix: "Add the secondary keyword to the meta description if it reads naturally.",
3795
+ jumpTo: { tab: "meta", anchorId: "anchor-meta-description" }
3796
+ });
3797
+ }
3798
+ const slugVal = documentFields?.slug;
3799
+ if (slugVal && !containsKeywordTokens(slugVal.replace(/-/g, " "), secondaryKeyword)) {
3800
+ items.push({
3801
+ id: "secondary-not-in-url",
3802
+ category: "meta",
3803
+ severity: "opportunity",
3804
+ label: "Secondary keyword not in URL",
3805
+ description: `The URL doesn't include "${secondaryKeyword}".`,
3806
+ howToFix: "Optionally include the secondary keyword in the URL after the primary - only if the slug stays short and clean.",
3807
+ jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
3808
+ });
3809
+ }
3810
+ }
3346
3811
  const actualQuestionHeadings = (documentFields?.headings || []).filter((h) => h.trim().endsWith("?"));
3347
3812
  if (deepAnalysis && actualQuestionHeadings.length === 0 && wordCount2 > 300) {
3348
3813
  items.push({
@@ -3453,7 +3918,7 @@ function buildSummaryItems(input) {
3453
3918
  }
3454
3919
 
3455
3920
  // src/components/tabs/SummaryTab.tsx
3456
- var import_jsx_runtime9 = require("react/jsx-runtime");
3921
+ var import_jsx_runtime10 = require("react/jsx-runtime");
3457
3922
  var cardStyle2 = {
3458
3923
  borderRadius: 14,
3459
3924
  background: "rgba(255,255,255,0.55)",
@@ -3477,9 +3942,9 @@ function scoreColors(score) {
3477
3942
  }
3478
3943
  function ScoreBadge({ score, breakdown }) {
3479
3944
  const c = scoreColors(score);
3480
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: cardStyle2, children: [
3481
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
3482
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3945
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: cardStyle2, children: [
3946
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
3947
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3483
3948
  "div",
3484
3949
  {
3485
3950
  style: {
@@ -3495,30 +3960,30 @@ function ScoreBadge({ score, breakdown }) {
3495
3960
  lineHeight: 1
3496
3961
  },
3497
3962
  children: [
3498
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { fontSize: 20, fontWeight: 700, color: c.text }, children: score }),
3499
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { fontSize: 8, fontWeight: 700, color: c.text, opacity: 0.7, letterSpacing: "0.06em", marginTop: 2 }, children: "/ 100" })
3963
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 20, fontWeight: 700, color: c.text }, children: score }),
3964
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 8, fontWeight: 700, color: c.text, opacity: 0.7, letterSpacing: "0.06em", marginTop: 2 }, children: "/ 100" })
3500
3965
  ]
3501
3966
  }
3502
3967
  ),
3503
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
3504
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
3505
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 14, fontWeight: 700, color: c.text }, children: c.label })
3968
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
3969
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
3970
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 14, fontWeight: 700, color: c.text }, children: c.label })
3506
3971
  ] })
3507
3972
  ] }),
3508
- breakdown.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
3973
+ breakdown.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
3509
3974
  const pct = comp.max > 0 ? comp.points / comp.max * 100 : 0;
3510
3975
  const barColor = pct >= 75 ? "#16a34a" : pct >= 40 ? "#E6C01B" : "#dc2626";
3511
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
3512
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
3513
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
3514
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { style: { fontSize: 11, color: "#4b5563", fontVariantNumeric: "tabular-nums" }, children: [
3976
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
3977
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
3978
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
3979
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { fontSize: 11, color: "#4b5563", fontVariantNumeric: "tabular-nums" }, children: [
3515
3980
  comp.points,
3516
3981
  " / ",
3517
3982
  comp.max
3518
3983
  ] })
3519
3984
  ] }),
3520
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { width: `${pct}%`, height: "100%", background: barColor, transition: "width 200ms" } }) }),
3521
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
3985
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { width: `${pct}%`, height: "100%", background: barColor, transition: "width 200ms" } }) }),
3986
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
3522
3987
  ] }, i);
3523
3988
  }) })
3524
3989
  ] });
@@ -3532,7 +3997,7 @@ function ItemCard({ item, onClick }) {
3532
3997
  const v = severityVisual(item.severity);
3533
3998
  const tab = item.jumpTo.tab;
3534
3999
  const tabLabel = TAB_LABEL[tab] ?? tab.charAt(0).toUpperCase() + tab.slice(1);
3535
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
4000
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3536
4001
  "div",
3537
4002
  {
3538
4003
  onClick,
@@ -3549,8 +4014,8 @@ function ItemCard({ item, onClick }) {
3549
4014
  cursor: "pointer"
3550
4015
  },
3551
4016
  children: [
3552
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
3553
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
4017
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
4018
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3554
4019
  "div",
3555
4020
  {
3556
4021
  style: {
@@ -3563,12 +4028,12 @@ function ItemCard({ item, onClick }) {
3563
4028
  }
3564
4029
  }
3565
4030
  ),
3566
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
3567
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
3568
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
4031
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
4032
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
4033
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
3569
4034
  ] })
3570
4035
  ] }),
3571
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
4036
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3572
4037
  "div",
3573
4038
  {
3574
4039
  style: {
@@ -3580,12 +4045,12 @@ function ItemCard({ item, onClick }) {
3580
4045
  lineHeight: 1.55
3581
4046
  },
3582
4047
  children: [
3583
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
4048
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
3584
4049
  item.howToFix
3585
4050
  ]
3586
4051
  }
3587
4052
  ),
3588
- item.jumpTo.tab !== "summary" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
4053
+ item.jumpTo.tab !== "summary" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
3589
4054
  "Go to ",
3590
4055
  tabLabel,
3591
4056
  " \u203A"
@@ -3601,7 +4066,7 @@ function FilterChip({
3601
4066
  count,
3602
4067
  dotColor
3603
4068
  }) {
3604
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
4069
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
3605
4070
  "button",
3606
4071
  {
3607
4072
  onClick,
@@ -3620,9 +4085,9 @@ function FilterChip({
3620
4085
  transition: "all 150ms"
3621
4086
  },
3622
4087
  children: [
3623
- dotColor && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
3624
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: label }),
3625
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
4088
+ dotColor && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
4089
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: label }),
4090
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
3626
4091
  ]
3627
4092
  }
3628
4093
  );
@@ -3634,14 +4099,17 @@ function SummaryTab({
3634
4099
  documentFields,
3635
4100
  linkingSuggestions,
3636
4101
  linkCheckResults,
4102
+ primaryKeyword,
4103
+ secondaryKeyword,
3637
4104
  isAnyLoading,
3638
4105
  onGenerateAll,
3639
4106
  onItemClick
3640
4107
  }) {
3641
4108
  const scoreDetail = (0, import_react13.useMemo)(() => {
3642
4109
  if (!analysis) return null;
3643
- return calculateContentScoreDetailed(text, analysis, documentFields);
3644
- }, [text, analysis, documentFields]);
4110
+ const scored = primaryKeyword && analysis.primaryKeyword && primaryKeyword !== analysis.primaryKeyword.term ? { ...analysis, primaryKeyword: { ...analysis.primaryKeyword, term: primaryKeyword } } : analysis;
4111
+ return calculateContentScoreDetailed(text, scored, documentFields);
4112
+ }, [text, analysis, documentFields, primaryKeyword]);
3645
4113
  const score = scoreDetail?.total ?? null;
3646
4114
  const items = (0, import_react13.useMemo)(
3647
4115
  () => buildSummaryItems({
@@ -3651,9 +4119,11 @@ function SummaryTab({
3651
4119
  contentScore: score,
3652
4120
  linkingSuggestions,
3653
4121
  linkCheckResults,
3654
- text
4122
+ text,
4123
+ primaryKeyword,
4124
+ secondaryKeyword
3655
4125
  }),
3656
- [analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text]
4126
+ [analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text, primaryKeyword, secondaryKeyword]
3657
4127
  );
3658
4128
  const [filter, setFilter] = (0, import_react13.useState)("all");
3659
4129
  const counts = (0, import_react13.useMemo)(
@@ -3667,15 +4137,15 @@ function SummaryTab({
3667
4137
  );
3668
4138
  const filtered = filter === "all" ? items : items.filter((i) => i.severity === filter);
3669
4139
  if (!analysis) {
3670
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
3671
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
3672
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
4140
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
4141
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
4142
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
3673
4143
  ] });
3674
4144
  }
3675
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
3676
- score != null && scoreDetail && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ScoreBadge, { score, breakdown: scoreDetail.components }),
3677
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: cardStyle2, children: [
3678
- isAnyLoading ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
4145
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4146
+ score != null && scoreDetail && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScoreBadge, { score, breakdown: scoreDetail.components }),
4147
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: cardStyle2, children: [
4148
+ isAnyLoading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3679
4149
  "button",
3680
4150
  {
3681
4151
  onClick: onGenerateAll,
@@ -3700,27 +4170,27 @@ function SummaryTab({
3700
4170
  transition: "all 150ms",
3701
4171
  letterSpacing: "0.01em"
3702
4172
  },
3703
- children: "Generate everything"
4173
+ children: "Run all analyses"
3704
4174
  }
3705
4175
  ),
3706
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
4176
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
3707
4177
  "Runs the analyses that fill the ",
3708
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: "AEO/GEO" }),
4178
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "AEO/GEO" }),
3709
4179
  ", ",
3710
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: "Linking" }),
4180
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "Linking" }),
3711
4181
  ", and ",
3712
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: "Other Recs" }),
4182
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "Other Recs" }),
3713
4183
  " tabs. New issues they find appear in this Summary as each one finishes."
3714
4184
  ] })
3715
4185
  ] }),
3716
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
3717
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
3718
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
3719
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
3720
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
4186
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
4187
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
4188
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
4189
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
4190
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
3721
4191
  ] }),
3722
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
3723
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
4192
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
4193
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3724
4194
  "div",
3725
4195
  {
3726
4196
  style: {
@@ -3733,15 +4203,15 @@ function SummaryTab({
3733
4203
  justifyContent: "center",
3734
4204
  margin: "0 auto 8px"
3735
4205
  },
3736
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("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" }) })
4206
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" }) })
3737
4207
  }
3738
4208
  ),
3739
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
3740
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
3741
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
3742
- isAnyLoading && items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
3743
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
3744
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
4209
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
4210
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
4211
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
4212
+ isAnyLoading && items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
4213
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
4214
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
3745
4215
  ] })
3746
4216
  ] });
3747
4217
  }
@@ -3821,7 +4291,7 @@ function analyzeGEO(text, headings) {
3821
4291
  }
3822
4292
 
3823
4293
  // src/components/tabs/AEOTab.tsx
3824
- var import_jsx_runtime10 = require("react/jsx-runtime");
4294
+ var import_jsx_runtime11 = require("react/jsx-runtime");
3825
4295
  var AEO_PURPLE = "#005DAC";
3826
4296
  var GEO_TEAL = "#C9A716";
3827
4297
  var cardStyle3 = {
@@ -3833,7 +4303,7 @@ var cardStyle3 = {
3833
4303
  padding: "14px"
3834
4304
  };
3835
4305
  function AiPill() {
3836
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4306
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3837
4307
  "span",
3838
4308
  {
3839
4309
  style: {
@@ -3852,23 +4322,29 @@ function AiPill() {
3852
4322
  );
3853
4323
  }
3854
4324
  function SectionHeader2({ label, iconColor, ai }) {
3855
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
3856
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
3857
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
3858
- ai && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AiPill, {})
4325
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
4326
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4327
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4328
+ ai && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AiPill, {})
3859
4329
  ] });
3860
4330
  }
3861
4331
  function CopyButton({ text }) {
3862
4332
  const [copied, setCopied] = (0, import_react14.useState)(false);
4333
+ const copyTimerRef = (0, import_react14.useRef)(null);
4334
+ (0, import_react14.useEffect)(() => {
4335
+ return () => {
4336
+ if (copyTimerRef.current) clearTimeout(copyTimerRef.current);
4337
+ };
4338
+ }, []);
3863
4339
  const handleCopy = async () => {
3864
4340
  try {
3865
4341
  await navigator.clipboard.writeText(text);
3866
4342
  setCopied(true);
3867
- setTimeout(() => setCopied(false), 1500);
4343
+ copyTimerRef.current = setTimeout(() => setCopied(false), 1500);
3868
4344
  } catch {
3869
4345
  }
3870
4346
  };
3871
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4347
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3872
4348
  "button",
3873
4349
  {
3874
4350
  onClick: handleCopy,
@@ -3887,9 +4363,9 @@ function CopyButton({ text }) {
3887
4363
  transition: "color 150ms"
3888
4364
  },
3889
4365
  title: copied ? "Copied!" : "Copy to clipboard",
3890
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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__ */ (0, import_jsx_runtime10.jsxs)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
3891
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" }),
3892
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" })
4366
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
4367
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" }),
4368
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" })
3893
4369
  ] })
3894
4370
  }
3895
4371
  );
@@ -3904,13 +4380,13 @@ function GEOCard({ geo, publication }) {
3904
4380
  const fdBg = effectiveStatus === "strong" ? "rgba(22,163,74,0.1)" : effectiveStatus === "moderate" ? "rgba(230,192,27,0.15)" : "rgba(220,38,38,0.08)";
3905
4381
  const goodCount = geo.headingAudit.filter((h) => h.status === "good").length;
3906
4382
  const totalHeadings = geo.headingAudit.length;
3907
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: cardStyle3, children: [
3908
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
3909
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
3910
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
4383
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle3, children: [
4384
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
4385
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
4386
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
3911
4387
  ] }),
3912
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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." }),
3913
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4388
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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." }),
4389
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3914
4390
  "div",
3915
4391
  {
3916
4392
  style: {
@@ -3923,7 +4399,7 @@ function GEOCard({ geo, publication }) {
3923
4399
  marginBottom: 8
3924
4400
  },
3925
4401
  children: [
3926
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4402
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3927
4403
  "div",
3928
4404
  {
3929
4405
  style: {
@@ -3939,17 +4415,17 @@ function GEOCard({ geo, publication }) {
3939
4415
  boxShadow: "0 1px 2px rgba(0,0,0,0.06)"
3940
4416
  },
3941
4417
  children: [
3942
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
3943
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
4418
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
4419
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
3944
4420
  ]
3945
4421
  }
3946
4422
  ),
3947
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
3948
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
4423
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
4424
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
3949
4425
  "Fact density: ",
3950
4426
  fdLabel
3951
4427
  ] }),
3952
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
4428
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
3953
4429
  fd.factCount,
3954
4430
  " specific stat",
3955
4431
  fd.factCount === 1 ? "" : "s",
@@ -3965,7 +4441,7 @@ function GEOCard({ geo, publication }) {
3965
4441
  ]
3966
4442
  }
3967
4443
  ),
3968
- fd.driftPassages > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4444
+ fd.driftPassages > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3969
4445
  "div",
3970
4446
  {
3971
4447
  style: {
@@ -3979,15 +4455,15 @@ function GEOCard({ geo, publication }) {
3979
4455
  lineHeight: 1.45
3980
4456
  },
3981
4457
  children: [
3982
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: fd.driftPassages }),
4458
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: fd.driftPassages }),
3983
4459
  " passage",
3984
4460
  fd.driftPassages === 1 ? "" : "s",
3985
4461
  " over 200 words with no specific stats or citations. AI engines tend to skip these."
3986
4462
  ]
3987
4463
  }
3988
4464
  ),
3989
- totalHeadings > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { marginTop: 4 }, children: [
3990
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4465
+ totalHeadings > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { marginTop: 4 }, children: [
4466
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3991
4467
  "button",
3992
4468
  {
3993
4469
  onClick: () => setShowDetails((v) => !v),
@@ -4006,22 +4482,22 @@ function GEOCard({ geo, publication }) {
4006
4482
  color: GEO_TEAL
4007
4483
  },
4008
4484
  children: [
4009
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
4485
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
4010
4486
  "Short-answer paragraphs: ",
4011
4487
  goodCount,
4012
4488
  "/",
4013
4489
  totalHeadings,
4014
4490
  " headings have one"
4015
4491
  ] }),
4016
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" }) })
4492
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" }) })
4017
4493
  ]
4018
4494
  }
4019
4495
  ),
4020
- showDetails && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
4021
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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." }),
4496
+ showDetails && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
4497
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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." }),
4022
4498
  geo.headingAudit.map((h, i) => {
4023
4499
  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" };
4024
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4500
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4025
4501
  "div",
4026
4502
  {
4027
4503
  style: {
@@ -4035,8 +4511,8 @@ function GEOCard({ geo, publication }) {
4035
4511
  gap: 8
4036
4512
  },
4037
4513
  children: [
4038
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
4039
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
4514
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
4515
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
4040
4516
  ]
4041
4517
  },
4042
4518
  i
@@ -4073,8 +4549,8 @@ function AEOTab({
4073
4549
  originalHeading: void 0,
4074
4550
  rationale: h.rationale
4075
4551
  })) ?? [];
4076
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4077
- aeoContentChanged && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4552
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
4553
+ aeoContentChanged && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4078
4554
  "div",
4079
4555
  {
4080
4556
  onClick: runDeepAnalysis,
@@ -4089,30 +4565,30 @@ function AEOTab({
4089
4565
  cursor: "pointer"
4090
4566
  },
4091
4567
  children: [
4092
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
4093
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
4568
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
4569
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
4094
4570
  ]
4095
4571
  }
4096
4572
  ),
4097
- hasEnoughTextForGEO && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GEOCard, { geo, publication }),
4098
- hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
4099
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
4573
+ hasEnoughTextForGEO && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GEOCard, { geo, publication }),
4574
+ hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
4575
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
4100
4576
  " needs at least 150 words to read fact density.",
4101
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("br", {}),
4102
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { color: "#4b5563" }, children: [
4577
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("br", {}),
4578
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { style: { color: "#4b5563" }, children: [
4103
4579
  "Current: ",
4104
4580
  geoWordCount,
4105
4581
  " word",
4106
4582
  geoWordCount === 1 ? "" : "s"
4107
4583
  ] })
4108
4584
  ] }) }),
4109
- !deepAnalysis && isDeepLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
4110
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4111
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
4585
+ !deepAnalysis && isDeepLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
4586
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4587
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
4112
4588
  ] }),
4113
- !deepAnalysis && !isDeepLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
4114
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
4115
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4589
+ !deepAnalysis && !isDeepLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
4590
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
4591
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4116
4592
  "button",
4117
4593
  {
4118
4594
  onClick: runDeepAnalysis,
@@ -4132,11 +4608,11 @@ function AEOTab({
4132
4608
  }
4133
4609
  )
4134
4610
  ] }),
4135
- deepAnalysis && !aeo && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
4136
- questionHeadings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: cardStyle3, children: [
4137
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
4138
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
4139
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4611
+ deepAnalysis && !aeo && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
4612
+ questionHeadings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle3, children: [
4613
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
4614
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
4615
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4140
4616
  "div",
4141
4617
  {
4142
4618
  style: {
@@ -4146,26 +4622,26 @@ function AEOTab({
4146
4622
  borderLeft: `3px solid ${AEO_PURPLE}`
4147
4623
  },
4148
4624
  children: [
4149
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4150
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { flex: 1 }, children: [
4151
- h.originalHeading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
4152
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
4625
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4626
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1 }, children: [
4627
+ h.originalHeading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
4628
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
4153
4629
  ] }),
4154
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4155
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopyButton, { text: h.heading }),
4156
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
4630
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4631
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CopyButton, { text: h.heading }),
4632
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
4157
4633
  ] })
4158
4634
  ] }),
4159
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
4635
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
4160
4636
  ]
4161
4637
  },
4162
4638
  i
4163
4639
  )) })
4164
4640
  ] }),
4165
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: cardStyle3, children: [
4166
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
4167
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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." }),
4168
- !contentSuggestions && !isCSLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4641
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle3, children: [
4642
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
4643
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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." }),
4644
+ !contentSuggestions && !isCSLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4169
4645
  "button",
4170
4646
  {
4171
4647
  onClick: loadContentSuggestions,
@@ -4189,15 +4665,15 @@ function AEOTab({
4189
4665
  children: "Generate suggestions"
4190
4666
  }
4191
4667
  ),
4192
- isCSLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
4193
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4194
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
4668
+ isCSLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
4669
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoadingBars, { size: "xs", color: AEO_PURPLE }),
4670
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
4195
4671
  ] }),
4196
- csError && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
4197
- contentSuggestions && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
4198
- contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4199
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
4200
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4672
+ csError && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
4673
+ contentSuggestions && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
4674
+ contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
4675
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
4676
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4201
4677
  "div",
4202
4678
  {
4203
4679
  style: {
@@ -4210,19 +4686,19 @@ function AEOTab({
4210
4686
  alignItems: "flex-start"
4211
4687
  },
4212
4688
  children: [
4213
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
4214
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4215
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopyButton, { text: kt }),
4216
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
4689
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
4690
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4691
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CopyButton, { text: kt }),
4692
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
4217
4693
  ] })
4218
4694
  ]
4219
4695
  },
4220
4696
  i
4221
4697
  )) })
4222
4698
  ] }),
4223
- contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4224
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
4225
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4699
+ contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
4700
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
4701
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4226
4702
  "div",
4227
4703
  {
4228
4704
  style: {
@@ -4232,23 +4708,23 @@ function AEOTab({
4232
4708
  borderLeft: `2px solid ${AEO_PURPLE}`
4233
4709
  },
4234
4710
  children: [
4235
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4236
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
4237
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
4711
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4712
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
4713
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
4238
4714
  ] }),
4239
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
4715
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
4240
4716
  ]
4241
4717
  },
4242
4718
  i
4243
4719
  )) })
4244
4720
  ] }),
4245
- contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4246
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
4247
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4248
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
4249
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4250
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
4251
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4721
+ contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
4722
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
4723
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
4724
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
4725
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
4726
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
4727
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4252
4728
  FeedbackButton,
4253
4729
  {
4254
4730
  suggestionType: "aeo_bullets",
@@ -4259,7 +4735,7 @@ function AEOTab({
4259
4735
  ] })
4260
4736
  ] })
4261
4737
  ] }),
4262
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4738
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4263
4739
  "button",
4264
4740
  {
4265
4741
  onClick: loadContentSuggestions,
@@ -4289,7 +4765,7 @@ function AEOTab({
4289
4765
 
4290
4766
  // src/components/ScoreDonut.tsx
4291
4767
  var import_react15 = require("react");
4292
- var import_jsx_runtime11 = require("react/jsx-runtime");
4768
+ var import_jsx_runtime12 = require("react/jsx-runtime");
4293
4769
  var W = { topic: 0.6, freshness: 0.25, sectionFit: 0.15 };
4294
4770
  var COLORS = { topic: MJH_BLUE, freshness: MJH_GOLD, sectionFit: "#9B59B6" };
4295
4771
  var TRACK = "#eef2f7";
@@ -4314,7 +4790,7 @@ function ScoreDonut({
4314
4790
  const topicLen = seg(cTopic);
4315
4791
  const freshLen = seg(cFresh);
4316
4792
  const sectionLen = seg(cSection);
4317
- const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4793
+ const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4318
4794
  "circle",
4319
4795
  {
4320
4796
  cx: size / 2,
@@ -4328,20 +4804,20 @@ function ScoreDonut({
4328
4804
  strokeDashoffset: -offset
4329
4805
  }
4330
4806
  );
4331
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4807
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4332
4808
  "div",
4333
4809
  {
4334
4810
  style: { position: "relative", width: size, height: size, flexShrink: 0 },
4335
4811
  onMouseEnter: () => setHovered(true),
4336
4812
  onMouseLeave: () => setHovered(false),
4337
4813
  children: [
4338
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
4339
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
4340
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
4341
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
4342
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
4814
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
4815
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
4816
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
4817
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
4818
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
4343
4819
  ] }),
4344
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4820
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4345
4821
  "div",
4346
4822
  {
4347
4823
  style: {
@@ -4355,15 +4831,15 @@ function ScoreDonut({
4355
4831
  lineHeight: 1
4356
4832
  },
4357
4833
  children: [
4358
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
4834
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
4359
4835
  compositeValue,
4360
4836
  "%"
4361
4837
  ] }),
4362
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
4838
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
4363
4839
  ]
4364
4840
  }
4365
4841
  ),
4366
- hovered && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4842
+ hovered && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4367
4843
  "div",
4368
4844
  {
4369
4845
  role: "tooltip",
@@ -4384,9 +4860,9 @@ function ScoreDonut({
4384
4860
  pointerEvents: "none"
4385
4861
  },
4386
4862
  children: [
4387
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
4388
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
4389
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
4863
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
4864
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
4865
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
4390
4866
  ]
4391
4867
  }
4392
4868
  )
@@ -4395,31 +4871,76 @@ function ScoreDonut({
4395
4871
  );
4396
4872
  }
4397
4873
  function SubScoreRow({ color, label, value }) {
4398
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
4399
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
4400
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { flex: 1 }, children: label }),
4401
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
4874
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
4875
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
4876
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { flex: 1 }, children: label }),
4877
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
4402
4878
  Math.round(value),
4403
4879
  "/100"
4404
4880
  ] })
4405
4881
  ] });
4406
4882
  }
4407
4883
  function ScoreDonutLegend() {
4408
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
4409
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
4410
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
4411
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
4884
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
4885
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
4886
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
4887
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
4412
4888
  ] });
4413
4889
  }
4414
4890
  function LegendDot({ color, label }) {
4415
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
4416
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
4891
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
4892
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
4417
4893
  label
4418
4894
  ] });
4419
4895
  }
4420
4896
 
4421
4897
  // src/components/tabs/LinkingTab.tsx
4422
- var import_jsx_runtime12 = require("react/jsx-runtime");
4898
+ var import_jsx_runtime13 = require("react/jsx-runtime");
4899
+ function buildLiveUrl(publication, slug) {
4900
+ if (!slug) return null;
4901
+ const pub = (publication || "").trim().toLowerCase();
4902
+ if (!KNOWN_MJH_PUBLICATIONS.has(pub)) return null;
4903
+ const cleanSlug = slug.replace(/^\/+/, "").split("/").map(encodeURIComponent).join("/");
4904
+ return `https://www.${pub}.com/view/${cleanSlug}`;
4905
+ }
4906
+ function buildSanityUrl(baseUrl, id, type) {
4907
+ if (!baseUrl || !id) return null;
4908
+ const cleanId = id.replace(/^drafts\./, "");
4909
+ const base = baseUrl.replace(/\/+$/, "");
4910
+ const typePart = type ? `;type=${encodeURIComponent(type)}` : "";
4911
+ return `${base}/intent/edit/id=${encodeURIComponent(cleanId)}${typePart}/`;
4912
+ }
4913
+ function LinkChip({ href, label, color }) {
4914
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4915
+ "a",
4916
+ {
4917
+ href,
4918
+ target: "_blank",
4919
+ rel: "noopener noreferrer",
4920
+ style: {
4921
+ display: "inline-flex",
4922
+ alignItems: "center",
4923
+ gap: 4,
4924
+ padding: "3px 9px",
4925
+ borderRadius: 99,
4926
+ fontSize: 10.5,
4927
+ fontWeight: 700,
4928
+ color,
4929
+ background: "rgba(255,255,255,0.7)",
4930
+ border: `1px solid ${color}33`,
4931
+ textDecoration: "none",
4932
+ lineHeight: 1.2
4933
+ },
4934
+ children: [
4935
+ label,
4936
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
4937
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" }),
4938
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" })
4939
+ ] })
4940
+ ]
4941
+ }
4942
+ );
4943
+ }
4423
4944
  var cardStyle4 = {
4424
4945
  borderRadius: 14,
4425
4946
  background: "rgba(255,255,255,0.55)",
@@ -4429,7 +4950,7 @@ var cardStyle4 = {
4429
4950
  padding: "14px"
4430
4951
  };
4431
4952
  function AiPill2() {
4432
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4953
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4433
4954
  "span",
4434
4955
  {
4435
4956
  style: {
@@ -4453,10 +4974,10 @@ function SectionHeader3({
4453
4974
  ai,
4454
4975
  action
4455
4976
  }) {
4456
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
4457
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4458
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4459
- ai && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AiPill2, {}),
4977
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
4978
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
4979
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
4980
+ ai && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AiPill2, {}),
4460
4981
  action
4461
4982
  ] });
4462
4983
  }
@@ -4476,7 +4997,8 @@ function freshnessChip(label, score) {
4476
4997
  "very-old": { bg: "rgba(220,38,38,0.1)", color: "#dc2626", text: "Very old" }
4477
4998
  };
4478
4999
  const c = map[label];
4479
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
5000
+ if (!c) return null;
5001
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4480
5002
  "span",
4481
5003
  {
4482
5004
  style: {
@@ -4496,8 +5018,8 @@ function freshnessChip(label, score) {
4496
5018
  );
4497
5019
  }
4498
5020
  function RefreshIcon({ spinning }) {
4499
- if (spinning) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LoadingBars, { size: "xs", color: "#9ca3af" });
4500
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" }) });
5021
+ if (spinning) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LoadingBars, { size: "xs", color: "#9ca3af" });
5022
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" }) });
4501
5023
  }
4502
5024
  function LinkingTab({
4503
5025
  analysis,
@@ -4508,24 +5030,26 @@ function LinkingTab({
4508
5030
  onRefresh,
4509
5031
  text,
4510
5032
  documentId,
4511
- publication
5033
+ publication,
5034
+ sanityBaseUrl,
5035
+ documentType
4512
5036
  }) {
4513
5037
  if (!analysis) {
4514
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
4515
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Run keyword analysis first" }),
4516
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Internal link suggestions need keywords to start from" })
5038
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
5039
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
5040
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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." })
4517
5041
  ] });
4518
5042
  }
4519
5043
  const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
4520
5044
  const recommendedMin = Math.max(1, Math.round(wordCount2 / 1e3 * 2));
4521
5045
  const recommendedMax = Math.max(2, Math.round(wordCount2 / 1e3 * 5));
4522
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
4523
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
5046
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
5047
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4524
5048
  SectionHeader3,
4525
5049
  {
4526
5050
  label: "Suggested Links",
4527
5051
  iconColor: MJH_BLUE,
4528
- action: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
5052
+ action: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4529
5053
  "button",
4530
5054
  {
4531
5055
  onClick: onRefresh,
@@ -4540,20 +5064,20 @@ function LinkingTab({
4540
5064
  fontSize: 10
4541
5065
  },
4542
5066
  title: "Refresh",
4543
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RefreshIcon, { spinning: isLoading })
5067
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RefreshIcon, { spinning: isLoading })
4544
5068
  }
4545
5069
  )
4546
5070
  }
4547
5071
  ),
4548
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
5072
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
4549
5073
  "Other articles on this site that fit this topic.",
4550
- wordCount2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
5074
+ wordCount2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
4551
5075
  " ",
4552
5076
  "For a ",
4553
5077
  wordCount2.toLocaleString(),
4554
5078
  "-word article, aim for",
4555
5079
  " ",
4556
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("strong", { children: [
5080
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("strong", { children: [
4557
5081
  recommendedMin,
4558
5082
  "-",
4559
5083
  recommendedMax,
@@ -4562,20 +5086,28 @@ function LinkingTab({
4562
5086
  "."
4563
5087
  ] })
4564
5088
  ] }),
4565
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
5089
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
4566
5090
  "Each suggestion gets a 0-100% match score from three signals - ",
4567
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "topic match" }),
5091
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "topic match" }),
4568
5092
  ", ",
4569
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "freshness" }),
5093
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "freshness" }),
4570
5094
  ", and ",
4571
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "section fit" }),
5095
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "section fit" }),
4572
5096
  " (where in your article the link belongs). The percentage on each card is the weighted total:"
4573
5097
  ] }),
4574
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ScoreDonutLegend, {}) }),
4575
- isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5098
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ScoreDonutLegend, {}) }),
5099
+ isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4576
5100
  "div",
4577
5101
  {
5102
+ role: "button",
5103
+ tabIndex: 0,
4578
5104
  onClick: onRefresh,
5105
+ onKeyDown: (e) => {
5106
+ if (e.key === "Enter" || e.key === " ") {
5107
+ e.preventDefault();
5108
+ onRefresh();
5109
+ }
5110
+ },
4579
5111
  style: {
4580
5112
  display: "flex",
4581
5113
  alignItems: "center",
@@ -4589,16 +5121,16 @@ function LinkingTab({
4589
5121
  cursor: "pointer"
4590
5122
  },
4591
5123
  children: [
4592
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
4593
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
5124
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
5125
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
4594
5126
  ]
4595
5127
  }
4596
5128
  ),
4597
- isLoading && suggestions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
4598
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
4599
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
5129
+ isLoading && suggestions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5130
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
5131
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
4600
5132
  ] }),
4601
- !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5133
+ !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4602
5134
  "div",
4603
5135
  {
4604
5136
  style: {
@@ -4609,9 +5141,9 @@ function LinkingTab({
4609
5141
  textAlign: "center"
4610
5142
  },
4611
5143
  children: [
4612
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
4613
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
4614
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
5144
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
5145
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
5146
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4615
5147
  "button",
4616
5148
  {
4617
5149
  onClick: onRefresh,
@@ -4631,11 +5163,11 @@ function LinkingTab({
4631
5163
  ]
4632
5164
  }
4633
5165
  ),
4634
- !isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("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: [
4635
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No related articles found yet." }),
4636
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { color: "#4b5563" }, children: "Linking suggests published articles on closely related topics. As more related content is published, matches will appear here." })
5166
+ !isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("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: [
5167
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
5168
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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." })
4637
5169
  ] }),
4638
- suggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5170
+ suggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4639
5171
  "div",
4640
5172
  {
4641
5173
  style: {
@@ -4648,32 +5180,41 @@ function LinkingTab({
4648
5180
  alignItems: "flex-start"
4649
5181
  },
4650
5182
  children: [
4651
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
5183
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4652
5184
  ScoreDonut,
4653
5185
  {
4654
5186
  size: 64,
4655
- topic: s.topicScore,
4656
- freshness: s.freshnessScore,
4657
- sectionFit: s.sectionFitScore,
4658
- composite: s.compositeScore
5187
+ topic: Math.max(0, Math.min(100, s.topicScore)),
5188
+ freshness: Math.max(0, Math.min(100, s.freshnessScore)),
5189
+ sectionFit: Math.max(0, Math.min(100, s.sectionFitScore)),
5190
+ composite: Math.max(0, Math.min(100, s.compositeScore))
4659
5191
  }
4660
5192
  ),
4661
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
4662
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
5193
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
5194
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
4663
5195
  freshnessChip(s.freshnessLabel, s.freshnessScore),
4664
- s.publishedAt && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) })
5196
+ s.publishedAt && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) })
4665
5197
  ] }),
4666
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
4667
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
5198
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
5199
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
4668
5200
  "/",
4669
5201
  s.slug
4670
5202
  ] }),
4671
- s.relevanceReason && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
4672
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
5203
+ (() => {
5204
+ const liveUrl = buildLiveUrl(publication, s.slug);
5205
+ const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id);
5206
+ if (!liveUrl && !sanityUrl) return null;
5207
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
5208
+ sanityUrl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
5209
+ liveUrl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
5210
+ ] });
5211
+ })(),
5212
+ s.relevanceReason && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
5213
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
4673
5214
  " ",
4674
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
5215
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
4675
5216
  ] }),
4676
- s.anchorQuote && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5217
+ s.anchorQuote && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4677
5218
  "div",
4678
5219
  {
4679
5220
  style: {
@@ -4687,21 +5228,21 @@ function LinkingTab({
4687
5228
  lineHeight: 1.5
4688
5229
  },
4689
5230
  children: [
4690
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
5231
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
4691
5232
  "Where to link from - paragraph ",
4692
5233
  s.anchorParagraph
4693
5234
  ] }),
4694
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { fontStyle: "italic" }, children: [
5235
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontStyle: "italic" }, children: [
4695
5236
  '"',
4696
5237
  s.anchorQuote,
4697
5238
  '"'
4698
5239
  ] }),
4699
- s.anchorReason && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
5240
+ s.anchorReason && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
4700
5241
  ]
4701
5242
  }
4702
5243
  )
4703
5244
  ] }),
4704
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
5245
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4705
5246
  FeedbackButton,
4706
5247
  {
4707
5248
  suggestionType: "internal_link",
@@ -4719,14 +5260,7 @@ function LinkingTab({
4719
5260
 
4720
5261
  // src/components/tabs/MetaTab.tsx
4721
5262
  var import_react16 = require("react");
4722
- var import_jsx_runtime13 = require("react/jsx-runtime");
4723
- function containsKeywordTokens(haystack, needle) {
4724
- if (!needle) return true;
4725
- const tokens = needle.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
4726
- if (tokens.length === 0) return true;
4727
- const lower = haystack.toLowerCase();
4728
- return tokens.every((t) => lower.includes(t));
4729
- }
5263
+ var import_jsx_runtime14 = require("react/jsx-runtime");
4730
5264
  var cardStyle5 = {
4731
5265
  borderRadius: 14,
4732
5266
  background: "rgba(255,255,255,0.55)",
@@ -4742,7 +5276,7 @@ function StatusBadge({ status }) {
4742
5276
  error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
4743
5277
  };
4744
5278
  const c = map[status];
4745
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5279
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4746
5280
  "span",
4747
5281
  {
4748
5282
  style: {
@@ -4761,12 +5295,12 @@ function StatusBadge({ status }) {
4761
5295
  );
4762
5296
  }
4763
5297
  function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
4764
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { id: anchorId, style: cardStyle5, children: [
4765
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
4766
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
4767
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StatusBadge, { status })
5298
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { id: anchorId, style: cardStyle5, children: [
5299
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5300
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5301
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StatusBadge, { status })
4768
5302
  ] }),
4769
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5303
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4770
5304
  "div",
4771
5305
  {
4772
5306
  style: {
@@ -4779,7 +5313,7 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
4779
5313
  children: value
4780
5314
  }
4781
5315
  ),
4782
- recommendation && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5316
+ recommendation && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4783
5317
  "div",
4784
5318
  {
4785
5319
  style: {
@@ -4798,23 +5332,37 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
4798
5332
  footer
4799
5333
  ] });
4800
5334
  }
4801
- function metaDescriptionAudit(meta, primaryKeyword) {
5335
+ function keywordCoverageNote(haystack, primaryKeyword, secondaryKeyword) {
5336
+ const hasPrimary = primaryKeyword ? containsKeywordTokens(haystack, primaryKeyword) : true;
5337
+ const hasSecondary = secondaryKeyword ? containsKeywordTokens(haystack, secondaryKeyword) : true;
5338
+ if (primaryKeyword && !hasPrimary && secondaryKeyword && !hasSecondary) {
5339
+ return `Neither your primary keyword "${primaryKeyword}" nor your secondary keyword "${secondaryKeyword}" appears here.`;
5340
+ }
5341
+ if (primaryKeyword && !hasPrimary) {
5342
+ return `Your primary keyword "${primaryKeyword}" isn't included${secondaryKeyword ? ` (secondary keyword "${secondaryKeyword}" ${hasSecondary ? "is" : "isn't"}).` : "."}`;
5343
+ }
5344
+ if (secondaryKeyword && !hasSecondary) {
5345
+ return `Your secondary keyword "${secondaryKeyword}" isn't included${primaryKeyword && hasPrimary ? ` (primary keyword "${primaryKeyword}" is present)` : ""}. Work it in if it reads naturally.`;
5346
+ }
5347
+ return "";
5348
+ }
5349
+ function metaDescriptionAudit(meta, primaryKeyword, secondaryKeyword) {
4802
5350
  if (!meta) {
4803
5351
  return {
4804
5352
  label: "Meta Description",
4805
5353
  value: "Missing",
4806
5354
  status: "error",
4807
- recommendation: "Add a 120-160 character meta description that includes your primary keyword."
5355
+ recommendation: `Add a 120-160 character meta description that includes your primary keyword${secondaryKeyword ? " (and your secondary keyword if it fits)" : ""}.`
4808
5356
  };
4809
5357
  }
4810
5358
  const len = meta.length;
4811
- const lacksKeyword = primaryKeyword && !containsKeywordTokens(meta, primaryKeyword);
5359
+ const kwNote = keywordCoverageNote(meta, primaryKeyword, secondaryKeyword);
4812
5360
  if (len < 120) {
4813
5361
  return {
4814
5362
  label: "Meta Description",
4815
5363
  value: `${meta} (${len} chars)`,
4816
5364
  status: "warning",
4817
- recommendation: `Too short - aim for 120-160 characters.${lacksKeyword ? ` Also missing primary keyword "${primaryKeyword}".` : ""}`
5365
+ recommendation: `A little short - aim for 120-160 characters.${kwNote ? ` ${kwNote}` : ""}`
4818
5366
  };
4819
5367
  }
4820
5368
  if (len > 160) {
@@ -4822,15 +5370,15 @@ function metaDescriptionAudit(meta, primaryKeyword) {
4822
5370
  label: "Meta Description",
4823
5371
  value: `${meta} (${len} chars)`,
4824
5372
  status: "warning",
4825
- recommendation: `Too long - Google may truncate beyond 160 characters.${lacksKeyword ? ` Also missing primary keyword "${primaryKeyword}".` : ""}`
5373
+ recommendation: `Over 160 characters - Google may shorten it in search, so trim it a little.${kwNote ? ` ${kwNote}` : ""}`
4826
5374
  };
4827
5375
  }
4828
- if (lacksKeyword) {
5376
+ if (kwNote) {
4829
5377
  return {
4830
5378
  label: "Meta Description",
4831
5379
  value: `${meta} (${len} chars)`,
4832
5380
  status: "warning",
4833
- recommendation: `Length is good but primary keyword "${primaryKeyword}" is not included.`
5381
+ recommendation: `Length is good. ${kwNote}`
4834
5382
  };
4835
5383
  }
4836
5384
  return {
@@ -4878,88 +5426,6 @@ function titleAudit(title, primaryKeyword) {
4878
5426
  }
4879
5427
  return { label: "Title Tag", value: `${title} (${len} chars)`, status: "good" };
4880
5428
  }
4881
- function urlAudit(slug, primaryKeyword) {
4882
- if (!slug) {
4883
- return { label: "URL Slug", value: "Missing", status: "error", recommendation: "Add a clean, hyphenated URL slug containing the primary keyword. Aim for 3-5 words." };
4884
- }
4885
- const issues = [];
4886
- if (slug.length > 60) issues.push("longer than 60 characters - aim for 3-5 words");
4887
- if (/[A-Z]/.test(slug)) issues.push("contains uppercase letters");
4888
- if (/_/.test(slug)) issues.push("uses underscores instead of hyphens");
4889
- if (/[^a-zA-Z0-9-/]/.test(slug.replace(/^\//, ""))) issues.push("contains special characters");
4890
- if (primaryKeyword && !containsKeywordTokens(slug.replace(/-/g, " "), primaryKeyword)) {
4891
- issues.push(`missing primary keyword "${primaryKeyword}"`);
4892
- }
4893
- if (issues.length === 0) {
4894
- return { label: "URL Slug", value: `/${slug}`, status: "good" };
4895
- }
4896
- return {
4897
- label: "URL Slug",
4898
- value: `/${slug}`,
4899
- status: "warning",
4900
- recommendation: `Issues: ${issues.join(", ")}.`
4901
- };
4902
- }
4903
- function SlugRedirectNotice() {
4904
- const [expanded, setExpanded] = (0, import_react16.useState)(false);
4905
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4906
- "div",
4907
- {
4908
- style: {
4909
- marginTop: 10,
4910
- paddingTop: 10,
4911
- borderTop: "1px solid rgba(0,0,0,0.07)"
4912
- },
4913
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4914
- "div",
4915
- {
4916
- style: {
4917
- padding: "8px 10px",
4918
- background: "rgba(245,158,11,0.08)",
4919
- borderLeft: "2px solid #f59e0b",
4920
- borderRadius: 6
4921
- },
4922
- children: [
4923
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
4924
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" }) }),
4925
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
4926
- ] }),
4927
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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." }),
4928
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4929
- "button",
4930
- {
4931
- onClick: () => setExpanded((v) => !v),
4932
- style: {
4933
- display: "flex",
4934
- alignItems: "center",
4935
- gap: 3,
4936
- marginTop: 6,
4937
- padding: 0,
4938
- background: "none",
4939
- border: "none",
4940
- cursor: "pointer",
4941
- fontSize: 10.5,
4942
- fontWeight: 700,
4943
- color: "#b45309",
4944
- fontFamily: "inherit"
4945
- },
4946
- children: [
4947
- expanded ? "Show less" : "Learn more",
4948
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" }) })
4949
- ]
4950
- }
4951
- ),
4952
- expanded && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
4953
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
4954
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
4955
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: "Set this up using vanity redirects in Sanity." })
4956
- ] })
4957
- ]
4958
- }
4959
- )
4960
- }
4961
- );
4962
- }
4963
5429
  function daysSince(iso) {
4964
5430
  if (!iso) return null;
4965
5431
  const t = new Date(iso).getTime();
@@ -4972,14 +5438,13 @@ function formatDateShort(iso) {
4972
5438
  if (isNaN(d.getTime())) return "";
4973
5439
  return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
4974
5440
  }
4975
- function MetaTab({ documentFields, primaryKeyword, isLoading }) {
5441
+ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }) {
4976
5442
  const audits = (0, import_react16.useMemo)(() => {
4977
5443
  const list = [];
4978
5444
  list.push(titleAudit(documentFields?.title, primaryKeyword));
4979
- list.push(metaDescriptionAudit(documentFields?.metaDescription, primaryKeyword));
4980
- list.push(urlAudit(documentFields?.slug, primaryKeyword));
5445
+ list.push(metaDescriptionAudit(documentFields?.metaDescription, primaryKeyword, secondaryKeyword));
4981
5446
  return list;
4982
- }, [documentFields, primaryKeyword]);
5447
+ }, [documentFields, primaryKeyword, secondaryKeyword]);
4983
5448
  const eeatItems = (0, import_react16.useMemo)(() => {
4984
5449
  const items = [];
4985
5450
  const author = documentFields?.authorName;
@@ -5024,33 +5489,32 @@ function MetaTab({ documentFields, primaryKeyword, isLoading }) {
5024
5489
  }, [documentFields]);
5025
5490
  const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.metaDescription !== void 0 || documentFields.slug !== void 0);
5026
5491
  if (isLoading && !hasAnyField) {
5027
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
5028
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
5029
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
5492
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
5493
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
5494
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
5030
5495
  ] });
5031
5496
  }
5032
- const auditAnchors = ["anchor-meta-title", "anchor-meta-description", "anchor-url-slug"];
5033
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
5034
- audits.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5497
+ const auditAnchors = ["anchor-meta-title", "anchor-meta-description"];
5498
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
5499
+ audits.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5035
5500
  AuditCard,
5036
5501
  {
5037
5502
  anchorId: auditAnchors[i],
5038
5503
  label: a.label,
5039
5504
  value: a.value,
5040
5505
  status: a.status,
5041
- recommendation: a.recommendation,
5042
- footer: a.label === "URL Slug" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SlugRedirectNotice, {}) : void 0
5506
+ recommendation: a.recommendation
5043
5507
  },
5044
5508
  i
5045
5509
  )),
5046
- eeatItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
5047
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
5048
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
5049
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
5050
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
5510
+ eeatItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
5511
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
5512
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
5513
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
5514
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
5051
5515
  ] }),
5052
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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." }),
5053
- eeatItems.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5516
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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." }),
5517
+ eeatItems.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5054
5518
  AuditCard,
5055
5519
  {
5056
5520
  label: item.label,
@@ -5066,7 +5530,66 @@ function MetaTab({ documentFields, primaryKeyword, isLoading }) {
5066
5530
 
5067
5531
  // src/components/tabs/TechnicalTab.tsx
5068
5532
  var import_react17 = require("react");
5069
- var import_jsx_runtime14 = require("react/jsx-runtime");
5533
+ var import_jsx_runtime15 = require("react/jsx-runtime");
5534
+ function urlAudit(slug, primaryKeyword, secondaryKeyword) {
5535
+ const SHORT_DESC = "Keep the URL short and descriptive - concise URLs are easier to read - and avoid trailing, duplicate, or excessive spaces.";
5536
+ if (!slug) {
5537
+ return {
5538
+ label: "URL Slug",
5539
+ value: "Missing",
5540
+ status: "warning",
5541
+ recommendation: `Add a URL slug that leads with your primary keyword. ${SHORT_DESC}`
5542
+ };
5543
+ }
5544
+ const slugAsWords = slug.replace(/-/g, " ");
5545
+ const hasPrimary = primaryKeyword ? containsKeywordTokens(slugAsWords, primaryKeyword) : true;
5546
+ const leads = primaryKeyword ? keywordLeadsSlug(slug, primaryKeyword) : true;
5547
+ const hasSecondary = secondaryKeyword ? containsKeywordTokens(slugAsWords, secondaryKeyword) : true;
5548
+ if (primaryKeyword && !hasPrimary) {
5549
+ const secNote = secondaryKeyword && !hasSecondary ? ` Your secondary keyword "${secondaryKeyword}" could follow it.` : "";
5550
+ return {
5551
+ label: "URL Slug",
5552
+ value: `/${slug}`,
5553
+ status: "warning",
5554
+ recommendation: `Work your primary keyword "${primaryKeyword}" into the URL, ideally at the start - if the address gets shortened, a leading keyword still shows.${secNote} ${SHORT_DESC}`
5555
+ };
5556
+ }
5557
+ if (primaryKeyword && hasPrimary && !leads) {
5558
+ return {
5559
+ label: "URL Slug",
5560
+ value: `/${slug}`,
5561
+ status: "warning",
5562
+ recommendation: `Your primary keyword is in the URL but not at the start. Leading with it reads better and holds up if the address gets shortened. ${SHORT_DESC}`
5563
+ };
5564
+ }
5565
+ return { label: "URL Slug", value: `/${slug}`, status: "good" };
5566
+ }
5567
+ function SlugRedirectNotice() {
5568
+ const [expanded, setExpanded] = (0, import_react17.useState)(false);
5569
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
5570
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
5571
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }) }),
5572
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
5573
+ ] }),
5574
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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." }),
5575
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5576
+ "button",
5577
+ {
5578
+ onClick: () => setExpanded((v) => !v),
5579
+ 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" },
5580
+ children: [
5581
+ expanded ? "Show less" : "Learn more",
5582
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }) })
5583
+ ]
5584
+ }
5585
+ ),
5586
+ expanded && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
5587
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
5588
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
5589
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: "Set this up using vanity redirects in Sanity." })
5590
+ ] })
5591
+ ] }) });
5592
+ }
5070
5593
  var cardStyle6 = {
5071
5594
  borderRadius: 14,
5072
5595
  background: "rgba(255,255,255,0.55)",
@@ -5082,7 +5605,7 @@ function StatusBadge2({ status }) {
5082
5605
  error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
5083
5606
  };
5084
5607
  const c = map[status];
5085
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5608
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5086
5609
  "span",
5087
5610
  {
5088
5611
  style: {
@@ -5105,14 +5628,15 @@ function AuditCard2({
5105
5628
  value,
5106
5629
  status,
5107
5630
  recommendation,
5108
- anchorId
5631
+ anchorId,
5632
+ footer
5109
5633
  }) {
5110
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { id: anchorId, style: cardStyle6, children: [
5111
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5112
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5113
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StatusBadge2, { status })
5634
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { id: anchorId, style: cardStyle6, children: [
5635
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5636
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
5637
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatusBadge2, { status })
5114
5638
  ] }),
5115
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5639
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5116
5640
  "div",
5117
5641
  {
5118
5642
  style: {
@@ -5125,7 +5649,7 @@ function AuditCard2({
5125
5649
  children: value
5126
5650
  }
5127
5651
  ),
5128
- recommendation && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5652
+ recommendation && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5129
5653
  "div",
5130
5654
  {
5131
5655
  style: {
@@ -5140,7 +5664,8 @@ function AuditCard2({
5140
5664
  },
5141
5665
  children: recommendation
5142
5666
  }
5143
- )
5667
+ ),
5668
+ footer
5144
5669
  ] });
5145
5670
  }
5146
5671
  var IMAGE_EXT_RE = /\.(jpe?g|png|gif|webp|svg|tiff?|bmp)$/i;
@@ -5174,7 +5699,7 @@ function imageFilenameAudit(filenames) {
5174
5699
  const words = base.split("-").filter(Boolean);
5175
5700
  if (words.length < 2) {
5176
5701
  issues.push({ filename: f, reason: "single word - use 2-3 descriptive hyphenated words" });
5177
- } else if (words.length > 7) {
5702
+ } else if (words.length > 5) {
5178
5703
  issues.push({ filename: f, reason: "too many words - keep to 3-5" });
5179
5704
  }
5180
5705
  }
@@ -5203,7 +5728,7 @@ function imageAltTextAudit(altTexts) {
5203
5728
  audited++;
5204
5729
  const len = trimmed.length;
5205
5730
  const wc = trimmed.split(/\s+/).filter(Boolean).length;
5206
- if (len > 125) {
5731
+ if (len >= 125) {
5207
5732
  issues.push({ alt: trimmed, reason: `${len} chars - shorten to under 125` });
5208
5733
  } else if (wc < 2) {
5209
5734
  issues.push({ alt: trimmed, reason: "just one word - use 2-5 descriptive keywords" });
@@ -5358,10 +5883,10 @@ function LinkCheckCard({
5358
5883
  const issues = results.filter((r) => r.category !== "ok");
5359
5884
  return { total, valid, redirects, broken, errored, unverified, issues };
5360
5885
  }, [results]);
5361
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { id: "anchor-link-check", style: cardStyle6, children: [
5362
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5363
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
5364
- hasRun && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5886
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { id: "anchor-link-check", style: cardStyle6, children: [
5887
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
5888
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
5889
+ hasRun && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5365
5890
  "button",
5366
5891
  {
5367
5892
  onClick: onCheck,
@@ -5379,8 +5904,8 @@ function LinkCheckCard({
5379
5904
  }
5380
5905
  )
5381
5906
  ] }),
5382
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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.` }),
5383
- urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5907
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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.` }),
5908
+ urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5384
5909
  "button",
5385
5910
  {
5386
5911
  onClick: onCheck,
@@ -5405,9 +5930,9 @@ function LinkCheckCard({
5405
5930
  ]
5406
5931
  }
5407
5932
  ),
5408
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5409
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
5410
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
5933
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
5934
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
5935
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
5411
5936
  "Checking ",
5412
5937
  urls.length,
5413
5938
  " link",
@@ -5415,7 +5940,7 @@ function LinkCheckCard({
5415
5940
  "..."
5416
5941
  ] })
5417
5942
  ] }),
5418
- error && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5943
+ error && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5419
5944
  "div",
5420
5945
  {
5421
5946
  style: {
@@ -5429,7 +5954,7 @@ function LinkCheckCard({
5429
5954
  },
5430
5955
  children: [
5431
5956
  error,
5432
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5957
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5433
5958
  "button",
5434
5959
  {
5435
5960
  onClick: onCheck,
@@ -5451,15 +5976,15 @@ function LinkCheckCard({
5451
5976
  ]
5452
5977
  }
5453
5978
  ),
5454
- hasRun && !isLoading && !error && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
5455
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "grid", gridTemplateColumns: counts.unverified > 0 ? "repeat(5, 1fr)" : "repeat(4, 1fr)", gap: 6 }, children: [
5456
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StatTile, { label: "Checked", value: counts.total, color: "#475569" }),
5457
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StatTile, { label: "Valid", value: counts.valid, color: "#16a34a" }),
5458
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StatTile, { label: "Redirects", value: counts.redirects, color: "#8B7310" }),
5459
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StatTile, { label: "Broken", value: counts.broken + counts.errored, color: "#dc2626" }),
5460
- counts.unverified > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StatTile, { label: "Blocked", value: counts.unverified, color: "#b45309" })
5979
+ hasRun && !isLoading && !error && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5980
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "grid", gridTemplateColumns: counts.unverified > 0 ? "repeat(5, 1fr)" : "repeat(4, 1fr)", gap: 6 }, children: [
5981
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Checked", value: counts.total, color: "#475569" }),
5982
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Valid", value: counts.valid, color: "#16a34a" }),
5983
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Redirects", value: counts.redirects, color: "#8B7310" }),
5984
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Broken", value: counts.broken + counts.errored, color: "#dc2626" }),
5985
+ counts.unverified > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Blocked", value: counts.unverified, color: "#b45309" })
5461
5986
  ] }),
5462
- counts.unverified > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5987
+ counts.unverified > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5463
5988
  "div",
5464
5989
  {
5465
5990
  style: {
@@ -5480,8 +6005,8 @@ function LinkCheckCard({
5480
6005
  ]
5481
6006
  }
5482
6007
  ),
5483
- counts.issues.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 6 }, children: [
5484
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em" }, children: [
6008
+ counts.issues.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 6 }, children: [
6009
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em" }, children: [
5485
6010
  counts.issues.length,
5486
6011
  " link",
5487
6012
  counts.issues.length === 1 ? "" : "s",
@@ -5489,8 +6014,8 @@ function LinkCheckCard({
5489
6014
  counts.issues.length === 1 ? "s" : "",
5490
6015
  " attention"
5491
6016
  ] }),
5492
- counts.issues.map((r) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LinkIssueRow, { result: r }, r.url))
5493
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
6017
+ counts.issues.map((r) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LinkIssueRow, { result: r }, r.url))
6018
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5494
6019
  "div",
5495
6020
  {
5496
6021
  style: {
@@ -5517,7 +6042,7 @@ function LinkCheckCard({
5517
6042
  ] });
5518
6043
  }
5519
6044
  function StatTile({ label, value, color }) {
5520
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
6045
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5521
6046
  "div",
5522
6047
  {
5523
6048
  style: {
@@ -5527,8 +6052,8 @@ function StatTile({ label, value, color }) {
5527
6052
  textAlign: "center"
5528
6053
  },
5529
6054
  children: [
5530
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 18, fontWeight: 700, color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: value }),
5531
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", marginTop: 4 }, children: label })
6055
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 18, fontWeight: 700, color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: value }),
6056
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", marginTop: 4 }, children: label })
5532
6057
  ]
5533
6058
  }
5534
6059
  );
@@ -5544,7 +6069,7 @@ function LinkIssueRow({ result }) {
5544
6069
  };
5545
6070
  const c = map[result.category];
5546
6071
  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;
5547
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
6072
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5548
6073
  "a",
5549
6074
  {
5550
6075
  href: result.url,
@@ -5560,7 +6085,7 @@ function LinkIssueRow({ result }) {
5560
6085
  textDecoration: "none"
5561
6086
  },
5562
6087
  children: [
5563
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6088
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5564
6089
  "span",
5565
6090
  {
5566
6091
  style: {
@@ -5577,7 +6102,7 @@ function LinkIssueRow({ result }) {
5577
6102
  children: c.label
5578
6103
  }
5579
6104
  ),
5580
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6105
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5581
6106
  "span",
5582
6107
  {
5583
6108
  style: {
@@ -5601,6 +6126,8 @@ function LinkIssueRow({ result }) {
5601
6126
  function TechnicalTab({
5602
6127
  text,
5603
6128
  documentFields,
6129
+ primaryKeyword,
6130
+ secondaryKeyword,
5604
6131
  isLoading,
5605
6132
  linkCheckResults,
5606
6133
  isLinkCheckLoading,
@@ -5608,9 +6135,16 @@ function TechnicalTab({
5608
6135
  hasRunLinkCheck,
5609
6136
  onCheckLinks
5610
6137
  }) {
6138
+ const urlSlugAudit = (0, import_react17.useMemo)(
6139
+ () => urlAudit(documentFields?.slug, primaryKeyword, secondaryKeyword),
6140
+ [documentFields?.slug, primaryKeyword, secondaryKeyword]
6141
+ );
5611
6142
  const headings = documentFields?.headings || [];
5612
6143
  const headingsDetailed = documentFields?.headingsDetailed;
5613
- const headingsForStructure = headingsDetailed ? headingsDetailed : headings.map((text2) => ({ text: text2, level: 2 }));
6144
+ const headingsForStructure = (0, import_react17.useMemo)(
6145
+ () => headingsDetailed ? headingsDetailed : headings.map((text2) => ({ text: text2, level: 2 })),
6146
+ [headingsDetailed, headings]
6147
+ );
5614
6148
  const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
5615
6149
  const structureAudits = (0, import_react17.useMemo)(
5616
6150
  () => computeHeadingStructureAudits(headingsForStructure, wordCount2),
@@ -5642,7 +6176,8 @@ function TechnicalTab({
5642
6176
  status: "warning",
5643
6177
  recommendation: "Add at least one hero image with descriptive alt text. Articles with images perform better on both reader engagement and search."
5644
6178
  } : null;
5645
- const wordAudit = wordCount2 === 0 ? null : wordCount2 < 450 ? {
6179
+ const isShortForm = isShortFormContent(documentFields, documentFields?.title);
6180
+ const wordAudit = wordCount2 === 0 ? null : isShortForm ? { label: "Word Count", value: `${wordCount2} words`, status: "good" } : wordCount2 < 450 ? {
5646
6181
  label: "Word Count",
5647
6182
  value: `${wordCount2} words`,
5648
6183
  status: "error",
@@ -5656,13 +6191,24 @@ function TechnicalTab({
5656
6191
  const bodyLinks = documentFields?.bodyLinks || [];
5657
6192
  const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.headings && documentFields.headings.length > 0 || documentFields.imageNames && documentFields.imageNames.length > 0 || wordCount2 > 0);
5658
6193
  if (isLoading && !hasAnyField) {
5659
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
5660
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
5661
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
6194
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
6195
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
6196
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
5662
6197
  ] });
5663
6198
  }
5664
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
5665
- wordAudit && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6199
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
6200
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6201
+ AuditCard2,
6202
+ {
6203
+ anchorId: "anchor-url-slug",
6204
+ label: urlSlugAudit.label,
6205
+ value: urlSlugAudit.value,
6206
+ status: urlSlugAudit.status,
6207
+ recommendation: urlSlugAudit.recommendation,
6208
+ footer: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlugRedirectNotice, {})
6209
+ }
6210
+ ),
6211
+ wordAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5666
6212
  AuditCard2,
5667
6213
  {
5668
6214
  anchorId: "anchor-word-count",
@@ -5672,7 +6218,7 @@ function TechnicalTab({
5672
6218
  recommendation: wordAudit.recommendation
5673
6219
  }
5674
6220
  ),
5675
- structureAudits.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6221
+ structureAudits.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5676
6222
  AuditCard2,
5677
6223
  {
5678
6224
  anchorId: i === 0 ? "anchor-headings-structure" : void 0,
@@ -5683,10 +6229,10 @@ function TechnicalTab({
5683
6229
  },
5684
6230
  `structure-${i}`
5685
6231
  )),
5686
- headings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
5687
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
5688
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
5689
- (headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
6232
+ headings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
6233
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
6234
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
6235
+ (headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5690
6236
  "div",
5691
6237
  {
5692
6238
  style: {
@@ -5697,7 +6243,7 @@ function TechnicalTab({
5697
6243
  paddingLeft: Math.max(0, (h.level - 2) * 12)
5698
6244
  },
5699
6245
  children: [
5700
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", marginRight: 6 }, children: [
6246
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", marginRight: 6 }, children: [
5701
6247
  "H",
5702
6248
  h.level
5703
6249
  ] }),
@@ -5706,14 +6252,14 @@ function TechnicalTab({
5706
6252
  },
5707
6253
  i
5708
6254
  )),
5709
- headings.length > 12 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
6255
+ (headingsDetailed ?? headings).length > 12 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
5710
6256
  "+ ",
5711
- headings.length - 12,
6257
+ (headingsDetailed ?? headings).length - 12,
5712
6258
  " more"
5713
6259
  ] })
5714
6260
  ] })
5715
6261
  ] }),
5716
- imagesAudit && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6262
+ imagesAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5717
6263
  AuditCard2,
5718
6264
  {
5719
6265
  anchorId: "anchor-images",
@@ -5723,7 +6269,7 @@ function TechnicalTab({
5723
6269
  recommendation: imagesAudit.recommendation
5724
6270
  }
5725
6271
  ),
5726
- filenameAudit && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6272
+ filenameAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5727
6273
  AuditCard2,
5728
6274
  {
5729
6275
  anchorId: "anchor-image-filenames",
@@ -5733,7 +6279,7 @@ function TechnicalTab({
5733
6279
  recommendation: filenameAudit.recommendation
5734
6280
  }
5735
6281
  ),
5736
- altTextAudit && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6282
+ altTextAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5737
6283
  AuditCard2,
5738
6284
  {
5739
6285
  anchorId: "anchor-image-alt",
@@ -5743,7 +6289,7 @@ function TechnicalTab({
5743
6289
  recommendation: altTextAudit.recommendation
5744
6290
  }
5745
6291
  ),
5746
- imgTitleAudit && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6292
+ imgTitleAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5747
6293
  AuditCard2,
5748
6294
  {
5749
6295
  anchorId: "anchor-image-titles",
@@ -5753,7 +6299,7 @@ function TechnicalTab({
5753
6299
  recommendation: imgTitleAudit.recommendation
5754
6300
  }
5755
6301
  ),
5756
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6302
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5757
6303
  LinkCheckCard,
5758
6304
  {
5759
6305
  urls: bodyLinks,
@@ -5768,12 +6314,12 @@ function TechnicalTab({
5768
6314
  }
5769
6315
 
5770
6316
  // src/components/SEOCopilotPanel.tsx
5771
- var import_jsx_runtime15 = require("react/jsx-runtime");
6317
+ var import_jsx_runtime16 = require("react/jsx-runtime");
5772
6318
  function LogoIcon2() {
5773
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
5774
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
5775
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
5776
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
6319
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
6320
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
6321
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
6322
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
5777
6323
  ] });
5778
6324
  }
5779
6325
  function PanelContent({
@@ -5791,8 +6337,12 @@ function PanelContent({
5791
6337
  docLoading,
5792
6338
  documentFields,
5793
6339
  documentId,
6340
+ documentType,
6341
+ sanityBaseUrl,
5794
6342
  selectedPrimary,
5795
6343
  onSelectPrimary,
6344
+ selectedSecondary,
6345
+ onSelectSecondary,
5796
6346
  activeTab,
5797
6347
  onActiveTabChange,
5798
6348
  chatOpen,
@@ -5810,6 +6360,7 @@ function PanelContent({
5810
6360
  const isLoading = externalAnalysis.isLoading;
5811
6361
  const keywordAnalysisState = externalAnalysis;
5812
6362
  const effectivePrimary = selectedPrimary || externalAnalysis.analysis?.primaryKeyword?.term || "";
6363
+ const effectiveSecondary = selectedSecondary || "";
5813
6364
  const containerRef = (0, import_react18.useRef)(null);
5814
6365
  const dragging = (0, import_react18.useRef)(false);
5815
6366
  const onMouseDown = (0, import_react18.useCallback)(() => {
@@ -5837,6 +6388,77 @@ function PanelContent({
5837
6388
  };
5838
6389
  }, [onSplitPercentChange]);
5839
6390
  const headerCursor = isFloating ? "grab" : "default";
6391
+ const onboardSite = publication || "default";
6392
+ const onboardKey = `seo-copilot-onboarded-${onboardSite}`;
6393
+ const onboardSessionKey = `seo-copilot-onboard-shown-${onboardSite}`;
6394
+ const [popupMode, setPopupMode] = (0, import_react18.useState)("hidden");
6395
+ const [popupClosing, setPopupClosing] = (0, import_react18.useState)(false);
6396
+ const onboardTimerRef = (0, import_react18.useRef)(null);
6397
+ const onboardFadeRef = (0, import_react18.useRef)(null);
6398
+ (0, import_react18.useEffect)(() => {
6399
+ let onboarded = false;
6400
+ let shownThisSession = false;
6401
+ try {
6402
+ onboarded = localStorage.getItem(onboardKey) === "1";
6403
+ } catch {
6404
+ }
6405
+ try {
6406
+ shownThisSession = sessionStorage.getItem(onboardSessionKey) === "1";
6407
+ } catch {
6408
+ }
6409
+ if (!onboarded && !shownThisSession) {
6410
+ setPopupMode("auto");
6411
+ try {
6412
+ sessionStorage.setItem(onboardSessionKey, "1");
6413
+ } catch {
6414
+ }
6415
+ onboardTimerRef.current = setTimeout(() => {
6416
+ setPopupClosing(true);
6417
+ onboardFadeRef.current = setTimeout(() => {
6418
+ setPopupMode("hidden");
6419
+ setPopupClosing(false);
6420
+ }, 180);
6421
+ }, 8e3);
6422
+ }
6423
+ return () => {
6424
+ if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
6425
+ if (onboardFadeRef.current) clearTimeout(onboardFadeRef.current);
6426
+ };
6427
+ }, [onboardKey, onboardSessionKey]);
6428
+ const markOnboarded = (0, import_react18.useCallback)(() => {
6429
+ try {
6430
+ localStorage.setItem(onboardKey, "1");
6431
+ } catch {
6432
+ }
6433
+ }, [onboardKey]);
6434
+ const dismissPopup = (0, import_react18.useCallback)(() => {
6435
+ if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
6436
+ if (onboardFadeRef.current) clearTimeout(onboardFadeRef.current);
6437
+ markOnboarded();
6438
+ setPopupClosing(true);
6439
+ onboardFadeRef.current = setTimeout(() => {
6440
+ setPopupMode("hidden");
6441
+ setPopupClosing(false);
6442
+ }, 180);
6443
+ }, [markOnboarded]);
6444
+ const openPopupPersistent = (0, import_react18.useCallback)(() => {
6445
+ if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
6446
+ if (onboardFadeRef.current) clearTimeout(onboardFadeRef.current);
6447
+ markOnboarded();
6448
+ setPopupClosing(false);
6449
+ setPopupMode("persistent");
6450
+ }, [markOnboarded]);
6451
+ const handleTabChange = (0, import_react18.useCallback)((id) => {
6452
+ markOnboarded();
6453
+ if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
6454
+ if (onboardFadeRef.current) clearTimeout(onboardFadeRef.current);
6455
+ setPopupClosing(true);
6456
+ onboardFadeRef.current = setTimeout(() => {
6457
+ setPopupMode("hidden");
6458
+ setPopupClosing(false);
6459
+ }, 120);
6460
+ onActiveTabChange(id);
6461
+ }, [markOnboarded, onActiveTabChange]);
5840
6462
  const tabDefs = [
5841
6463
  { id: "summary", label: "Summary", isHub: true, loading: summaryOps.isAnyLoading },
5842
6464
  { id: "keywords", label: "Keywords", loading: keywordAnalysisState.isLoading || keywordAnalysisState.isVolumesLoading },
@@ -5845,7 +6467,7 @@ function PanelContent({
5845
6467
  { id: "meta", label: "Meta", beta: true },
5846
6468
  { id: "technical", label: "Other Recs", beta: true, loading: technicalOps.isLinkCheckLoading }
5847
6469
  ];
5848
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6470
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
5849
6471
  "div",
5850
6472
  {
5851
6473
  className: "seo-copilot-panel",
@@ -5856,11 +6478,13 @@ function PanelContent({
5856
6478
  // backgroundColor (longhand) so the sheen background-image in INJECTED_CSS isn't reset
5857
6479
  backgroundColor: PANEL_BG,
5858
6480
  fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
5859
- opacity: 1
6481
+ opacity: 1,
6482
+ position: "relative"
5860
6483
  },
5861
6484
  children: [
5862
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
5863
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6485
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
6486
+ popupMode !== "hidden" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
6487
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
5864
6488
  "div",
5865
6489
  {
5866
6490
  onMouseDown: isFloating ? onDragStart : void 0,
@@ -5878,15 +6502,16 @@ function PanelContent({
5878
6502
  flexShrink: 0
5879
6503
  },
5880
6504
  children: [
5881
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
5882
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LogoIcon2, {}),
5883
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
5884
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { color: MJH_GOLD }, children: "SEO" }),
5885
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { color: MJH_SLATE }, children: " copilot" })
6505
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
6506
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LogoIcon2, {}),
6507
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
6508
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { color: MJH_GOLD }, children: "SEO" }),
6509
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { color: MJH_SLATE }, children: " copilot" })
5886
6510
  ] })
5887
6511
  ] }),
5888
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
5889
- isFloating && onToggleFullscreen && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6512
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
6513
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(OnboardingInfoButton, { onClick: openPopupPersistent }),
6514
+ isFloating && onToggleFullscreen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5890
6515
  "button",
5891
6516
  {
5892
6517
  onClick: (e) => {
@@ -5908,16 +6533,16 @@ function PanelContent({
5908
6533
  fontWeight: 600,
5909
6534
  transition: "all 150ms"
5910
6535
  },
5911
- children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5912
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }) }),
6536
+ children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
6537
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) }),
5913
6538
  "Exit fullscreen"
5914
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5915
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }) }),
6539
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
6540
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) }),
5916
6541
  "Fullscreen"
5917
6542
  ] })
5918
6543
  }
5919
6544
  ),
5920
- isFloating && onToggleFloat && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6545
+ isFloating && onToggleFloat && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
5921
6546
  "button",
5922
6547
  {
5923
6548
  onClick: (e) => {
@@ -5940,7 +6565,7 @@ function PanelContent({
5940
6565
  transition: "all 150ms"
5941
6566
  },
5942
6567
  children: [
5943
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6568
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5944
6569
  "path",
5945
6570
  {
5946
6571
  fillRule: "evenodd",
@@ -5952,7 +6577,7 @@ function PanelContent({
5952
6577
  ]
5953
6578
  }
5954
6579
  ),
5955
- !isFloating && onToggleFloat && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6580
+ !isFloating && onToggleFloat && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5956
6581
  "button",
5957
6582
  {
5958
6583
  onClick: (e) => {
@@ -5971,13 +6596,13 @@ function PanelContent({
5971
6596
  transition: "color 150ms"
5972
6597
  },
5973
6598
  title: "Pop out",
5974
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
5975
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }),
5976
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" })
6599
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
6600
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }),
6601
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" })
5977
6602
  ] })
5978
6603
  }
5979
6604
  ),
5980
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6605
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5981
6606
  "div",
5982
6607
  {
5983
6608
  style: {
@@ -5989,7 +6614,7 @@ function PanelContent({
5989
6614
  }
5990
6615
  }
5991
6616
  ),
5992
- onClose && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6617
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5993
6618
  "button",
5994
6619
  {
5995
6620
  onClick: (e) => {
@@ -6008,11 +6633,11 @@ function PanelContent({
6008
6633
  transition: "color 150ms"
6009
6634
  },
6010
6635
  title: "Close",
6011
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }) })
6636
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) })
6012
6637
  }
6013
6638
  )
6014
6639
  ] }),
6015
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6640
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6016
6641
  "div",
6017
6642
  {
6018
6643
  style: {
@@ -6031,8 +6656,8 @@ function PanelContent({
6031
6656
  ]
6032
6657
  }
6033
6658
  ),
6034
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TabBar, { tabs: tabDefs, activeTab, onTabChange: onActiveTabChange }),
6035
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6659
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
6660
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6036
6661
  "div",
6037
6662
  {
6038
6663
  style: {
@@ -6048,8 +6673,8 @@ function PanelContent({
6048
6673
  children: "Recommendations are generated by AI. Verify details before publishing."
6049
6674
  }
6050
6675
  ),
6051
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
6052
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6676
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
6677
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6053
6678
  "div",
6054
6679
  {
6055
6680
  style: {
@@ -6060,7 +6685,7 @@ function PanelContent({
6060
6685
  background: RECS_ZONE_BG
6061
6686
  },
6062
6687
  children: [
6063
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6688
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6064
6689
  KeywordPanel,
6065
6690
  {
6066
6691
  text,
@@ -6068,19 +6693,23 @@ function PanelContent({
6068
6693
  seedKeywords,
6069
6694
  onSeedsChange,
6070
6695
  onSelectPrimary,
6696
+ secondaryKeyword: effectiveSecondary,
6697
+ onSelectSecondary,
6071
6698
  documentFields,
6072
6699
  documentId,
6073
6700
  externalAnalysis: keywordAnalysisState
6074
6701
  },
6075
6702
  documentId || "default"
6076
6703
  ) }),
6077
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6704
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6078
6705
  SummaryTab,
6079
6706
  {
6080
6707
  text,
6081
6708
  analysis: keywordAnalysisState.analysis,
6082
6709
  deepAnalysis: keywordAnalysisState.deepAnalysis,
6083
6710
  documentFields,
6711
+ primaryKeyword: effectivePrimary,
6712
+ secondaryKeyword: effectiveSecondary,
6084
6713
  linkingSuggestions: linkingOps.suggestions,
6085
6714
  linkCheckResults: technicalOps.linkCheckResults,
6086
6715
  isAnyLoading: summaryOps.isAnyLoading,
@@ -6088,7 +6717,7 @@ function PanelContent({
6088
6717
  onItemClick: summaryOps.onItemClick
6089
6718
  }
6090
6719
  ) }),
6091
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6720
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6092
6721
  AEOTab,
6093
6722
  {
6094
6723
  text,
@@ -6105,7 +6734,7 @@ function PanelContent({
6105
6734
  loadContentSuggestions: aeoOps.loadContentSuggestions
6106
6735
  }
6107
6736
  ) }),
6108
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6737
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6109
6738
  LinkingTab,
6110
6739
  {
6111
6740
  analysis: keywordAnalysisState.analysis,
@@ -6116,16 +6745,20 @@ function PanelContent({
6116
6745
  onRefresh: linkingOps.refresh,
6117
6746
  documentId,
6118
6747
  publication,
6119
- text
6748
+ text,
6749
+ sanityBaseUrl,
6750
+ documentType
6120
6751
  }
6121
6752
  ) }),
6122
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MetaTab, { documentFields, primaryKeyword: effectivePrimary, isLoading: docLoading }) }),
6123
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6753
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
6754
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6124
6755
  TechnicalTab,
6125
6756
  {
6126
6757
  text,
6127
6758
  documentFields,
6128
6759
  isLoading: docLoading,
6760
+ primaryKeyword: effectivePrimary,
6761
+ secondaryKeyword: effectiveSecondary,
6129
6762
  linkCheckResults: technicalOps.linkCheckResults,
6130
6763
  isLinkCheckLoading: technicalOps.isLinkCheckLoading,
6131
6764
  linkCheckError: technicalOps.linkCheckError,
@@ -6136,7 +6769,7 @@ function PanelContent({
6136
6769
  ]
6137
6770
  }
6138
6771
  ),
6139
- chatOpen && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6772
+ chatOpen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6140
6773
  "div",
6141
6774
  {
6142
6775
  onMouseDown,
@@ -6149,10 +6782,10 @@ function PanelContent({
6149
6782
  justifyContent: "center",
6150
6783
  flexShrink: 0
6151
6784
  },
6152
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
6785
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
6153
6786
  }
6154
6787
  ),
6155
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6788
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6156
6789
  "div",
6157
6790
  {
6158
6791
  style: {
@@ -6165,7 +6798,7 @@ function PanelContent({
6165
6798
  background: CHAT_ZONE_BG
6166
6799
  },
6167
6800
  children: [
6168
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6801
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6169
6802
  "button",
6170
6803
  {
6171
6804
  onClick: () => onChatOpenChange(!chatOpen),
@@ -6186,7 +6819,7 @@ function PanelContent({
6186
6819
  flexShrink: 0
6187
6820
  },
6188
6821
  children: [
6189
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6822
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6190
6823
  "span",
6191
6824
  {
6192
6825
  style: {
@@ -6199,7 +6832,7 @@ function PanelContent({
6199
6832
  children: "Chat"
6200
6833
  }
6201
6834
  ),
6202
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6835
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6203
6836
  "svg",
6204
6837
  {
6205
6838
  width: "12",
@@ -6207,7 +6840,7 @@ function PanelContent({
6207
6840
  viewBox: "0 0 20 20",
6208
6841
  fill: "rgba(0,0,0,0.55)",
6209
6842
  style: { transform: chatOpen ? "rotate(0deg)" : "rotate(-90deg)", transition: "transform 200ms" },
6210
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6843
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6211
6844
  "path",
6212
6845
  {
6213
6846
  fillRule: "evenodd",
@@ -6220,7 +6853,7 @@ function PanelContent({
6220
6853
  ]
6221
6854
  }
6222
6855
  ),
6223
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6856
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6224
6857
  "div",
6225
6858
  {
6226
6859
  style: {
@@ -6230,7 +6863,7 @@ function PanelContent({
6230
6863
  flexDirection: "column",
6231
6864
  minHeight: 0
6232
6865
  },
6233
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6866
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6234
6867
  ChatPanel,
6235
6868
  {
6236
6869
  messages: chatState.messages,
@@ -6263,10 +6896,17 @@ function SEOCopilotInner({ config, onClose }) {
6263
6896
  );
6264
6897
  const dragOffset = (0, import_react18.useRef)(null);
6265
6898
  const resizeStart = (0, import_react18.useRef)(null);
6266
- const { text, isLoading: docLoading, documentFields, documentId } = useDocumentContent();
6899
+ const activeDragCleanupRef = (0, import_react18.useRef)(null);
6900
+ const activeResizeCleanupRef = (0, import_react18.useRef)(null);
6901
+ const { text, isLoading: docLoading, documentFields, documentId, documentType } = useDocumentContent();
6267
6902
  const { apiUrl } = useConfig();
6268
6903
  const workspace = (0, import_sanity3.useWorkspace)();
6269
6904
  const effectivePublication = config.publication || workspace?.dataset;
6905
+ const sanityBaseUrl = (0, import_react18.useMemo)(() => {
6906
+ if (typeof window === "undefined") return void 0;
6907
+ const basePath = (workspace?.basePath || "/").replace(/\/+$/, "");
6908
+ return `${window.location.origin}${basePath}`;
6909
+ }, [workspace?.basePath]);
6270
6910
  const seedCacheKey = documentId ? `seo-copilot-cache-${documentId}` : "seo-copilot-cache-v2";
6271
6911
  const loadSeedsFromCache = (0, import_react18.useCallback)(() => {
6272
6912
  try {
@@ -6290,6 +6930,8 @@ function SEOCopilotInner({ config, onClose }) {
6290
6930
  );
6291
6931
  const selectedPrimaryKey = documentId ? `seo-copilot-primary-${documentId}` : "seo-copilot-primary-default";
6292
6932
  const [selectedPrimary, setSelectedPrimary] = usePersistentState(selectedPrimaryKey, void 0);
6933
+ const selectedSecondaryKey = documentId ? `seo-copilot-secondary-${documentId}` : "seo-copilot-secondary-default";
6934
+ const [selectedSecondary, setSelectedSecondary] = usePersistentState(selectedSecondaryKey, "");
6293
6935
  const seedsInitializedRef = (0, import_react18.useRef)(false);
6294
6936
  (0, import_react18.useEffect)(() => {
6295
6937
  if (!seedsInitializedRef.current) {
@@ -6303,6 +6945,11 @@ function SEOCopilotInner({ config, onClose }) {
6303
6945
  const [splitPercent, setSplitPercent] = usePersistentState("seo-copilot-ui-split", 70);
6304
6946
  const keywordAnalysisState = useKeywordAnalysis(text, apiUrl, effectivePublication, seedKeywords, documentFields, selectedPrimary, documentId);
6305
6947
  const effectivePrimary = selectedPrimary || keywordAnalysisState.analysis?.primaryKeyword?.term || "";
6948
+ (0, import_react18.useEffect)(() => {
6949
+ if (selectedSecondary && effectivePrimary && selectedSecondary.toLowerCase() === effectivePrimary.toLowerCase()) {
6950
+ setSelectedSecondary("");
6951
+ }
6952
+ }, [effectivePrimary, selectedSecondary, setSelectedSecondary]);
6306
6953
  const keywordPanelData = (0, import_react18.useMemo)(() => {
6307
6954
  const analysis = keywordAnalysisState.analysis;
6308
6955
  if (!analysis) return void 0;
@@ -6324,6 +6971,7 @@ function SEOCopilotInner({ config, onClose }) {
6324
6971
  const [isCSLoading, setIsCSLoading] = (0, import_react18.useState)(false);
6325
6972
  const [csError, setCsError] = (0, import_react18.useState)(null);
6326
6973
  const aeoOpVersionRef = (0, import_react18.useRef)(0);
6974
+ const csAbortRef = (0, import_react18.useRef)(null);
6327
6975
  const didInitAeoRef = (0, import_react18.useRef)(false);
6328
6976
  (0, import_react18.useEffect)(() => {
6329
6977
  if (!didInitAeoRef.current) {
@@ -6339,7 +6987,11 @@ function SEOCopilotInner({ config, onClose }) {
6339
6987
  setIsCSLoading(true);
6340
6988
  setCsError(null);
6341
6989
  try {
6342
- const data = await fetchContentSuggestions(apiUrl, text, effectivePrimary, effectivePublication);
6990
+ csAbortRef.current?.abort();
6991
+ const csController = new AbortController();
6992
+ csAbortRef.current = csController;
6993
+ const data = await fetchContentSuggestions(apiUrl, text, effectivePrimary, effectivePublication, csController.signal);
6994
+ if (csController.signal.aborted) return;
6343
6995
  if (aeoOpVersionRef.current !== myVersion) return;
6344
6996
  if (data.keyTakeaways.length === 0 && data.infographicOpportunities.length === 0 && data.bulletListItems.length === 0) {
6345
6997
  setCsError("No suggestions returned. Try again with more content.");
@@ -6359,6 +7011,7 @@ function SEOCopilotInner({ config, onClose }) {
6359
7011
  const [linkingError, setLinkingError] = (0, import_react18.useState)(null);
6360
7012
  const [linkingFetchedText, setLinkingFetchedText] = (0, import_react18.useState)("");
6361
7013
  const linkingVersionRef = (0, import_react18.useRef)(0);
7014
+ const linkingAbortRef = (0, import_react18.useRef)(null);
6362
7015
  const didInitLinkingRef = (0, import_react18.useRef)(false);
6363
7016
  const lastLinkingFetchKey = (0, import_react18.useRef)("");
6364
7017
  (0, import_react18.useEffect)(() => {
@@ -6372,8 +7025,10 @@ function SEOCopilotInner({ config, onClose }) {
6372
7025
  lastLinkingFetchKey.current = "";
6373
7026
  }, [documentId]);
6374
7027
  const supportingKeywordsForLinking = (0, import_react18.useMemo)(() => {
6375
- return (keywordAnalysisState.analysis?.supportingKeywords || []).map((kw) => kw.term).filter(Boolean).slice(0, 5);
6376
- }, [keywordAnalysisState.analysis]);
7028
+ const base = (keywordAnalysisState.analysis?.supportingKeywords || []).map((kw) => kw.term).filter(Boolean);
7029
+ const merged = selectedSecondary ? [selectedSecondary, ...base.filter((t) => t.toLowerCase() !== selectedSecondary.toLowerCase())] : base;
7030
+ return merged.slice(0, 5);
7031
+ }, [keywordAnalysisState.analysis, selectedSecondary]);
6377
7032
  const refreshLinkingSuggestions = (0, import_react18.useCallback)(async () => {
6378
7033
  if (!text || text.trim().length < 50) return;
6379
7034
  if (!effectivePrimary) return;
@@ -6381,14 +7036,19 @@ function SEOCopilotInner({ config, onClose }) {
6381
7036
  setIsLinkingLoading(true);
6382
7037
  setLinkingError(null);
6383
7038
  try {
7039
+ linkingAbortRef.current?.abort();
7040
+ const linkingController = new AbortController();
7041
+ linkingAbortRef.current = linkingController;
6384
7042
  const suggestions = await fetchLinkingSuggestions(
6385
7043
  apiUrl,
6386
7044
  text,
6387
7045
  effectivePrimary,
6388
7046
  supportingKeywordsForLinking,
6389
7047
  documentId,
6390
- effectivePublication
7048
+ effectivePublication,
7049
+ linkingController.signal
6391
7050
  );
7051
+ if (linkingController.signal.aborted) return;
6392
7052
  if (linkingVersionRef.current !== myVersion) return;
6393
7053
  setLinkingSuggestions(suggestions);
6394
7054
  setLinkingFetchedText(text);
@@ -6457,6 +7117,14 @@ function SEOCopilotInner({ config, onClose }) {
6457
7117
  if (linkCheckVersionRef.current !== myVersion) return;
6458
7118
  setIsLinkCheckLoading(false);
6459
7119
  }, [apiUrl, documentFields?.bodyLinks, setHasRunLinkCheck, setLinkCheckResults]);
7120
+ (0, import_react18.useEffect)(() => {
7121
+ return () => {
7122
+ activeDragCleanupRef.current?.();
7123
+ activeResizeCleanupRef.current?.();
7124
+ csAbortRef.current?.abort();
7125
+ linkingAbortRef.current?.abort();
7126
+ };
7127
+ }, []);
6460
7128
  const handleDragStart = (0, import_react18.useCallback)(
6461
7129
  (e) => {
6462
7130
  dragOffset.current = {
@@ -6471,6 +7139,7 @@ function SEOCopilotInner({ config, onClose }) {
6471
7139
  });
6472
7140
  };
6473
7141
  const onMouseUp = () => {
7142
+ activeDragCleanupRef.current = null;
6474
7143
  dragOffset.current = null;
6475
7144
  window.removeEventListener("mousemove", onMouseMove);
6476
7145
  window.removeEventListener("mouseup", onMouseUp);
@@ -6481,6 +7150,12 @@ function SEOCopilotInner({ config, onClose }) {
6481
7150
  document.body.style.userSelect = "none";
6482
7151
  window.addEventListener("mousemove", onMouseMove);
6483
7152
  window.addEventListener("mouseup", onMouseUp);
7153
+ activeDragCleanupRef.current = () => {
7154
+ window.removeEventListener("mousemove", onMouseMove);
7155
+ window.removeEventListener("mouseup", onMouseUp);
7156
+ document.body.style.cursor = "";
7157
+ document.body.style.userSelect = "";
7158
+ };
6484
7159
  },
6485
7160
  [floatPos]
6486
7161
  );
@@ -6498,6 +7173,7 @@ function SEOCopilotInner({ config, onClose }) {
6498
7173
  setFloatSize({ width: newW, height: newH });
6499
7174
  };
6500
7175
  const onMouseUp = () => {
7176
+ activeResizeCleanupRef.current = null;
6501
7177
  resizeStart.current = null;
6502
7178
  document.body.style.cursor = "";
6503
7179
  document.body.style.userSelect = "";
@@ -6506,10 +7182,16 @@ function SEOCopilotInner({ config, onClose }) {
6506
7182
  };
6507
7183
  window.addEventListener("mousemove", onMouseMove);
6508
7184
  window.addEventListener("mouseup", onMouseUp);
7185
+ activeResizeCleanupRef.current = () => {
7186
+ window.removeEventListener("mousemove", onMouseMove);
7187
+ window.removeEventListener("mouseup", onMouseUp);
7188
+ document.body.style.cursor = "";
7189
+ document.body.style.userSelect = "";
7190
+ };
6509
7191
  },
6510
7192
  [floatSize]
6511
7193
  );
6512
- const panelContent = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7194
+ const panelContent = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6513
7195
  PanelContent,
6514
7196
  {
6515
7197
  initialPublication: effectivePublication,
@@ -6529,8 +7211,12 @@ function SEOCopilotInner({ config, onClose }) {
6529
7211
  docLoading,
6530
7212
  documentFields,
6531
7213
  documentId,
7214
+ documentType,
7215
+ sanityBaseUrl,
6532
7216
  selectedPrimary,
6533
7217
  onSelectPrimary: setSelectedPrimary,
7218
+ selectedSecondary,
7219
+ onSelectSecondary: setSelectedSecondary,
6534
7220
  activeTab,
6535
7221
  onActiveTabChange: setActiveTab,
6536
7222
  chatOpen,
@@ -6592,7 +7278,7 @@ function SEOCopilotInner({ config, onClose }) {
6592
7278
  }
6593
7279
  }
6594
7280
  );
6595
- const floatingPanel = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
7281
+ const floatingPanel = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6596
7282
  "div",
6597
7283
  {
6598
7284
  style: {
@@ -6610,7 +7296,7 @@ function SEOCopilotInner({ config, onClose }) {
6610
7296
  },
6611
7297
  children: [
6612
7298
  panelContent,
6613
- !isFullscreen && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7299
+ !isFullscreen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6614
7300
  "div",
6615
7301
  {
6616
7302
  onMouseDown: handleResizeStart,
@@ -6625,9 +7311,9 @@ function SEOCopilotInner({ config, onClose }) {
6625
7311
  alignItems: "center",
6626
7312
  justifyContent: "center"
6627
7313
  },
6628
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
6629
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
6630
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
7314
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
7315
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
7316
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
6631
7317
  ] })
6632
7318
  }
6633
7319
  )
@@ -6635,8 +7321,8 @@ function SEOCopilotInner({ config, onClose }) {
6635
7321
  }
6636
7322
  );
6637
7323
  if (isFloating) {
6638
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
6639
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7324
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
7325
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6640
7326
  "div",
6641
7327
  {
6642
7328
  style: {
@@ -6646,30 +7332,30 @@ function SEOCopilotInner({ config, onClose }) {
6646
7332
  alignItems: "center",
6647
7333
  justifyContent: "center"
6648
7334
  },
6649
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
7335
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
6650
7336
  }
6651
7337
  ),
6652
7338
  typeof document !== "undefined" && (0, import_react_dom.createPortal)(floatingPanel, document.body)
6653
7339
  ] });
6654
7340
  }
6655
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
7341
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
6656
7342
  }
6657
7343
  function SEOCopilotPanel({ config, onClose }) {
6658
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7344
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6659
7345
  import_react18.Suspense,
6660
7346
  {
6661
- fallback: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
6662
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LoadingBars, {}),
6663
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
7347
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
7348
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingBars, {}),
7349
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
6664
7350
  ] }),
6665
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SEOCopilotInner, { config, onClose }) })
7351
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SEOCopilotInner, { config, onClose }) })
6666
7352
  }
6667
7353
  );
6668
7354
  }
6669
7355
  function LoadingBars({ size = "sm", color = MJH_GOLD }) {
6670
7356
  const barWidth = size === "xs" ? 4 : 6;
6671
7357
  const containerHeight = size === "xs" ? 10 : 14;
6672
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7358
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6673
7359
  "div",
6674
7360
  {
6675
7361
  style: {
@@ -6727,8 +7413,7 @@ function seoCopilotInspector(config) {
6727
7413
  name: "seo-copilot",
6728
7414
  useMenuItem: () => ({
6729
7415
  title: "SEO Copilot",
6730
- icon: SEOIcon,
6731
- showAsAction: true
7416
+ icon: SEOIcon
6732
7417
  }),
6733
7418
  component: function SEOCopilotInspector(props) {
6734
7419
  return (0, import_react19.createElement)(SEOCopilotPanel, { ...props, config });