@netlify/spark-ui 1.11.0 → 1.12.0-alpha.1

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.
Files changed (61) hide show
  1. package/dist/assets/AskNetlify.css +1 -1
  2. package/dist/assets/SearchLink.css +1 -1
  3. package/dist/assets/SearchModal.css +1 -1
  4. package/dist/chunks/{ChatInterface.EQAPs01R.js → AskNetlify.lrswYyKn.js} +119 -110
  5. package/dist/components/preact/AskNetlify/AskNetlify.d.ts +3 -3
  6. package/dist/components/preact/AskNetlify/AskNetlify.js +8 -34
  7. package/dist/components/preact/AskNetlify/components/ChatMessages.d.ts +2 -1
  8. package/dist/components/preact/AskNetlify/components/ChatMessages.js +78 -70
  9. package/dist/components/preact/AskNetlify/components/SourcesList.d.ts +3 -0
  10. package/dist/components/preact/AskNetlify/components/SourcesList.js +23 -0
  11. package/dist/components/preact/AskNetlify/hooks/useAskAnalytics.d.ts +23 -0
  12. package/dist/components/preact/AskNetlify/hooks/useAskAnalytics.js +22 -0
  13. package/dist/components/preact/Icon/index.js +6 -6
  14. package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.d.ts +1 -1
  15. package/dist/components/preact/SearchModal/components/SearchLink/SearchLink.js +23 -22
  16. package/dist/components/preact/SearchModal/components/SearchLinkThemeToggle.d.ts +1 -0
  17. package/dist/components/preact/SearchModal/components/SearchLinkThemeToggle.js +26 -0
  18. package/dist/components/preact/SearchModal/components/SearchModal/SearchModal.js +89 -84
  19. package/dist/components/preact/SearchModal/components/SearchWindow.d.ts +1 -1
  20. package/dist/components/preact/SearchModal/components/SearchWindow.js +55 -48
  21. package/dist/components/preact/SearchModal/hooks/index.d.ts +1 -1
  22. package/dist/components/preact/SearchModal/hooks/index.js +8 -8
  23. package/dist/components/preact/SearchModal/hooks/useKeyboardNav.d.ts +1 -1
  24. package/dist/components/preact/SearchModal/hooks/useKeyboardNav.js +11 -12
  25. package/dist/components/preact/SearchModal/hooks/useSearch.js +19 -19
  26. package/dist/components/preact/SearchModal/hooks/{useSearchLogger.d.ts → useSearchAnalytics.d.ts} +2 -2
  27. package/dist/components/preact/SearchModal/hooks/{useSearchLogger.js → useSearchAnalytics.js} +5 -5
  28. package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.d.ts +1 -1
  29. package/dist/components/preact/SearchModal/hooks/useSearchHotkeys.js +8 -9
  30. package/dist/components/preact/SearchModal/hooks/useSearchParams.d.ts +1 -1
  31. package/dist/components/preact/SearchModal/hooks/useSearchParams.js +14 -7
  32. package/dist/components/preact/SearchModal/hooks/useSearchToggles.d.ts +1 -1
  33. package/dist/components/preact/SearchModal/hooks/useSearchToggles.js +7 -8
  34. package/dist/components/preact/SearchModal/types/search.types.d.ts +11 -4
  35. package/dist/components/preact/index.js +3 -3
  36. package/package.json +2 -2
  37. package/packages/components/preact/AskNetlify/AskNetlify.css +54 -1
  38. package/packages/components/preact/AskNetlify/AskNetlify.tsx +98 -34
  39. package/packages/components/preact/AskNetlify/components/ChatMessages.tsx +10 -5
  40. package/packages/components/preact/AskNetlify/components/SourcesList.tsx +33 -0
  41. package/packages/components/preact/AskNetlify/hooks/useAskAnalytics.tsx +50 -0
  42. package/packages/components/preact/Icon/index.tsx +2 -2
  43. package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.css +5 -0
  44. package/packages/components/preact/SearchModal/components/SearchLink/SearchLink.tsx +6 -4
  45. package/packages/components/preact/SearchModal/components/SearchLinkThemeToggle.tsx +19 -0
  46. package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.css +22 -3
  47. package/packages/components/preact/SearchModal/components/SearchModal/SearchModal.tsx +73 -89
  48. package/packages/components/preact/SearchModal/components/SearchWindow.tsx +64 -46
  49. package/packages/components/preact/SearchModal/hooks/index.ts +1 -1
  50. package/packages/components/preact/SearchModal/hooks/useKeyboardNav.ts +1 -3
  51. package/packages/components/preact/SearchModal/hooks/useSearch.ts +20 -16
  52. package/packages/components/preact/SearchModal/hooks/{useSearchLogger.ts → useSearchAnalytics.ts} +9 -10
  53. package/packages/components/preact/SearchModal/hooks/useSearchHotkeys.ts +2 -4
  54. package/packages/components/preact/SearchModal/hooks/useSearchParams.ts +24 -2
  55. package/packages/components/preact/SearchModal/hooks/useSearchToggles.ts +1 -3
  56. package/packages/components/preact/SearchModal/types/search.types.tsx +7 -4
  57. package/packages/styles/loaders.css +18 -0
  58. package/packages/styles/tokens.css +4 -0
  59. package/dist/components/preact/AskNetlify/components/ChatInterface.d.ts +0 -7
  60. package/dist/components/preact/AskNetlify/components/ChatInterface.js +0 -10
  61. package/packages/components/preact/AskNetlify/components/ChatInterface.tsx +0 -94
