@hanzo/docs-core 16.2.5

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 (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/dist/algolia-IZEDLPHE.js +58 -0
  4. package/dist/breadcrumb.d.ts +46 -0
  5. package/dist/breadcrumb.js +81 -0
  6. package/dist/chunk-5PMI7QDD.js +220 -0
  7. package/dist/chunk-ADBHPKXG.js +78 -0
  8. package/dist/chunk-APKPSBSB.js +74 -0
  9. package/dist/chunk-CH7YHH7V.js +222 -0
  10. package/dist/chunk-EFVXL2PP.js +144 -0
  11. package/dist/chunk-EMWGTXSW.js +19 -0
  12. package/dist/chunk-FAEPKD7U.js +20 -0
  13. package/dist/chunk-FUUVPEA5.js +29 -0
  14. package/dist/chunk-GINBKBVQ.js +12 -0
  15. package/dist/chunk-GLRQBLGN.js +59 -0
  16. package/dist/chunk-JUF4WZ6G.js +117 -0
  17. package/dist/chunk-K4WNLOVQ.js +75 -0
  18. package/dist/chunk-L4JKQWCM.js +131 -0
  19. package/dist/chunk-MA6O2UUE.js +50 -0
  20. package/dist/chunk-ONG4RVCR.js +8 -0
  21. package/dist/chunk-OTD7MV33.js +53 -0
  22. package/dist/chunk-PFNP6PEB.js +11 -0
  23. package/dist/chunk-QJRXMG4S.js +275 -0
  24. package/dist/chunk-SH7BNTG7.js +38 -0
  25. package/dist/chunk-TWIDBWFG.js +84 -0
  26. package/dist/chunk-U67V476Y.js +35 -0
  27. package/dist/chunk-VLSDGCJE.js +47 -0
  28. package/dist/chunk-W6WTLKRA.js +73 -0
  29. package/dist/chunk-X2HFD5QJ.js +275 -0
  30. package/dist/chunk-XJ6ZQNEX.js +91 -0
  31. package/dist/chunk-XN2LKXFZ.js +101 -0
  32. package/dist/chunk-XOFXGHS4.js +93 -0
  33. package/dist/chunk-XZSI7AHE.js +67 -0
  34. package/dist/chunk-YVVDKJ2H.js +34 -0
  35. package/dist/chunk-ZMWYLUDP.js +21 -0
  36. package/dist/content/github.d.ts +40 -0
  37. package/dist/content/github.js +44 -0
  38. package/dist/content/index.d.ts +16 -0
  39. package/dist/content/index.js +30 -0
  40. package/dist/content/mdx/preset-bundler.d.ts +31 -0
  41. package/dist/content/mdx/preset-bundler.js +72 -0
  42. package/dist/content/mdx/preset-runtime.d.ts +31 -0
  43. package/dist/content/mdx/preset-runtime.js +71 -0
  44. package/dist/content/toc.d.ts +21 -0
  45. package/dist/content/toc.js +22 -0
  46. package/dist/definitions-pJ7PybYY.d.ts +60 -0
  47. package/dist/dynamic-link.d.ts +12 -0
  48. package/dist/dynamic-link.js +32 -0
  49. package/dist/fetch-IBTWQCJR.js +22 -0
  50. package/dist/framework/index.d.ts +41 -0
  51. package/dist/framework/index.js +18 -0
  52. package/dist/framework/next.d.ts +12 -0
  53. package/dist/framework/next.js +31 -0
  54. package/dist/framework/react-router.d.ts +12 -0
  55. package/dist/framework/react-router.js +59 -0
  56. package/dist/framework/tanstack.d.ts +15 -0
  57. package/dist/framework/tanstack.js +72 -0
  58. package/dist/framework/waku.d.ts +12 -0
  59. package/dist/framework/waku.js +63 -0
  60. package/dist/highlight/client.d.ts +15 -0
  61. package/dist/highlight/client.js +18 -0
  62. package/dist/highlight/index.d.ts +30 -0
  63. package/dist/highlight/index.js +13 -0
  64. package/dist/i18n/index.d.ts +39 -0
  65. package/dist/i18n/index.js +9 -0
  66. package/dist/i18n/middleware.d.ts +34 -0
  67. package/dist/i18n/middleware.js +76 -0
  68. package/dist/link.d.ts +18 -0
  69. package/dist/link.js +9 -0
  70. package/dist/loader-BvlPPJX0.d.ts +321 -0
  71. package/dist/mdx-plugins/codeblock-utils.d.ts +29 -0
  72. package/dist/mdx-plugins/codeblock-utils.js +9 -0
  73. package/dist/mdx-plugins/index.d.ts +20 -0
  74. package/dist/mdx-plugins/index.js +73 -0
  75. package/dist/mdx-plugins/rehype-code.d.ts +55 -0
  76. package/dist/mdx-plugins/rehype-code.js +15 -0
  77. package/dist/mdx-plugins/rehype-toc.d.ts +14 -0
  78. package/dist/mdx-plugins/rehype-toc.js +7 -0
  79. package/dist/mdx-plugins/remark-admonition.d.ts +20 -0
  80. package/dist/mdx-plugins/remark-admonition.js +8 -0
  81. package/dist/mdx-plugins/remark-code-tab.d.ts +30 -0
  82. package/dist/mdx-plugins/remark-code-tab.js +8 -0
  83. package/dist/mdx-plugins/remark-directive-admonition.d.ts +27 -0
  84. package/dist/mdx-plugins/remark-directive-admonition.js +7 -0
  85. package/dist/mdx-plugins/remark-gfm.d.ts +1 -0
  86. package/dist/mdx-plugins/remark-gfm.js +7 -0
  87. package/dist/mdx-plugins/remark-heading.d.ts +31 -0
  88. package/dist/mdx-plugins/remark-heading.js +8 -0
  89. package/dist/mdx-plugins/remark-image.d.ts +57 -0
  90. package/dist/mdx-plugins/remark-image.js +7 -0
  91. package/dist/mdx-plugins/remark-mdx-files.d.ts +40 -0
  92. package/dist/mdx-plugins/remark-mdx-files.js +7 -0
  93. package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +15 -0
  94. package/dist/mdx-plugins/remark-mdx-mermaid.js +7 -0
  95. package/dist/mdx-plugins/remark-npm.d.ts +31 -0
  96. package/dist/mdx-plugins/remark-npm.js +8 -0
  97. package/dist/mdx-plugins/remark-steps.d.ts +23 -0
  98. package/dist/mdx-plugins/remark-steps.js +7 -0
  99. package/dist/mdx-plugins/remark-structure.d.ts +71 -0
  100. package/dist/mdx-plugins/remark-structure.js +12 -0
  101. package/dist/mixedbread-RAHDVXGJ.js +118 -0
  102. package/dist/negotiation/index.d.ts +19 -0
  103. package/dist/negotiation/index.js +11 -0
  104. package/dist/orama-cloud-UZAPMPFV.js +93 -0
  105. package/dist/page-tree/index.d.ts +33 -0
  106. package/dist/page-tree/index.js +17 -0
  107. package/dist/search/algolia.d.ts +69 -0
  108. package/dist/search/algolia.js +71 -0
  109. package/dist/search/client.d.ts +140 -0
  110. package/dist/search/client.js +99 -0
  111. package/dist/search/index.d.ts +26 -0
  112. package/dist/search/index.js +7 -0
  113. package/dist/search/orama-cloud.d.ts +79 -0
  114. package/dist/search/orama-cloud.js +60 -0
  115. package/dist/search/server.d.ts +136 -0
  116. package/dist/search/server.js +400 -0
  117. package/dist/source/client/index.d.ts +16 -0
  118. package/dist/source/client/index.js +41 -0
  119. package/dist/source/index.d.ts +42 -0
  120. package/dist/source/index.js +776 -0
  121. package/dist/source/plugins/lucide-icons.d.ts +14 -0
  122. package/dist/source/plugins/lucide-icons.js +23 -0
  123. package/dist/source/schema.d.ts +26 -0
  124. package/dist/source/schema.js +25 -0
  125. package/dist/static-A2YJ5TXV.js +62 -0
  126. package/dist/toc.d.ts +43 -0
  127. package/dist/toc.js +151 -0
  128. package/dist/util-bZU2QeJ2.d.ts +6 -0
  129. package/dist/utils/use-effect-event.d.ts +9 -0
  130. package/dist/utils/use-effect-event.js +16 -0
  131. package/dist/utils/use-media-query.d.ts +3 -0
  132. package/dist/utils/use-media-query.js +23 -0
  133. package/dist/utils/use-on-change.d.ts +8 -0
  134. package/dist/utils/use-on-change.js +7 -0
  135. package/package.json +222 -0
@@ -0,0 +1,31 @@
1
+ import { Root, Heading } from 'mdast';
2
+ import { Transformer } from 'unified';
3
+
4
+ declare module 'mdast' {
5
+ interface HeadingData extends Data {
6
+ hProperties?: {
7
+ id?: string;
8
+ };
9
+ }
10
+ }
11
+ interface RemarkHeadingOptions {
12
+ slug?: (root: Root, heading: Heading, text: string) => string;
13
+ /**
14
+ * Allow custom headings ids
15
+ *
16
+ * @defaultValue true
17
+ */
18
+ customId?: boolean;
19
+ /**
20
+ * Attach an array of `TOCItemType` to `file.data.toc`
21
+ *
22
+ * @defaultValue true
23
+ */
24
+ generateToc?: boolean;
25
+ }
26
+ /**
27
+ * Add heading ids and extract TOC
28
+ */
29
+ declare function remarkHeading({ slug: defaultSlug, customId, generateToc, }?: RemarkHeadingOptions): Transformer<Root, Root>;
30
+
31
+ export { type RemarkHeadingOptions, remarkHeading };
@@ -0,0 +1,8 @@
1
+ import {
2
+ remarkHeading
3
+ } from "../chunk-MA6O2UUE.js";
4
+ import "../chunk-VLSDGCJE.js";
5
+ import "../chunk-U67V476Y.js";
6
+ export {
7
+ remarkHeading
8
+ };
@@ -0,0 +1,57 @@
1
+ import { Root } from 'mdast';
2
+ import { Transformer } from 'unified';
3
+
4
+ type ExternalImageOptions = {
5
+ /**
6
+ * timeout for fetching remote images (in milliseconds)
7
+ */
8
+ timeout?: number;
9
+ } | boolean;
10
+ interface RemarkImageOptions {
11
+ /**
12
+ * Directory or base URL to resolve absolute image paths
13
+ */
14
+ publicDir?: string;
15
+ /**
16
+ * Preferred placeholder type, only available with `useImport` + local images.
17
+ *
18
+ * @defaultValue 'blur'
19
+ */
20
+ placeholder?: 'blur' | 'none';
21
+ /**
22
+ * Define how to handle errors when fetching image size.
23
+ *
24
+ * - `error` (default): throw an error.
25
+ * - `ignore`: do absolutely nothing (Next.js Image component may complain).
26
+ * - `hide`: remove that image element.
27
+ *
28
+ * @defaultValue 'error'
29
+ */
30
+ onError?: 'error' | 'hide' | 'ignore' | ((error: Error) => void);
31
+ /**
32
+ * Import images in the file, and let bundlers handle it.
33
+ *
34
+ * ```tsx
35
+ * import MyImage from "./public/img.png";
36
+ *
37
+ * <img src={MyImage} />
38
+ * ```
39
+ *
40
+ * When disabled, `placeholder` will be ignored.
41
+ *
42
+ * @defaultValue true
43
+ */
44
+ useImport?: boolean;
45
+ /**
46
+ * Fetch image size of external URLs
47
+ *
48
+ * @defaultValue true
49
+ */
50
+ external?: ExternalImageOptions;
51
+ }
52
+ /**
53
+ * Turn images into Next.js Image compatible usage.
54
+ */
55
+ declare function remarkImage({ placeholder, external, useImport, onError, publicDir, }?: RemarkImageOptions): Transformer<Root, Root>;
56
+
57
+ export { type RemarkImageOptions, remarkImage };
@@ -0,0 +1,7 @@
1
+ import {
2
+ remarkImage
3
+ } from "../chunk-5PMI7QDD.js";
4
+ import "../chunk-U67V476Y.js";
5
+ export {
6
+ remarkImage
7
+ };
@@ -0,0 +1,40 @@
1
+ import { Root } from 'mdast';
2
+ import { Transformer } from 'unified';
3
+ import { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
4
+
5
+ interface FileNode {
6
+ depth: number;
7
+ type: 'file';
8
+ name: string;
9
+ }
10
+ interface FolderNode {
11
+ depth: number;
12
+ type: 'folder';
13
+ name: string;
14
+ children: Node[];
15
+ }
16
+ type Node = FileNode | FolderNode;
17
+ interface RemarkMdxFilesOptions {
18
+ /**
19
+ * @defaultValue files
20
+ */
21
+ lang?: string;
22
+ toMdx?: (node: Node) => MdxJsxFlowElement;
23
+ }
24
+ /**
25
+ * Convert codeblocks with `files` as lang, like:
26
+ *
27
+ * ```files
28
+ * project
29
+ * ├── src
30
+ * │ ├── index.js
31
+ * │ └── utils
32
+ * │ └── helper.js
33
+ * ├── package.json
34
+ * ```
35
+ *
36
+ * into MDX `<Files />` component
37
+ */
38
+ declare function remarkMdxFiles(options?: RemarkMdxFilesOptions): Transformer<Root, Root>;
39
+
40
+ export { type RemarkMdxFilesOptions, remarkMdxFiles };
@@ -0,0 +1,7 @@
1
+ import {
2
+ remarkMdxFiles
3
+ } from "../chunk-ADBHPKXG.js";
4
+ import "../chunk-U67V476Y.js";
5
+ export {
6
+ remarkMdxFiles
7
+ };
@@ -0,0 +1,15 @@
1
+ import { Transformer } from 'unified';
2
+ import { Root } from 'mdast';
3
+
4
+ interface RemarkMdxMermaidOptions {
5
+ /**
6
+ * @defaultValue mermaid
7
+ */
8
+ lang?: string;
9
+ }
10
+ /**
11
+ * Convert `mermaid` codeblocks into `<Mermaid />` MDX component
12
+ */
13
+ declare function remarkMdxMermaid(options?: RemarkMdxMermaidOptions): Transformer<Root, Root>;
14
+
15
+ export { type RemarkMdxMermaidOptions, remarkMdxMermaid };
@@ -0,0 +1,7 @@
1
+ import {
2
+ remarkMdxMermaid
3
+ } from "../chunk-FUUVPEA5.js";
4
+ import "../chunk-U67V476Y.js";
5
+ export {
6
+ remarkMdxMermaid
7
+ };
@@ -0,0 +1,31 @@
1
+ import { Root } from 'mdast';
2
+ import { Transformer } from 'unified';
3
+
4
+ interface PackageManager {
5
+ name: string;
6
+ /**
7
+ * Default to `name`
8
+ */
9
+ value?: string;
10
+ /**
11
+ * Convert from npm to another package manager
12
+ */
13
+ command: (command: string) => string | undefined;
14
+ }
15
+ interface RemarkNpmOptions {
16
+ /**
17
+ * Persist Tab value (Fumadocs UI only)
18
+ *
19
+ * @defaultValue false
20
+ */
21
+ persist?: {
22
+ id: string;
23
+ } | false;
24
+ packageManagers?: PackageManager[];
25
+ }
26
+ /**
27
+ * It generates multiple tabs of codeblocks for different package managers from a npm command codeblock.
28
+ */
29
+ declare function remarkNpm({ persist, packageManagers, }?: RemarkNpmOptions): Transformer<Root, Root>;
30
+
31
+ export { type RemarkNpmOptions, remarkNpm };
@@ -0,0 +1,8 @@
1
+ import {
2
+ remarkNpm
3
+ } from "../chunk-GLRQBLGN.js";
4
+ import "../chunk-TWIDBWFG.js";
5
+ import "../chunk-U67V476Y.js";
6
+ export {
7
+ remarkNpm
8
+ };
@@ -0,0 +1,23 @@
1
+ import { Transformer } from 'unified';
2
+ import { Root } from 'mdast';
3
+
4
+ interface RemarkStepsOptions {
5
+ /**
6
+ * Class name for steps container
7
+ *
8
+ * @defaultValue fd-steps
9
+ */
10
+ steps?: string;
11
+ /**
12
+ * Class name for step container
13
+ *
14
+ * @defaultValue fd-step
15
+ */
16
+ step?: string;
17
+ }
18
+ /**
19
+ * Convert headings in the format of `1. Hello World` into steps.
20
+ */
21
+ declare function remarkSteps({ steps, step, }?: RemarkStepsOptions): Transformer<Root, Root>;
22
+
23
+ export { type RemarkStepsOptions, remarkSteps };
@@ -0,0 +1,7 @@
1
+ import {
2
+ remarkSteps
3
+ } from "../chunk-XJ6ZQNEX.js";
4
+ import "../chunk-U67V476Y.js";
5
+ export {
6
+ remarkSteps
7
+ };
@@ -0,0 +1,71 @@
1
+ import { Nodes, Root } from 'mdast';
2
+ import { Transformer, PluggableList } from 'unified';
3
+ import { MdxJsxFlowElement, MdxJsxAttribute, MdxJsxExpressionAttribute } from 'mdast-util-mdx-jsx';
4
+
5
+ interface Heading {
6
+ id: string;
7
+ content: string;
8
+ }
9
+ interface Content {
10
+ heading: string | undefined;
11
+ content: string;
12
+ }
13
+ interface StructuredData {
14
+ headings: Heading[];
15
+ /**
16
+ * Refer to paragraphs, a heading may contain multiple contents as well
17
+ */
18
+ contents: Content[];
19
+ }
20
+ interface StructureOptions {
21
+ /**
22
+ * Types to be scanned as content.
23
+ *
24
+ * @defaultValue ['heading', 'paragraph', 'blockquote', 'tableCell', 'mdxJsxFlowElement']
25
+ */
26
+ types?: string[] | ((node: Nodes) => boolean);
27
+ /**
28
+ * A list of indexable MDX attributes, either:
29
+ *
30
+ * - an array of attribute names.
31
+ * - a function that determines if attribute should be indexed.
32
+ */
33
+ allowedMdxAttributes?: string[] | ((node: MdxJsxFlowElement, attribute: MdxJsxAttribute | MdxJsxExpressionAttribute) => boolean);
34
+ /**
35
+ * export as `structuredData` or specified variable name.
36
+ */
37
+ exportAs?: string | boolean;
38
+ }
39
+ declare module 'mdast' {
40
+ interface Data {
41
+ /**
42
+ * [Fumadocs] Get content of unserializable element, `remarkStructure` uses it to generate search index.
43
+ */
44
+ _string?: string[];
45
+ }
46
+ }
47
+ declare module 'vfile' {
48
+ interface DataMap {
49
+ /**
50
+ * [Fumadocs] injected by `remarkStructure`
51
+ */
52
+ structuredData: StructuredData;
53
+ }
54
+ }
55
+ declare const remarkStructureDefaultOptions: {
56
+ types: string[];
57
+ allowedMdxAttributes: (node: MdxJsxFlowElement) => boolean;
58
+ exportAs: false;
59
+ };
60
+ /**
61
+ * Extract content into structured data.
62
+ *
63
+ * By default, the output is stored into VFile (`vfile.data.structuredData`), you can specify `exportAs` to export it.
64
+ */
65
+ declare function remarkStructure({ types, allowedMdxAttributes, exportAs, }?: StructureOptions): Transformer<Root, Root>;
66
+ /**
67
+ * Extract data from markdown/mdx content
68
+ */
69
+ declare function structure(content: string, remarkPlugins?: PluggableList, options?: StructureOptions): StructuredData;
70
+
71
+ export { type StructureOptions, type StructuredData, remarkStructure, remarkStructureDefaultOptions, structure };
@@ -0,0 +1,12 @@
1
+ import {
2
+ remarkStructure,
3
+ remarkStructureDefaultOptions,
4
+ structure
5
+ } from "../chunk-JUF4WZ6G.js";
6
+ import "../chunk-VLSDGCJE.js";
7
+ import "../chunk-U67V476Y.js";
8
+ export {
9
+ remarkStructure,
10
+ remarkStructureDefaultOptions,
11
+ structure
12
+ };
@@ -0,0 +1,118 @@
1
+ import {
2
+ __commonJS,
3
+ __toESM
4
+ } from "./chunk-U67V476Y.js";
5
+
6
+ // ../../node_modules/.pnpm/remove-markdown@0.6.2/node_modules/remove-markdown/index.js
7
+ var require_remove_markdown = __commonJS({
8
+ "../../node_modules/.pnpm/remove-markdown@0.6.2/node_modules/remove-markdown/index.js"(exports, module) {
9
+ "use strict";
10
+ module.exports = function(md, options) {
11
+ options = options || {};
12
+ options.listUnicodeChar = options.hasOwnProperty("listUnicodeChar") ? options.listUnicodeChar : false;
13
+ options.stripListLeaders = options.hasOwnProperty("stripListLeaders") ? options.stripListLeaders : true;
14
+ options.gfm = options.hasOwnProperty("gfm") ? options.gfm : true;
15
+ options.useImgAltText = options.hasOwnProperty("useImgAltText") ? options.useImgAltText : true;
16
+ options.abbr = options.hasOwnProperty("abbr") ? options.abbr : false;
17
+ options.replaceLinksWithURL = options.hasOwnProperty("replaceLinksWithURL") ? options.replaceLinksWithURL : false;
18
+ options.htmlTagsToSkip = options.hasOwnProperty("htmlTagsToSkip") ? options.htmlTagsToSkip : [];
19
+ options.throwError = options.hasOwnProperty("throwError") ? options.throwError : false;
20
+ var output = md || "";
21
+ output = output.replace(/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/gm, "");
22
+ try {
23
+ if (options.stripListLeaders) {
24
+ if (options.listUnicodeChar)
25
+ output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, options.listUnicodeChar + " $1");
26
+ else
27
+ output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1");
28
+ }
29
+ if (options.gfm) {
30
+ output = output.replace(/\n={2,}/g, "\n").replace(/~{3}.*\n/g, "").replace(/~~/g, "").replace(/```(?:.*)\n([\s\S]*?)```/g, (_, code) => code.trim());
31
+ }
32
+ if (options.abbr) {
33
+ output = output.replace(/\*\[.*\]:.*\n/, "");
34
+ }
35
+ let htmlReplaceRegex = /<[^>]*>/g;
36
+ if (options.htmlTagsToSkip && options.htmlTagsToSkip.length > 0) {
37
+ const joinedHtmlTagsToSkip = options.htmlTagsToSkip.join("|");
38
+ htmlReplaceRegex = new RegExp(
39
+ `<(?!/?(${joinedHtmlTagsToSkip})(?=>|s[^>]*>))[^>]*>`,
40
+ "g"
41
+ );
42
+ }
43
+ output = output.replace(htmlReplaceRegex, "").replace(/^[=\-]{2,}\s*$/g, "").replace(/\[\^.+?\](\: .*?$)?/g, "").replace(/\s{0,2}\[.*?\]: .*?$/g, "").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, options.useImgAltText ? "$1" : "").replace(/\[([\s\S]*?)\]\s*[\(\[].*?[\)\]]/g, options.replaceLinksWithURL ? "$2" : "$1").replace(/^(\n)?\s{0,3}>\s?/gm, "$1").replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "").replace(/^(\n)?\s{0,}#{1,6}\s*( (.+))? +#+$|^(\n)?\s{0,}#{1,6}\s*( (.+))?$/gm, "$1$3$4$6").replace(/([\*]+)(\S)(.*?\S)??\1/g, "$2$3").replace(/(^|\W)([_]+)(\S)(.*?\S)??\2($|\W)/g, "$1$3$4$5").replace(/(`{3,})(.*?)\1/gm, "$2").replace(/`(.+?)`/g, "$1").replace(/~(.*?)~/g, "$1");
44
+ } catch (e) {
45
+ if (options.throwError) throw e;
46
+ console.error("remove-markdown encountered error: %s", e);
47
+ return md;
48
+ }
49
+ return output;
50
+ };
51
+ }
52
+ });
53
+
54
+ // src/search/client/mixedbread.ts
55
+ var import_remove_markdown = __toESM(require_remove_markdown(), 1);
56
+ import Slugger from "github-slugger";
57
+ var slugger = new Slugger();
58
+ function extractHeadingTitle(text) {
59
+ const trimmedText = text.trim();
60
+ if (!trimmedText.startsWith("#")) {
61
+ return "";
62
+ }
63
+ const lines = trimmedText.split("\n");
64
+ const firstLine = lines[0]?.trim();
65
+ if (firstLine) {
66
+ const plainText = (0, import_remove_markdown.default)(firstLine, {
67
+ useImgAltText: false
68
+ });
69
+ return plainText;
70
+ }
71
+ return "";
72
+ }
73
+ async function search(query, options) {
74
+ const { client, vectorStoreId, tag } = options;
75
+ if (!query.trim()) {
76
+ return [];
77
+ }
78
+ const res = await client.vectorStores.search({
79
+ query,
80
+ vector_store_identifiers: [vectorStoreId],
81
+ top_k: 10,
82
+ filters: {
83
+ key: "generated_metadata.tag",
84
+ operator: "eq",
85
+ value: tag
86
+ },
87
+ search_options: {
88
+ return_metadata: true
89
+ }
90
+ });
91
+ return res.data.flatMap((item) => {
92
+ const metadata = item.generated_metadata;
93
+ const url = metadata.url || "#";
94
+ const title = metadata.title || "Untitled";
95
+ const chunkResults = [
96
+ {
97
+ id: `${item.file_id}-${item.chunk_index}-page`,
98
+ type: "page",
99
+ content: title,
100
+ url
101
+ }
102
+ ];
103
+ const headingTitle = item.type === "text" ? extractHeadingTitle(item.text) : "";
104
+ if (headingTitle) {
105
+ slugger.reset();
106
+ chunkResults.push({
107
+ id: `${item.file_id}-${item.chunk_index}-heading`,
108
+ type: "heading",
109
+ content: headingTitle,
110
+ url: `${url}#${slugger.slug(headingTitle)}`
111
+ });
112
+ }
113
+ return chunkResults;
114
+ });
115
+ }
116
+ export {
117
+ search
118
+ };
@@ -0,0 +1,19 @@
1
+ import Negotiator from 'negotiator';
2
+
3
+ declare function getNegotiator(request: Request): Negotiator;
4
+ /**
5
+ * Rewrite incoming path matching the `source` pattern into the `destination` pattern.
6
+ *
7
+ * See [`path-to-regexp`](https://github.com/pillarjs/path-to-regexp) for accepted pattern formats.
8
+ *
9
+ * @param source - the original pattern of incoming paths
10
+ * @param destination - the target pattern to convert into
11
+ */
12
+ declare function rewritePath(source: string, destination: string): {
13
+ rewrite(pathname: string): string | false;
14
+ };
15
+ declare function isMarkdownPreferred(request: Request, options?: {
16
+ markdownMediaTypes?: string[];
17
+ }): boolean;
18
+
19
+ export { getNegotiator, isMarkdownPreferred, rewritePath };
@@ -0,0 +1,11 @@
1
+ import {
2
+ getNegotiator,
3
+ isMarkdownPreferred,
4
+ rewritePath
5
+ } from "../chunk-YVVDKJ2H.js";
6
+ import "../chunk-U67V476Y.js";
7
+ export {
8
+ getNegotiator,
9
+ isMarkdownPreferred,
10
+ rewritePath
11
+ };
@@ -0,0 +1,93 @@
1
+ import {
2
+ removeUndefined
3
+ } from "./chunk-ZMWYLUDP.js";
4
+ import {
5
+ createContentHighlighter
6
+ } from "./chunk-OTD7MV33.js";
7
+ import "./chunk-U67V476Y.js";
8
+
9
+ // src/search/client/orama-cloud.ts
10
+ async function searchDocs(query, options) {
11
+ const highlighter = createContentHighlighter(query);
12
+ const list = [];
13
+ const { index = "default", client, params: extraParams, tag } = options;
14
+ if (index === "crawler") {
15
+ const result2 = await client.search({
16
+ datasources: [],
17
+ ...extraParams,
18
+ term: query,
19
+ where: {
20
+ category: tag ? {
21
+ eq: tag.slice(0, 1).toUpperCase() + tag.slice(1)
22
+ } : void 0,
23
+ ...extraParams?.where
24
+ },
25
+ limit: 10
26
+ });
27
+ if (!result2) return list;
28
+ for (const hit of result2.hits) {
29
+ const doc = hit.document;
30
+ list.push(
31
+ {
32
+ id: hit.id,
33
+ type: "page",
34
+ content: doc.title,
35
+ contentWithHighlights: highlighter.highlight(doc.title),
36
+ url: doc.path
37
+ },
38
+ {
39
+ id: "page" + hit.id,
40
+ type: "text",
41
+ content: doc.content,
42
+ contentWithHighlights: highlighter.highlight(doc.content),
43
+ url: doc.path
44
+ }
45
+ );
46
+ }
47
+ return list;
48
+ }
49
+ const params = {
50
+ datasources: [],
51
+ ...extraParams,
52
+ term: query,
53
+ where: removeUndefined({
54
+ tag,
55
+ ...extraParams?.where
56
+ }),
57
+ groupBy: {
58
+ properties: ["page_id"],
59
+ max_results: 7,
60
+ ...extraParams?.groupBy
61
+ }
62
+ };
63
+ const result = await client.search(params);
64
+ if (!result || !result.groups) return list;
65
+ for (const item of result.groups) {
66
+ let addedHead = false;
67
+ for (const hit of item.result) {
68
+ const doc = hit.document;
69
+ if (!addedHead) {
70
+ list.push({
71
+ id: doc.page_id,
72
+ type: "page",
73
+ content: doc.title,
74
+ breadcrumbs: doc.breadcrumbs,
75
+ contentWithHighlights: highlighter.highlight(doc.title),
76
+ url: doc.url
77
+ });
78
+ addedHead = true;
79
+ }
80
+ list.push({
81
+ id: doc.id,
82
+ content: doc.content,
83
+ contentWithHighlights: highlighter.highlight(doc.content),
84
+ type: doc.content === doc.section ? "heading" : "text",
85
+ url: doc.section_id ? `${doc.url}#${doc.section_id}` : doc.url
86
+ });
87
+ }
88
+ }
89
+ return list;
90
+ }
91
+ export {
92
+ searchDocs
93
+ };
@@ -0,0 +1,33 @@
1
+ import { N as Node, I as Item, R as Root, F as Folder } from '../definitions-pJ7PybYY.js';
2
+ export { S as Separator } from '../definitions-pJ7PybYY.js';
3
+ import 'react';
4
+
5
+ /**
6
+ * Flatten tree to an array of page nodes
7
+ */
8
+ declare function flattenTree(nodes: Node[]): Item[];
9
+ /**
10
+ * Get neighbours of a page, useful for implementing "previous & next" buttons
11
+ */
12
+ declare function findNeighbour(tree: Root, url: string, options?: {
13
+ separateRoot?: boolean;
14
+ }): {
15
+ previous?: Item;
16
+ next?: Item;
17
+ };
18
+ declare function getPageTreeRoots(pageTree: Root | Folder): (Root | Folder)[];
19
+ /**
20
+ * Get other page tree nodes that lives under the same parent
21
+ */
22
+ declare function getPageTreePeers(treeOrTrees: Root | Record<string, Root>, url: string): Item[];
23
+ /**
24
+ * Search the path of a node in the tree matched by the matcher.
25
+ *
26
+ * @returns The path to the target node (from starting root), or null if the page doesn't exist
27
+ */
28
+ declare function findPath(nodes: Node[], matcher: (node: Node) => boolean, options?: {
29
+ includeSeparator?: boolean;
30
+ }): Node[] | null;
31
+ declare function visit<Root extends Node | Root>(root: Root, visitor: <T extends Node | Root>(node: T, parent?: Root | Folder) => 'skip' | 'break' | T | void): Root;
32
+
33
+ export { Folder, Item, Node, Root, findNeighbour, findPath, flattenTree, getPageTreePeers, getPageTreeRoots, visit };
@@ -0,0 +1,17 @@
1
+ import {
2
+ findNeighbour,
3
+ findPath,
4
+ flattenTree,
5
+ getPageTreePeers,
6
+ getPageTreeRoots,
7
+ visit
8
+ } from "../chunk-L4JKQWCM.js";
9
+ import "../chunk-U67V476Y.js";
10
+ export {
11
+ findNeighbour,
12
+ findPath,
13
+ flattenTree,
14
+ getPageTreePeers,
15
+ getPageTreeRoots,
16
+ visit
17
+ };