@clarify-labs/renderer 0.11.9 → 0.11.11

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 (51) hide show
  1. package/output/{ClarifyShell-nV23Fn7m.js → ClarifyShell-DGm_R5Bp.js} +33 -13
  2. package/output/ClarifyShell-DGm_R5Bp.js.map +1 -0
  3. package/output/{ClarifyShell-GCXbb_AF.cjs → ClarifyShell-DLOGS18o.cjs} +33 -13
  4. package/output/ClarifyShell-DLOGS18o.cjs.map +1 -0
  5. package/output/{MermaidViewer-DEKNDG7K.cjs → MermaidViewer-BRR8SGnK.cjs} +2 -2
  6. package/output/{MermaidViewer-DEKNDG7K.cjs.map → MermaidViewer-BRR8SGnK.cjs.map} +1 -1
  7. package/output/{MermaidViewer-Ssxr00dy.js → MermaidViewer-CSbKX396.js} +2 -2
  8. package/output/{MermaidViewer-Ssxr00dy.js.map → MermaidViewer-CSbKX396.js.map} +1 -1
  9. package/output/{OpenApiOperation-DIgbzvk5.cjs → OpenApiOperation-416zAKci.cjs} +80 -12
  10. package/output/OpenApiOperation-416zAKci.cjs.map +1 -0
  11. package/output/{OpenApiOperation-B26v2y44.js → OpenApiOperation-bY3wbaJC.js} +70 -14
  12. package/output/OpenApiOperation-bY3wbaJC.js.map +1 -0
  13. package/output/{PageActions-DxGK-444.cjs → PageActions-CVOTIuxh.cjs} +198 -80
  14. package/output/PageActions-CVOTIuxh.cjs.map +1 -0
  15. package/output/{PageActions-BbmyFeSk.js → PageActions-D52u18C8.js} +194 -82
  16. package/output/PageActions-D52u18C8.js.map +1 -0
  17. package/output/{SearchDialog-DexOW8E4.cjs → SearchDialog--OLp05za.cjs} +3 -3
  18. package/output/{SearchDialog-DexOW8E4.cjs.map → SearchDialog--OLp05za.cjs.map} +1 -1
  19. package/output/{SearchDialog-4oEbmVMR.js → SearchDialog-Cq7w-uc7.js} +3 -3
  20. package/output/{SearchDialog-4oEbmVMR.js.map → SearchDialog-Cq7w-uc7.js.map} +1 -1
  21. package/output/app/AppShell.d.ts +2 -1
  22. package/output/app/PageActions.d.ts +6 -0
  23. package/output/app/PageUpdatedAt.d.ts +6 -0
  24. package/output/client.cjs +3 -3
  25. package/output/client.js +3 -3
  26. package/output/core/types.d.ts +21 -5
  27. package/output/{i18n-BuvwT5W9.cjs → i18n-BMNCgF9o.cjs} +2 -2
  28. package/output/{i18n-BuvwT5W9.cjs.map → i18n-BMNCgF9o.cjs.map} +1 -1
  29. package/output/{i18n-C6tIP-nl.js → i18n-Zmmhz7FF.js} +2 -2
  30. package/output/{i18n-C6tIP-nl.js.map → i18n-Zmmhz7FF.js.map} +1 -1
  31. package/output/index.cjs +7 -5
  32. package/output/index.d.ts +2 -1
  33. package/output/index.js +6 -6
  34. package/output/mdx/components.d.ts +9 -0
  35. package/output/mdx/primitives.d.ts +11 -0
  36. package/output/preview.cjs +3 -3
  37. package/output/preview.js +3 -3
  38. package/output/{render-CAtVGsQF.js → render-D_QvIv7Z.js} +2 -2
  39. package/output/{render-CAtVGsQF.js.map → render-D_QvIv7Z.js.map} +1 -1
  40. package/output/{render-D8h-jcnw.cjs → render-TErh9x_2.cjs} +2 -2
  41. package/output/{render-D8h-jcnw.cjs.map → render-TErh9x_2.cjs.map} +1 -1
  42. package/output/renderer.css +86 -0
  43. package/output/server.cjs +2 -2
  44. package/output/server.js +2 -2
  45. package/package.json +1 -1
  46. package/output/ClarifyShell-GCXbb_AF.cjs.map +0 -1
  47. package/output/ClarifyShell-nV23Fn7m.js.map +0 -1
  48. package/output/OpenApiOperation-B26v2y44.js.map +0 -1
  49. package/output/OpenApiOperation-DIgbzvk5.cjs.map +0 -1
  50. package/output/PageActions-BbmyFeSk.js.map +0 -1
  51. package/output/PageActions-DxGK-444.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SearchDialog-4oEbmVMR.js","names":[],"sources":["../source/shell/search/items.ts","../source/shell/search/pagefind.ts","../source/shell/search/SearchInput.tsx","../source/shell/search/Highlight.tsx","../source/shell/search/SearchResult.tsx","../source/shell/search/SearchDialog.tsx"],"sourcesContent":["import type { NavigationNode, RouteItem } from '../../types'\n\nimport type { SearchItem } from './types'\n\nfunction routeGroupTitles(navigation: NavigationNode[]) {\n const titles = new Map<string, string>()\n\n for (const node of navigation) {\n if (node.children?.length) {\n for (const child of node.children) {\n titles.set(child.path, node.title)\n }\n } else {\n titles.set(node.path, node.title)\n }\n }\n\n return titles\n}\n\nexport function buildSearchItems(routes: RouteItem[], navigation: NavigationNode[]): SearchItem[] {\n const groupTitles = routeGroupTitles(navigation)\n\n return routes.flatMap((route) => {\n // Skip bare alias routes (e.g., /path) from search to avoid duplicates in multilingual sites\n if (route.isBareAlias) return []\n \n const groupTitle = groupTitles.get(route.path)\n const pageItem: SearchItem = {\n title: route.title,\n pageTitle: route.title,\n sectionTitle: groupTitle,\n url: route.path,\n keywords: [groupTitle, route.title, route.path, route.kind].filter(Boolean).join(' ').toLowerCase(),\n }\n\n const sectionItems = route.sections?.map((section) => ({\n title: section.title,\n pageTitle: route.title,\n sectionTitle: groupTitle,\n url: `${route.path}#${section.id}`,\n keywords: [groupTitle, route.title, section.title, route.path, section.id].filter(Boolean).join(' ').toLowerCase(),\n })) ?? []\n\n return [pageItem, ...sectionItems]\n })\n}\n","import type { Pagefind } from './types'\n\ntype PagefindModule = {\n createInstance: () => Pagefind\n}\n\nconst pagefindPromises = new Map<string, Promise<Pagefind | null>>()\n\nexport function pagefindCacheKey(assetPrefix: string, locale: string | undefined) {\n return `${assetPrefix || '/'}:${locale || 'default'}`\n}\n\nexport function resolvePagefindUrl(assetPrefix: string): string {\n const prefix = assetPrefix || '/'\n return `${prefix.endsWith('/') ? prefix : `${prefix}/`}pagefind/pagefind.js`\n}\n\nexport function loadPagefind(assetPrefix: string, locale: string | undefined): Promise<Pagefind | null> {\n if (typeof window === 'undefined') return Promise.resolve(null)\n\n const cacheKey = pagefindCacheKey(assetPrefix, locale)\n const cachedPagefind = pagefindPromises.get(cacheKey)\n if (cachedPagefind) {\n return cachedPagefind\n }\n\n const pagefindUrl = resolvePagefindUrl(assetPrefix)\n const pagefindPromise = import(/* @vite-ignore */ pagefindUrl)\n .then(async (module: PagefindModule) => {\n const previousLanguage = document.documentElement.lang\n if (locale) document.documentElement.lang = locale\n const pagefind = module.createInstance()\n if (previousLanguage !== locale) document.documentElement.lang = previousLanguage\n try {\n await pagefind.init?.()\n } catch (error) {\n if (error instanceof Error && error.message.includes('No language indexes found')) {\n return null\n }\n throw error\n }\n return pagefind\n })\n .catch((error: unknown) => {\n pagefindPromises.delete(cacheKey)\n console.warn('[clarify:search] Pagefind instance failed', { cacheKey, locale, error })\n return null\n })\n\n pagefindPromises.set(cacheKey, pagefindPromise)\n return pagefindPromise\n}\n\nexport function normalizePagefindUrl(url: string, routePrefix: string): string {\n const parsedUrl = new URL(url, typeof window === 'undefined' ? 'http://localhost' : window.location.origin)\n let pathname = parsedUrl.pathname\n const prefix = routePrefix && routePrefix !== '/' ? `/${routePrefix.replace(/^\\/+|\\/+$/g, '')}` : ''\n\n if (prefix && (pathname === prefix || pathname.startsWith(`${prefix}/`))) {\n pathname = pathname.slice(prefix.length) || '/'\n }\n\n return `${pathname}${parsedUrl.search}${parsedUrl.hash}`\n}\n","import clsx from 'clsx'\nimport { LoaderCircle, Search as SearchIcon } from 'lucide-react'\nimport { forwardRef } from 'react'\n\nimport { useBuiltInText } from '../../i18n'\n\nexport const SearchInput = forwardRef<\n React.ElementRef<'input'>,\n {\n query: string\n setQuery: (query: string) => void\n onClose: () => void\n onSubmit: () => void\n activeDescendantId?: string\n loading?: boolean\n }\n>(function SearchInput(arg0, inputRef) {\n const { query, setQuery, onClose, onSubmit, activeDescendantId, loading = false } = arg0\n const t = useBuiltInText()\n const Icon = loading ? LoaderCircle : SearchIcon\n\n return (\n <div className=\"clarify-search-input group relative flex h-12\">\n <Icon\n aria-hidden=\"true\"\n className={clsx(\n 'pointer-events-none absolute top-0 left-3 h-full w-5 stroke-(--clarify-theme-tokens-colors-muted)',\n loading && 'animate-spin',\n )}\n />\n <input\n ref={inputRef}\n data-autofocus\n role=\"combobox\"\n aria-expanded={query !== ''}\n aria-controls=\"clarify-search-results\"\n aria-activedescendant={activeDescendantId}\n value={query}\n onChange={(event) => setQuery(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (event.key === 'Escape') {\n if (query) setQuery('')\n else onClose()\n }\n if (event.key === 'Enter') {\n event.preventDefault()\n onSubmit()\n }\n }}\n placeholder={t('search.placeholder')}\n className=\"clarify-search-field flex-auto appearance-none bg-transparent pr-4 pl-10 outline-hidden focus:w-full focus:flex-none [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden\"\n />\n </div>\n )\n})\n","import { Fragment } from 'react'\nimport type { ReactNode } from 'react'\n\nfunction stripHtml(value: string): string {\n if (typeof document === 'undefined') return value.replace(/<[^>]*>/g, '')\n const template = document.createElement('template')\n template.innerHTML = value\n return template.content.textContent ?? ''\n}\n\nfunction escapeRegExp(value: string) {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\ntype HighlightQueryProps = { text: string; query: string }\n\nexport function HighlightQuery(arg0: HighlightQueryProps) {\n const { text, query } = arg0\n\n if (!query) return text\n\n const parts = text.split(new RegExp(`(${escapeRegExp(query)})`, 'ig'))\n\n return (\n <>\n {parts.map((part, index) =>\n part.toLowerCase() === query.toLowerCase() ? (\n <mark key={index} className=\"bg-transparent text-(--clarify-theme-tokens-colors-primary) underline\">\n {part}\n </mark>\n ) : (\n <Fragment key={index}>{part}</Fragment>\n ),\n )}\n </>\n )\n}\n\nfunction renderExcerptNode(node: ChildNode, key: string): ReactNode {\n if (node.nodeType === Node.TEXT_NODE) return node.textContent\n if (node.nodeType !== Node.ELEMENT_NODE) return null\n\n const element = node as HTMLElement\n const children = Array.from(element.childNodes).map((child, index) => renderExcerptNode(child, `${key}-${index}`))\n\n if (element.tagName.toLowerCase() === 'mark') {\n return (\n <mark key={key} className=\"bg-transparent text-(--clarify-theme-tokens-colors-primary) underline\">\n {children}\n </mark>\n )\n }\n\n return <Fragment key={key}>{children}</Fragment>\n}\n\ntype HighlightExcerptProps = { excerpt: string; query: string }\n\nexport function HighlightExcerpt(arg0: HighlightExcerptProps) {\n const { excerpt, query } = arg0\n\n if (typeof document === 'undefined' || !excerpt.includes('<mark')) {\n return <HighlightQuery text={stripHtml(excerpt)} query={query} />\n }\n\n const template = document.createElement('template')\n template.innerHTML = excerpt\n\n return <>{Array.from(template.content.childNodes).map((node, index) => renderExcerptNode(node, String(index)))}</>\n}\n","import clsx from 'clsx'\nimport { Fragment, useId } from 'react'\n\nimport { HighlightExcerpt, HighlightQuery } from './Highlight'\nimport type { SearchDisplayItem } from './types'\n\ntype SearchResultProps = {\n result: SearchDisplayItem\n query: string\n active: boolean\n onActive: () => void\n onSelect: () => void\n}\n\nexport function SearchResult(arg0: SearchResultProps) {\n const { result, query, active, onActive, onSelect } = arg0\n const id = useId()\n const hierarchy = result.type === 'quick'\n ? [result.sectionTitle, result.pageTitle].filter((value): value is string => typeof value === 'string')\n : []\n\n return (\n <li\n id={id}\n className={clsx('clarify-search-result group block cursor-pointer px-4 py-3', active && 'clarify-search-result-active')}\n aria-selected={active}\n onMouseEnter={onActive}\n onMouseMove={onActive}\n onMouseDown={(event) => {\n event.preventDefault()\n onSelect()\n }}\n >\n <div className=\"clarify-search-result-title\">\n <HighlightQuery text={result.title} query={query} />\n </div>\n {hierarchy.length > 0 ? (\n <div className=\"clarify-search-result-hierarchy mt-1 truncate whitespace-nowrap\">\n {hierarchy.map((item, itemIndex, items) => (\n <Fragment key={`${item}-${itemIndex}`}>\n <HighlightQuery text={item} query={query} />\n <span className={itemIndex === items.length - 1 ? 'sr-only' : 'clarify-search-result-separator mx-2'}>/</span>\n </Fragment>\n ))}\n </div>\n ) : null}\n {result.type === 'full-text' && result.excerpt ? (\n <p className=\"clarify-search-result-excerpt mt-1 line-clamp-2 text-xs leading-5 text-(--clarify-theme-tokens-colors-muted)\">\n <HighlightExcerpt excerpt={result.excerpt} query={query} />\n </p>\n ) : null}\n </li>\n )\n}\n","import { Dialog, DialogBackdrop, DialogPanel } from '@headlessui/react'\nimport clsx from 'clsx'\nimport { SearchX } from 'lucide-react'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { useLocation, useNavigate } from 'react-router-dom'\n\nimport { useBuiltInText } from '../../i18n'\nimport type { NavigationNode, RouteItem } from '../../types'\n\nimport { buildSearchItems } from './items'\nimport { loadPagefind, normalizePagefindUrl, pagefindCacheKey } from './pagefind'\nimport { SearchInput } from './SearchInput'\nimport { SearchResult } from './SearchResult'\nimport type { FullTextSearchItem, Pagefind, SearchDisplayItem } from './types'\n\ntype SearchDialogProps = {\n open: boolean\n setOpen: (open: boolean) => void\n routes: RouteItem[]\n navigation: NavigationNode[]\n routePrefix: string\n assetPrefix: string\n currentLocale?: string\n className?: string\n onNavigate?: () => void\n}\n\ntype PagefindState = {\n key: string\n pagefind: Pagefind | null\n available: boolean\n}\n\ntype FullTextSearchState = {\n key: string\n results: FullTextSearchItem[] | null\n}\n\ntype UseSearchDialogLifecycleArgs = {\n open: boolean\n setOpen: (open: boolean) => void\n}\n\nfunction useSearchDialogLifecycle(arg0: UseSearchDialogLifecycleArgs) {\n const { open, setOpen } = arg0\n const location = useLocation()\n\n useEffect(() => {\n setOpen(false)\n }, [location.pathname, location.search, location.hash, setOpen])\n\n useEffect(() => {\n if (typeof window === 'undefined') return undefined\n if (open) return undefined\n\n function onKeyDown(event: KeyboardEvent) {\n if (event.key === 'k' && (event.metaKey || event.ctrlKey)) {\n event.preventDefault()\n setOpen(true)\n }\n }\n\n window.addEventListener('keydown', onKeyDown)\n return () => window.removeEventListener('keydown', onKeyDown)\n }, [open, setOpen])\n}\n\ntype UseSearchDataArgs = {\n query: string\n searchItems: ReturnType<typeof buildSearchItems>\n routePrefix: string\n assetPrefix: string\n currentLocale?: string\n}\n\ntype SearchDataState = {\n results: SearchDisplayItem[]\n searchInputLoading: boolean\n showNoResults: boolean\n}\n\nfunction useSearchData(arg0: UseSearchDataArgs): SearchDataState {\n const { query, searchItems, routePrefix, assetPrefix, currentLocale } = arg0\n const [fullTextState, setFullTextState] = useState<FullTextSearchState | null>(null)\n const [pagefindState, setPagefindState] = useState<PagefindState | null>(null)\n\n const quickResults = useMemo(() => {\n const normalizedQuery = query.trim().toLowerCase()\n if (!normalizedQuery) return []\n return searchItems.filter((item) => item.keywords.includes(normalizedQuery)).slice(0, 8).map((item) => ({ ...item, type: 'quick' as const }))\n }, [query, searchItems])\n\n const pagefindKey = pagefindCacheKey(assetPrefix, currentLocale)\n const activePagefindState = pagefindState?.key === pagefindKey ? pagefindState : null\n const pagefind = activePagefindState?.pagefind ?? null\n const pagefindAvailable = activePagefindState?.available ?? null\n const trimmedQuery = query.trim()\n const fullTextKey = `${pagefindKey}:${trimmedQuery}`\n const fullTextResults = fullTextState?.key === fullTextKey ? fullTextState.results : null\n const results: SearchDisplayItem[] = fullTextResults ?? quickResults\n const searchInputLoading = pagefindAvailable === null || Boolean(trimmedQuery && pagefind && fullTextState?.key !== fullTextKey)\n const showNoResults = Boolean(query.trim()) && results.length === 0 && pagefindAvailable !== null\n\n useEffect(() => {\n let cancelled = false\n\n loadPagefind(assetPrefix, currentLocale).then((loadedPagefind) => {\n if (cancelled) return\n setPagefindState({ key: pagefindKey, pagefind: loadedPagefind, available: Boolean(loadedPagefind) })\n })\n\n return () => {\n cancelled = true\n }\n }, [assetPrefix, currentLocale, pagefindKey])\n\n useEffect(() => {\n let cancelled = false\n if (!trimmedQuery || !pagefind) return undefined\n\n Promise.resolve().then(async () => {\n if (cancelled) return\n\n try {\n const search = await pagefind.search(trimmedQuery, { limit: 8 })\n const data = await Promise.all(search.results.map(async (result) => ({ id: result.id, data: await result.data() })))\n if (cancelled) return\n setFullTextState({\n key: fullTextKey,\n results: data.map(({ id, data }) => ({\n type: 'full-text',\n id,\n title: data.meta.title || data.url,\n url: normalizePagefindUrl(data.url, routePrefix),\n excerpt: data.excerpt,\n })),\n })\n } catch (error: unknown) {\n console.warn('[clarify:search] Pagefind search failed', { currentLocale, query: trimmedQuery, error })\n if (!cancelled) setFullTextState({ key: fullTextKey, results: null })\n }\n })\n\n return () => {\n cancelled = true\n }\n }, [currentLocale, fullTextKey, pagefind, routePrefix, trimmedQuery])\n\n return {\n results,\n searchInputLoading,\n showNoResults,\n }\n}\n\nexport function SearchDialog(arg0: SearchDialogProps) {\n const {\n open,\n setOpen,\n routes,\n navigation,\n routePrefix,\n assetPrefix,\n currentLocale,\n className,\n onNavigate = () => {},\n } = arg0\n\n const t = useBuiltInText()\n const navigate = useNavigate()\n const inputRef = useRef<React.ElementRef<typeof SearchInput>>(null)\n const [query, setQuery] = useState('')\n const [activeIndex, setActiveIndex] = useState(0)\n const searchItems = useMemo(() => buildSearchItems(routes, navigation), [navigation, routes])\n\n useSearchDialogLifecycle({ open, setOpen })\n const { results, searchInputLoading, showNoResults } = useSearchData({ query, searchItems, routePrefix, assetPrefix, currentLocale })\n\n const updateQuery = (value: string) => {\n setQuery(value)\n setActiveIndex(0)\n }\n\n function closeDialog() {\n updateQuery('')\n setOpen(false)\n }\n\n function selectResult(result = results[activeIndex]) {\n if (!result) return\n navigate(result.url)\n onNavigate()\n closeDialog()\n }\n\n function renderResultsPanel() {\n return (\n <div className=\"border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5\">\n {showNoResults ? (\n <div className=\"p-6 text-center\">\n <SearchX className=\"mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600\" />\n <p className=\"mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400\">\n {t('search.noResults', { query })}\n </p>\n </div>\n ) : null}\n {results.length ? (\n <ul id=\"clarify-search-results\" className=\"clarify-search-results\" role=\"listbox\">\n {results.map((result, resultIndex) => (\n <SearchResult\n key={result.type === 'full-text' ? result.id : result.url}\n result={result}\n query={query}\n active={resultIndex === activeIndex}\n onActive={() => setActiveIndex(resultIndex)}\n onSelect={() => selectResult(result)}\n />\n ))}\n </ul>\n ) : null}\n </div>\n )\n }\n\n return (\n <Dialog open={open} onClose={closeDialog} className={clsx('clarify-search-dialog fixed inset-0 z-50', className)}>\n <DialogBackdrop\n transition\n className=\"clarify-search-backdrop clarify-ui-backdrop fixed inset-0 backdrop-blur-xs data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in\"\n />\n\n <div className=\"fixed inset-0 overflow-y-auto px-4 py-4 sm:px-6 sm:py-20 md:py-32 lg:px-8 lg:py-(--clarify-search-dialog-padding-block-lg)\">\n <DialogPanel\n transition\n className=\"clarify-search-panel mx-auto transform-gpu overflow-hidden rounded-(--clarify-theme-tokens-radius-lg) bg-(--clarify-theme-tokens-colors-surface) shadow-xl ring-1 ring-(--clarify-theme-tokens-colors-border) data-closed:scale-95 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:max-w-xl dark:bg-zinc-900 dark:ring-zinc-800\"\n onKeyDown={(event) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n setActiveIndex((index) => (results.length ? (index + 1) % results.length : 0))\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n setActiveIndex((index) => (results.length ? (index - 1 + results.length) % results.length : 0))\n }\n }}\n >\n <SearchInput\n ref={inputRef}\n query={query}\n setQuery={updateQuery}\n onClose={closeDialog}\n onSubmit={() => selectResult()}\n loading={searchInputLoading}\n />\n {renderResultsPanel()}\n </DialogPanel>\n </div>\n </Dialog>\n )\n}\n\nexport default SearchDialog\n"],"mappings":";;;;;;;;;AAIA,SAAS,iBAAiB,YAA8B;CACtD,MAAM,yBAAS,IAAI,IAAoB;CAEvC,KAAK,MAAM,QAAQ,YACjB,IAAI,KAAK,UAAU,QACjB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AAD;IAAK,WAAU;cAAf,CACE,oBAAC,SAAD,EAAS,WAAU,yFAA0F,CAAA,GAC7G,oBAAC,KAAD;KAAG,WAAU;eACV,EAAE,oBAAoB,EAAE,MAAM,CAAC;IAC/B,CAAA,CACA;QACH,MACH,QAAQ,SACP,oBAAC,MAAD;IAAI,IAAG;IAAyB,WAAU;IAAyB,MAAK;cACrE,QAAQ,KAAK,QAAQ,gBACpB,oBAAC,cAAD;KAEU;KACD;KACP,QAAQ,gBAAgB;KACxB,gBAAgB,eAAe,WAAW;KAC1C,gBAAgB,aAAa,MAAM;IACpC,GANM,OAAO,SAAS,cAAc,OAAO,KAAK,OAAO,GAMvD,CACF;GACC,CAAA,IACF,IACD;;CAET;CAEA,OACE,qBAAC,QAAD;EAAc;EAAM,SAAS;EAAa,WAAW,KAAK,4CAA4C,SAAS;YAA/G,CACE,oBAAC,gBAAD;GACE,YAAA;GACA,WAAU;EACX,CAAA,GAED,oBAAC,OAAD;GAAK,WAAU;aACb,qBAAC,aAAD;IACE,YAAA;IACA,WAAU;IACV,YAAY,UAAU;KACpB,IAAI,MAAM,QAAQ,aAAa;MAC7B,MAAM,eAAe;MACrB,gBAAgB,UAAW,QAAQ,UAAU,QAAQ,KAAK,QAAQ,SAAS,CAAE;KAC/E;KACA,IAAI,MAAM,QAAQ,WAAW;MAC3B,MAAM,eAAe;MACrB,gBAAgB,UAAW,QAAQ,UAAU,QAAQ,IAAI,QAAQ,UAAU,QAAQ,SAAS,CAAE;KAChG;IACF;cAZF,CAcE,oBAAC,aAAD;KACE,KAAK;KACE;KACP,UAAU;KACV,SAAS;KACT,gBAAgB,aAAa;KAC7B,SAAS;IACV,CAAA,GACA,mBAAmB,CACT;;EACV,CAAA,CACC;;AAEZ"}
1
+ {"version":3,"file":"SearchDialog-Cq7w-uc7.js","names":[],"sources":["../source/shell/search/items.ts","../source/shell/search/pagefind.ts","../source/shell/search/SearchInput.tsx","../source/shell/search/Highlight.tsx","../source/shell/search/SearchResult.tsx","../source/shell/search/SearchDialog.tsx"],"sourcesContent":["import type { NavigationNode, RouteItem } from '../../types'\n\nimport type { SearchItem } from './types'\n\nfunction routeGroupTitles(navigation: NavigationNode[]) {\n const titles = new Map<string, string>()\n\n for (const node of navigation) {\n if (node.children?.length) {\n for (const child of node.children) {\n titles.set(child.path, node.title)\n }\n } else {\n titles.set(node.path, node.title)\n }\n }\n\n return titles\n}\n\nexport function buildSearchItems(routes: RouteItem[], navigation: NavigationNode[]): SearchItem[] {\n const groupTitles = routeGroupTitles(navigation)\n\n return routes.flatMap((route) => {\n // Skip bare alias routes (e.g., /path) from search to avoid duplicates in multilingual sites\n if (route.isBareAlias) return []\n \n const groupTitle = groupTitles.get(route.path)\n const pageItem: SearchItem = {\n title: route.title,\n pageTitle: route.title,\n sectionTitle: groupTitle,\n url: route.path,\n keywords: [groupTitle, route.title, route.path, route.kind].filter(Boolean).join(' ').toLowerCase(),\n }\n\n const sectionItems = route.sections?.map((section) => ({\n title: section.title,\n pageTitle: route.title,\n sectionTitle: groupTitle,\n url: `${route.path}#${section.id}`,\n keywords: [groupTitle, route.title, section.title, route.path, section.id].filter(Boolean).join(' ').toLowerCase(),\n })) ?? []\n\n return [pageItem, ...sectionItems]\n })\n}\n","import type { Pagefind } from './types'\n\ntype PagefindModule = {\n createInstance: () => Pagefind\n}\n\nconst pagefindPromises = new Map<string, Promise<Pagefind | null>>()\n\nexport function pagefindCacheKey(assetPrefix: string, locale: string | undefined) {\n return `${assetPrefix || '/'}:${locale || 'default'}`\n}\n\nexport function resolvePagefindUrl(assetPrefix: string): string {\n const prefix = assetPrefix || '/'\n return `${prefix.endsWith('/') ? prefix : `${prefix}/`}pagefind/pagefind.js`\n}\n\nexport function loadPagefind(assetPrefix: string, locale: string | undefined): Promise<Pagefind | null> {\n if (typeof window === 'undefined') return Promise.resolve(null)\n\n const cacheKey = pagefindCacheKey(assetPrefix, locale)\n const cachedPagefind = pagefindPromises.get(cacheKey)\n if (cachedPagefind) {\n return cachedPagefind\n }\n\n const pagefindUrl = resolvePagefindUrl(assetPrefix)\n const pagefindPromise = import(/* @vite-ignore */ pagefindUrl)\n .then(async (module: PagefindModule) => {\n const previousLanguage = document.documentElement.lang\n if (locale) document.documentElement.lang = locale\n const pagefind = module.createInstance()\n if (previousLanguage !== locale) document.documentElement.lang = previousLanguage\n try {\n await pagefind.init?.()\n } catch (error) {\n if (error instanceof Error && error.message.includes('No language indexes found')) {\n return null\n }\n throw error\n }\n return pagefind\n })\n .catch((error: unknown) => {\n pagefindPromises.delete(cacheKey)\n console.warn('[clarify:search] Pagefind instance failed', { cacheKey, locale, error })\n return null\n })\n\n pagefindPromises.set(cacheKey, pagefindPromise)\n return pagefindPromise\n}\n\nexport function normalizePagefindUrl(url: string, routePrefix: string): string {\n const parsedUrl = new URL(url, typeof window === 'undefined' ? 'http://localhost' : window.location.origin)\n let pathname = parsedUrl.pathname\n const prefix = routePrefix && routePrefix !== '/' ? `/${routePrefix.replace(/^\\/+|\\/+$/g, '')}` : ''\n\n if (prefix && (pathname === prefix || pathname.startsWith(`${prefix}/`))) {\n pathname = pathname.slice(prefix.length) || '/'\n }\n\n return `${pathname}${parsedUrl.search}${parsedUrl.hash}`\n}\n","import clsx from 'clsx'\nimport { LoaderCircle, Search as SearchIcon } from 'lucide-react'\nimport { forwardRef } from 'react'\n\nimport { useBuiltInText } from '../../i18n'\n\nexport const SearchInput = forwardRef<\n React.ElementRef<'input'>,\n {\n query: string\n setQuery: (query: string) => void\n onClose: () => void\n onSubmit: () => void\n activeDescendantId?: string\n loading?: boolean\n }\n>(function SearchInput(arg0, inputRef) {\n const { query, setQuery, onClose, onSubmit, activeDescendantId, loading = false } = arg0\n const t = useBuiltInText()\n const Icon = loading ? LoaderCircle : SearchIcon\n\n return (\n <div className=\"clarify-search-input group relative flex h-12\">\n <Icon\n aria-hidden=\"true\"\n className={clsx(\n 'pointer-events-none absolute top-0 left-3 h-full w-5 stroke-(--clarify-theme-tokens-colors-muted)',\n loading && 'animate-spin',\n )}\n />\n <input\n ref={inputRef}\n data-autofocus\n role=\"combobox\"\n aria-expanded={query !== ''}\n aria-controls=\"clarify-search-results\"\n aria-activedescendant={activeDescendantId}\n value={query}\n onChange={(event) => setQuery(event.currentTarget.value)}\n onKeyDown={(event) => {\n if (event.key === 'Escape') {\n if (query) setQuery('')\n else onClose()\n }\n if (event.key === 'Enter') {\n event.preventDefault()\n onSubmit()\n }\n }}\n placeholder={t('search.placeholder')}\n className=\"clarify-search-field flex-auto appearance-none bg-transparent pr-4 pl-10 outline-hidden focus:w-full focus:flex-none [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden\"\n />\n </div>\n )\n})\n","import { Fragment } from 'react'\nimport type { ReactNode } from 'react'\n\nfunction stripHtml(value: string): string {\n if (typeof document === 'undefined') return value.replace(/<[^>]*>/g, '')\n const template = document.createElement('template')\n template.innerHTML = value\n return template.content.textContent ?? ''\n}\n\nfunction escapeRegExp(value: string) {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\ntype HighlightQueryProps = { text: string; query: string }\n\nexport function HighlightQuery(arg0: HighlightQueryProps) {\n const { text, query } = arg0\n\n if (!query) return text\n\n const parts = text.split(new RegExp(`(${escapeRegExp(query)})`, 'ig'))\n\n return (\n <>\n {parts.map((part, index) =>\n part.toLowerCase() === query.toLowerCase() ? (\n <mark key={index} className=\"bg-transparent text-(--clarify-theme-tokens-colors-primary) underline\">\n {part}\n </mark>\n ) : (\n <Fragment key={index}>{part}</Fragment>\n ),\n )}\n </>\n )\n}\n\nfunction renderExcerptNode(node: ChildNode, key: string): ReactNode {\n if (node.nodeType === Node.TEXT_NODE) return node.textContent\n if (node.nodeType !== Node.ELEMENT_NODE) return null\n\n const element = node as HTMLElement\n const children = Array.from(element.childNodes).map((child, index) => renderExcerptNode(child, `${key}-${index}`))\n\n if (element.tagName.toLowerCase() === 'mark') {\n return (\n <mark key={key} className=\"bg-transparent text-(--clarify-theme-tokens-colors-primary) underline\">\n {children}\n </mark>\n )\n }\n\n return <Fragment key={key}>{children}</Fragment>\n}\n\ntype HighlightExcerptProps = { excerpt: string; query: string }\n\nexport function HighlightExcerpt(arg0: HighlightExcerptProps) {\n const { excerpt, query } = arg0\n\n if (typeof document === 'undefined' || !excerpt.includes('<mark')) {\n return <HighlightQuery text={stripHtml(excerpt)} query={query} />\n }\n\n const template = document.createElement('template')\n template.innerHTML = excerpt\n\n return <>{Array.from(template.content.childNodes).map((node, index) => renderExcerptNode(node, String(index)))}</>\n}\n","import clsx from 'clsx'\nimport { Fragment, useId } from 'react'\n\nimport { HighlightExcerpt, HighlightQuery } from './Highlight'\nimport type { SearchDisplayItem } from './types'\n\ntype SearchResultProps = {\n result: SearchDisplayItem\n query: string\n active: boolean\n onActive: () => void\n onSelect: () => void\n}\n\nexport function SearchResult(arg0: SearchResultProps) {\n const { result, query, active, onActive, onSelect } = arg0\n const id = useId()\n const hierarchy = result.type === 'quick'\n ? [result.sectionTitle, result.pageTitle].filter((value): value is string => typeof value === 'string')\n : []\n\n return (\n <li\n id={id}\n className={clsx('clarify-search-result group block cursor-pointer px-4 py-3', active && 'clarify-search-result-active')}\n aria-selected={active}\n onMouseEnter={onActive}\n onMouseMove={onActive}\n onMouseDown={(event) => {\n event.preventDefault()\n onSelect()\n }}\n >\n <div className=\"clarify-search-result-title\">\n <HighlightQuery text={result.title} query={query} />\n </div>\n {hierarchy.length > 0 ? (\n <div className=\"clarify-search-result-hierarchy mt-1 truncate whitespace-nowrap\">\n {hierarchy.map((item, itemIndex, items) => (\n <Fragment key={`${item}-${itemIndex}`}>\n <HighlightQuery text={item} query={query} />\n <span className={itemIndex === items.length - 1 ? 'sr-only' : 'clarify-search-result-separator mx-2'}>/</span>\n </Fragment>\n ))}\n </div>\n ) : null}\n {result.type === 'full-text' && result.excerpt ? (\n <p className=\"clarify-search-result-excerpt mt-1 line-clamp-2 text-xs leading-5 text-(--clarify-theme-tokens-colors-muted)\">\n <HighlightExcerpt excerpt={result.excerpt} query={query} />\n </p>\n ) : null}\n </li>\n )\n}\n","import { Dialog, DialogBackdrop, DialogPanel } from '@headlessui/react'\nimport clsx from 'clsx'\nimport { SearchX } from 'lucide-react'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { useLocation, useNavigate } from 'react-router-dom'\n\nimport { useBuiltInText } from '../../i18n'\nimport type { NavigationNode, RouteItem } from '../../types'\n\nimport { buildSearchItems } from './items'\nimport { loadPagefind, normalizePagefindUrl, pagefindCacheKey } from './pagefind'\nimport { SearchInput } from './SearchInput'\nimport { SearchResult } from './SearchResult'\nimport type { FullTextSearchItem, Pagefind, SearchDisplayItem } from './types'\n\ntype SearchDialogProps = {\n open: boolean\n setOpen: (open: boolean) => void\n routes: RouteItem[]\n navigation: NavigationNode[]\n routePrefix: string\n assetPrefix: string\n currentLocale?: string\n className?: string\n onNavigate?: () => void\n}\n\ntype PagefindState = {\n key: string\n pagefind: Pagefind | null\n available: boolean\n}\n\ntype FullTextSearchState = {\n key: string\n results: FullTextSearchItem[] | null\n}\n\ntype UseSearchDialogLifecycleArgs = {\n open: boolean\n setOpen: (open: boolean) => void\n}\n\nfunction useSearchDialogLifecycle(arg0: UseSearchDialogLifecycleArgs) {\n const { open, setOpen } = arg0\n const location = useLocation()\n\n useEffect(() => {\n setOpen(false)\n }, [location.pathname, location.search, location.hash, setOpen])\n\n useEffect(() => {\n if (typeof window === 'undefined') return undefined\n if (open) return undefined\n\n function onKeyDown(event: KeyboardEvent) {\n if (event.key === 'k' && (event.metaKey || event.ctrlKey)) {\n event.preventDefault()\n setOpen(true)\n }\n }\n\n window.addEventListener('keydown', onKeyDown)\n return () => window.removeEventListener('keydown', onKeyDown)\n }, [open, setOpen])\n}\n\ntype UseSearchDataArgs = {\n query: string\n searchItems: ReturnType<typeof buildSearchItems>\n routePrefix: string\n assetPrefix: string\n currentLocale?: string\n}\n\ntype SearchDataState = {\n results: SearchDisplayItem[]\n searchInputLoading: boolean\n showNoResults: boolean\n}\n\nfunction useSearchData(arg0: UseSearchDataArgs): SearchDataState {\n const { query, searchItems, routePrefix, assetPrefix, currentLocale } = arg0\n const [fullTextState, setFullTextState] = useState<FullTextSearchState | null>(null)\n const [pagefindState, setPagefindState] = useState<PagefindState | null>(null)\n\n const quickResults = useMemo(() => {\n const normalizedQuery = query.trim().toLowerCase()\n if (!normalizedQuery) return []\n return searchItems.filter((item) => item.keywords.includes(normalizedQuery)).slice(0, 8).map((item) => ({ ...item, type: 'quick' as const }))\n }, [query, searchItems])\n\n const pagefindKey = pagefindCacheKey(assetPrefix, currentLocale)\n const activePagefindState = pagefindState?.key === pagefindKey ? pagefindState : null\n const pagefind = activePagefindState?.pagefind ?? null\n const pagefindAvailable = activePagefindState?.available ?? null\n const trimmedQuery = query.trim()\n const fullTextKey = `${pagefindKey}:${trimmedQuery}`\n const fullTextResults = fullTextState?.key === fullTextKey ? fullTextState.results : null\n const results: SearchDisplayItem[] = fullTextResults ?? quickResults\n const searchInputLoading = pagefindAvailable === null || Boolean(trimmedQuery && pagefind && fullTextState?.key !== fullTextKey)\n const showNoResults = Boolean(query.trim()) && results.length === 0 && pagefindAvailable !== null\n\n useEffect(() => {\n let cancelled = false\n\n loadPagefind(assetPrefix, currentLocale).then((loadedPagefind) => {\n if (cancelled) return\n setPagefindState({ key: pagefindKey, pagefind: loadedPagefind, available: Boolean(loadedPagefind) })\n })\n\n return () => {\n cancelled = true\n }\n }, [assetPrefix, currentLocale, pagefindKey])\n\n useEffect(() => {\n let cancelled = false\n if (!trimmedQuery || !pagefind) return undefined\n\n Promise.resolve().then(async () => {\n if (cancelled) return\n\n try {\n const search = await pagefind.search(trimmedQuery, { limit: 8 })\n const data = await Promise.all(search.results.map(async (result) => ({ id: result.id, data: await result.data() })))\n if (cancelled) return\n setFullTextState({\n key: fullTextKey,\n results: data.map(({ id, data }) => ({\n type: 'full-text',\n id,\n title: data.meta.title || data.url,\n url: normalizePagefindUrl(data.url, routePrefix),\n excerpt: data.excerpt,\n })),\n })\n } catch (error: unknown) {\n console.warn('[clarify:search] Pagefind search failed', { currentLocale, query: trimmedQuery, error })\n if (!cancelled) setFullTextState({ key: fullTextKey, results: null })\n }\n })\n\n return () => {\n cancelled = true\n }\n }, [currentLocale, fullTextKey, pagefind, routePrefix, trimmedQuery])\n\n return {\n results,\n searchInputLoading,\n showNoResults,\n }\n}\n\nexport function SearchDialog(arg0: SearchDialogProps) {\n const {\n open,\n setOpen,\n routes,\n navigation,\n routePrefix,\n assetPrefix,\n currentLocale,\n className,\n onNavigate = () => {},\n } = arg0\n\n const t = useBuiltInText()\n const navigate = useNavigate()\n const inputRef = useRef<React.ElementRef<typeof SearchInput>>(null)\n const [query, setQuery] = useState('')\n const [activeIndex, setActiveIndex] = useState(0)\n const searchItems = useMemo(() => buildSearchItems(routes, navigation), [navigation, routes])\n\n useSearchDialogLifecycle({ open, setOpen })\n const { results, searchInputLoading, showNoResults } = useSearchData({ query, searchItems, routePrefix, assetPrefix, currentLocale })\n\n const updateQuery = (value: string) => {\n setQuery(value)\n setActiveIndex(0)\n }\n\n function closeDialog() {\n updateQuery('')\n setOpen(false)\n }\n\n function selectResult(result = results[activeIndex]) {\n if (!result) return\n navigate(result.url)\n onNavigate()\n closeDialog()\n }\n\n function renderResultsPanel() {\n return (\n <div className=\"border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5\">\n {showNoResults ? (\n <div className=\"p-6 text-center\">\n <SearchX className=\"mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600\" />\n <p className=\"mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400\">\n {t('search.noResults', { query })}\n </p>\n </div>\n ) : null}\n {results.length ? (\n <ul id=\"clarify-search-results\" className=\"clarify-search-results\" role=\"listbox\">\n {results.map((result, resultIndex) => (\n <SearchResult\n key={result.type === 'full-text' ? result.id : result.url}\n result={result}\n query={query}\n active={resultIndex === activeIndex}\n onActive={() => setActiveIndex(resultIndex)}\n onSelect={() => selectResult(result)}\n />\n ))}\n </ul>\n ) : null}\n </div>\n )\n }\n\n return (\n <Dialog open={open} onClose={closeDialog} className={clsx('clarify-search-dialog fixed inset-0 z-50', className)}>\n <DialogBackdrop\n transition\n className=\"clarify-search-backdrop clarify-ui-backdrop fixed inset-0 backdrop-blur-xs data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in\"\n />\n\n <div className=\"fixed inset-0 overflow-y-auto px-4 py-4 sm:px-6 sm:py-20 md:py-32 lg:px-8 lg:py-(--clarify-search-dialog-padding-block-lg)\">\n <DialogPanel\n transition\n className=\"clarify-search-panel mx-auto transform-gpu overflow-hidden rounded-(--clarify-theme-tokens-radius-lg) bg-(--clarify-theme-tokens-colors-surface) shadow-xl ring-1 ring-(--clarify-theme-tokens-colors-border) data-closed:scale-95 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:max-w-xl dark:bg-zinc-900 dark:ring-zinc-800\"\n onKeyDown={(event) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n setActiveIndex((index) => (results.length ? (index + 1) % results.length : 0))\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n setActiveIndex((index) => (results.length ? (index - 1 + results.length) % results.length : 0))\n }\n }}\n >\n <SearchInput\n ref={inputRef}\n query={query}\n setQuery={updateQuery}\n onClose={closeDialog}\n onSubmit={() => selectResult()}\n loading={searchInputLoading}\n />\n {renderResultsPanel()}\n </DialogPanel>\n </div>\n </Dialog>\n )\n}\n\nexport default SearchDialog\n"],"mappings":";;;;;;;;;AAIA,SAAS,iBAAiB,YAA8B;CACtD,MAAM,yBAAS,IAAI,IAAoB;CAEvC,KAAK,MAAM,QAAQ,YACjB,IAAI,KAAK,UAAU,QACjB,KAAK,MAAM,SAAS,KAAK,UACvB,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AC,SAAD,EAAS,WAAU,yFAA0F,CAAA,GAC7G,oBAAC,KAAD;KAAG,WAAU;eACV,EAAE,oBAAoB,EAAE,MAAM,CAAC;IAC/B,CAAA,CACA;QACH,MACH,QAAQ,SACP,oBAAC,MAAD;IAAI,IAAG;IAAyB,WAAU;IAAyB,MAAK;cACrE,QAAQ,KAAK,QAAQ,gBACpB,oBAAC,cAAD;KAEU;KACD;KACP,QAAQ,gBAAgB;KACxB,gBAAgB,eAAe,WAAW;KAC1C,gBAAgB,aAAa,MAAM;IACpC,GANM,OAAO,SAAS,cAAc,OAAO,KAAK,OAAO,GAMvD,CACF;GACC,CAAA,IACF,IACD;;CAET;CAEA,OACE,qBAAC,QAAD;EAAc;EAAM,SAAS;EAAa,WAAW,KAAK,4CAA4C,SAAS;YAA/G,CACE,oBAAC,gBAAD;GACE,YAAA;GACA,WAAU;EACX,CAAA,GAED,oBAAC,OAAD;GAAK,WAAU;aACb,qBAAC,aAAD;IACE,YAAA;IACA,WAAU;IACV,YAAY,UAAU;KACpB,IAAI,MAAM,QAAQ,aAAa;MAC7B,MAAM,eAAe;MACrB,gBAAgB,UAAW,QAAQ,UAAU,QAAQ,KAAK,QAAQ,SAAS,CAAE;KAC/E;KACA,IAAI,MAAM,QAAQ,WAAW;MAC3B,MAAM,eAAe;MACrB,gBAAgB,UAAW,QAAQ,UAAU,QAAQ,IAAI,QAAQ,UAAU,QAAQ,SAAS,CAAE;KAChG;IACF;cAZF,CAcE,oBAAC,aAAD;KACE,KAAK;KACE;KACP,UAAU;KACV,SAAS;KACT,gBAAgB,aAAa;KAC7B,SAAS;IACV,CAAA,GACA,mBAAmB,CACT;;EACV,CAAA,CACC;;AAEZ"}
@@ -1,9 +1,10 @@
1
1
  import { RuntimeSlotRegistry } from '../slots';
2
- import { RouteItem, NavigationTree } from '../types';
2
+ import { RouteItem, NavigationNode, NavigationTree } from '../types';
3
3
  export type AppShellProps = {
4
4
  routes: RouteItem[];
5
5
  navigation: NavigationTree;
6
6
  runtimeSlots?: RuntimeSlotRegistry;
7
7
  };
8
8
  export declare function scrollToHash(hash: string): () => void;
9
+ export declare function resolvePageLayout(route: RouteItem | undefined, navigation: NavigationNode[], pathname: string): 'documentation' | 'blog';
9
10
  export declare function AppShell(arg0: AppShellProps): import("react").JSX.Element;
@@ -2,10 +2,16 @@ import { ReactNode } from 'react';
2
2
  import { RouteItem } from '../types';
3
3
  type PageActionsContextValue = {
4
4
  route?: RouteItem;
5
+ locale?: string;
5
6
  };
6
7
  type PageActionsProviderProps = PageActionsContextValue & {
7
8
  children: ReactNode;
8
9
  };
10
+ type PageMetadataProps = {
11
+ updatedAt?: string;
12
+ locale?: string;
13
+ };
9
14
  export declare function PageActionsProvider(props: PageActionsProviderProps): import("react").JSX.Element;
10
15
  export declare function PageActions(): import("react").JSX.Element;
16
+ export declare function PageMetadata(props: PageMetadataProps): import("react").JSX.Element;
11
17
  export {};
@@ -0,0 +1,6 @@
1
+ type PageUpdatedAtProps = {
2
+ updatedAt?: string;
3
+ locale?: string;
4
+ };
5
+ export declare function PageUpdatedAt(props: PageUpdatedAtProps): import("react").JSX.Element | null;
6
+ export {};
package/output/client.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_ClarifyShell = require("./ClarifyShell-GCXbb_AF.cjs");
3
- const require_PageActions = require("./PageActions-DxGK-444.cjs");
4
- const require_render = require("./render-D8h-jcnw.cjs");
2
+ const require_ClarifyShell = require("./ClarifyShell-DLOGS18o.cjs");
3
+ const require_PageActions = require("./PageActions-CVOTIuxh.cjs");
4
+ const require_render = require("./render-TErh9x_2.cjs");
5
5
  exports.ThemeEditor = require_ClarifyShell.ThemeEditor;
6
6
  exports.applyThemeVariables = require_ClarifyShell.applyThemeVariables;
7
7
  exports.getStoredLocalePreference = require_PageActions.getStoredLocalePreference;
package/output/client.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as themeBootstrapScript, i as themeEditorPresets, n as ThemeEditor, r as applyThemeVariables, s as themeStorageKey } from "./ClarifyShell-nV23Fn7m.js";
2
- import { S as themeCookieName, _ as getStoredThemePreference, b as storeLocalePreference, g as getStoredLocalePreference, v as localeCookieName, x as storeThemePreference, y as readLocaleCookie } from "./PageActions-BbmyFeSk.js";
3
- import { t as render } from "./render-CAtVGsQF.js";
1
+ import { a as themeBootstrapScript, i as themeEditorPresets, n as ThemeEditor, r as applyThemeVariables, s as themeStorageKey } from "./ClarifyShell-DGm_R5Bp.js";
2
+ import { C as themeCookieName, S as storeThemePreference, _ as getStoredLocalePreference, b as readLocaleCookie, v as getStoredThemePreference, x as storeLocalePreference, y as localeCookieName } from "./PageActions-D52u18C8.js";
3
+ import { t as render } from "./render-D_QvIv7Z.js";
4
4
  export { ThemeEditor, applyThemeVariables, getStoredLocalePreference, getStoredThemePreference, localeCookieName, readLocaleCookie, render, storeLocalePreference, storeThemePreference, themeBootstrapScript, themeCookieName, themeEditorPresets, themeStorageKey };
@@ -19,6 +19,7 @@ export type NavigationNode = {
19
19
  path: string;
20
20
  title: string;
21
21
  icon?: string;
22
+ layout?: 'documentation' | 'blog';
22
23
  children?: NavigationNode[];
23
24
  sections?: RouteSection[];
24
25
  };
@@ -38,6 +39,8 @@ export type RouteItem = {
38
39
  sections?: RouteSection[];
39
40
  contentArtifactUrl?: string;
40
41
  sourceEditUrl?: string;
42
+ layout?: 'documentation' | 'blog';
43
+ updatedAt?: string;
41
44
  };
42
45
  export type LogoConfig = string | {
43
46
  light?: string;
@@ -58,18 +61,17 @@ export type LocalesConfig = {
58
61
  missing: 'fallback' | '404' | 'hide';
59
62
  locales: LocaleConfig[];
60
63
  };
61
- export type NavbarLink = {
64
+ export type LinkConfig = {
62
65
  label: LocalizedText;
63
66
  href: string;
64
- external?: boolean;
65
67
  };
66
68
  export type BannerConfig = {
67
69
  content: LocalizedText;
68
70
  dismissible?: boolean;
69
- link?: NavbarLink;
71
+ link?: LinkConfig;
70
72
  };
71
73
  export type FooterConfig = {
72
- links?: NavbarLink[];
74
+ links?: LinkConfig[];
73
75
  socials?: Record<string, string>;
74
76
  copyright?: LocalizedText;
75
77
  };
@@ -131,6 +133,7 @@ export type PagesItem = string | {
131
133
  export type PagesGroup = {
132
134
  group: LocalizedText;
133
135
  icon?: string;
136
+ layout?: 'documentation' | 'blog';
134
137
  pages: PagesItem[];
135
138
  };
136
139
  export type PagesConfig = PagesGroup[] | 'FileTree';
@@ -140,8 +143,20 @@ export type TabItem = {
140
143
  pages?: PagesConfig;
141
144
  };
142
145
  export type TabsConfig = TabItem[];
146
+ export type NavbarMenuItem = {
147
+ label: LocalizedText;
148
+ description?: LocalizedText;
149
+ icon?: string;
150
+ } & ({
151
+ href: string;
152
+ } | {
153
+ page: string;
154
+ } | {
155
+ items: NavbarMenuItem[];
156
+ });
157
+ export type NavbarMenu = NavbarMenuItem;
143
158
  export type NavigationConfig = {
144
- links?: NavbarLink[];
159
+ menus?: NavbarMenu[];
145
160
  tabs?: TabsConfig;
146
161
  };
147
162
  export type FeaturesConfig = {
@@ -178,6 +193,7 @@ export type Config = {
178
193
  banner?: BannerConfig;
179
194
  footer?: FooterConfig;
180
195
  locales?: LocalesConfig;
196
+ defaultLocale?: string;
181
197
  variables?: VariablesConfig;
182
198
  features: FeaturesConfig;
183
199
  version?: string;
@@ -399,7 +399,7 @@ function translateBuiltInText(locale, key, replacements = {}) {
399
399
  function useBuiltInText(locale) {
400
400
  const config = (0, react.useContext)(ConfigContext);
401
401
  const currentLocale = (0, react.useContext)(LocaleContext);
402
- const resolvedLocale = locale ?? currentLocale ?? config?.locales?.default;
402
+ const resolvedLocale = locale ?? currentLocale ?? config?.locales?.default ?? config?.defaultLocale;
403
403
  return (key, replacements) => translateBuiltInText(resolvedLocale, key, replacements);
404
404
  }
405
405
  //#endregion
@@ -464,4 +464,4 @@ Object.defineProperty(exports, "useOpenApiSpecs", {
464
464
  }
465
465
  });
466
466
 
467
- //# sourceMappingURL=i18n-BuvwT5W9.cjs.map
467
+ //# sourceMappingURL=i18n-BMNCgF9o.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-BuvwT5W9.cjs","names":[],"sources":["../source/core/context.tsx","../source/core/locales/en.json","../source/core/locales/zh-CN.json","../source/core/i18n.ts"],"sourcesContent":["import { createContext, useContext, useState } from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { Config, OpenApiRegistry } from './types'\n\nexport const ConfigContext = createContext<Config | null>(null)\nexport type ConfigUpdater = (update: Config | ((config: Config) => Config)) => void\nconst ConfigUpdaterContext = createContext<ConfigUpdater | null>(null)\nexport const LocaleContext = createContext<string | undefined>(undefined)\nexport const OpenApiSpecsContext = createContext<OpenApiRegistry>({})\n\nexport type ConfigProviderProps = {\n config: Config\n children: ReactNode\n}\n\nexport function ConfigProvider(props: ConfigProviderProps) {\n const { config: initialConfig, children } = props\n const [config, setConfig] = useState(initialConfig)\n\n return (\n <ConfigContext.Provider value={config}>\n <ConfigUpdaterContext.Provider value={setConfig}>\n {children}\n </ConfigUpdaterContext.Provider>\n </ConfigContext.Provider>\n )\n}\n\nexport function useConfig(): Config {\n const config = useContext(ConfigContext)\n if (!config) {\n throw new Error(\n '[clarify] useConfig must be used within a ConfigContext.Provider'\n )\n }\n return config\n}\n\nexport function useConfigOptional(): Config | null {\n return useContext(ConfigContext)\n}\n\nexport function useConfigUpdater(): ConfigUpdater {\n const updater = useContext(ConfigUpdaterContext)\n if (!updater) {\n throw new Error('[clarify] useConfigUpdater must be used within a ConfigProvider')\n }\n return updater\n}\n\nexport function useConfigUpdaterOptional(): ConfigUpdater | null {\n return useContext(ConfigUpdaterContext)\n}\n\nexport function useLocale(): string | undefined {\n return useContext(LocaleContext)\n}\n\nexport function useOpenApiSpecs(): OpenApiRegistry {\n return useContext(OpenApiSpecsContext)\n}\n","{\n \"actions.code\": \"Code\",\n \"actions.copy\": \"Copy\",\n \"actions.copying\": \"Copying...\",\n \"actions.copied\": \"Copied!\",\n \"actions.copyFailed\": \"Copy failed\",\n \"builtWith.label\": \"Built with Clarify\",\n \"builtWith.prefix\": \"Built with\",\n \"callout.danger\": \"Danger\",\n \"callout.info\": \"Info\",\n \"callout.note\": \"Note\",\n \"callout.success\": \"Success\",\n \"callout.tip\": \"Tip\",\n \"callout.warning\": \"Warning\",\n \"contentActions.copyContent\": \"Copy page\",\n \"contentActions.copyContentDescription\": \"Copy this page as {contentType} for LLMs\",\n \"contentActions.copyLink\": \"Copy {contentType} link\",\n \"contentActions.copyLinkDescription\": \"Copy the raw {contentType} content link for this page\",\n \"contentActions.copyLlms\": \"Copy llms.txt\",\n \"contentActions.copyLlmsDescription\": \"Copy the llms.txt link for this site\",\n \"contentActions.copiedLlms\": \"Copied llms.txt\",\n \"contentActions.copiedMcpConfig\": \"Copied MCP config\",\n \"contentActions.mcpConfig\": \"Copy MCP config\",\n \"contentActions.mcpConfigDescription\": \"Copy this site's MCP server configuration\",\n \"contentActions.editPage\": \"Edit this page\",\n \"contentActions.editPageDescription\": \"Open the source file for this page\",\n \"contentActions.copyOptions\": \"Choose copy option\",\n \"contentActions.copiedContent\": \"Copied page\",\n \"contentActions.copiedLink\": \"Copied link\",\n \"contentActions.viewMarkdown\": \"View as Markdown\",\n \"contentActions.viewMarkdownDescription\": \"View this page as plain text\",\n \"contentActions.viewOpenApi\": \"View raw OpenAPI\",\n \"contentActions.viewOpenApiDescription\": \"Open the API description file in a new tab\",\n \"feedback.no\": \"No\",\n \"feedback.prompt\": \"Was this page helpful?\",\n \"feedback.thanks\": \"Thanks for your feedback!\",\n \"feedback.yes\": \"Yes\",\n \"navigation.documentation\": \"Documentation\",\n \"navigation.next\": \"Next\",\n \"navigation.previous\": \"Previous\",\n \"navigation.previousNext\": \"Previous and next pages\",\n \"navigation.toggle\": \"Toggle navigation\",\n \"navbar.home\": \"Home\",\n \"navbar.openLinks\": \"Open navigation links\",\n \"navbar.sections\": \"Documentation sections\",\n \"notFound.description\": \"The page may have moved, been renamed, or never existed. Check the address or return to the homepage.\",\n \"notFound.home\": \"Back to homepage\",\n \"notFound.label\": \"404\",\n \"notFound.title\": \"Page not found\",\n \"openapi.apiDocumentation\": \"API Documentation\",\n \"openapi.authentication\": \"Authentication\",\n \"openapi.authAnd\": \"AND\",\n \"openapi.authApiKey\": \"API key\",\n \"openapi.authBearerFormat\": \"Bearer format: {format}\",\n \"openapi.authLocation\": \"{in} parameter: {name}\",\n \"openapi.authNoAuth\": \"No authentication required\",\n \"openapi.authOr\": \"OR\",\n \"openapi.authScopes\": \"Scopes: {scopes}\",\n \"openapi.bodyProperties\": \"Body properties\",\n \"openapi.collapse\": \"Collapse\",\n \"openapi.clear\": \"Clear\",\n \"openapi.codeSnippet\": \"Code snippet\",\n \"openapi.endpointNotFound\": \"Operation not found or operationId is not unique: {endpoint}\",\n \"openapi.example\": \"Example\",\n \"openapi.expand\": \"Expand\",\n \"openapi.headers\": \"Headers\",\n \"openapi.headerName\": \"Name\",\n \"openapi.headerValue\": \"Value\",\n \"openapi.headerParameters\": \"Header parameters\",\n \"openapi.fieldDescription\": \"Field description\",\n \"openapi.includeParameter\": \"Include parameter\",\n \"openapi.cookieParameters\": \"Cookie parameters\",\n \"openapi.cookieParametersBrowserManaged\": \"Cookies are managed by the browser. Matching cookies are sent when the server allows credentialed requests.\",\n \"openapi.cookies\": \"Cookies\",\n \"openapi.cookiesBrowserHidden\": \"Cookies are managed by the browser. Set-Cookie values are not exposed to JavaScript.\",\n \"openapi.language\": \"Language\",\n \"openapi.client\": \"Client\",\n \"openapi.closeRequest\": \"Close request tester\",\n \"openapi.credential\": \"Credential\",\n \"openapi.loading\": \"Loading OpenAPI spec...\",\n \"openapi.mediaType\": \"Media type\",\n \"openapi.none\": \"None\",\n \"openapi.noRequestConfiguration\": \"This request has no parameters, authentication, variables, or request body. It is ready to send as-is.\",\n \"openapi.openApiReference\": \"OpenAPI Reference\",\n \"openapi.operationParameter\": \"Operation parameter.\",\n \"openapi.optional\": \"Optional.\",\n \"openapi.parameter\": \"parameter\",\n \"openapi.parameterInvalidArray\": \"Enter a valid JSON array.\",\n \"openapi.parameterInvalidDate\": \"Enter a valid date.\",\n \"openapi.parameterInvalidDateTime\": \"Enter a valid date and time.\",\n \"openapi.parameterInvalidEnum\": \"Select one of the allowed values.\",\n \"openapi.parameterInvalidInteger\": \"Enter a whole number.\",\n \"openapi.parameterInvalidNumber\": \"Enter a valid number.\",\n \"openapi.parameterInvalidObject\": \"Enter a valid JSON object.\",\n \"openapi.pathParameters\": \"Path parameters\",\n \"openapi.queryParameters\": \"Query parameters\",\n \"openapi.preview\": \"Preview\",\n \"openapi.raw\": \"Raw\",\n \"openapi.resetToExample\": \"Reset to example\",\n \"openapi.body\": \"Body\",\n \"openapi.binaryPreview\": \"Binary response preview is not available.\",\n \"openapi.downloadBody\": \"Download response body\",\n \"openapi.noHeaders\": \"No response headers match the current search.\",\n \"openapi.responseViews\": \"Response views\",\n \"openapi.responseUrl\": \"Final URL\",\n \"openapi.redirected\": \"Redirected\",\n \"openapi.searchHeaders\": \"Search response headers\",\n \"openapi.searchBodyProperties\": \"Search request body properties\",\n \"openapi.searchResponseBodyProperties\": \"Search response body properties\",\n \"openapi.noBodyProperties\": \"No request body properties match the current search.\",\n \"openapi.noResponseBodyProperties\": \"No response body properties match the current search.\",\n \"openapi.unknownContentType\": \"Unknown content type\",\n \"openapi.variables\": \"Variables\",\n \"openapi.requestConfiguration\": \"Request configuration\",\n \"openapi.requestExample\": \"Request example\",\n \"openapi.requestHeaders\": \"Request headers\",\n \"openapi.request\": \"Request\",\n \"openapi.requestBody\": \"Request body\",\n \"openapi.requestBodyEmpty\": \"No request body\",\n \"openapi.requestCorsHint\": \"The API may be unavailable from this browser because of its network or CORS policy\",\n \"openapi.responseBodyProperties\": \"Response body properties\",\n \"openapi.responseHeaders\": \"Response headers\",\n \"openapi.required\": \"Required.\",\n \"openapi.requiredBadge\": \"required\",\n \"openapi.response\": \"Response\",\n \"openapi.responseBodyEmpty\": \"The response body is empty.\",\n \"openapi.responseBodyEmptyTitle\": \"No response content\",\n \"openapi.responseEmpty\": \"Send the request to inspect the response.\",\n \"openapi.responseEmptyTitle\": \"Ready for a request\",\n \"openapi.responseErrorTitle\": \"Request failed\",\n \"openapi.streaming\": \"Streaming\",\n \"openapi.responses\": \"Responses\",\n \"openapi.schemaExample\": \"Schema example\",\n \"openapi.sendRequest\": \"Send\",\n \"openapi.sendingRequest\": \"Sending\",\n \"openapi.server\": \"Server\",\n \"openapi.scrollExamplesLeft\": \"Scroll examples left\",\n \"openapi.scrollExamplesRight\": \"Scroll examples right\",\n \"openapi.specNotFound\": \"OpenAPI spec not found: {specPath}\",\n \"openapi.specPathMissing\": \"spec or specPath was not provided\",\n \"openapi.status\": \"Status\",\n \"openapi.tryRequest\": \"Try request\",\n \"openapi.version\": \"Version {version}\",\n \"openapi.webhookResponse\": \"Webhook response\",\n \"openapi.webhookResponses\": \"Webhook responses\",\n \"search.button\": \"Search...\",\n \"search.noResults\": \"Nothing found for {query}.\",\n \"search.placeholder\": \"Find something...\",\n \"search.shortcutCtrl\": \"Ctrl \",\n \"renderError.componentStack\": \"React component stack\",\n \"renderError.description\": \"Clarify stopped rendering this route to keep the rest of the shell responsive. Review the diagnostics below, fix the page source, then reload the route.\",\n \"renderError.details\": \"Runtime diagnostics\",\n \"renderError.message\": \"Message\",\n \"renderError.path\": \"Route\",\n \"renderError.reload\": \"Reload route\",\n \"renderError.stack\": \"JavaScript stack trace\",\n \"renderError.title\": \"Route render failed\",\n \"renderError.type\": \"Error type\",\n \"renderError.version\": \"Clarify version\",\n \"theme.dark\": \"Dark\",\n \"theme.light\": \"Light\",\n \"theme.switch\": \"Switch theme\",\n \"theme.switchToDark\": \"Switch to dark theme\",\n \"theme.switchToLight\": \"Switch to light theme\",\n \"theme.switchToSystem\": \"Follow system theme\",\n \"theme.system\": \"System\",\n \"language.switch\": \"Switch language\",\n \"mermaid.zoomIn\": \"Zoom in\",\n \"mermaid.zoomOut\": \"Zoom out\",\n \"mermaid.resetZoom\": \"Reset zoom\",\n \"mermaid.renderError\": \"Mermaid render error\",\n \"mermaid.scrollHint\": \"Click the diagram to enable scroll-to-zoom\"\n}\n","{\n \"actions.code\": \"代码\",\n \"actions.copy\": \"复制\",\n \"actions.copying\": \"正在复制...\",\n \"actions.copied\": \"已复制!\",\n \"actions.copyFailed\": \"复制失败\",\n \"builtWith.label\": \"由 Clarify 构建\",\n \"builtWith.prefix\": \"构建来自\",\n \"callout.danger\": \"危险\",\n \"callout.info\": \"信息\",\n \"callout.note\": \"注意\",\n \"callout.success\": \"成功\",\n \"callout.tip\": \"提示\",\n \"callout.warning\": \"警告\",\n \"contentActions.copyContent\": \"复制页面\",\n \"contentActions.copyContentDescription\": \"将页面以 {contentType} 格式复制给 LLMs\",\n \"contentActions.copyLink\": \"复制 {contentType} 链接\",\n \"contentActions.copyLinkDescription\": \"复制当前页面的 {contentType} 原始内容链接\",\n \"contentActions.copyLlms\": \"复制 llms.txt\",\n \"contentActions.copyLlmsDescription\": \"复制此站点的 llms.txt 链接\",\n \"contentActions.copiedLlms\": \"已复制 llms.txt\",\n \"contentActions.copiedMcpConfig\": \"已复制 MCP 配置\",\n \"contentActions.mcpConfig\": \"复制 MCP 配置\",\n \"contentActions.mcpConfigDescription\": \"复制站点的 MCP server 配置\",\n \"contentActions.editPage\": \"编辑此页面\",\n \"contentActions.editPageDescription\": \"打开当前页面的源文件\",\n \"contentActions.copyOptions\": \"选择复制选项\",\n \"contentActions.copiedContent\": \"已复制页面\",\n \"contentActions.copiedLink\": \"已复制链接\",\n \"contentActions.viewMarkdown\": \"以 Markdown 格式查看\",\n \"contentActions.viewMarkdownDescription\": \"以纯文本查看此页面\",\n \"contentActions.viewOpenApi\": \"查看 OpenAPI 原始内容\",\n \"contentActions.viewOpenApiDescription\": \"在新标签页打开 API 描述文件\",\n \"feedback.no\": \"否\",\n \"feedback.prompt\": \"这个页面有帮助吗?\",\n \"feedback.thanks\": \"感谢你的反馈!\",\n \"feedback.yes\": \"是\",\n \"navigation.documentation\": \"文档\",\n \"navigation.next\": \"下一页\",\n \"navigation.previous\": \"上一页\",\n \"navigation.previousNext\": \"上一页和下一页\",\n \"navigation.toggle\": \"切换导航\",\n \"navbar.home\": \"首页\",\n \"navbar.openLinks\": \"打开导航链接\",\n \"navbar.sections\": \"文档栏目\",\n \"notFound.description\": \"页面可能已移动、重命名或不存在。请检查地址,或返回首页继续浏览。\",\n \"notFound.home\": \"返回首页\",\n \"notFound.label\": \"404\",\n \"notFound.title\": \"页面未找到\",\n \"openapi.apiDocumentation\": \"API 文档\",\n \"openapi.authentication\": \"认证方式\",\n \"openapi.authAnd\": \"并且\",\n \"openapi.authApiKey\": \"API 密钥\",\n \"openapi.authBearerFormat\": \"Bearer 格式:{format}\",\n \"openapi.authLocation\": \"{in} 参数:{name}\",\n \"openapi.authNoAuth\": \"无需认证\",\n \"openapi.authOr\": \"或者\",\n \"openapi.authScopes\": \"Scopes:{scopes}\",\n \"openapi.bodyProperties\": \"请求体属性\",\n \"openapi.collapse\": \"收起\",\n \"openapi.clear\": \"清除\",\n \"openapi.codeSnippet\": \"代码示例\",\n \"openapi.endpointNotFound\": \"未找到 operation,或 operationId 不唯一:{endpoint}\",\n \"openapi.example\": \"示例\",\n \"openapi.expand\": \"展开\",\n \"openapi.headers\": \"请求头\",\n \"openapi.headerName\": \"名称\",\n \"openapi.headerValue\": \"值\",\n \"openapi.headerParameters\": \"请求头参数\",\n \"openapi.fieldDescription\": \"字段说明\",\n \"openapi.includeParameter\": \"传递参数\",\n \"openapi.cookieParameters\": \"Cookie 参数\",\n \"openapi.cookieParametersBrowserManaged\": \"Cookie 由浏览器管理;当服务端允许携带凭据时,匹配的 Cookie 会随请求发送。\",\n \"openapi.cookies\": \"Cookies\",\n \"openapi.cookiesBrowserHidden\": \"Cookie 由浏览器管理,JavaScript 无法读取 Set-Cookie 的值。\",\n \"openapi.language\": \"语言\",\n \"openapi.client\": \"客户端\",\n \"openapi.closeRequest\": \"关闭请求测试器\",\n \"openapi.credential\": \"认证凭证\",\n \"openapi.loading\": \"正在加载 OpenAPI 描述文件...\",\n \"openapi.mediaType\": \"媒体类型\",\n \"openapi.none\": \"无\",\n \"openapi.noRequestConfiguration\": \"此请求没有参数、认证、变量或请求体,可以直接发送。\",\n \"openapi.openApiReference\": \"OpenAPI 参考\",\n \"openapi.operationParameter\": \"操作参数。\",\n \"openapi.optional\": \"可选。\",\n \"openapi.parameter\": \"参数\",\n \"openapi.parameterInvalidArray\": \"请输入有效的 JSON 数组。\",\n \"openapi.parameterInvalidDate\": \"请输入有效日期。\",\n \"openapi.parameterInvalidDateTime\": \"请输入有效的日期和时间。\",\n \"openapi.parameterInvalidEnum\": \"请选择允许的值。\",\n \"openapi.parameterInvalidInteger\": \"请输入整数。\",\n \"openapi.parameterInvalidNumber\": \"请输入有效数字。\",\n \"openapi.parameterInvalidObject\": \"请输入有效的 JSON 对象。\",\n \"openapi.pathParameters\": \"路径参数\",\n \"openapi.queryParameters\": \"查询参数\",\n \"openapi.preview\": \"预览\",\n \"openapi.raw\": \"原始内容\",\n \"openapi.resetToExample\": \"重置为示例\",\n \"openapi.body\": \"响应体\",\n \"openapi.binaryPreview\": \"暂不支持预览二进制响应。\",\n \"openapi.downloadBody\": \"下载响应体\",\n \"openapi.noHeaders\": \"没有匹配当前搜索的响应头。\",\n \"openapi.responseViews\": \"响应视图\",\n \"openapi.responseUrl\": \"最终 URL\",\n \"openapi.redirected\": \"已重定向\",\n \"openapi.searchHeaders\": \"搜索响应头\",\n \"openapi.searchBodyProperties\": \"搜索请求体属性\",\n \"openapi.searchResponseBodyProperties\": \"搜索响应体属性\",\n \"openapi.noBodyProperties\": \"没有匹配当前搜索的请求体属性。\",\n \"openapi.noResponseBodyProperties\": \"没有匹配当前搜索的响应体属性。\",\n \"openapi.unknownContentType\": \"未知内容类型\",\n \"openapi.variables\": \"变量\",\n \"openapi.requestConfiguration\": \"请求配置\",\n \"openapi.requestExample\": \"请求示例\",\n \"openapi.requestHeaders\": \"请求头\",\n \"openapi.request\": \"请求\",\n \"openapi.requestBody\": \"请求体\",\n \"openapi.requestBodyEmpty\": \"暂无请求体\",\n \"openapi.requestCorsHint\": \"受目标 API 的网络或 CORS 策略影响,浏览器可能无法直接访问\",\n \"openapi.responseBodyProperties\": \"响应体属性\",\n \"openapi.responseHeaders\": \"响应头\",\n \"openapi.required\": \"必填。\",\n \"openapi.requiredBadge\": \"必填\",\n \"openapi.response\": \"响应\",\n \"openapi.responseBodyEmpty\": \"响应体为空。\",\n \"openapi.responseBodyEmptyTitle\": \"无响应内容\",\n \"openapi.responseEmpty\": \"发送请求后在这里查看响应。\",\n \"openapi.responseEmptyTitle\": \"等待发送请求\",\n \"openapi.responseErrorTitle\": \"请求失败\",\n \"openapi.streaming\": \"正在接收\",\n \"openapi.responses\": \"响应\",\n \"openapi.schemaExample\": \"Schema 示例\",\n \"openapi.sendRequest\": \"发送\",\n \"openapi.sendingRequest\": \"发送中\",\n \"openapi.server\": \"服务地址\",\n \"openapi.scrollExamplesLeft\": \"向左滚动示例\",\n \"openapi.scrollExamplesRight\": \"向右滚动示例\",\n \"openapi.specNotFound\": \"未找到 OpenAPI 描述文件:{specPath}\",\n \"openapi.specPathMissing\": \"未提供 spec 或 specPath\",\n \"openapi.status\": \"状态\",\n \"openapi.tryRequest\": \"发起测试请求\",\n \"openapi.version\": \"版本 {version}\",\n \"openapi.webhookResponse\": \"Webhook 响应\",\n \"openapi.webhookResponses\": \"Webhook 响应\",\n \"search.button\": \"搜索...\",\n \"search.noResults\": \"没有找到与 {query} 相关的结果。\",\n \"search.placeholder\": \"搜索内容...\",\n \"search.shortcutCtrl\": \"Ctrl \",\n \"renderError.componentStack\": \"React 组件栈\",\n \"renderError.description\": \"Clarify 已停止渲染此路由,以保证文档 Shell 仍可响应。请查看下方诊断信息,修复页面源码后重新加载路由。\",\n \"renderError.details\": \"运行时诊断\",\n \"renderError.message\": \"错误消息\",\n \"renderError.path\": \"路由\",\n \"renderError.reload\": \"重新加载路由\",\n \"renderError.stack\": \"JavaScript 堆栈\",\n \"renderError.title\": \"路由渲染失败\",\n \"renderError.type\": \"错误类型\",\n \"renderError.version\": \"Clarify 版本\",\n \"theme.dark\": \"深色\",\n \"theme.light\": \"浅色\",\n \"theme.switch\": \"切换主题\",\n \"theme.switchToDark\": \"切换到深色主题\",\n \"theme.switchToLight\": \"切换到浅色主题\",\n \"theme.switchToSystem\": \"跟随系统主题\",\n \"theme.system\": \"跟随系统\",\n \"language.switch\": \"切换语言\",\n \"mermaid.zoomIn\": \"放大\",\n \"mermaid.zoomOut\": \"缩小\",\n \"mermaid.resetZoom\": \"重置缩放\",\n \"mermaid.renderError\": \"Mermaid 渲染错误\",\n \"mermaid.scrollHint\": \"点击图表后即可滚轮缩放\"\n}\n","import { useContext } from 'react'\n\nimport { ConfigContext, LocaleContext } from './context'\nimport enText from './locales/en.json'\nimport zhCNText from './locales/zh-CN.json'\n\nexport type BuiltInLocale = 'en' | 'zh-CN'\n\nexport type BuiltInTextKey = keyof typeof enText\n\nconst checkedZhCNText: Record<BuiltInTextKey, string> & Record<Exclude<keyof typeof zhCNText, BuiltInTextKey>, never> = zhCNText\n\nconst builtInText: Record<BuiltInLocale, Record<BuiltInTextKey, string>> = {\n en: enText,\n 'zh-CN': checkedZhCNText,\n}\n\nexport function resolveBuiltInLocale(locale?: string): BuiltInLocale {\n return locale === 'zh-CN' || locale?.toLowerCase().startsWith('zh') ? 'zh-CN' : 'en'\n}\n\nexport function translateBuiltInText(locale: string | undefined, key: BuiltInTextKey, replacements: Record<string, string> = {}): string {\n let value = builtInText[resolveBuiltInLocale(locale)]?.[key] ?? builtInText.en[key]\n for (const [name, replacement] of Object.entries(replacements)) {\n value = value.replaceAll(`{${name}}`, replacement)\n }\n return value\n}\n\nexport function useBuiltInText(locale?: string) {\n const config = useContext(ConfigContext)\n const currentLocale = useContext(LocaleContext)\n const resolvedLocale = locale ?? currentLocale ?? config?.locales?.default\n return (key: BuiltInTextKey, replacements?: Record<string, string>) => translateBuiltInText(resolved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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAA;CACJ,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAA;AACX;AAEA,SAAgB,qBAAqB,QAAgC;CACnE,OAAO,WAAW,WAAW,QAAQ,YAAY,CAAC,CAAC,WAAW,IAAI,IAAI,UAAU;AAClF;AAEA,SAAgB,qBAAqB,QAA4B,KAAqB,eAAuC,CAAC,GAAW;CACvI,IAAI,QAAQ,YAAY,qBAAqB,MAAM,EAAE,GAAG,QAAQ,YAAY,GAAG;CAC/E,KAAK,MAAM,CAAC,MAAM,gBAAgB,OAAO,QAAQ,YAAY,GAC3D,QAAQ,MAAM,WAAW,IAAI,KAAK,IAAI,WAAW;CAEnD,OAAO;AACT;AAEA,SAAgB,eAAe,QAAiB;CAC9C,MAAM,UAAA,GAAA,MAAA,WAAA,CAAoB,aAAa;CACvC,MAAM,iBAAA,GAAA,MAAA,WAAA,CAA2B,aAAa;CAC9C,MAAM,iBAAiB,UAAU,iBAAiB,QAAQ,SAAS;CACnE,QAAQ,KAAqB,iBAA0C,qBAAqB,gBAAgB,KAAK,YAAY;AAC/H"}
1
+ {"version":3,"file":"i18n-BMNCgF9o.cjs","names":[],"sources":["../source/core/context.tsx","../source/core/locales/en.json","../source/core/locales/zh-CN.json","../source/core/i18n.ts"],"sourcesContent":["import { createContext, useContext, useState } from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { Config, OpenApiRegistry } from './types'\n\nexport const ConfigContext = createContext<Config | null>(null)\nexport type ConfigUpdater = (update: Config | ((config: Config) => Config)) => void\nconst ConfigUpdaterContext = createContext<ConfigUpdater | null>(null)\nexport const LocaleContext = createContext<string | undefined>(undefined)\nexport const OpenApiSpecsContext = createContext<OpenApiRegistry>({})\n\nexport type ConfigProviderProps = {\n config: Config\n children: ReactNode\n}\n\nexport function ConfigProvider(props: ConfigProviderProps) {\n const { config: initialConfig, children } = props\n const [config, setConfig] = useState(initialConfig)\n\n return (\n <ConfigContext.Provider value={config}>\n <ConfigUpdaterContext.Provider value={setConfig}>\n {children}\n </ConfigUpdaterContext.Provider>\n </ConfigContext.Provider>\n )\n}\n\nexport function useConfig(): Config {\n const config = useContext(ConfigContext)\n if (!config) {\n throw new Error(\n '[clarify] useConfig must be used within a ConfigContext.Provider'\n )\n }\n return config\n}\n\nexport function useConfigOptional(): Config | null {\n return useContext(ConfigContext)\n}\n\nexport function useConfigUpdater(): ConfigUpdater {\n const updater = useContext(ConfigUpdaterContext)\n if (!updater) {\n throw new Error('[clarify] useConfigUpdater must be used within a ConfigProvider')\n }\n return updater\n}\n\nexport function useConfigUpdaterOptional(): ConfigUpdater | null {\n return useContext(ConfigUpdaterContext)\n}\n\nexport function useLocale(): string | undefined {\n return useContext(LocaleContext)\n}\n\nexport function useOpenApiSpecs(): OpenApiRegistry {\n return useContext(OpenApiSpecsContext)\n}\n","{\n \"actions.code\": \"Code\",\n \"actions.copy\": \"Copy\",\n \"actions.copying\": \"Copying...\",\n \"actions.copied\": \"Copied!\",\n \"actions.copyFailed\": \"Copy failed\",\n \"builtWith.label\": \"Built with Clarify\",\n \"builtWith.prefix\": \"Built with\",\n \"callout.danger\": \"Danger\",\n \"callout.info\": \"Info\",\n \"callout.note\": \"Note\",\n \"callout.success\": \"Success\",\n \"callout.tip\": \"Tip\",\n \"callout.warning\": \"Warning\",\n \"contentActions.copyContent\": \"Copy page\",\n \"contentActions.copyContentDescription\": \"Copy this page as {contentType} for LLMs\",\n \"contentActions.copyLink\": \"Copy {contentType} link\",\n \"contentActions.copyLinkDescription\": \"Copy the raw {contentType} content link for this page\",\n \"contentActions.copyLlms\": \"Copy llms.txt\",\n \"contentActions.copyLlmsDescription\": \"Copy the llms.txt link for this site\",\n \"contentActions.copiedLlms\": \"Copied llms.txt\",\n \"contentActions.copiedMcpConfig\": \"Copied MCP config\",\n \"contentActions.mcpConfig\": \"Copy MCP config\",\n \"contentActions.mcpConfigDescription\": \"Copy this site's MCP server configuration\",\n \"contentActions.editPage\": \"Edit this page\",\n \"contentActions.editPageDescription\": \"Open the source file for this page\",\n \"contentActions.copyOptions\": \"Choose copy option\",\n \"contentActions.copiedContent\": \"Copied page\",\n \"contentActions.copiedLink\": \"Copied link\",\n \"contentActions.viewMarkdown\": \"View as Markdown\",\n \"contentActions.viewMarkdownDescription\": \"View this page as plain text\",\n \"contentActions.viewOpenApi\": \"View raw OpenAPI\",\n \"contentActions.viewOpenApiDescription\": \"Open the API description file in a new tab\",\n \"feedback.no\": \"No\",\n \"feedback.prompt\": \"Was this page helpful?\",\n \"feedback.thanks\": \"Thanks for your feedback!\",\n \"feedback.yes\": \"Yes\",\n \"navigation.documentation\": \"Documentation\",\n \"navigation.next\": \"Next\",\n \"navigation.previous\": \"Previous\",\n \"navigation.previousNext\": \"Previous and next pages\",\n \"navigation.toggle\": \"Toggle navigation\",\n \"navbar.home\": \"Home\",\n \"navbar.openLinks\": \"Open navigation links\",\n \"navbar.sections\": \"Documentation sections\",\n \"notFound.description\": \"The page may have moved, been renamed, or never existed. Check the address or return to the homepage.\",\n \"notFound.home\": \"Back to homepage\",\n \"notFound.label\": \"404\",\n \"notFound.title\": \"Page not found\",\n \"openapi.apiDocumentation\": \"API Documentation\",\n \"openapi.authentication\": \"Authentication\",\n \"openapi.authAnd\": \"AND\",\n \"openapi.authApiKey\": \"API key\",\n \"openapi.authBearerFormat\": \"Bearer format: {format}\",\n \"openapi.authLocation\": \"{in} parameter: {name}\",\n \"openapi.authNoAuth\": \"No authentication required\",\n \"openapi.authOr\": \"OR\",\n \"openapi.authScopes\": \"Scopes: {scopes}\",\n \"openapi.bodyProperties\": \"Body properties\",\n \"openapi.collapse\": \"Collapse\",\n \"openapi.clear\": \"Clear\",\n \"openapi.codeSnippet\": \"Code snippet\",\n \"openapi.endpointNotFound\": \"Operation not found or operationId is not unique: {endpoint}\",\n \"openapi.example\": \"Example\",\n \"openapi.expand\": \"Expand\",\n \"openapi.headers\": \"Headers\",\n \"openapi.headerName\": \"Name\",\n \"openapi.headerValue\": \"Value\",\n \"openapi.headerParameters\": \"Header parameters\",\n \"openapi.fieldDescription\": \"Field description\",\n \"openapi.includeParameter\": \"Include parameter\",\n \"openapi.cookieParameters\": \"Cookie parameters\",\n \"openapi.cookieParametersBrowserManaged\": \"Cookies are managed by the browser. Matching cookies are sent when the server allows credentialed requests.\",\n \"openapi.cookies\": \"Cookies\",\n \"openapi.cookiesBrowserHidden\": \"Cookies are managed by the browser. Set-Cookie values are not exposed to JavaScript.\",\n \"openapi.language\": \"Language\",\n \"openapi.client\": \"Client\",\n \"openapi.closeRequest\": \"Close request tester\",\n \"openapi.credential\": \"Credential\",\n \"openapi.loading\": \"Loading OpenAPI spec...\",\n \"openapi.mediaType\": \"Media type\",\n \"openapi.none\": \"None\",\n \"openapi.noRequestConfiguration\": \"This request has no parameters, authentication, variables, or request body. It is ready to send as-is.\",\n \"openapi.openApiReference\": \"OpenAPI Reference\",\n \"openapi.operationParameter\": \"Operation parameter.\",\n \"openapi.optional\": \"Optional.\",\n \"openapi.parameter\": \"parameter\",\n \"openapi.parameterInvalidArray\": \"Enter a valid JSON array.\",\n \"openapi.parameterInvalidDate\": \"Enter a valid date.\",\n \"openapi.parameterInvalidDateTime\": \"Enter a valid date and time.\",\n \"openapi.parameterInvalidEnum\": \"Select one of the allowed values.\",\n \"openapi.parameterInvalidInteger\": \"Enter a whole number.\",\n \"openapi.parameterInvalidNumber\": \"Enter a valid number.\",\n \"openapi.parameterInvalidObject\": \"Enter a valid JSON object.\",\n \"openapi.pathParameters\": \"Path parameters\",\n \"openapi.queryParameters\": \"Query parameters\",\n \"openapi.preview\": \"Preview\",\n \"openapi.raw\": \"Raw\",\n \"openapi.resetToExample\": \"Reset to example\",\n \"openapi.body\": \"Body\",\n \"openapi.binaryPreview\": \"Binary response preview is not available.\",\n \"openapi.downloadBody\": \"Download response body\",\n \"openapi.noHeaders\": \"No response headers match the current search.\",\n \"openapi.responseViews\": \"Response views\",\n \"openapi.responseUrl\": \"Final URL\",\n \"openapi.redirected\": \"Redirected\",\n \"openapi.searchHeaders\": \"Search response headers\",\n \"openapi.searchBodyProperties\": \"Search request body properties\",\n \"openapi.searchResponseBodyProperties\": \"Search response body properties\",\n \"openapi.noBodyProperties\": \"No request body properties match the current search.\",\n \"openapi.noResponseBodyProperties\": \"No response body properties match the current search.\",\n \"openapi.unknownContentType\": \"Unknown content type\",\n \"openapi.variables\": \"Variables\",\n \"openapi.requestConfiguration\": \"Request configuration\",\n \"openapi.requestExample\": \"Request example\",\n \"openapi.requestHeaders\": \"Request headers\",\n \"openapi.request\": \"Request\",\n \"openapi.requestBody\": \"Request body\",\n \"openapi.requestBodyEmpty\": \"No request body\",\n \"openapi.requestCorsHint\": \"The API may be unavailable from this browser because of its network or CORS policy\",\n \"openapi.responseBodyProperties\": \"Response body properties\",\n \"openapi.responseHeaders\": \"Response headers\",\n \"openapi.required\": \"Required.\",\n \"openapi.requiredBadge\": \"required\",\n \"openapi.response\": \"Response\",\n \"openapi.responseBodyEmpty\": \"The response body is empty.\",\n \"openapi.responseBodyEmptyTitle\": \"No response content\",\n \"openapi.responseEmpty\": \"Send the request to inspect the response.\",\n \"openapi.responseEmptyTitle\": \"Ready for a request\",\n \"openapi.responseErrorTitle\": \"Request failed\",\n \"openapi.streaming\": \"Streaming\",\n \"openapi.responses\": \"Responses\",\n \"openapi.schemaExample\": \"Schema example\",\n \"openapi.sendRequest\": \"Send\",\n \"openapi.sendingRequest\": \"Sending\",\n \"openapi.server\": \"Server\",\n \"openapi.scrollExamplesLeft\": \"Scroll examples left\",\n \"openapi.scrollExamplesRight\": \"Scroll examples right\",\n \"openapi.specNotFound\": \"OpenAPI spec not found: {specPath}\",\n \"openapi.specPathMissing\": \"spec or specPath was not provided\",\n \"openapi.status\": \"Status\",\n \"openapi.tryRequest\": \"Try request\",\n \"openapi.version\": \"Version {version}\",\n \"openapi.webhookResponse\": \"Webhook response\",\n \"openapi.webhookResponses\": \"Webhook responses\",\n \"search.button\": \"Search...\",\n \"search.noResults\": \"Nothing found for {query}.\",\n \"search.placeholder\": \"Find something...\",\n \"search.shortcutCtrl\": \"Ctrl \",\n \"renderError.componentStack\": \"React component stack\",\n \"renderError.description\": \"Clarify stopped rendering this route to keep the rest of the shell responsive. Review the diagnostics below, fix the page source, then reload the route.\",\n \"renderError.details\": \"Runtime diagnostics\",\n \"renderError.message\": \"Message\",\n \"renderError.path\": \"Route\",\n \"renderError.reload\": \"Reload route\",\n \"renderError.stack\": \"JavaScript stack trace\",\n \"renderError.title\": \"Route render failed\",\n \"renderError.type\": \"Error type\",\n \"renderError.version\": \"Clarify version\",\n \"theme.dark\": \"Dark\",\n \"theme.light\": \"Light\",\n \"theme.switch\": \"Switch theme\",\n \"theme.switchToDark\": \"Switch to dark theme\",\n \"theme.switchToLight\": \"Switch to light theme\",\n \"theme.switchToSystem\": \"Follow system theme\",\n \"theme.system\": \"System\",\n \"language.switch\": \"Switch language\",\n \"mermaid.zoomIn\": \"Zoom in\",\n \"mermaid.zoomOut\": \"Zoom out\",\n \"mermaid.resetZoom\": \"Reset zoom\",\n \"mermaid.renderError\": \"Mermaid render error\",\n \"mermaid.scrollHint\": \"Click the diagram to enable scroll-to-zoom\"\n}\n","{\n \"actions.code\": \"代码\",\n \"actions.copy\": \"复制\",\n \"actions.copying\": \"正在复制...\",\n \"actions.copied\": \"已复制!\",\n \"actions.copyFailed\": \"复制失败\",\n \"builtWith.label\": \"由 Clarify 构建\",\n \"builtWith.prefix\": \"构建来自\",\n \"callout.danger\": \"危险\",\n \"callout.info\": \"信息\",\n \"callout.note\": \"注意\",\n \"callout.success\": \"成功\",\n \"callout.tip\": \"提示\",\n \"callout.warning\": \"警告\",\n \"contentActions.copyContent\": \"复制页面\",\n \"contentActions.copyContentDescription\": \"将页面以 {contentType} 格式复制给 LLMs\",\n \"contentActions.copyLink\": \"复制 {contentType} 链接\",\n \"contentActions.copyLinkDescription\": \"复制当前页面的 {contentType} 原始内容链接\",\n \"contentActions.copyLlms\": \"复制 llms.txt\",\n \"contentActions.copyLlmsDescription\": \"复制此站点的 llms.txt 链接\",\n \"contentActions.copiedLlms\": \"已复制 llms.txt\",\n \"contentActions.copiedMcpConfig\": \"已复制 MCP 配置\",\n \"contentActions.mcpConfig\": \"复制 MCP 配置\",\n \"contentActions.mcpConfigDescription\": \"复制站点的 MCP server 配置\",\n \"contentActions.editPage\": \"编辑此页面\",\n \"contentActions.editPageDescription\": \"打开当前页面的源文件\",\n \"contentActions.copyOptions\": \"选择复制选项\",\n \"contentActions.copiedContent\": \"已复制页面\",\n \"contentActions.copiedLink\": \"已复制链接\",\n \"contentActions.viewMarkdown\": \"以 Markdown 格式查看\",\n \"contentActions.viewMarkdownDescription\": \"以纯文本查看此页面\",\n \"contentActions.viewOpenApi\": \"查看 OpenAPI 原始内容\",\n \"contentActions.viewOpenApiDescription\": \"在新标签页打开 API 描述文件\",\n \"feedback.no\": \"否\",\n \"feedback.prompt\": \"这个页面有帮助吗?\",\n \"feedback.thanks\": \"感谢你的反馈!\",\n \"feedback.yes\": \"是\",\n \"navigation.documentation\": \"文档\",\n \"navigation.next\": \"下一页\",\n \"navigation.previous\": \"上一页\",\n \"navigation.previousNext\": \"上一页和下一页\",\n \"navigation.toggle\": \"切换导航\",\n \"navbar.home\": \"首页\",\n \"navbar.openLinks\": \"打开导航链接\",\n \"navbar.sections\": \"文档栏目\",\n \"notFound.description\": \"页面可能已移动、重命名或不存在。请检查地址,或返回首页继续浏览。\",\n \"notFound.home\": \"返回首页\",\n \"notFound.label\": \"404\",\n \"notFound.title\": \"页面未找到\",\n \"openapi.apiDocumentation\": \"API 文档\",\n \"openapi.authentication\": \"认证方式\",\n \"openapi.authAnd\": \"并且\",\n \"openapi.authApiKey\": \"API 密钥\",\n \"openapi.authBearerFormat\": \"Bearer 格式:{format}\",\n \"openapi.authLocation\": \"{in} 参数:{name}\",\n \"openapi.authNoAuth\": \"无需认证\",\n \"openapi.authOr\": \"或者\",\n \"openapi.authScopes\": \"Scopes:{scopes}\",\n \"openapi.bodyProperties\": \"请求体属性\",\n \"openapi.collapse\": \"收起\",\n \"openapi.clear\": \"清除\",\n \"openapi.codeSnippet\": \"代码示例\",\n \"openapi.endpointNotFound\": \"未找到 operation,或 operationId 不唯一:{endpoint}\",\n \"openapi.example\": \"示例\",\n \"openapi.expand\": \"展开\",\n \"openapi.headers\": \"请求头\",\n \"openapi.headerName\": \"名称\",\n \"openapi.headerValue\": \"值\",\n \"openapi.headerParameters\": \"请求头参数\",\n \"openapi.fieldDescription\": \"字段说明\",\n \"openapi.includeParameter\": \"传递参数\",\n \"openapi.cookieParameters\": \"Cookie 参数\",\n \"openapi.cookieParametersBrowserManaged\": \"Cookie 由浏览器管理;当服务端允许携带凭据时,匹配的 Cookie 会随请求发送。\",\n \"openapi.cookies\": \"Cookies\",\n \"openapi.cookiesBrowserHidden\": \"Cookie 由浏览器管理,JavaScript 无法读取 Set-Cookie 的值。\",\n \"openapi.language\": \"语言\",\n \"openapi.client\": \"客户端\",\n \"openapi.closeRequest\": \"关闭请求测试器\",\n \"openapi.credential\": \"认证凭证\",\n \"openapi.loading\": \"正在加载 OpenAPI 描述文件...\",\n \"openapi.mediaType\": \"媒体类型\",\n \"openapi.none\": \"无\",\n \"openapi.noRequestConfiguration\": \"此请求没有参数、认证、变量或请求体,可以直接发送。\",\n \"openapi.openApiReference\": \"OpenAPI 参考\",\n \"openapi.operationParameter\": \"操作参数。\",\n \"openapi.optional\": \"可选。\",\n \"openapi.parameter\": \"参数\",\n \"openapi.parameterInvalidArray\": \"请输入有效的 JSON 数组。\",\n \"openapi.parameterInvalidDate\": \"请输入有效日期。\",\n \"openapi.parameterInvalidDateTime\": \"请输入有效的日期和时间。\",\n \"openapi.parameterInvalidEnum\": \"请选择允许的值。\",\n \"openapi.parameterInvalidInteger\": \"请输入整数。\",\n \"openapi.parameterInvalidNumber\": \"请输入有效数字。\",\n \"openapi.parameterInvalidObject\": \"请输入有效的 JSON 对象。\",\n \"openapi.pathParameters\": \"路径参数\",\n \"openapi.queryParameters\": \"查询参数\",\n \"openapi.preview\": \"预览\",\n \"openapi.raw\": \"原始内容\",\n \"openapi.resetToExample\": \"重置为示例\",\n \"openapi.body\": \"响应体\",\n \"openapi.binaryPreview\": \"暂不支持预览二进制响应。\",\n \"openapi.downloadBody\": \"下载响应体\",\n \"openapi.noHeaders\": \"没有匹配当前搜索的响应头。\",\n \"openapi.responseViews\": \"响应视图\",\n \"openapi.responseUrl\": \"最终 URL\",\n \"openapi.redirected\": \"已重定向\",\n \"openapi.searchHeaders\": \"搜索响应头\",\n \"openapi.searchBodyProperties\": \"搜索请求体属性\",\n \"openapi.searchResponseBodyProperties\": \"搜索响应体属性\",\n \"openapi.noBodyProperties\": \"没有匹配当前搜索的请求体属性。\",\n \"openapi.noResponseBodyProperties\": \"没有匹配当前搜索的响应体属性。\",\n \"openapi.unknownContentType\": \"未知内容类型\",\n \"openapi.variables\": \"变量\",\n \"openapi.requestConfiguration\": \"请求配置\",\n \"openapi.requestExample\": \"请求示例\",\n \"openapi.requestHeaders\": \"请求头\",\n \"openapi.request\": \"请求\",\n \"openapi.requestBody\": \"请求体\",\n \"openapi.requestBodyEmpty\": \"暂无请求体\",\n \"openapi.requestCorsHint\": \"受目标 API 的网络或 CORS 策略影响,浏览器可能无法直接访问\",\n \"openapi.responseBodyProperties\": \"响应体属性\",\n \"openapi.responseHeaders\": \"响应头\",\n \"openapi.required\": \"必填。\",\n \"openapi.requiredBadge\": \"必填\",\n \"openapi.response\": \"响应\",\n \"openapi.responseBodyEmpty\": \"响应体为空。\",\n \"openapi.responseBodyEmptyTitle\": \"无响应内容\",\n \"openapi.responseEmpty\": \"发送请求后在这里查看响应。\",\n \"openapi.responseEmptyTitle\": \"等待发送请求\",\n \"openapi.responseErrorTitle\": \"请求失败\",\n \"openapi.streaming\": \"正在接收\",\n \"openapi.responses\": \"响应\",\n \"openapi.schemaExample\": \"Schema 示例\",\n \"openapi.sendRequest\": \"发送\",\n \"openapi.sendingRequest\": \"发送中\",\n \"openapi.server\": \"服务地址\",\n \"openapi.scrollExamplesLeft\": \"向左滚动示例\",\n \"openapi.scrollExamplesRight\": \"向右滚动示例\",\n \"openapi.specNotFound\": \"未找到 OpenAPI 描述文件:{specPath}\",\n \"openapi.specPathMissing\": \"未提供 spec 或 specPath\",\n \"openapi.status\": \"状态\",\n \"openapi.tryRequest\": \"发起测试请求\",\n \"openapi.version\": \"版本 {version}\",\n \"openapi.webhookResponse\": \"Webhook 响应\",\n \"openapi.webhookResponses\": \"Webhook 响应\",\n \"search.button\": \"搜索...\",\n \"search.noResults\": \"没有找到与 {query} 相关的结果。\",\n \"search.placeholder\": \"搜索内容...\",\n \"search.shortcutCtrl\": \"Ctrl \",\n \"renderError.componentStack\": \"React 组件栈\",\n \"renderError.description\": \"Clarify 已停止渲染此路由,以保证文档 Shell 仍可响应。请查看下方诊断信息,修复页面源码后重新加载路由。\",\n \"renderError.details\": \"运行时诊断\",\n \"renderError.message\": \"错误消息\",\n \"renderError.path\": \"路由\",\n \"renderError.reload\": \"重新加载路由\",\n \"renderError.stack\": \"JavaScript 堆栈\",\n \"renderError.title\": \"路由渲染失败\",\n \"renderError.type\": \"错误类型\",\n \"renderError.version\": \"Clarify 版本\",\n \"theme.dark\": \"深色\",\n \"theme.light\": \"浅色\",\n \"theme.switch\": \"切换主题\",\n \"theme.switchToDark\": \"切换到深色主题\",\n \"theme.switchToLight\": \"切换到浅色主题\",\n \"theme.switchToSystem\": \"跟随系统主题\",\n \"theme.system\": \"跟随系统\",\n \"language.switch\": \"切换语言\",\n \"mermaid.zoomIn\": \"放大\",\n \"mermaid.zoomOut\": \"缩小\",\n \"mermaid.resetZoom\": \"重置缩放\",\n \"mermaid.renderError\": \"Mermaid 渲染错误\",\n \"mermaid.scrollHint\": \"点击图表后即可滚轮缩放\"\n}\n","import { useContext } from 'react'\n\nimport { ConfigContext, LocaleContext } from './context'\nimport enText from './locales/en.json'\nimport zhCNText from './locales/zh-CN.json'\n\nexport type BuiltInLocale = 'en' | 'zh-CN'\n\nexport type BuiltInTextKey = keyof typeof enText\n\nconst checkedZhCNText: Record<BuiltInTextKey, string> & Record<Exclude<keyof typeof zhCNText, BuiltInTextKey>, never> = zhCNText\n\nconst builtInText: Record<BuiltInLocale, Record<BuiltInTextKey, string>> = {\n en: enText,\n 'zh-CN': checkedZhCNText,\n}\n\nexport function resolveBuiltInLocale(locale?: string): BuiltInLocale {\n return locale === 'zh-CN' || locale?.toLowerCase().startsWith('zh') ? 'zh-CN' : 'en'\n}\n\nexport function translateBuiltInText(locale: string | undefined, key: BuiltInTextKey, replacements: Record<string, string> = {}): string {\n let value = builtInText[resolveBuiltInLocale(locale)]?.[key] ?? builtInText.en[key]\n for (const [name, replacement] of Object.entries(replacements)) {\n value = value.replaceAll(`{${name}}`, replacement)\n }\n return value\n}\n\nexport function useBuiltInText(locale?: string) {\n const config = useContext(ConfigContext)\n const currentLocale = useContext(LocaleContext)\n const resolvedLocale = locale ?? currentLocale ?? config?.locales?.default ?? config?.defaultLocale\n return (key: BuiltInTextKey, replacements?: Record<string, string>) => translateBuiltInText(resolvedLocale, key, replacements)\n}\n"],"mappings":";;;AAKA,IAAa,iBAAA,GAAA,MAAA,cAAA,CAA6C,IAAI;AAE9D,IAAM,wBAAA,GAAA,MAAA,cAAA,CAA2D,IAAI;AACrE,IAAa,iBAAA,GAAA,MAAA,cAAA,CAAkD,KAAA,CAAS;AACxE,IAAa,uBAAA,GAAA,MAAA,cAAA,CAAqD,CAAC,CAAC;AAOpE,SAAgB,eAAe,OAA4B;CACzD,MAAM,EAAE,QAAQ,eAAe,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAA;AACX;AAEA,SAAgB,qBAAqB,QAAgC;CACnE,OAAO,WAAW,WAAW,QAAQ,YAAY,CAAC,CAAC,WAAW,IAAI,IAAI,UAAU;AAClF;AAEA,SAAgB,qBAAqB,QAA4B,KAAqB,eAAuC,CAAC,GAAW;CACvI,IAAI,QAAQ,YAAY,qBAAqB,MAAM,EAAE,GAAG,QAAQ,YAAY,GAAG;CAC/E,KAAK,MAAM,CAAC,MAAM,gBAAgB,OAAO,QAAQ,YAAY,GAC3D,QAAQ,MAAM,WAAW,IAAI,KAAK,IAAI,WAAW;CAEnD,OAAO;AACT;AAEA,SAAgB,eAAe,QAAiB;CAC9C,MAAM,UAAA,GAAA,MAAA,WAAA,CAAoB,aAAa;CACvC,MAAM,iBAAA,GAAA,MAAA,WAAA,CAA2B,aAAa;CAC9C,MAAM,iBAAiB,UAAU,iBAAiB,QAAQ,SAAS,WAAW,QAAQ;CACtF,QAAQ,KAAqB,iBAA0C,qBAAqB,gBAAgB,KAAK,YAAY;AAC/H"}
@@ -399,10 +399,10 @@ function translateBuiltInText(locale, key, replacements = {}) {
399
399
  function useBuiltInText(locale) {
400
400
  const config = useContext(ConfigContext);
401
401
  const currentLocale = useContext(LocaleContext);
402
- const resolvedLocale = locale ?? currentLocale ?? config?.locales?.default;
402
+ const resolvedLocale = locale ?? currentLocale ?? config?.locales?.default ?? config?.defaultLocale;
403
403
  return (key, replacements) => translateBuiltInText(resolvedLocale, key, replacements);
404
404
  }
405
405
  //#endregion
406
406
  export { useConfig as a, useConfigUpdaterOptional as c, OpenApiSpecsContext as i, useLocale as l, ConfigProvider as n, useConfigOptional as o, LocaleContext as r, useConfigUpdater as s, useBuiltInText as t, useOpenApiSpecs as u };
407
407
 
408
- //# sourceMappingURL=i18n-C6tIP-nl.js.map
408
+ //# sourceMappingURL=i18n-Zmmhz7FF.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-C6tIP-nl.js","names":[],"sources":["../source/core/context.tsx","../source/core/locales/en.json","../source/core/locales/zh-CN.json","../source/core/i18n.ts"],"sourcesContent":["import { createContext, useContext, useState } from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { Config, OpenApiRegistry } from './types'\n\nexport const ConfigContext = createContext<Config | null>(null)\nexport type ConfigUpdater = (update: Config | ((config: Config) => Config)) => void\nconst ConfigUpdaterContext = createContext<ConfigUpdater | null>(null)\nexport const LocaleContext = createContext<string | undefined>(undefined)\nexport const OpenApiSpecsContext = createContext<OpenApiRegistry>({})\n\nexport type ConfigProviderProps = {\n config: Config\n children: ReactNode\n}\n\nexport function ConfigProvider(props: ConfigProviderProps) {\n const { config: initialConfig, children } = props\n const [config, setConfig] = useState(initialConfig)\n\n return (\n <ConfigContext.Provider value={config}>\n <ConfigUpdaterContext.Provider value={setConfig}>\n {children}\n </ConfigUpdaterContext.Provider>\n </ConfigContext.Provider>\n )\n}\n\nexport function useConfig(): Config {\n const config = useContext(ConfigContext)\n if (!config) {\n throw new Error(\n '[clarify] useConfig must be used within a ConfigContext.Provider'\n )\n }\n return config\n}\n\nexport function useConfigOptional(): Config | null {\n return useContext(ConfigContext)\n}\n\nexport function useConfigUpdater(): ConfigUpdater {\n const updater = useContext(ConfigUpdaterContext)\n if (!updater) {\n throw new Error('[clarify] useConfigUpdater must be used within a ConfigProvider')\n }\n return updater\n}\n\nexport function useConfigUpdaterOptional(): ConfigUpdater | null {\n return useContext(ConfigUpdaterContext)\n}\n\nexport function useLocale(): string | undefined {\n return useContext(LocaleContext)\n}\n\nexport function useOpenApiSpecs(): OpenApiRegistry {\n return useContext(OpenApiSpecsContext)\n}\n","{\n \"actions.code\": \"Code\",\n \"actions.copy\": \"Copy\",\n \"actions.copying\": \"Copying...\",\n \"actions.copied\": \"Copied!\",\n \"actions.copyFailed\": \"Copy failed\",\n \"builtWith.label\": \"Built with Clarify\",\n \"builtWith.prefix\": \"Built with\",\n \"callout.danger\": \"Danger\",\n \"callout.info\": \"Info\",\n \"callout.note\": \"Note\",\n \"callout.success\": \"Success\",\n \"callout.tip\": \"Tip\",\n \"callout.warning\": \"Warning\",\n \"contentActions.copyContent\": \"Copy page\",\n \"contentActions.copyContentDescription\": \"Copy this page as {contentType} for LLMs\",\n \"contentActions.copyLink\": \"Copy {contentType} link\",\n \"contentActions.copyLinkDescription\": \"Copy the raw {contentType} content link for this page\",\n \"contentActions.copyLlms\": \"Copy llms.txt\",\n \"contentActions.copyLlmsDescription\": \"Copy the llms.txt link for this site\",\n \"contentActions.copiedLlms\": \"Copied llms.txt\",\n \"contentActions.copiedMcpConfig\": \"Copied MCP config\",\n \"contentActions.mcpConfig\": \"Copy MCP config\",\n \"contentActions.mcpConfigDescription\": \"Copy this site's MCP server configuration\",\n \"contentActions.editPage\": \"Edit this page\",\n \"contentActions.editPageDescription\": \"Open the source file for this page\",\n \"contentActions.copyOptions\": \"Choose copy option\",\n \"contentActions.copiedContent\": \"Copied page\",\n \"contentActions.copiedLink\": \"Copied link\",\n \"contentActions.viewMarkdown\": \"View as Markdown\",\n \"contentActions.viewMarkdownDescription\": \"View this page as plain text\",\n \"contentActions.viewOpenApi\": \"View raw OpenAPI\",\n \"contentActions.viewOpenApiDescription\": \"Open the API description file in a new tab\",\n \"feedback.no\": \"No\",\n \"feedback.prompt\": \"Was this page helpful?\",\n \"feedback.thanks\": \"Thanks for your feedback!\",\n \"feedback.yes\": \"Yes\",\n \"navigation.documentation\": \"Documentation\",\n \"navigation.next\": \"Next\",\n \"navigation.previous\": \"Previous\",\n \"navigation.previousNext\": \"Previous and next pages\",\n \"navigation.toggle\": \"Toggle navigation\",\n \"navbar.home\": \"Home\",\n \"navbar.openLinks\": \"Open navigation links\",\n \"navbar.sections\": \"Documentation sections\",\n \"notFound.description\": \"The page may have moved, been renamed, or never existed. Check the address or return to the homepage.\",\n \"notFound.home\": \"Back to homepage\",\n \"notFound.label\": \"404\",\n \"notFound.title\": \"Page not found\",\n \"openapi.apiDocumentation\": \"API Documentation\",\n \"openapi.authentication\": \"Authentication\",\n \"openapi.authAnd\": \"AND\",\n \"openapi.authApiKey\": \"API key\",\n \"openapi.authBearerFormat\": \"Bearer format: {format}\",\n \"openapi.authLocation\": \"{in} parameter: {name}\",\n \"openapi.authNoAuth\": \"No authentication required\",\n \"openapi.authOr\": \"OR\",\n \"openapi.authScopes\": \"Scopes: {scopes}\",\n \"openapi.bodyProperties\": \"Body properties\",\n \"openapi.collapse\": \"Collapse\",\n \"openapi.clear\": \"Clear\",\n \"openapi.codeSnippet\": \"Code snippet\",\n \"openapi.endpointNotFound\": \"Operation not found or operationId is not unique: {endpoint}\",\n \"openapi.example\": \"Example\",\n \"openapi.expand\": \"Expand\",\n \"openapi.headers\": \"Headers\",\n \"openapi.headerName\": \"Name\",\n \"openapi.headerValue\": \"Value\",\n \"openapi.headerParameters\": \"Header parameters\",\n \"openapi.fieldDescription\": \"Field description\",\n \"openapi.includeParameter\": \"Include parameter\",\n \"openapi.cookieParameters\": \"Cookie parameters\",\n \"openapi.cookieParametersBrowserManaged\": \"Cookies are managed by the browser. Matching cookies are sent when the server allows credentialed requests.\",\n \"openapi.cookies\": \"Cookies\",\n \"openapi.cookiesBrowserHidden\": \"Cookies are managed by the browser. Set-Cookie values are not exposed to JavaScript.\",\n \"openapi.language\": \"Language\",\n \"openapi.client\": \"Client\",\n \"openapi.closeRequest\": \"Close request tester\",\n \"openapi.credential\": \"Credential\",\n \"openapi.loading\": \"Loading OpenAPI spec...\",\n \"openapi.mediaType\": \"Media type\",\n \"openapi.none\": \"None\",\n \"openapi.noRequestConfiguration\": \"This request has no parameters, authentication, variables, or request body. It is ready to send as-is.\",\n \"openapi.openApiReference\": \"OpenAPI Reference\",\n \"openapi.operationParameter\": \"Operation parameter.\",\n \"openapi.optional\": \"Optional.\",\n \"openapi.parameter\": \"parameter\",\n \"openapi.parameterInvalidArray\": \"Enter a valid JSON array.\",\n \"openapi.parameterInvalidDate\": \"Enter a valid date.\",\n \"openapi.parameterInvalidDateTime\": \"Enter a valid date and time.\",\n \"openapi.parameterInvalidEnum\": \"Select one of the allowed values.\",\n \"openapi.parameterInvalidInteger\": \"Enter a whole number.\",\n \"openapi.parameterInvalidNumber\": \"Enter a valid number.\",\n \"openapi.parameterInvalidObject\": \"Enter a valid JSON object.\",\n \"openapi.pathParameters\": \"Path parameters\",\n \"openapi.queryParameters\": \"Query parameters\",\n \"openapi.preview\": \"Preview\",\n \"openapi.raw\": \"Raw\",\n \"openapi.resetToExample\": \"Reset to example\",\n \"openapi.body\": \"Body\",\n \"openapi.binaryPreview\": \"Binary response preview is not available.\",\n \"openapi.downloadBody\": \"Download response body\",\n \"openapi.noHeaders\": \"No response headers match the current search.\",\n \"openapi.responseViews\": \"Response views\",\n \"openapi.responseUrl\": \"Final URL\",\n \"openapi.redirected\": \"Redirected\",\n \"openapi.searchHeaders\": \"Search response headers\",\n \"openapi.searchBodyProperties\": \"Search request body properties\",\n \"openapi.searchResponseBodyProperties\": \"Search response body properties\",\n \"openapi.noBodyProperties\": \"No request body properties match the current search.\",\n \"openapi.noResponseBodyProperties\": \"No response body properties match the current search.\",\n \"openapi.unknownContentType\": \"Unknown content type\",\n \"openapi.variables\": \"Variables\",\n \"openapi.requestConfiguration\": \"Request configuration\",\n \"openapi.requestExample\": \"Request example\",\n \"openapi.requestHeaders\": \"Request headers\",\n \"openapi.request\": \"Request\",\n \"openapi.requestBody\": \"Request body\",\n \"openapi.requestBodyEmpty\": \"No request body\",\n \"openapi.requestCorsHint\": \"The API may be unavailable from this browser because of its network or CORS policy\",\n \"openapi.responseBodyProperties\": \"Response body properties\",\n \"openapi.responseHeaders\": \"Response headers\",\n \"openapi.required\": \"Required.\",\n \"openapi.requiredBadge\": \"required\",\n \"openapi.response\": \"Response\",\n \"openapi.responseBodyEmpty\": \"The response body is empty.\",\n \"openapi.responseBodyEmptyTitle\": \"No response content\",\n \"openapi.responseEmpty\": \"Send the request to inspect the response.\",\n \"openapi.responseEmptyTitle\": \"Ready for a request\",\n \"openapi.responseErrorTitle\": \"Request failed\",\n \"openapi.streaming\": \"Streaming\",\n \"openapi.responses\": \"Responses\",\n \"openapi.schemaExample\": \"Schema example\",\n \"openapi.sendRequest\": \"Send\",\n \"openapi.sendingRequest\": \"Sending\",\n \"openapi.server\": \"Server\",\n \"openapi.scrollExamplesLeft\": \"Scroll examples left\",\n \"openapi.scrollExamplesRight\": \"Scroll examples right\",\n \"openapi.specNotFound\": \"OpenAPI spec not found: {specPath}\",\n \"openapi.specPathMissing\": \"spec or specPath was not provided\",\n \"openapi.status\": \"Status\",\n \"openapi.tryRequest\": \"Try request\",\n \"openapi.version\": \"Version {version}\",\n \"openapi.webhookResponse\": \"Webhook response\",\n \"openapi.webhookResponses\": \"Webhook responses\",\n \"search.button\": \"Search...\",\n \"search.noResults\": \"Nothing found for {query}.\",\n \"search.placeholder\": \"Find something...\",\n \"search.shortcutCtrl\": \"Ctrl \",\n \"renderError.componentStack\": \"React component stack\",\n \"renderError.description\": \"Clarify stopped rendering this route to keep the rest of the shell responsive. Review the diagnostics below, fix the page source, then reload the route.\",\n \"renderError.details\": \"Runtime diagnostics\",\n \"renderError.message\": \"Message\",\n \"renderError.path\": \"Route\",\n \"renderError.reload\": \"Reload route\",\n \"renderError.stack\": \"JavaScript stack trace\",\n \"renderError.title\": \"Route render failed\",\n \"renderError.type\": \"Error type\",\n \"renderError.version\": \"Clarify version\",\n \"theme.dark\": \"Dark\",\n \"theme.light\": \"Light\",\n \"theme.switch\": \"Switch theme\",\n \"theme.switchToDark\": \"Switch to dark theme\",\n \"theme.switchToLight\": \"Switch to light theme\",\n \"theme.switchToSystem\": \"Follow system theme\",\n \"theme.system\": \"System\",\n \"language.switch\": \"Switch language\",\n \"mermaid.zoomIn\": \"Zoom in\",\n \"mermaid.zoomOut\": \"Zoom out\",\n \"mermaid.resetZoom\": \"Reset zoom\",\n \"mermaid.renderError\": \"Mermaid render error\",\n \"mermaid.scrollHint\": \"Click the diagram to enable scroll-to-zoom\"\n}\n","{\n \"actions.code\": \"代码\",\n \"actions.copy\": \"复制\",\n \"actions.copying\": \"正在复制...\",\n \"actions.copied\": \"已复制!\",\n \"actions.copyFailed\": \"复制失败\",\n \"builtWith.label\": \"由 Clarify 构建\",\n \"builtWith.prefix\": \"构建来自\",\n \"callout.danger\": \"危险\",\n \"callout.info\": \"信息\",\n \"callout.note\": \"注意\",\n \"callout.success\": \"成功\",\n \"callout.tip\": \"提示\",\n \"callout.warning\": \"警告\",\n \"contentActions.copyContent\": \"复制页面\",\n \"contentActions.copyContentDescription\": \"将页面以 {contentType} 格式复制给 LLMs\",\n \"contentActions.copyLink\": \"复制 {contentType} 链接\",\n \"contentActions.copyLinkDescription\": \"复制当前页面的 {contentType} 原始内容链接\",\n \"contentActions.copyLlms\": \"复制 llms.txt\",\n \"contentActions.copyLlmsDescription\": \"复制此站点的 llms.txt 链接\",\n \"contentActions.copiedLlms\": \"已复制 llms.txt\",\n \"contentActions.copiedMcpConfig\": \"已复制 MCP 配置\",\n \"contentActions.mcpConfig\": \"复制 MCP 配置\",\n \"contentActions.mcpConfigDescription\": \"复制站点的 MCP server 配置\",\n \"contentActions.editPage\": \"编辑此页面\",\n \"contentActions.editPageDescription\": \"打开当前页面的源文件\",\n \"contentActions.copyOptions\": \"选择复制选项\",\n \"contentActions.copiedContent\": \"已复制页面\",\n \"contentActions.copiedLink\": \"已复制链接\",\n \"contentActions.viewMarkdown\": \"以 Markdown 格式查看\",\n \"contentActions.viewMarkdownDescription\": \"以纯文本查看此页面\",\n \"contentActions.viewOpenApi\": \"查看 OpenAPI 原始内容\",\n \"contentActions.viewOpenApiDescription\": \"在新标签页打开 API 描述文件\",\n \"feedback.no\": \"否\",\n \"feedback.prompt\": \"这个页面有帮助吗?\",\n \"feedback.thanks\": \"感谢你的反馈!\",\n \"feedback.yes\": \"是\",\n \"navigation.documentation\": \"文档\",\n \"navigation.next\": \"下一页\",\n \"navigation.previous\": \"上一页\",\n \"navigation.previousNext\": \"上一页和下一页\",\n \"navigation.toggle\": \"切换导航\",\n \"navbar.home\": \"首页\",\n \"navbar.openLinks\": \"打开导航链接\",\n \"navbar.sections\": \"文档栏目\",\n \"notFound.description\": \"页面可能已移动、重命名或不存在。请检查地址,或返回首页继续浏览。\",\n \"notFound.home\": \"返回首页\",\n \"notFound.label\": \"404\",\n \"notFound.title\": \"页面未找到\",\n \"openapi.apiDocumentation\": \"API 文档\",\n \"openapi.authentication\": \"认证方式\",\n \"openapi.authAnd\": \"并且\",\n \"openapi.authApiKey\": \"API 密钥\",\n \"openapi.authBearerFormat\": \"Bearer 格式:{format}\",\n \"openapi.authLocation\": \"{in} 参数:{name}\",\n \"openapi.authNoAuth\": \"无需认证\",\n \"openapi.authOr\": \"或者\",\n \"openapi.authScopes\": \"Scopes:{scopes}\",\n \"openapi.bodyProperties\": \"请求体属性\",\n \"openapi.collapse\": \"收起\",\n \"openapi.clear\": \"清除\",\n \"openapi.codeSnippet\": \"代码示例\",\n \"openapi.endpointNotFound\": \"未找到 operation,或 operationId 不唯一:{endpoint}\",\n \"openapi.example\": \"示例\",\n \"openapi.expand\": \"展开\",\n \"openapi.headers\": \"请求头\",\n \"openapi.headerName\": \"名称\",\n \"openapi.headerValue\": \"值\",\n \"openapi.headerParameters\": \"请求头参数\",\n \"openapi.fieldDescription\": \"字段说明\",\n \"openapi.includeParameter\": \"传递参数\",\n \"openapi.cookieParameters\": \"Cookie 参数\",\n \"openapi.cookieParametersBrowserManaged\": \"Cookie 由浏览器管理;当服务端允许携带凭据时,匹配的 Cookie 会随请求发送。\",\n \"openapi.cookies\": \"Cookies\",\n \"openapi.cookiesBrowserHidden\": \"Cookie 由浏览器管理,JavaScript 无法读取 Set-Cookie 的值。\",\n \"openapi.language\": \"语言\",\n \"openapi.client\": \"客户端\",\n \"openapi.closeRequest\": \"关闭请求测试器\",\n \"openapi.credential\": \"认证凭证\",\n \"openapi.loading\": \"正在加载 OpenAPI 描述文件...\",\n \"openapi.mediaType\": \"媒体类型\",\n \"openapi.none\": \"无\",\n \"openapi.noRequestConfiguration\": \"此请求没有参数、认证、变量或请求体,可以直接发送。\",\n \"openapi.openApiReference\": \"OpenAPI 参考\",\n \"openapi.operationParameter\": \"操作参数。\",\n \"openapi.optional\": \"可选。\",\n \"openapi.parameter\": \"参数\",\n \"openapi.parameterInvalidArray\": \"请输入有效的 JSON 数组。\",\n \"openapi.parameterInvalidDate\": \"请输入有效日期。\",\n \"openapi.parameterInvalidDateTime\": \"请输入有效的日期和时间。\",\n \"openapi.parameterInvalidEnum\": \"请选择允许的值。\",\n \"openapi.parameterInvalidInteger\": \"请输入整数。\",\n \"openapi.parameterInvalidNumber\": \"请输入有效数字。\",\n \"openapi.parameterInvalidObject\": \"请输入有效的 JSON 对象。\",\n \"openapi.pathParameters\": \"路径参数\",\n \"openapi.queryParameters\": \"查询参数\",\n \"openapi.preview\": \"预览\",\n \"openapi.raw\": \"原始内容\",\n \"openapi.resetToExample\": \"重置为示例\",\n \"openapi.body\": \"响应体\",\n \"openapi.binaryPreview\": \"暂不支持预览二进制响应。\",\n \"openapi.downloadBody\": \"下载响应体\",\n \"openapi.noHeaders\": \"没有匹配当前搜索的响应头。\",\n \"openapi.responseViews\": \"响应视图\",\n \"openapi.responseUrl\": \"最终 URL\",\n \"openapi.redirected\": \"已重定向\",\n \"openapi.searchHeaders\": \"搜索响应头\",\n \"openapi.searchBodyProperties\": \"搜索请求体属性\",\n \"openapi.searchResponseBodyProperties\": \"搜索响应体属性\",\n \"openapi.noBodyProperties\": \"没有匹配当前搜索的请求体属性。\",\n \"openapi.noResponseBodyProperties\": \"没有匹配当前搜索的响应体属性。\",\n \"openapi.unknownContentType\": \"未知内容类型\",\n \"openapi.variables\": \"变量\",\n \"openapi.requestConfiguration\": \"请求配置\",\n \"openapi.requestExample\": \"请求示例\",\n \"openapi.requestHeaders\": \"请求头\",\n \"openapi.request\": \"请求\",\n \"openapi.requestBody\": \"请求体\",\n \"openapi.requestBodyEmpty\": \"暂无请求体\",\n \"openapi.requestCorsHint\": \"受目标 API 的网络或 CORS 策略影响,浏览器可能无法直接访问\",\n \"openapi.responseBodyProperties\": \"响应体属性\",\n \"openapi.responseHeaders\": \"响应头\",\n \"openapi.required\": \"必填。\",\n \"openapi.requiredBadge\": \"必填\",\n \"openapi.response\": \"响应\",\n \"openapi.responseBodyEmpty\": \"响应体为空。\",\n \"openapi.responseBodyEmptyTitle\": \"无响应内容\",\n \"openapi.responseEmpty\": \"发送请求后在这里查看响应。\",\n \"openapi.responseEmptyTitle\": \"等待发送请求\",\n \"openapi.responseErrorTitle\": \"请求失败\",\n \"openapi.streaming\": \"正在接收\",\n \"openapi.responses\": \"响应\",\n \"openapi.schemaExample\": \"Schema 示例\",\n \"openapi.sendRequest\": \"发送\",\n \"openapi.sendingRequest\": \"发送中\",\n \"openapi.server\": \"服务地址\",\n \"openapi.scrollExamplesLeft\": \"向左滚动示例\",\n \"openapi.scrollExamplesRight\": \"向右滚动示例\",\n \"openapi.specNotFound\": \"未找到 OpenAPI 描述文件:{specPath}\",\n \"openapi.specPathMissing\": \"未提供 spec 或 specPath\",\n \"openapi.status\": \"状态\",\n \"openapi.tryRequest\": \"发起测试请求\",\n \"openapi.version\": \"版本 {version}\",\n \"openapi.webhookResponse\": \"Webhook 响应\",\n \"openapi.webhookResponses\": \"Webhook 响应\",\n \"search.button\": \"搜索...\",\n \"search.noResults\": \"没有找到与 {query} 相关的结果。\",\n \"search.placeholder\": \"搜索内容...\",\n \"search.shortcutCtrl\": \"Ctrl \",\n \"renderError.componentStack\": \"React 组件栈\",\n \"renderError.description\": \"Clarify 已停止渲染此路由,以保证文档 Shell 仍可响应。请查看下方诊断信息,修复页面源码后重新加载路由。\",\n \"renderError.details\": \"运行时诊断\",\n \"renderError.message\": \"错误消息\",\n \"renderError.path\": \"路由\",\n \"renderError.reload\": \"重新加载路由\",\n \"renderError.stack\": \"JavaScript 堆栈\",\n \"renderError.title\": \"路由渲染失败\",\n \"renderError.type\": \"错误类型\",\n \"renderError.version\": \"Clarify 版本\",\n \"theme.dark\": \"深色\",\n \"theme.light\": \"浅色\",\n \"theme.switch\": \"切换主题\",\n \"theme.switchToDark\": \"切换到深色主题\",\n \"theme.switchToLight\": \"切换到浅色主题\",\n \"theme.switchToSystem\": \"跟随系统主题\",\n \"theme.system\": \"跟随系统\",\n \"language.switch\": \"切换语言\",\n \"mermaid.zoomIn\": \"放大\",\n \"mermaid.zoomOut\": \"缩小\",\n \"mermaid.resetZoom\": \"重置缩放\",\n \"mermaid.renderError\": \"Mermaid 渲染错误\",\n \"mermaid.scrollHint\": \"点击图表后即可滚轮缩放\"\n}\n","import { useContext } from 'react'\n\nimport { ConfigContext, LocaleContext } from './context'\nimport enText from './locales/en.json'\nimport zhCNText from './locales/zh-CN.json'\n\nexport type BuiltInLocale = 'en' | 'zh-CN'\n\nexport type BuiltInTextKey = keyof typeof enText\n\nconst checkedZhCNText: Record<BuiltInTextKey, string> & Record<Exclude<keyof typeof zhCNText, BuiltInTextKey>, never> = zhCNText\n\nconst builtInText: Record<BuiltInLocale, Record<BuiltInTextKey, string>> = {\n en: enText,\n 'zh-CN': checkedZhCNText,\n}\n\nexport function resolveBuiltInLocale(locale?: string): BuiltInLocale {\n return locale === 'zh-CN' || locale?.toLowerCase().startsWith('zh') ? 'zh-CN' : 'en'\n}\n\nexport function translateBuiltInText(locale: string | undefined, key: BuiltInTextKey, replacements: Record<string, string> = {}): string {\n let value = builtInText[resolveBuiltInLocale(locale)]?.[key] ?? builtInText.en[key]\n for (const [name, replacement] of Object.entries(replacements)) {\n value = value.replaceAll(`{${name}}`, replacement)\n }\n return value\n}\n\nexport function useBuiltInText(locale?: string) {\n const config = useContext(ConfigContext)\n const currentLocale = useContext(LocaleContext)\n const resolvedLocale = locale ?? currentLocale ?? config?.locales?.default\n return (key: BuiltInTextKey, replacements?: Record<string, string>) => translateBuiltInText(resolvedLocale, key, replacements)\n}\n"],"mappings":";;;AAKA,IAAa,gBAAgB,cAA6B,IAAI;AAE9D,IAAM,uBAAuB,c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;;;;;CAAA;AACX;AAEA,SAAgB,qBAAqB,QAAgC;CACnE,OAAO,WAAW,WAAW,QAAQ,YAAY,CAAC,CAAC,WAAW,IAAI,IAAI,UAAU;AAClF;AAEA,SAAgB,qBAAqB,QAA4B,KAAqB,eAAuC,CAAC,GAAW;CACvI,IAAI,QAAQ,YAAY,qBAAqB,MAAM,EAAE,GAAG,QAAQ,YAAY,GAAG;CAC/E,KAAK,MAAM,CAAC,MAAM,gBAAgB,OAAO,QAAQ,YAAY,GAC3D,QAAQ,MAAM,WAAW,IAAI,KAAK,IAAI,WAAW;CAEnD,OAAO;AACT;AAEA,SAAgB,eAAe,QAAiB;CAC9C,MAAM,SAAS,WAAW,aAAa;CACvC,MAAM,gBAAgB,WAAW,aAAa;CAC9C,MAAM,iBAAiB,UAAU,iBAAiB,QAAQ,SAAS;CACnE,QAAQ,KAAqB,iBAA0C,qBAAqB,gBAAgB,KAAK,YAAY;AAC/H"}
1
+ {"version":3,"file":"i18n-Zmmhz7FF.js","names":[],"sources":["../source/core/context.tsx","../source/core/locales/en.json","../source/core/locales/zh-CN.json","../source/core/i18n.ts"],"sourcesContent":["import { createContext, useContext, useState } from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { Config, OpenApiRegistry } from './types'\n\nexport const ConfigContext = createContext<Config | null>(null)\nexport type ConfigUpdater = (update: Config | ((config: Config) => Config)) => void\nconst ConfigUpdaterContext = createContext<ConfigUpdater | null>(null)\nexport const LocaleContext = createContext<string | undefined>(undefined)\nexport const OpenApiSpecsContext = createContext<OpenApiRegistry>({})\n\nexport type ConfigProviderProps = {\n config: Config\n children: ReactNode\n}\n\nexport function ConfigProvider(props: ConfigProviderProps) {\n const { config: initialConfig, children } = props\n const [config, setConfig] = useState(initialConfig)\n\n return (\n <ConfigContext.Provider value={config}>\n <ConfigUpdaterContext.Provider value={setConfig}>\n {children}\n </ConfigUpdaterContext.Provider>\n </ConfigContext.Provider>\n )\n}\n\nexport function useConfig(): Config {\n const config = useContext(ConfigContext)\n if (!config) {\n throw new Error(\n '[clarify] useConfig must be used within a ConfigContext.Provider'\n )\n }\n return config\n}\n\nexport function useConfigOptional(): Config | null {\n return useContext(ConfigContext)\n}\n\nexport function useConfigUpdater(): ConfigUpdater {\n const updater = useContext(ConfigUpdaterContext)\n if (!updater) {\n throw new Error('[clarify] useConfigUpdater must be used within a ConfigProvider')\n }\n return updater\n}\n\nexport function useConfigUpdaterOptional(): ConfigUpdater | null {\n return useContext(ConfigUpdaterContext)\n}\n\nexport function useLocale(): string | undefined {\n return useContext(LocaleContext)\n}\n\nexport function useOpenApiSpecs(): OpenApiRegistry {\n return useContext(OpenApiSpecsContext)\n}\n","{\n \"actions.code\": \"Code\",\n \"actions.copy\": \"Copy\",\n \"actions.copying\": \"Copying...\",\n \"actions.copied\": \"Copied!\",\n \"actions.copyFailed\": \"Copy failed\",\n \"builtWith.label\": \"Built with Clarify\",\n \"builtWith.prefix\": \"Built with\",\n \"callout.danger\": \"Danger\",\n \"callout.info\": \"Info\",\n \"callout.note\": \"Note\",\n \"callout.success\": \"Success\",\n \"callout.tip\": \"Tip\",\n \"callout.warning\": \"Warning\",\n \"contentActions.copyContent\": \"Copy page\",\n \"contentActions.copyContentDescription\": \"Copy this page as {contentType} for LLMs\",\n \"contentActions.copyLink\": \"Copy {contentType} link\",\n \"contentActions.copyLinkDescription\": \"Copy the raw {contentType} content link for this page\",\n \"contentActions.copyLlms\": \"Copy llms.txt\",\n \"contentActions.copyLlmsDescription\": \"Copy the llms.txt link for this site\",\n \"contentActions.copiedLlms\": \"Copied llms.txt\",\n \"contentActions.copiedMcpConfig\": \"Copied MCP config\",\n \"contentActions.mcpConfig\": \"Copy MCP config\",\n \"contentActions.mcpConfigDescription\": \"Copy this site's MCP server configuration\",\n \"contentActions.editPage\": \"Edit this page\",\n \"contentActions.editPageDescription\": \"Open the source file for this page\",\n \"contentActions.copyOptions\": \"Choose copy option\",\n \"contentActions.copiedContent\": \"Copied page\",\n \"contentActions.copiedLink\": \"Copied link\",\n \"contentActions.viewMarkdown\": \"View as Markdown\",\n \"contentActions.viewMarkdownDescription\": \"View this page as plain text\",\n \"contentActions.viewOpenApi\": \"View raw OpenAPI\",\n \"contentActions.viewOpenApiDescription\": \"Open the API description file in a new tab\",\n \"feedback.no\": \"No\",\n \"feedback.prompt\": \"Was this page helpful?\",\n \"feedback.thanks\": \"Thanks for your feedback!\",\n \"feedback.yes\": \"Yes\",\n \"navigation.documentation\": \"Documentation\",\n \"navigation.next\": \"Next\",\n \"navigation.previous\": \"Previous\",\n \"navigation.previousNext\": \"Previous and next pages\",\n \"navigation.toggle\": \"Toggle navigation\",\n \"navbar.home\": \"Home\",\n \"navbar.openLinks\": \"Open navigation links\",\n \"navbar.sections\": \"Documentation sections\",\n \"notFound.description\": \"The page may have moved, been renamed, or never existed. Check the address or return to the homepage.\",\n \"notFound.home\": \"Back to homepage\",\n \"notFound.label\": \"404\",\n \"notFound.title\": \"Page not found\",\n \"openapi.apiDocumentation\": \"API Documentation\",\n \"openapi.authentication\": \"Authentication\",\n \"openapi.authAnd\": \"AND\",\n \"openapi.authApiKey\": \"API key\",\n \"openapi.authBearerFormat\": \"Bearer format: {format}\",\n \"openapi.authLocation\": \"{in} parameter: {name}\",\n \"openapi.authNoAuth\": \"No authentication required\",\n \"openapi.authOr\": \"OR\",\n \"openapi.authScopes\": \"Scopes: {scopes}\",\n \"openapi.bodyProperties\": \"Body properties\",\n \"openapi.collapse\": \"Collapse\",\n \"openapi.clear\": \"Clear\",\n \"openapi.codeSnippet\": \"Code snippet\",\n \"openapi.endpointNotFound\": \"Operation not found or operationId is not unique: {endpoint}\",\n \"openapi.example\": \"Example\",\n \"openapi.expand\": \"Expand\",\n \"openapi.headers\": \"Headers\",\n \"openapi.headerName\": \"Name\",\n \"openapi.headerValue\": \"Value\",\n \"openapi.headerParameters\": \"Header parameters\",\n \"openapi.fieldDescription\": \"Field description\",\n \"openapi.includeParameter\": \"Include parameter\",\n \"openapi.cookieParameters\": \"Cookie parameters\",\n \"openapi.cookieParametersBrowserManaged\": \"Cookies are managed by the browser. Matching cookies are sent when the server allows credentialed requests.\",\n \"openapi.cookies\": \"Cookies\",\n \"openapi.cookiesBrowserHidden\": \"Cookies are managed by the browser. Set-Cookie values are not exposed to JavaScript.\",\n \"openapi.language\": \"Language\",\n \"openapi.client\": \"Client\",\n \"openapi.closeRequest\": \"Close request tester\",\n \"openapi.credential\": \"Credential\",\n \"openapi.loading\": \"Loading OpenAPI spec...\",\n \"openapi.mediaType\": \"Media type\",\n \"openapi.none\": \"None\",\n \"openapi.noRequestConfiguration\": \"This request has no parameters, authentication, variables, or request body. It is ready to send as-is.\",\n \"openapi.openApiReference\": \"OpenAPI Reference\",\n \"openapi.operationParameter\": \"Operation parameter.\",\n \"openapi.optional\": \"Optional.\",\n \"openapi.parameter\": \"parameter\",\n \"openapi.parameterInvalidArray\": \"Enter a valid JSON array.\",\n \"openapi.parameterInvalidDate\": \"Enter a valid date.\",\n \"openapi.parameterInvalidDateTime\": \"Enter a valid date and time.\",\n \"openapi.parameterInvalidEnum\": \"Select one of the allowed values.\",\n \"openapi.parameterInvalidInteger\": \"Enter a whole number.\",\n \"openapi.parameterInvalidNumber\": \"Enter a valid number.\",\n \"openapi.parameterInvalidObject\": \"Enter a valid JSON object.\",\n \"openapi.pathParameters\": \"Path parameters\",\n \"openapi.queryParameters\": \"Query parameters\",\n \"openapi.preview\": \"Preview\",\n \"openapi.raw\": \"Raw\",\n \"openapi.resetToExample\": \"Reset to example\",\n \"openapi.body\": \"Body\",\n \"openapi.binaryPreview\": \"Binary response preview is not available.\",\n \"openapi.downloadBody\": \"Download response body\",\n \"openapi.noHeaders\": \"No response headers match the current search.\",\n \"openapi.responseViews\": \"Response views\",\n \"openapi.responseUrl\": \"Final URL\",\n \"openapi.redirected\": \"Redirected\",\n \"openapi.searchHeaders\": \"Search response headers\",\n \"openapi.searchBodyProperties\": \"Search request body properties\",\n \"openapi.searchResponseBodyProperties\": \"Search response body properties\",\n \"openapi.noBodyProperties\": \"No request body properties match the current search.\",\n \"openapi.noResponseBodyProperties\": \"No response body properties match the current search.\",\n \"openapi.unknownContentType\": \"Unknown content type\",\n \"openapi.variables\": \"Variables\",\n \"openapi.requestConfiguration\": \"Request configuration\",\n \"openapi.requestExample\": \"Request example\",\n \"openapi.requestHeaders\": \"Request headers\",\n \"openapi.request\": \"Request\",\n \"openapi.requestBody\": \"Request body\",\n \"openapi.requestBodyEmpty\": \"No request body\",\n \"openapi.requestCorsHint\": \"The API may be unavailable from this browser because of its network or CORS policy\",\n \"openapi.responseBodyProperties\": \"Response body properties\",\n \"openapi.responseHeaders\": \"Response headers\",\n \"openapi.required\": \"Required.\",\n \"openapi.requiredBadge\": \"required\",\n \"openapi.response\": \"Response\",\n \"openapi.responseBodyEmpty\": \"The response body is empty.\",\n \"openapi.responseBodyEmptyTitle\": \"No response content\",\n \"openapi.responseEmpty\": \"Send the request to inspect the response.\",\n \"openapi.responseEmptyTitle\": \"Ready for a request\",\n \"openapi.responseErrorTitle\": \"Request failed\",\n \"openapi.streaming\": \"Streaming\",\n \"openapi.responses\": \"Responses\",\n \"openapi.schemaExample\": \"Schema example\",\n \"openapi.sendRequest\": \"Send\",\n \"openapi.sendingRequest\": \"Sending\",\n \"openapi.server\": \"Server\",\n \"openapi.scrollExamplesLeft\": \"Scroll examples left\",\n \"openapi.scrollExamplesRight\": \"Scroll examples right\",\n \"openapi.specNotFound\": \"OpenAPI spec not found: {specPath}\",\n \"openapi.specPathMissing\": \"spec or specPath was not provided\",\n \"openapi.status\": \"Status\",\n \"openapi.tryRequest\": \"Try request\",\n \"openapi.version\": \"Version {version}\",\n \"openapi.webhookResponse\": \"Webhook response\",\n \"openapi.webhookResponses\": \"Webhook responses\",\n \"search.button\": \"Search...\",\n \"search.noResults\": \"Nothing found for {query}.\",\n \"search.placeholder\": \"Find something...\",\n \"search.shortcutCtrl\": \"Ctrl \",\n \"renderError.componentStack\": \"React component stack\",\n \"renderError.description\": \"Clarify stopped rendering this route to keep the rest of the shell responsive. Review the diagnostics below, fix the page source, then reload the route.\",\n \"renderError.details\": \"Runtime diagnostics\",\n \"renderError.message\": \"Message\",\n \"renderError.path\": \"Route\",\n \"renderError.reload\": \"Reload route\",\n \"renderError.stack\": \"JavaScript stack trace\",\n \"renderError.title\": \"Route render failed\",\n \"renderError.type\": \"Error type\",\n \"renderError.version\": \"Clarify version\",\n \"theme.dark\": \"Dark\",\n \"theme.light\": \"Light\",\n \"theme.switch\": \"Switch theme\",\n \"theme.switchToDark\": \"Switch to dark theme\",\n \"theme.switchToLight\": \"Switch to light theme\",\n \"theme.switchToSystem\": \"Follow system theme\",\n \"theme.system\": \"System\",\n \"language.switch\": \"Switch language\",\n \"mermaid.zoomIn\": \"Zoom in\",\n \"mermaid.zoomOut\": \"Zoom out\",\n \"mermaid.resetZoom\": \"Reset zoom\",\n \"mermaid.renderError\": \"Mermaid render error\",\n \"mermaid.scrollHint\": \"Click the diagram to enable scroll-to-zoom\"\n}\n","{\n \"actions.code\": \"代码\",\n \"actions.copy\": \"复制\",\n \"actions.copying\": \"正在复制...\",\n \"actions.copied\": \"已复制!\",\n \"actions.copyFailed\": \"复制失败\",\n \"builtWith.label\": \"由 Clarify 构建\",\n \"builtWith.prefix\": \"构建来自\",\n \"callout.danger\": \"危险\",\n \"callout.info\": \"信息\",\n \"callout.note\": \"注意\",\n \"callout.success\": \"成功\",\n \"callout.tip\": \"提示\",\n \"callout.warning\": \"警告\",\n \"contentActions.copyContent\": \"复制页面\",\n \"contentActions.copyContentDescription\": \"将页面以 {contentType} 格式复制给 LLMs\",\n \"contentActions.copyLink\": \"复制 {contentType} 链接\",\n \"contentActions.copyLinkDescription\": \"复制当前页面的 {contentType} 原始内容链接\",\n \"contentActions.copyLlms\": \"复制 llms.txt\",\n \"contentActions.copyLlmsDescription\": \"复制此站点的 llms.txt 链接\",\n \"contentActions.copiedLlms\": \"已复制 llms.txt\",\n \"contentActions.copiedMcpConfig\": \"已复制 MCP 配置\",\n \"contentActions.mcpConfig\": \"复制 MCP 配置\",\n \"contentActions.mcpConfigDescription\": \"复制站点的 MCP server 配置\",\n \"contentActions.editPage\": \"编辑此页面\",\n \"contentActions.editPageDescription\": \"打开当前页面的源文件\",\n \"contentActions.copyOptions\": \"选择复制选项\",\n \"contentActions.copiedContent\": \"已复制页面\",\n \"contentActions.copiedLink\": \"已复制链接\",\n \"contentActions.viewMarkdown\": \"以 Markdown 格式查看\",\n \"contentActions.viewMarkdownDescription\": \"以纯文本查看此页面\",\n \"contentActions.viewOpenApi\": \"查看 OpenAPI 原始内容\",\n \"contentActions.viewOpenApiDescription\": \"在新标签页打开 API 描述文件\",\n \"feedback.no\": \"否\",\n \"feedback.prompt\": \"这个页面有帮助吗?\",\n \"feedback.thanks\": \"感谢你的反馈!\",\n \"feedback.yes\": \"是\",\n \"navigation.documentation\": \"文档\",\n \"navigation.next\": \"下一页\",\n \"navigation.previous\": \"上一页\",\n \"navigation.previousNext\": \"上一页和下一页\",\n \"navigation.toggle\": \"切换导航\",\n \"navbar.home\": \"首页\",\n \"navbar.openLinks\": \"打开导航链接\",\n \"navbar.sections\": \"文档栏目\",\n \"notFound.description\": \"页面可能已移动、重命名或不存在。请检查地址,或返回首页继续浏览。\",\n \"notFound.home\": \"返回首页\",\n \"notFound.label\": \"404\",\n \"notFound.title\": \"页面未找到\",\n \"openapi.apiDocumentation\": \"API 文档\",\n \"openapi.authentication\": \"认证方式\",\n \"openapi.authAnd\": \"并且\",\n \"openapi.authApiKey\": \"API 密钥\",\n \"openapi.authBearerFormat\": \"Bearer 格式:{format}\",\n \"openapi.authLocation\": \"{in} 参数:{name}\",\n \"openapi.authNoAuth\": \"无需认证\",\n \"openapi.authOr\": \"或者\",\n \"openapi.authScopes\": \"Scopes:{scopes}\",\n \"openapi.bodyProperties\": \"请求体属性\",\n \"openapi.collapse\": \"收起\",\n \"openapi.clear\": \"清除\",\n \"openapi.codeSnippet\": \"代码示例\",\n \"openapi.endpointNotFound\": \"未找到 operation,或 operationId 不唯一:{endpoint}\",\n \"openapi.example\": \"示例\",\n \"openapi.expand\": \"展开\",\n \"openapi.headers\": \"请求头\",\n \"openapi.headerName\": \"名称\",\n \"openapi.headerValue\": \"值\",\n \"openapi.headerParameters\": \"请求头参数\",\n \"openapi.fieldDescription\": \"字段说明\",\n \"openapi.includeParameter\": \"传递参数\",\n \"openapi.cookieParameters\": \"Cookie 参数\",\n \"openapi.cookieParametersBrowserManaged\": \"Cookie 由浏览器管理;当服务端允许携带凭据时,匹配的 Cookie 会随请求发送。\",\n \"openapi.cookies\": \"Cookies\",\n \"openapi.cookiesBrowserHidden\": \"Cookie 由浏览器管理,JavaScript 无法读取 Set-Cookie 的值。\",\n \"openapi.language\": \"语言\",\n \"openapi.client\": \"客户端\",\n \"openapi.closeRequest\": \"关闭请求测试器\",\n \"openapi.credential\": \"认证凭证\",\n \"openapi.loading\": \"正在加载 OpenAPI 描述文件...\",\n \"openapi.mediaType\": \"媒体类型\",\n \"openapi.none\": \"无\",\n \"openapi.noRequestConfiguration\": \"此请求没有参数、认证、变量或请求体,可以直接发送。\",\n \"openapi.openApiReference\": \"OpenAPI 参考\",\n \"openapi.operationParameter\": \"操作参数。\",\n \"openapi.optional\": \"可选。\",\n \"openapi.parameter\": \"参数\",\n \"openapi.parameterInvalidArray\": \"请输入有效的 JSON 数组。\",\n \"openapi.parameterInvalidDate\": \"请输入有效日期。\",\n \"openapi.parameterInvalidDateTime\": \"请输入有效的日期和时间。\",\n \"openapi.parameterInvalidEnum\": \"请选择允许的值。\",\n \"openapi.parameterInvalidInteger\": \"请输入整数。\",\n \"openapi.parameterInvalidNumber\": \"请输入有效数字。\",\n \"openapi.parameterInvalidObject\": \"请输入有效的 JSON 对象。\",\n \"openapi.pathParameters\": \"路径参数\",\n \"openapi.queryParameters\": \"查询参数\",\n \"openapi.preview\": \"预览\",\n \"openapi.raw\": \"原始内容\",\n \"openapi.resetToExample\": \"重置为示例\",\n \"openapi.body\": \"响应体\",\n \"openapi.binaryPreview\": \"暂不支持预览二进制响应。\",\n \"openapi.downloadBody\": \"下载响应体\",\n \"openapi.noHeaders\": \"没有匹配当前搜索的响应头。\",\n \"openapi.responseViews\": \"响应视图\",\n \"openapi.responseUrl\": \"最终 URL\",\n \"openapi.redirected\": \"已重定向\",\n \"openapi.searchHeaders\": \"搜索响应头\",\n \"openapi.searchBodyProperties\": \"搜索请求体属性\",\n \"openapi.searchResponseBodyProperties\": \"搜索响应体属性\",\n \"openapi.noBodyProperties\": \"没有匹配当前搜索的请求体属性。\",\n \"openapi.noResponseBodyProperties\": \"没有匹配当前搜索的响应体属性。\",\n \"openapi.unknownContentType\": \"未知内容类型\",\n \"openapi.variables\": \"变量\",\n \"openapi.requestConfiguration\": \"请求配置\",\n \"openapi.requestExample\": \"请求示例\",\n \"openapi.requestHeaders\": \"请求头\",\n \"openapi.request\": \"请求\",\n \"openapi.requestBody\": \"请求体\",\n \"openapi.requestBodyEmpty\": \"暂无请求体\",\n \"openapi.requestCorsHint\": \"受目标 API 的网络或 CORS 策略影响,浏览器可能无法直接访问\",\n \"openapi.responseBodyProperties\": \"响应体属性\",\n \"openapi.responseHeaders\": \"响应头\",\n \"openapi.required\": \"必填。\",\n \"openapi.requiredBadge\": \"必填\",\n \"openapi.response\": \"响应\",\n \"openapi.responseBodyEmpty\": \"响应体为空。\",\n \"openapi.responseBodyEmptyTitle\": \"无响应内容\",\n \"openapi.responseEmpty\": \"发送请求后在这里查看响应。\",\n \"openapi.responseEmptyTitle\": \"等待发送请求\",\n \"openapi.responseErrorTitle\": \"请求失败\",\n \"openapi.streaming\": \"正在接收\",\n \"openapi.responses\": \"响应\",\n \"openapi.schemaExample\": \"Schema 示例\",\n \"openapi.sendRequest\": \"发送\",\n \"openapi.sendingRequest\": \"发送中\",\n \"openapi.server\": \"服务地址\",\n \"openapi.scrollExamplesLeft\": \"向左滚动示例\",\n \"openapi.scrollExamplesRight\": \"向右滚动示例\",\n \"openapi.specNotFound\": \"未找到 OpenAPI 描述文件:{specPath}\",\n \"openapi.specPathMissing\": \"未提供 spec 或 specPath\",\n \"openapi.status\": \"状态\",\n \"openapi.tryRequest\": \"发起测试请求\",\n \"openapi.version\": \"版本 {version}\",\n \"openapi.webhookResponse\": \"Webhook 响应\",\n \"openapi.webhookResponses\": \"Webhook 响应\",\n \"search.button\": \"搜索...\",\n \"search.noResults\": \"没有找到与 {query} 相关的结果。\",\n \"search.placeholder\": \"搜索内容...\",\n \"search.shortcutCtrl\": \"Ctrl \",\n \"renderError.componentStack\": \"React 组件栈\",\n \"renderError.description\": \"Clarify 已停止渲染此路由,以保证文档 Shell 仍可响应。请查看下方诊断信息,修复页面源码后重新加载路由。\",\n \"renderError.details\": \"运行时诊断\",\n \"renderError.message\": \"错误消息\",\n \"renderError.path\": \"路由\",\n \"renderError.reload\": \"重新加载路由\",\n \"renderError.stack\": \"JavaScript 堆栈\",\n \"renderError.title\": \"路由渲染失败\",\n \"renderError.type\": \"错误类型\",\n \"renderError.version\": \"Clarify 版本\",\n \"theme.dark\": \"深色\",\n \"theme.light\": \"浅色\",\n \"theme.switch\": \"切换主题\",\n \"theme.switchToDark\": \"切换到深色主题\",\n \"theme.switchToLight\": \"切换到浅色主题\",\n \"theme.switchToSystem\": \"跟随系统主题\",\n \"theme.system\": \"跟随系统\",\n \"language.switch\": \"切换语言\",\n \"mermaid.zoomIn\": \"放大\",\n \"mermaid.zoomOut\": \"缩小\",\n \"mermaid.resetZoom\": \"重置缩放\",\n \"mermaid.renderError\": \"Mermaid 渲染错误\",\n \"mermaid.scrollHint\": \"点击图表后即可滚轮缩放\"\n}\n","import { useContext } from 'react'\n\nimport { ConfigContext, LocaleContext } from './context'\nimport enText from './locales/en.json'\nimport zhCNText from './locales/zh-CN.json'\n\nexport type BuiltInLocale = 'en' | 'zh-CN'\n\nexport type BuiltInTextKey = keyof typeof enText\n\nconst checkedZhCNText: Record<BuiltInTextKey, string> & Record<Exclude<keyof typeof zhCNText, BuiltInTextKey>, never> = zhCNText\n\nconst builtInText: Record<BuiltInLocale, Record<BuiltInTextKey, string>> = {\n en: enText,\n 'zh-CN': checkedZhCNText,\n}\n\nexport function resolveBuiltInLocale(locale?: string): BuiltInLocale {\n return locale === 'zh-CN' || locale?.toLowerCase().startsWith('zh') ? 'zh-CN' : 'en'\n}\n\nexport function translateBuiltInText(locale: string | undefined, key: BuiltInTextKey, replacements: Record<string, string> = {}): string {\n let value = builtInText[resolveBuiltInLocale(locale)]?.[key] ?? builtInText.en[key]\n for (const [name, replacement] of Object.entries(replacements)) {\n value = value.replaceAll(`{${name}}`, replacement)\n }\n return value\n}\n\nexport function useBuiltInText(locale?: string) {\n const config = useContext(ConfigContext)\n const currentLocale = useContext(LocaleContext)\n const resolvedLocale = locale ?? currentLocale ?? config?.locales?.default ?? config?.defaultLocale\n return (key: BuiltInTextKey, replacements?: Record<string, string>) => translateBuiltInText(resolvedLocale, key, replacements)\n}\n"],"mappings":";;;AAKA,IAAa,gBAAgB,cAA6B,IAAI;AAE9D,IAAM,uBAAuB,cAAoC,IAAI;AACrE,IAAa,gBAAgB,cAAkC,KAAA,CAAS;AACxE,IAAa,sBAAsB,cAA+B,CAAC,CAAC;AAOpE,SAAgB,eAAe,OAA4B;CACzD,MAAM,EAAE,QAAQ,eAAe,aAAa;CAC5C,MAAM,CAAC,QAAQ,aAAa,SAAS,aAAa;CAElD,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;YAC7B,oBAAC,qBAAqB,UAAtB;GAA+B,OAAO;GACnC;EAC4B,CAAA;CACT,CAAA;AAE5B;AAEA,SAAgB,YAAoB;CAClC,MAAM,SAAS,WAAW,aAAa;CACvC,IAAI,CAAC,QACH,MAAM,IAAI,MACR,kEACF;CAEF,OAAO;AACT;AAEA,SAAgB,oBAAmC;CACjD,OAAO,WAAW,aAAa;AACjC;AAEA,SAAgB,mBAAkC;CAChD,MAAM,UAAU,WAAW,oBAAoB;CAC/C,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,iEAAiE;C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