@@ -1,8 +1,8 @@
1
- interface AskNetlifyProps {
2
- kapaIntegrationId?: string;
1
+ interface Props {
3
2
  setModalState?: (e: {
4
3
  current: string;
5
4
  }) => void;
5
+ initialQuery?: string;
6
6
  }
7
- export default function AskNetlify(props: AskNetlifyProps): import("preact").JSX.Element | undefined;
7
+ export default function AskNetlify({ setModalState, initialQuery }: Props): import("preact").JSX.Element;
8
8
  export {};
@@ -1,36 +1,10 @@
1
- import { u as o } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
- import { A as i } from "../../../chunks/hooks.module.DGkdD5n9.js";
3
- import { C as s, K as a } from "../../../chunks/ChatInterface.EQAPs01R.js";
4
- import { A as u } from "../../../chunks/analytics.Ch1vuuOl.js";
5
- import '../../../assets/AskNetlify.css';function w(n) {
6
- const r = i(new u());
7
- if (n.kapaIntegrationId)
8
- return /* @__PURE__ */ o(
9
- a,
10
- {
11
- integrationId: n.kapaIntegrationId,
12
- callbacks: {
13
- askAI: {
14
- onQuerySubmit: (e) => {
15
- var t;
16
- !e.question || !e.threadId || (t = r == null ? void 0 : r.current) == null || t.track("ask:new_query", {
17
- question: e.question,
18
- thread_id: e.threadId
19
- });
20
- },
21
- onAnswerGenerationCompleted: (e) => {
22
- var t;
23
- !e.questionAnswerId || !e.answer || (t = r == null ? void 0 : r.current) == null || t.track("ask:answer_generated", {
24
- question_id: e.questionAnswerId,
25
- answer_length: e.answer.length
26
- });
27
- }
28
- }
29
- },
30
- children: /* @__PURE__ */ o(s, { setModalState: n.setModalState })
31
- }
32
- );
33
- }
1
+ import "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
+ import "../../../chunks/hooks.module.DGkdD5n9.js";
3
+ import { A as f } from "../../../chunks/AskNetlify.lrswYyKn.js";
4
+ import "./components/QuestionList/questions.js";
5
+ import "./components/QuestionList/QuestionList.js";
6
+ import "./components/BackButton.js";
7
+ import "./components/ChatMessages.js";
34
8
  export {
35
- w as default
9
+ f as default
36
10
  };
@@ -1,5 +1,6 @@
1
1
  import { Ref } from 'preact';
2
- export declare function ChatMessages({ conversation, lastMessageRef, }: {
2
+ export declare function ChatMessages({ conversation, lastMessageRef, isPreparingAnswer, }: {
3
3
  conversation: any[];
4
4
  lastMessageRef: Ref<HTMLDivElement>;
5
+ isPreparingAnswer: boolean;
5
6
  }): import("preact").JSX.Element;
@@ -3,7 +3,8 @@ var ye = (n, e, t) => e in n ? we(n, e, { enumerable: !0, configurable: !0, writ
3
3
  var d = (n, e, t) => ye(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { u as w } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
5
5
  import Se from "../../Icon/index.js";
6
- import { Fragment as $e } from "preact";
6
+ import { SourcesList as $e } from "./SourcesList.js";
7
+ import { Fragment as Re } from "preact";
7
8
  function H() {
8
9
  return {
9
10
  async: !1,
@@ -91,31 +92,31 @@ var x = {
91
92
  fencesBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}(?:\`\`\`|~~~)`),
92
93
  headingBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}#`),
93
94
  htmlBeginRegex: (n) => new RegExp(`^ {0,${Math.min(3, n - 1)}}<(?:[a-z].*>|!--)`, "i")
94
- }, Re = /^(?:[ \t]*(?:\n|$))+/, ve = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Te = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, L = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, ze = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = /(?:[*+-]|\d{1,9}[.)])/, ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, he = u(ce).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), _e = u(ce).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Ae = /^[^\n]+/, U = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Le = u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ie = u(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), q = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", X = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ce = u(
95
+ }, ve = /^(?:[ \t]*(?:\n|$))+/, Te = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ze = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, L = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, _e = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Q = /(?:[*+-]|\d{1,9}[.)])/, ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, he = u(ce).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Ae = u(ce).replace(/bull/g, Q).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Le = /^[^\n]+/, U = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Ie = u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ce = u(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Q).getRegex(), q = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", X = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Pe = u(
95
96
  "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))",
96
97
  "i"
97
- ).replace("comment", X).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), pe = u(F).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(), Pe = u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", pe).getRegex(), W = {
98
- blockquote: Pe,
99
- code: ve,
100
- def: Le,
101
- fences: Te,
102
- heading: ze,
98
+ ).replace("comment", X).replace("tag", q).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), pe = u(F).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(), Be = u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", pe).getRegex(), W = {
99
+ blockquote: Be,
100
+ code: Te,
101
+ def: Ie,
102
+ fences: ze,
103
+ heading: _e,
103
104
  hr: L,
104
- html: Ce,
105
+ html: Pe,
105
106
  lheading: he,
106
- list: Ie,
107
- newline: Re,
107
+ list: Ce,
108
+ newline: ve,
108
109
  paragraph: pe,
109
110
  table: A,
110
- text: Ae
111
+ text: Le
111
112
  }, re = u(
112
113
  "^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
113
- ).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(), Be = {
114
+ ).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex(), Ee = {
114
115
  ...W,
115
- lheading: _e,
116
+ lheading: Ae,
116
117
  table: re,
117
118
  paragraph: u(F).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", q).getRegex()
118
- }, Ee = {
119
+ }, qe = {
119
120
  ...W,
120
121
  html: u(
121
122
  `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
@@ -127,64 +128,64 @@ var x = {
127
128
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
128
129
  paragraph: u(F).replace("hr", L).replace("heading", ` *#{1,6} *[^
129
130
  ]`).replace("lheading", he).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
130
- }, qe = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ze = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, De = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Z = /[\p{P}\p{S}]/u, J = /[\s\p{P}\p{S}]/u, ge = /[^\s\p{P}\p{S}]/u, Me = u(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, J).getRegex(), fe = /(?!~)[\p{P}\p{S}]/u, Ge = /(?!~)[\s\p{P}\p{S}]/u, Ne = /(?:[^\s\p{P}\p{S}]|~)/u, Oe = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, de = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, je = u(de, "u").replace(/punct/g, Z).getRegex(), He = u(de, "u").replace(/punct/g, fe).getRegex(), ke = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Qe = u(ke, "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(), Fe = u(ke, "gu").replace(/notPunctSpace/g, Ne).replace(/punctSpace/g, Ge).replace(/punct/g, fe).getRegex(), Ue = u(
131
+ }, Ze = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, De = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, Me = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Z = /[\p{P}\p{S}]/u, J = /[\s\p{P}\p{S}]/u, ge = /[^\s\p{P}\p{S}]/u, Ge = u(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, J).getRegex(), fe = /(?!~)[\p{P}\p{S}]/u, Ne = /(?!~)[\s\p{P}\p{S}]/u, Oe = /(?:[^\s\p{P}\p{S}]|~)/u, je = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, de = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, He = u(de, "u").replace(/punct/g, Z).getRegex(), Qe = u(de, "u").replace(/punct/g, fe).getRegex(), ke = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Fe = u(ke, "gu").replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(), Ue = u(ke, "gu").replace(/notPunctSpace/g, Oe).replace(/punctSpace/g, Ne).replace(/punct/g, fe).getRegex(), Xe = u(
131
132
  "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
132
133
  "gu"
133
- ).replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(), Xe = u(/\\(punct)/, "gu").replace(/punct/g, Z).getRegex(), We = u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Je = u(X).replace("(?:-->|$)", "-->").getRegex(), Ke = u(
134
+ ).replace(/notPunctSpace/g, ge).replace(/punctSpace/g, J).replace(/punct/g, Z).getRegex(), We = u(/\\(punct)/, "gu").replace(/punct/g, Z).getRegex(), Je = u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Ke = u(X).replace("(?:-->|$)", "-->").getRegex(), Ve = u(
134
135
  "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
135
- ).replace("comment", Je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), P = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Ve = u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", P).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), be = u(/^!?\[(label)\]\[(ref)\]/).replace("label", P).replace("ref", U).getRegex(), xe = u(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex(), Ye = u("reflink|nolink(?!\\()", "g").replace("reflink", be).replace("nolink", xe).getRegex(), K = {
136
+ ).replace("comment", Ke).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), P = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Ye = u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", P).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), be = u(/^!?\[(label)\]\[(ref)\]/).replace("label", P).replace("ref", U).getRegex(), xe = u(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex(), et = u("reflink|nolink(?!\\()", "g").replace("reflink", be).replace("nolink", xe).getRegex(), K = {
136
137
  _backpedal: A,
137
138
  // only used for GFM url
138
- anyPunctuation: Xe,
139
- autolink: We,
140
- blockSkip: Oe,
139
+ anyPunctuation: We,
140
+ autolink: Je,
141
+ blockSkip: je,
141
142
  br: ue,
142
- code: Ze,
143
+ code: De,
143
144
  del: A,
144
- emStrongLDelim: je,
145
- emStrongRDelimAst: Qe,
146
- emStrongRDelimUnd: Ue,
147
- escape: qe,
148
- link: Ve,
145
+ emStrongLDelim: He,
146
+ emStrongRDelimAst: Fe,
147
+ emStrongRDelimUnd: Xe,
148
+ escape: Ze,
149
+ link: Ye,
149
150
  nolink: xe,
150
- punctuation: Me,
151
+ punctuation: Ge,
151
152
  reflink: be,
152
- reflinkSearch: Ye,
153
- tag: Ke,
154
- text: De,
153
+ reflinkSearch: et,
154
+ tag: Ve,
155
+ text: Me,
155
156
  url: A
156
- }, et = {
157
+ }, tt = {
157
158
  ...K,
158
159
  link: u(/^!?\[(label)\]\((.*?)\)/).replace("label", P).getRegex(),
159
160
  reflink: u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", P).getRegex()
160
161
  }, N = {
161
162
  ...K,
162
- emStrongRDelimAst: Fe,
163
- emStrongLDelim: He,
163
+ emStrongRDelimAst: Ue,
164
+ emStrongLDelim: Qe,
164
165
  url: u(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
165
166
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
166
167
  del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
167
168
  text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
168
- }, tt = {
169
+ }, nt = {
169
170
  ...N,
170
171
  br: u(ue).replace("{2,}", "*").getRegex(),
171
172
  text: u(N.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
172
173
  }, I = {
173
174
  normal: W,
174
- gfm: Be,
175
- pedantic: Ee
175
+ gfm: Ee,
176
+ pedantic: qe
176
177
  }, z = {
177
178
  normal: K,
178
179
  gfm: N,
179
- breaks: tt,
180
- pedantic: et
181
- }, nt = {
180
+ breaks: nt,
181
+ pedantic: tt
182
+ }, rt = {
182
183
  "&": "&amp;",
183
184
  "<": "&lt;",
184
185
  ">": "&gt;",
185
186
  '"': "&quot;",
186
187
  "'": "&#39;"
187
- }, se = (n) => nt[n];
188
+ }, se = (n) => rt[n];
188
189
  function y(n, e) {
189
190
  if (e) {
190
191
  if (x.escapeTest.test(n))
@@ -227,7 +228,7 @@ function _(n, e, t) {
227
228
  s++;
228
229
  return n.slice(0, r - s);
229
230
  }
230
- function rt(n, e) {
231
+ function st(n, e) {
231
232
  if (n.indexOf(e[1]) === -1)
232
233
  return -1;
233
234
  let t = 0;
@@ -253,7 +254,7 @@ function ae(n, e, t, r, s) {
253
254
  };
254
255
  return r.state.inLink = !1, h;
255
256
  }
256
- function st(n, e, t) {
257
+ function it(n, e, t) {
257
258
  const r = n.match(t.other.indentCodeCompensation);
258
259
  if (r === null)
259
260
  return e;
@@ -301,7 +302,7 @@ var B = class {
301
302
  fences(n) {
302
303
  const e = this.rules.block.fences.exec(n);
303
304
  if (e) {
304
- const t = e[0], r = st(t, e[3] || "", this.rules);
305
+ const t = e[0], r = it(t, e[3] || "", this.rules);
305
306
  return {
306
307
  type: "code",
307
308
  raw: t,
@@ -587,7 +588,7 @@ ${o}` : o;
587
588
  if ((t.length - i.length) % 2 === 0)
588
589
  return;
589
590
  } else {
590
- const i = rt(e[2], "()");
591
+ const i = st(e[2], "()");
591
592
  if (i === -2)
592
593
  return;
593
594
  if (i > -1) {
@@ -1360,7 +1361,7 @@ ${n}</tr>
1360
1361
  "preprocess",
1361
1362
  "postprocess",
1362
1363
  "processAllTokens"
1363
- ])), G), it = class {
1364
+ ])), G), lt = class {
1364
1365
  constructor(...n) {
1365
1366
  d(this, "defaults", H());
1366
1367
  d(this, "options", this.setOptions);
@@ -1532,7 +1533,7 @@ Please report this to https://github.com/markedjs/marked.`, n) {
1532
1533
  throw t;
1533
1534
  };
1534
1535
  }
1535
- }, R = new it();
1536
+ }, R = new lt();
1536
1537
  function f(n, e) {
1537
1538
  return R.parse(n, e);
1538
1539
  }
@@ -1564,31 +1565,38 @@ f.walkTokens;
1564
1565
  f.parseInline;
1565
1566
  $.parse;
1566
1567
  S.lex;
1567
- function ht({
1568
+ function ut({
1568
1569
  conversation: n,
1569
- lastMessageRef: e
1570
+ lastMessageRef: e,
1571
+ isPreparingAnswer: t
1570
1572
  }) {
1571
- return /* @__PURE__ */ w($e, { children: n.map((t, r) => {
1572
- const s = r === n.length - 1;
1573
- return /* @__PURE__ */ w("div", { class: "n-ask-message", children: [
1574
- /* @__PURE__ */ w("div", { class: "n-ask-message-right", children: /* @__PURE__ */ w(
1575
- "div",
1576
- {
1577
- ref: s ? e : null,
1578
- class: "n-ask-message-bubble n-ask-user-message",
1579
- children: /* @__PURE__ */ w("p", { children: t.question })
1580
- }
1581
- ) }),
1582
- /* @__PURE__ */ w("div", { class: "n-ask-message-left", children: t.answer ? /* @__PURE__ */ w("div", { class: "n-ask-message-bubble n-ask-bot-message", children: /* @__PURE__ */ w(
1583
- "div",
1584
- {
1585
- class: "n-ask-message-answer n-ask-prose prose flow",
1586
- dangerouslySetInnerHTML: { __html: f.parse(t.answer) }
1587
- }
1588
- ) }) : /* @__PURE__ */ w("div", { class: "n-ask-message-loader", children: /* @__PURE__ */ w(Se, { name: "askNetlify" }) }) })
1589
- ] }, t.id || `qa-${r}`);
1590
- }) });
1573
+ return /* @__PURE__ */ w(Re, { children: [
1574
+ n.map((r, s) => {
1575
+ const i = s === n.length - 1;
1576
+ return /* @__PURE__ */ w("div", { class: "n-ask-message", children: [
1577
+ /* @__PURE__ */ w("div", { class: "n-ask-message-right", children: /* @__PURE__ */ w(
1578
+ "div",
1579
+ {
1580
+ ref: i ? e : null,
1581
+ class: "n-ask-message-bubble n-ask-user-message",
1582
+ children: /* @__PURE__ */ w("p", { children: r.question })
1583
+ }
1584
+ ) }),
1585
+ /* @__PURE__ */ w("div", { class: "n-ask-message-left", children: r.answer && /* @__PURE__ */ w("div", { class: "n-ask-message-bubble n-ask-bot-message", children: [
1586
+ /* @__PURE__ */ w(
1587
+ "div",
1588
+ {
1589
+ class: "n-ask-message-answer n-ask-prose prose flow",
1590
+ dangerouslySetInnerHTML: { __html: f.parse(r.answer) }
1591
+ }
1592
+ ),
1593
+ r.id && /* @__PURE__ */ w($e, { sources: r.sources })
1594
+ ] }) })
1595
+ ] }, r.id || `qa-${s}`);
1596
+ }),
1597
+ t && /* @__PURE__ */ w("div", { class: "n-ask-message-loader", children: /* @__PURE__ */ w(Se, { name: "askNetlify" }) })
1598
+ ] });
1591
1599
  }
1592
1600
  export {
1593
- ht as ChatMessages
1601
+ ut as ChatMessages
1594
1602
  };
@@ -0,0 +1,3 @@
1
+ export declare function SourcesList({ sources }: {
2
+ sources: any;
3
+ }): import("preact").JSX.Element | null;
@@ -0,0 +1,23 @@
1
+ import { u as t } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
+ import i from "../../Icon/index.js";
3
+ function h({ sources: l }) {
4
+ return l != null && l.length ? /* @__PURE__ */ t("div", { className: "n-ask-sources", children: /* @__PURE__ */ t("details", { children: [
5
+ /* @__PURE__ */ t("summary", { children: [
6
+ /* @__PURE__ */ t("h4", { class: "n-ask-sources-title", children: "Sources:" }),
7
+ /* @__PURE__ */ t(i, { name: "caretRight" })
8
+ ] }),
9
+ /* @__PURE__ */ t("ul", { children: l.map((e, r) => {
10
+ if (e.title)
11
+ return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t("a", { href: e.source_url, target: "_blank", rel: "noopener noreferrer", children: [
12
+ e.title,
13
+ e.subtitle && e.subtitle !== e.title && /* @__PURE__ */ t("span", { children: [
14
+ " - ",
15
+ e.subtitle
16
+ ] })
17
+ ] }) }, r);
18
+ }) })
19
+ ] }) }) : null;
20
+ }
21
+ export {
22
+ h as SourcesList
23
+ };
@@ -0,0 +1,23 @@
1
+ import { QuerySubmitPayload, AnswerGenerationCompletedPayload } from '@kapaai/react-sdk';
2
+ /**
3
+ * Custom hook that tracks analytics events related to Ask Netlify and pushes them to the Google Analytics 4 (GA4) data layer.
4
+ *
5
+ * This hook captures two key interaction events and pushes their payloads to the `dataLayer`, enabling tracking in GA4:
6
+ * - `ask:new_query`: Triggered when a user submits a new question. The payload includes the question text and a thread ID.
7
+ * - `ask:answer_generated`: Triggered when a generated answer is completed. The payload includes the question ID and the length of the answer.
8
+ *
9
+ * Internally, the hook uses an instance of the `Analytics` class to structure and dispatch events. All event payloads are pushed to `window.dataLayer` to be consumed by Google Tag Manager and GA4.
10
+ *
11
+ * @returns {Object} - An object with the following functions:
12
+ * - `handleNewQuery`: Callback to be invoked when a user submits a new question. Sends a `ask:new_query` event with:
13
+ * - `question` (string): The user-submitted question.
14
+ * - `thread_id` (string): A unique identifier for the conversation thread.
15
+ * - `handleAnswer`: Callback to be invoked when a answer is returned. Sends a `ask:answer_generated` event with:
16
+ * - `question_id` (string): The ID linking the question to its answer.
17
+ * - `answer_length` (number): The character length of the generated answer.
18
+
19
+ */
20
+ export declare function useAskAnalytics(): {
21
+ handleNewQuery: (data: QuerySubmitPayload) => void;
22
+ handleAnswer: (data: AnswerGenerationCompletedPayload) => void;
23
+ };
@@ -0,0 +1,22 @@
1
+ import { A as o, q as n } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
+ import { A as u } from "../../../../chunks/analytics.Ch1vuuOl.js";
3
+ function A() {
4
+ const r = o(new u()).current, s = n((e) => {
5
+ !e.question || !e.threadId || r == null || r.track("ask:new_query", {
6
+ question: e.question,
7
+ thread_id: e.threadId
8
+ });
9
+ }, []), t = n((e) => {
10
+ !e.questionAnswerId || !e.answer || r == null || r.track("ask:answer_generated", {
11
+ question_id: e.questionAnswerId,
12
+ answer_length: e.answer.length
13
+ });
14
+ }, []);
15
+ return {
16
+ handleNewQuery: s,
17
+ handleAnswer: t
18
+ };
19
+ }
20
+ export {
21
+ A as useAskAnalytics
22
+ };
@@ -84,7 +84,7 @@ const l = () => /* @__PURE__ */ C(e, { children: [
84
84
  y: "7.3",
85
85
  width: "3",
86
86
  height: "2",
87
- fill: "var(--search-bg-color, currentColor)"
87
+ fill: "var(--n-ask-netlify-eyelid-color, currentColor)"
88
88
  }
89
89
  ),
90
90
  /* @__PURE__ */ C(
@@ -95,7 +95,7 @@ const l = () => /* @__PURE__ */ C(e, { children: [
95
95
  y: "7.3",
96
96
  width: "3",
97
97
  height: "2",
98
- fill: "var(--search-bg-color, currentColor)"
98
+ fill: "var(--n-ask-netlify-eyelid-color, currentColor)"
99
99
  }
100
100
  )
101
101
  ] }), n = () => /* @__PURE__ */ C(
@@ -157,7 +157,7 @@ const l = () => /* @__PURE__ */ C(e, { children: [
157
157
  d: "M49.8875 0.137732C48.3 -0.349768 46.625 0.525232 46.1375 2.11273L28.1375 60.1127C27.65 61.7002 28.525 63.3752 30.1125 63.8627C31.7 64.3502 33.375 63.4752 33.8625 61.8877L51.8625 3.88773C52.35 2.30023 51.475 0.625232 49.8875 0.137732ZM58.8125 14.9502C57.675 16.1627 57.7375 18.0627 58.95 19.1877L72.6125 32.0002L58.95 44.8127C57.7375 45.9502 57.675 47.8502 58.8125 49.0502C59.95 50.2502 61.85 50.3252 63.05 49.1877L79.05 34.1877C79.65 33.6252 80 32.8252 80 32.0002C80 31.1752 79.6625 30.3752 79.05 29.8127L63.05 14.8127C61.8375 13.6752 59.9375 13.7377 58.8125 14.9502ZM21.1875 14.9502C20.05 13.7377 18.15 13.6752 16.95 14.8127L0.95 29.8127C0.3375 30.3752 0 31.1752 0 32.0002C0 32.8252 0.3375 33.6252 0.95 34.1877L16.95 49.1877C18.1625 50.3252 20.0625 50.2627 21.1875 49.0502C22.3125 47.8377 22.2625 45.9377 21.05 44.8127L7.3875 32.0002L21.05 19.1877C22.2625 18.0502 22.325 16.1502 21.1875 14.9502Z",
158
158
  fill: "currentColor"
159
159
  }
160
- ), h = () => /* @__PURE__ */ C(
160
+ ), f = () => /* @__PURE__ */ C(
161
161
  "path",
162
162
  {
163
163
  d: "M4.83333 1C3.82214 1 3 1.78477 3 2.75V13.25C3 14.2152 3.82214 15 4.83333 15H12.1667C13.1779 15 14 14.2152 14 13.25V5.375H10.3333C9.8263 5.375 9.41667 4.98398 9.41667 4.5V1H4.83333ZM10.3333 1V4.5H14L10.3333 1ZM6.20833 8H10.7917C11.0438 8 11.25 8.19687 11.25 8.4375C11.25 8.67813 11.0438 8.875 10.7917 8.875H6.20833C5.95625 8.875 5.75 8.67813 5.75 8.4375C5.75 8.19687 5.95625 8 6.20833 8ZM6.20833 9.75H10.7917C11.0438 9.75 11.25 9.94687 11.25 10.1875C11.25 10.4281 11.0438 10.625 10.7917 10.625H6.20833C5.95625 10.625 5.75 10.4281 5.75 10.1875C5.75 9.94687 5.95625 9.75 6.20833 9.75ZM6.20833 11.5H10.7917C11.0438 11.5 11.25 11.6969 11.25 11.9375C11.25 12.1781 11.0438 12.375 10.7917 12.375H6.20833C5.95625 12.375 5.75 12.1781 5.75 11.9375C5.75 11.6969 5.95625 11.5 6.20833 11.5Z",
@@ -177,7 +177,7 @@ const l = () => /* @__PURE__ */ C(e, { children: [
177
177
  d: "M15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM7.48998 7.58293C7.24532 7.9418 7.1073 8.36489 7.09243 8.80158L7.09232 9.00062C7.09232 9.21263 7.17498 9.41595 7.32211 9.56587C7.46924 9.71578 7.6688 9.8 7.87688 9.8C8.08495 9.8 8.28451 9.71578 8.43164 9.56587C8.57878 9.41595 8.66143 9.21263 8.66143 9.00062V8.8172C8.67459 8.68789 8.72283 8.56481 8.80083 8.46179C8.82284 8.43271 8.87624 8.39281 8.96482 8.34893C9.04677 8.30834 9.13665 8.27475 9.21483 8.24583L9.2194 8.24414L9.22961 8.24053L9.23662 8.2376C9.7635 8.01739 10.1981 7.61624 10.4651 7.10372C10.7321 6.5912 10.8149 5.99957 10.6987 5.43153L10.6962 5.42197C10.5641 4.91215 10.2876 4.45323 9.90133 4.10235C9.51593 3.7523 9.03819 3.52522 8.52737 3.44924C8.1077 3.37054 7.67619 3.38633 7.26312 3.49553C6.849 3.605 6.46349 3.80568 6.13376 4.08342C5.58181 4.54443 5.25866 5.23048 5.25 5.95706V5.95934C5.25 6.17135 5.33266 6.37468 5.47979 6.52459C5.62692 6.6745 5.82648 6.75872 6.03456 6.75872C6.24264 6.75872 6.44219 6.6745 6.58933 6.52459C6.73595 6.37519 6.81855 6.17275 6.81911 5.96153C6.82486 5.70702 6.94287 5.46722 7.13988 5.30865C7.29566 5.18188 7.47721 5.09021 7.67067 5.04112C7.86413 4.99203 8.06566 4.98632 8.26159 5.02383L8.2716 5.02518C8.47683 5.05273 8.67003 5.13962 8.82831 5.27556C8.98372 5.40903 9.09909 5.5843 9.16133 5.78128C9.23237 6.20988 8.99652 6.63061 8.59639 6.78484L8.59136 6.78696C8.22065 6.94277 7.74615 7.20718 7.48998 7.58293ZM7.87406 12.6C8.42636 12.6 8.8741 12.1523 8.8741 11.6C8.8741 11.0477 8.42636 10.6 7.87406 10.6C7.32175 10.6 6.87402 11.0477 6.87402 11.6C6.87402 12.1523 7.32175 12.6 7.87406 12.6Z",
178
178
  fill: "currentColor"
179
179
  }
180
- ), f = () => /* @__PURE__ */ C(
180
+ ), h = () => /* @__PURE__ */ C(
181
181
  "path",
182
182
  {
183
183
  d: "M59.4286 0H4.55714C2.04286 0 0 2.07143 0 4.61429V59.3857C0 61.9286 2.04286 64 4.55714 64H59.4286C61.9429 64 64 61.9286 64 59.3857V4.61429C64 2.07143 61.9429 0 59.4286 0ZM19.3429 54.8571H9.85714V24.3143H19.3571V54.8571H19.3429ZM14.6 20.1429C11.5571 20.1429 9.1 17.6714 9.1 14.6429C9.1 11.6143 11.5571 9.14286 14.6 9.14286C17.6286 9.14286 20.1 11.6143 20.1 14.6429C20.1 17.6857 17.6429 20.1429 14.6 20.1429ZM54.9 54.8571H45.4143V40C45.4143 36.4571 45.3429 31.9 40.4857 31.9C35.5429 31.9 34.7857 35.7571 34.7857 39.7429V54.8571H25.3V24.3143H34.4V28.4857H34.5286C35.8 26.0857 38.9 23.5571 43.5143 23.5571C53.1143 23.5571 54.9 29.8857 54.9 38.1143V54.8571Z",
@@ -209,13 +209,13 @@ const l = () => /* @__PURE__ */ C(e, { children: [
209
209
  comment: c,
210
210
  link: d,
211
211
  lightbulb: u,
212
- pageWithLines: h,
212
+ pageWithLines: f,
213
213
  rss: i,
214
214
  search: n,
215
215
  terminal: M,
216
216
  question: Z,
217
217
  bluesky: s,
218
- linkedin: f,
218
+ linkedin: h,
219
219
  twitter: H,
220
220
  youtube: p
221
221
  };
@@ -1,3 +1,3 @@
1
1
  import { SearchLinkProps } from '../../types/search.types';
2
- declare const SearchLink: ({ as: Component, icon, label, url, excerpt, resource, onClick, }: SearchLinkProps) => import("preact").JSX.Element;
2
+ declare const SearchLink: ({ as: Component, icon, label, url, excerpt, resource, onClick, children, }: SearchLinkProps) => import("preact").JSX.Element;
3
3
  export default SearchLink;
@@ -1,40 +1,41 @@
1
1
  import { u as a } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
2
  import "../../../../../chunks/hooks.module.DGkdD5n9.js";
3
- import { useSearchLogger as d } from "../../hooks/useSearchLogger.js";
4
- import c from "../../../Icon/index.js";
5
- import '../../../../../assets/SearchLink.css';const g = ({
6
- as: r = "a",
7
- icon: n,
8
- label: i,
9
- url: h,
10
- excerpt: l,
11
- resource: e,
12
- onClick: s
3
+ import { useSearchAnalytics as k } from "../../hooks/useSearchAnalytics.js";
4
+ import i from "../../../Icon/index.js";
5
+ import '../../../../../assets/SearchLink.css';const u = ({
6
+ as: h = "a",
7
+ icon: e,
8
+ label: s,
9
+ url: m,
10
+ excerpt: c,
11
+ resource: n,
12
+ onClick: l,
13
+ children: r
13
14
  }) => {
14
- const { handleClick: m } = d();
15
+ const { handleClick: t } = k();
15
16
  return /* @__PURE__ */ a(
16
- r,
17
+ h,
17
18
  {
18
19
  className: "n-search-link",
19
- href: h,
20
- onClick: (t) => {
21
- s && s(), m(t);
20
+ href: m,
21
+ onClick: (d) => {
22
+ l && l(), t(d);
22
23
  },
23
24
  children: [
24
- n && /* @__PURE__ */ a("span", { className: "n-search-link-icon", children: /* @__PURE__ */ a(c, { name: n }) }),
25
+ e && /* @__PURE__ */ a("span", { className: "n-search-link-icon", children: /* @__PURE__ */ a(i, { name: e }) }),
25
26
  /* @__PURE__ */ a("div", { className: "n-search-link-body", children: [
26
27
  /* @__PURE__ */ a("p", { className: "n-search-link-title", children: [
27
- /* @__PURE__ */ a("span", { className: "n-search-link-label", children: i }),
28
- " ",
29
- e && /* @__PURE__ */ a("span", { className: "n-search-link-badge", "data-resource": e, children: e })
28
+ s && /* @__PURE__ */ a("span", { className: "n-search-link-label", children: s }),
29
+ r && /* @__PURE__ */ a("span", { className: "n-search-link-label", children: r }),
30
+ n && /* @__PURE__ */ a("span", { className: "n-search-link-badge", "data-resource": n, children: n })
30
31
  ] }),
31
- l && /* @__PURE__ */ a("p", { className: "n-search-link-excerpt", dangerouslySetInnerHTML: { __html: l } })
32
+ c && /* @__PURE__ */ a("p", { className: "n-search-link-excerpt", dangerouslySetInnerHTML: { __html: c } })
32
33
  ] }),
33
- /* @__PURE__ */ a("div", { className: "n-search-link-icon", children: /* @__PURE__ */ a(c, { name: "caretRight" }) })
34
+ /* @__PURE__ */ a("div", { className: "n-search-link-icon", children: /* @__PURE__ */ a(i, { name: "caretRight" }) })
34
35
  ]
35
36
  }
36
37
  );
37
38
  };
38
39
  export {
39
- g as default
40
+ u as default
40
41
  };
@@ -0,0 +1 @@
1
+ export default function SearchLinkThemeToggle(): import("preact").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { u as n } from "../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
+ import o from "./SearchLink/SearchLink.js";
3
+ const c = {
4
+ light: "dark",
5
+ dark: "light"
6
+ }, h = (e) => {
7
+ const t = document.getElementById("site-theme-select");
8
+ t && (t.value = e), document.documentElement.setAttribute("data-theme", e), localStorage.setItem("theme", e);
9
+ };
10
+ function l() {
11
+ return /* @__PURE__ */ n(
12
+ o,
13
+ {
14
+ as: "button",
15
+ icon: "lightbulb",
16
+ label: "Toggle theme",
17
+ onClick: () => {
18
+ const e = window.matchMedia("(prefers-color-scheme: dark)").matches, t = document.documentElement.getAttribute("data-theme"), m = e ? "dark" : t || "light";
19
+ m && h(c[m]);
20
+ }
21
+ }
22
+ );
23
+ }
24
+ export {
25
+ l as default
26
+ };