@flamingo-stack/openframe-frontend-core 0.0.557 → 0.0.558-1830.4885.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-A6TAVIBX.cjs → chunk-3TKG7SW6.cjs} +42 -42
- package/dist/{chunk-A6TAVIBX.cjs.map → chunk-3TKG7SW6.cjs.map} +1 -1
- package/dist/{chunk-SBKX2VSG.js → chunk-4VLGJEKQ.js} +2 -2
- package/dist/{chunk-V5EYGEX7.cjs → chunk-53GNFRVQ.cjs} +7 -7
- package/dist/{chunk-V5EYGEX7.cjs.map → chunk-53GNFRVQ.cjs.map} +1 -1
- package/dist/{chunk-FXVMRZIQ.js → chunk-5JHJX7OX.js} +5 -5
- package/dist/{chunk-6YXEZCVG.cjs → chunk-5WQPOH27.cjs} +5 -5
- package/dist/{chunk-6YXEZCVG.cjs.map → chunk-5WQPOH27.cjs.map} +1 -1
- package/dist/{chunk-RPCY2FAC.js → chunk-C5HQCF4R.js} +6 -6
- package/dist/{chunk-4WREPWRL.cjs → chunk-CWQSUYVV.cjs} +3 -3
- package/dist/{chunk-4WREPWRL.cjs.map → chunk-CWQSUYVV.cjs.map} +1 -1
- package/dist/{chunk-33FOBAWS.cjs → chunk-DHSIAIFG.cjs} +18 -18
- package/dist/{chunk-33FOBAWS.cjs.map → chunk-DHSIAIFG.cjs.map} +1 -1
- package/dist/{chunk-VJL46NHW.js → chunk-DNPQ2U7P.js} +4 -4
- package/dist/{chunk-G7ROZAY5.js → chunk-DV4CSNZD.js} +3 -3
- package/dist/{chunk-25YLMIWU.js → chunk-E26KVZJM.js} +3 -3
- package/dist/{chunk-YHRE4JBF.cjs → chunk-FCCSHC3H.cjs} +32 -32
- package/dist/{chunk-YHRE4JBF.cjs.map → chunk-FCCSHC3H.cjs.map} +1 -1
- package/dist/{chunk-DRNSIK3V.js → chunk-FVHFBEXH.js} +2 -2
- package/dist/{chunk-6ZOVSD4M.cjs → chunk-GYQHUJWR.cjs} +14 -14
- package/dist/{chunk-6ZOVSD4M.cjs.map → chunk-GYQHUJWR.cjs.map} +1 -1
- package/dist/{chunk-G3NBTL4I.js → chunk-IHXUZBBV.js} +6 -4
- package/dist/{chunk-G3NBTL4I.js.map → chunk-IHXUZBBV.js.map} +1 -1
- package/dist/{chunk-WBQ3NOH7.js → chunk-KL6ZDLDF.js} +2 -2
- package/dist/{chunk-Y6TXTBIQ.js → chunk-LM6NDYGD.js} +2 -2
- package/dist/{chunk-5HNZTPAB.cjs → chunk-N3OGB543.cjs} +12 -12
- package/dist/{chunk-5HNZTPAB.cjs.map → chunk-N3OGB543.cjs.map} +1 -1
- package/dist/{chunk-VJTD2DGF.cjs → chunk-NK3M6F5A.cjs} +39 -30
- package/dist/chunk-NK3M6F5A.cjs.map +1 -0
- package/dist/{chunk-DFJ7TWH6.cjs → chunk-NKEOD2AD.cjs} +3 -3
- package/dist/{chunk-DFJ7TWH6.cjs.map → chunk-NKEOD2AD.cjs.map} +1 -1
- package/dist/{chunk-5JF6H7OJ.cjs → chunk-R3OCP4A7.cjs} +76 -76
- package/dist/{chunk-5JF6H7OJ.cjs.map → chunk-R3OCP4A7.cjs.map} +1 -1
- package/dist/{chunk-IPO24G7U.cjs → chunk-R3TXAMMB.cjs} +143 -141
- package/dist/{chunk-IPO24G7U.cjs.map → chunk-R3TXAMMB.cjs.map} +1 -1
- package/dist/{chunk-LJWTXODF.js → chunk-S3NZZKNU.js} +3 -3
- package/dist/{chunk-BE6TRUKY.cjs → chunk-SI64DC72.cjs} +40 -40
- package/dist/{chunk-BE6TRUKY.cjs.map → chunk-SI64DC72.cjs.map} +1 -1
- package/dist/{chunk-NNGQ6ONX.js → chunk-UVGFICZT.js} +8 -8
- package/dist/{chunk-4EGNYOZA.cjs → chunk-VNWGXQJD.cjs} +23 -23
- package/dist/{chunk-4EGNYOZA.cjs.map → chunk-VNWGXQJD.cjs.map} +1 -1
- package/dist/{chunk-QCBBX6DO.cjs → chunk-XDMRN3SG.cjs} +97 -97
- package/dist/{chunk-QCBBX6DO.cjs.map → chunk-XDMRN3SG.cjs.map} +1 -1
- package/dist/{chunk-64HHDGRN.cjs → chunk-XL2G2HHJ.cjs} +4 -4
- package/dist/{chunk-64HHDGRN.cjs.map → chunk-XL2G2HHJ.cjs.map} +1 -1
- package/dist/{chunk-UTEQHK3H.js → chunk-YUVCH2LX.js} +6 -6
- package/dist/{chunk-26HAJBSQ.js → chunk-Z5FN5VTC.js} +2 -2
- package/dist/{chunk-VRX6Y6A7.js → chunk-ZNEVGXMU.js} +23 -14
- package/dist/chunk-ZNEVGXMU.js.map +1 -0
- package/dist/{chunk-RRWWAH37.js → chunk-ZSZ24UY6.js} +2 -2
- package/dist/components/case-studies/index.cjs +9 -9
- package/dist/components/case-studies/index.js +3 -3
- package/dist/components/chat/index.cjs +3 -3
- package/dist/components/chat/index.js +2 -2
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/contact/index.js +3 -3
- package/dist/components/docs/index.cjs +6 -6
- package/dist/components/docs/index.js +5 -5
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/embeds/index.js +3 -3
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/faq/index.js +4 -4
- package/dist/components/features/index.cjs +3 -3
- package/dist/components/features/index.js +2 -2
- package/dist/components/features/video.d.ts.map +1 -1
- package/dist/components/help-center-pages/index.cjs +24 -24
- package/dist/components/help-center-pages/index.js +15 -15
- package/dist/components/index.cjs +137 -137
- package/dist/components/index.js +13 -13
- package/dist/components/meeting-scheduler/index.cjs +34 -34
- package/dist/components/meeting-scheduler/index.js +4 -4
- package/dist/components/navigation/index.cjs +3 -3
- package/dist/components/navigation/index.js +2 -2
- package/dist/components/onboarding-guides/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.js +6 -6
- package/dist/components/related-content/index.cjs +5 -5
- package/dist/components/related-content/index.js +4 -4
- package/dist/components/tickets/index.cjs +7 -7
- package/dist/components/tickets/index.js +6 -6
- package/dist/components/ui/index.cjs +3 -3
- package/dist/components/ui/index.js +2 -2
- package/dist/hooks/index.cjs +6 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +5 -1
- package/dist/hooks/use-authed-asset-src.d.ts +16 -0
- package/dist/hooks/use-authed-asset-src.d.ts.map +1 -0
- package/dist/hooks/use-authed-image-src.d.ts +15 -6
- package/dist/hooks/use-authed-image-src.d.ts.map +1 -1
- package/dist/index.cjs +7 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -2
- package/dist/utils/embed-authed-fetch.d.ts +24 -10
- package/dist/utils/embed-authed-fetch.d.ts.map +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/features/video.tsx +13 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-authed-asset-src.ts +98 -0
- package/src/hooks/use-authed-image-src.ts +15 -84
- package/src/utils/__tests__/embed-authed-fetch.test.ts +50 -1
- package/src/utils/embed-authed-fetch.ts +31 -14
- package/dist/chunk-VJTD2DGF.cjs.map +0 -1
- package/dist/chunk-VRX6Y6A7.js.map +0 -1
- /package/dist/{chunk-SBKX2VSG.js.map → chunk-4VLGJEKQ.js.map} +0 -0
- /package/dist/{chunk-FXVMRZIQ.js.map → chunk-5JHJX7OX.js.map} +0 -0
- /package/dist/{chunk-RPCY2FAC.js.map → chunk-C5HQCF4R.js.map} +0 -0
- /package/dist/{chunk-VJL46NHW.js.map → chunk-DNPQ2U7P.js.map} +0 -0
- /package/dist/{chunk-G7ROZAY5.js.map → chunk-DV4CSNZD.js.map} +0 -0
- /package/dist/{chunk-25YLMIWU.js.map → chunk-E26KVZJM.js.map} +0 -0
- /package/dist/{chunk-DRNSIK3V.js.map → chunk-FVHFBEXH.js.map} +0 -0
- /package/dist/{chunk-WBQ3NOH7.js.map → chunk-KL6ZDLDF.js.map} +0 -0
- /package/dist/{chunk-Y6TXTBIQ.js.map → chunk-LM6NDYGD.js.map} +0 -0
- /package/dist/{chunk-LJWTXODF.js.map → chunk-S3NZZKNU.js.map} +0 -0
- /package/dist/{chunk-NNGQ6ONX.js.map → chunk-UVGFICZT.js.map} +0 -0
- /package/dist/{chunk-UTEQHK3H.js.map → chunk-YUVCH2LX.js.map} +0 -0
- /package/dist/{chunk-26HAJBSQ.js.map → chunk-Z5FN5VTC.js.map} +0 -0
- /package/dist/{chunk-RRWWAH37.js.map → chunk-ZSZ24UY6.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
contentFetch
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZNEVGXMU.js";
|
|
5
5
|
|
|
6
6
|
// src/hooks/use-self-fetch.ts
|
|
7
7
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -78,4 +78,4 @@ function useSelfFetch(url, options) {
|
|
|
78
78
|
export {
|
|
79
79
|
useSelfFetch
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-KL6ZDLDF.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
TASK_TYPE_LABELS,
|
|
11
11
|
TASK_TYPE_TEXT_COLORS,
|
|
12
12
|
getStatusColorScheme
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IHXUZBBV.js";
|
|
14
14
|
import {
|
|
15
15
|
init_next_navigation,
|
|
16
16
|
usePathname,
|
|
@@ -271,4 +271,4 @@ export {
|
|
|
271
271
|
DevCardRowSkeletonList,
|
|
272
272
|
DeliveryRow
|
|
273
273
|
};
|
|
274
|
-
//# sourceMappingURL=chunk-
|
|
274
|
+
//# sourceMappingURL=chunk-LM6NDYGD.js.map
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkR3TXAMMBcjs = require('./chunk-R3TXAMMB.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkNK3M6F5Acjs = require('./chunk-NK3M6F5A.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
var _chunkSSJNN5BScjs = require('./chunk-SSJNN5BS.cjs');
|
|
@@ -34,7 +34,7 @@ function DocSearchResultRow({
|
|
|
34
34
|
}) {
|
|
35
35
|
const docType = _optionalChain([result, 'access', _ => _.metadata, 'optionalAccess', _2 => _2.documentType]) || void 0;
|
|
36
36
|
const sourceRepo = _optionalChain([result, 'access', _3 => _3.metadata, 'optionalAccess', _4 => _4.sourceRepo]) || void 0;
|
|
37
|
-
const { Icon: SourceIcon, label: iconLabel } =
|
|
37
|
+
const { Icon: SourceIcon, label: iconLabel } = _chunkR3TXAMMBcjs.resolveSourceIcon.call(void 0, {
|
|
38
38
|
sourceRepo,
|
|
39
39
|
documentType: docType
|
|
40
40
|
});
|
|
@@ -77,7 +77,7 @@ function DocSearchBar({
|
|
|
77
77
|
renderResult
|
|
78
78
|
}) {
|
|
79
79
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
80
|
-
|
|
80
|
+
_chunkR3TXAMMBcjs.SearchInput,
|
|
81
81
|
{
|
|
82
82
|
placeholder,
|
|
83
83
|
value: query,
|
|
@@ -202,7 +202,7 @@ function resolveSearchResultAction(result, source, runtimeMode, composeContentUr
|
|
|
202
202
|
if (composed && !isAbsoluteHref(href)) {
|
|
203
203
|
return { kind: "navigate-same-tab", href };
|
|
204
204
|
}
|
|
205
|
-
const isNewTab =
|
|
205
|
+
const isNewTab = _chunkR3TXAMMBcjs.decideNewTab.call(void 0, {
|
|
206
206
|
href,
|
|
207
207
|
targetPlatform: composed ? composed.targetPlatform : targetPlatform,
|
|
208
208
|
surface: "useUnifiedNav",
|
|
@@ -246,7 +246,7 @@ function useDocSearch(config) {
|
|
|
246
246
|
const [query, setQuery] = _react.useState.call(void 0, "");
|
|
247
247
|
const [results, setResults] = _react.useState.call(void 0, []);
|
|
248
248
|
const [isFetching, setIsFetching] = _react.useState.call(void 0, false);
|
|
249
|
-
const debouncedQuery =
|
|
249
|
+
const debouncedQuery = _chunkNK3M6F5Acjs.useDebounce.call(void 0, query, 300);
|
|
250
250
|
_react.useEffect.call(void 0, () => {
|
|
251
251
|
if (!debouncedQuery || debouncedQuery.trim().length < 2) {
|
|
252
252
|
setResults([]);
|
|
@@ -263,7 +263,7 @@ function useDocSearch(config) {
|
|
|
263
263
|
limit: "10"
|
|
264
264
|
});
|
|
265
265
|
if (tableIdsKey) params.set("tableIds", tableIdsKey);
|
|
266
|
-
const response = await
|
|
266
|
+
const response = await _chunkNK3M6F5Acjs.contentFetch.call(void 0, `${resolvedSearchEndpoint}?${params.toString()}`);
|
|
267
267
|
if (!response.ok) {
|
|
268
268
|
throw new Error(`Search request failed: ${response.status}`);
|
|
269
269
|
}
|
|
@@ -303,27 +303,27 @@ function useDocSearch(config) {
|
|
|
303
303
|
case "navigate-same-tab": {
|
|
304
304
|
if (wantsNewTab) {
|
|
305
305
|
setKeepOpen(true);
|
|
306
|
-
window.open(action.href, "_blank",
|
|
306
|
+
window.open(action.href, "_blank", _chunkR3TXAMMBcjs.NEW_TAB_FEATURES);
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
309
|
setKeepOpen(false);
|
|
310
310
|
const path = baseRoute && action.href.startsWith(`${baseRoute}/`) ? action.href.slice(baseRoute.length + 1) : null;
|
|
311
311
|
if (path && _optionalChain([onInPageSwap, 'optionalCall', _16 => _16(path)])) return;
|
|
312
|
-
router.push(
|
|
312
|
+
router.push(_chunkR3TXAMMBcjs.stripSameOriginToPath.call(void 0, action.href));
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
315
315
|
case "navigate-new-tab":
|
|
316
316
|
setKeepOpen(true);
|
|
317
317
|
if (_optionalChain([runtime, 'optionalAccess', _17 => _17.navigation, 'access', _18 => _18.mode]) === "embed") {
|
|
318
318
|
const targetPlatform = _nullishCoalesce(_optionalChain([result, 'access', _19 => _19.metadata, 'optionalAccess', _20 => _20.targetPlatform]), () => ( null));
|
|
319
|
-
|
|
319
|
+
_chunkR3TXAMMBcjs.resolveExternalNavigation.call(void 0, {
|
|
320
320
|
href: action.href,
|
|
321
321
|
targetPlatform,
|
|
322
322
|
runtime
|
|
323
323
|
}).open();
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
326
|
-
window.open(action.href, "_blank",
|
|
326
|
+
window.open(action.href, "_blank", _chunkR3TXAMMBcjs.NEW_TAB_FEATURES);
|
|
327
327
|
return;
|
|
328
328
|
case "ask-ai":
|
|
329
329
|
setKeepOpen(false);
|
|
@@ -370,4 +370,4 @@ function useDocSearch(config) {
|
|
|
370
370
|
|
|
371
371
|
|
|
372
372
|
exports.formatRelativePath = formatRelativePath; exports.DocSearchResultRow = DocSearchResultRow; exports.DocSearchBar = DocSearchBar; exports.mapDocSearchResults = mapDocSearchResults; exports.resolveSearchResultAction = resolveSearchResultAction; exports.useDocSearch = useDocSearch;
|
|
373
|
-
//# sourceMappingURL=chunk-
|
|
373
|
+
//# sourceMappingURL=chunk-N3OGB543.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-5HNZTPAB.cjs","../src/components/shared/doc-search/format-relative-path.ts","../src/components/shared/doc-search/doc-search-result-row.tsx","../src/components/shared/doc-search/doc-search-bar.tsx","../src/components/shared/doc-search/map-doc-search-results.ts","../src/components/shared/doc-search/resolve-search-result-action.ts","../src/components/shared/doc-search/use-doc-search.ts"],"names":["jsx"],"mappings":"AAAA,6rBAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA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AACG,IAAA;AACT,EAAA;AAEH,EAAA;AACL,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACkB,IAAA;AACpB,EAAA;AACF;AN4DqG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-5HNZTPAB.cjs","sourcesContent":[null,"/**\n * Format a full document path as a breadcrumb trail.\n * Shows parent folders only (excludes the last segment / filename).\n *\n * @example\n * formatRelativePath('openframe-oss-tenant/architecture/api-controllers.md')\n * // → 'Openframe oss tenant / Architecture'\n */\nexport function formatRelativePath(fullPath: string): string {\n if (!fullPath) return ''\n const segments = fullPath.replace(/\\.md$/, '').split('/')\n // Show only parent path (exclude the filename itself since the title already shows it)\n const parentSegments = segments.length > 1 ? segments.slice(0, -1) : segments\n return parentSegments\n .map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1).replace(/-/g, ' '))\n .join(' / ')\n}\n","'use client'\n\n/**\n * Single row in the `<SearchInput>` dropdown — the standard layout\n * used by every doc-search-backed surface (company-hub data-room\n * search bar, onboarding-guide catalog search, …). Single source of\n * truth for the row appearance so search dropdowns are visually\n * identical everywhere.\n *\n * Resolves the source icon via the same `resolveSourceIcon()`\n * registry the inline chat-card refs use, so a row pointing at e.g.\n * an onboarding-guide surfaces the SAME `<GraduationCap>` glyph the\n * chat card surfaces — no cross-surface drift.\n */\n\nimport { resolveSourceIcon } from '../../chat/utils/source-row-cta'\nimport { formatRelativePath } from './format-relative-path'\n\n/**\n * Minimal result shape this row renders. Compatible with any\n * doc-search hook whose result type exposes `{ title?, path?,\n * metadata? }`. The two hub consumers (onboarding-guide catalog,\n * data-room sidebar) both satisfy this shape via their\n * `useDocSearch` hook result.\n */\nexport interface DocSearchResultRowEntry {\n title?: string\n path?: string\n metadata?: Record<string, unknown>\n}\n\nexport interface DocSearchResultRowProps {\n result: DocSearchResultRowEntry\n isHighlighted: boolean\n}\n\nexport function DocSearchResultRow({\n result,\n isHighlighted,\n}: DocSearchResultRowProps) {\n const docType = (result.metadata?.documentType as string) || undefined\n const sourceRepo = (result.metadata?.sourceRepo as string) || undefined\n const { Icon: SourceIcon, label: iconLabel } = resolveSourceIcon({\n sourceRepo,\n documentType: docType,\n })\n const isGroup = result.metadata?.isGroup as boolean | undefined\n\n return (\n <div className=\"flex items-center gap-3 w-full min-w-0\">\n <span\n className=\"flex-shrink-0 text-ods-text-secondary\"\n title={iconLabel}\n >\n <SourceIcon className=\"size-4\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <div\n className={`text-h6 truncate ${\n isHighlighted ? 'text-ods-accent' : 'text-ods-text-primary'\n }`}\n >\n {result.title || result.path}\n </div>\n {!isGroup && result.path?.includes('/') && (\n <div className=\"text-h6 text-ods-text-secondary truncate mt-0.5\">\n {formatRelativePath(result.path)}\n </div>\n )}\n </div>\n </div>\n )\n}\n","'use client'\n\n/**\n * `<DocSearchBar>` — the canonical RAG-search dropdown surface.\n *\n * Mounted by every doc-search consumer (data-room sidebar, onboarding-\n * guide catalog, and any future surface that needs typeahead against\n * `/api/docs/search`). Wraps `<SearchInput>` with the lib's standard\n * `<DocSearchResultRow>` so the dropdown looks identical everywhere.\n *\n * ## Why a presentation component, not a \"search bar that owns its\n * own hook\"\n *\n * The data-fetching hook (`useDocSearch`) lives hub-side because it\n * depends on hub-only context (`useDocNavigation`, the rag-table-\n * config registry, the hub's `decideNewTab` helper). Moving the hook\n * would cascade ~5 more file migrations into the lib.\n *\n * Instead, the hook stays hub-side and callers pass its result into\n * this component as plain props. Both consumers shrink to ~5 lines.\n */\n\nimport type { ReactNode } from 'react'\nimport { SearchInput, type SearchResult } from '../../ui/search-input'\nimport { DocSearchResultRow } from './doc-search-result-row'\n\nexport interface DocSearchBarProps {\n placeholder: string\n query: string\n onQueryChange: (value: string) => void\n /** Hook-fetched results. Reuses the lib's `<SearchInput>` `SearchResult`\n * shape directly so callers don't translate. */\n results: SearchResult[]\n isLoading: boolean\n /** Result selection handler. Mirrors `<SearchInput>` — the second\n * `modifiers` argument is preserved so cmd-click / shift-click on\n * a result row still forces new-tab behavior. Hub `useDocSearch`\n * reads these to short-circuit to `window.open()`. */\n onResultSelect: (\n result: SearchResult,\n modifiers?: {\n metaKey?: boolean\n ctrlKey?: boolean\n shiftKey?: boolean\n altKey?: boolean\n button?: number\n },\n ) => void\n /** Lets the caller's hook force the dropdown open after a recent\n * internal action (e.g. result navigation). `undefined` falls back\n * to `<SearchInput>`'s built-in focus/hover heuristics. */\n showDropdown?: boolean\n /** Defaults to 2 — matches the existing data-room and onboarding-\n * guide consumers. Override only if a surface needs different\n * typeahead semantics. */\n minQueryLength?: number\n /** Defaults to 0 — both existing consumers debounce inside the\n * hook, not the input. */\n debounceMs?: number\n className?: string\n /** Optional row-renderer override. Defaults to the lib's standard\n * `<DocSearchResultRow>` (source icon + title + path breadcrumb).\n * Override only when a surface needs custom row chrome. */\n renderResult?: (result: SearchResult, isHighlighted: boolean) => ReactNode\n}\n\nexport function DocSearchBar({\n placeholder,\n query,\n onQueryChange,\n results,\n isLoading,\n onResultSelect,\n showDropdown,\n minQueryLength = 2,\n debounceMs = 0,\n className = 'w-full',\n renderResult,\n}: DocSearchBarProps) {\n return (\n <SearchInput\n placeholder={placeholder}\n value={query}\n onChange={onQueryChange}\n results={results}\n isLoading={isLoading}\n onResultSelect={onResultSelect}\n showDropdown={showDropdown || undefined}\n debounceMs={debounceMs}\n minQueryLength={minQueryLength}\n className={className}\n renderResult={\n renderResult ??\n ((result, isHighlighted) => (\n <DocSearchResultRow result={result} isHighlighted={isHighlighted} />\n ))\n }\n />\n )\n}\n","/**\n * Map RAG `/api/docs/search` wire results into the `<DocSearchBar>`\n * dropdown's row shape, collapsing entity-table rows into grouped\n * results so the dropdown lists ONE \"Cap Table (12 records)\" row\n * instead of 12 individual rows.\n *\n * Pure transform — no telemetry, no navigation, no React deps. Lifted\n * from the hub's `hooks/use-docs.ts:mapDocSearchResults` (the hub's\n * `traceCompose` call was hub-only telemetry and is intentionally\n * dropped — callers that want logging can wrap this helper).\n */\n\nimport type { SearchResult } from '../../ui/search-input'\nimport type { DocSearchResult } from './types'\n\n/** Source repos that should be collapsed into grouped results in the search bar.\n * Only financial tables (all rows link to the same admin page).\n * Content tables (blog, webinar, podcast, etc.) stay individual since each has a unique URL. */\nconst SEARCH_GROUP_REPOS = new Set([\n 'financial-cap-table',\n 'financial-kpis',\n 'financial-pnl',\n 'financial-balance-sheet',\n 'financial-cash-flow',\n])\n\nconst ENTITY_LABELS: Record<string, string> = {\n 'financial-cap-table': 'Cap Table',\n 'financial-kpis': 'Financial KPIs',\n 'financial-pnl': 'Profit & Loss',\n 'financial-balance-sheet': 'Balance Sheets',\n 'financial-cash-flow': 'Cash Flow',\n 'blog-posts': 'Blog Posts',\n 'product-releases': 'Product Releases',\n 'case-studies': 'Case Studies',\n webinars: 'Webinars',\n events: 'Events',\n podcasts: 'Podcasts',\n}\n\nexport function mapDocSearchResults(docs: DocSearchResult[]): SearchResult[] {\n const entityGroups = new Map<string, DocSearchResult[]>()\n // Track insertion order — groups appear where the FIRST row of that\n // repo appeared in the response.\n const order: Array<\n { type: 'entity'; repo: string } | { type: 'doc'; doc: DocSearchResult }\n > = []\n const seenRepos = new Set<string>()\n\n for (const doc of docs) {\n if (doc.sourceRepo && SEARCH_GROUP_REPOS.has(doc.sourceRepo)) {\n const group = entityGroups.get(doc.sourceRepo) || []\n group.push(doc)\n entityGroups.set(doc.sourceRepo, group)\n if (!seenRepos.has(doc.sourceRepo)) {\n seenRepos.add(doc.sourceRepo)\n order.push({ type: 'entity', repo: doc.sourceRepo })\n }\n } else {\n order.push({ type: 'doc', doc })\n }\n }\n\n const results: SearchResult[] = []\n for (const entry of order) {\n if (entry.type === 'entity') {\n const rows = entityGroups.get(entry.repo)!\n const label = ENTITY_LABELS[entry.repo] || entry.repo\n results.push({\n id: `group-${entry.repo}`,\n title: `${label} (${rows.length} ${rows.length === 1 ? 'record' : 'records'})`,\n path: rows[0].path,\n type: 'file',\n metadata: {\n documentType: rows[0].documentType,\n externalUrl: rows[0].externalUrl,\n sourceRepo: entry.repo,\n id: rows[0].entityId,\n isGroup: true,\n items: rows.map((r) => ({\n name: r.name,\n externalUrl: r.externalUrl,\n id: r.entityId,\n sourceRepo: r.sourceRepo,\n documentType: r.documentType,\n })),\n },\n })\n } else {\n const doc = entry.doc\n const isNonMarkdown = doc.documentType && doc.documentType !== 'markdown'\n results.push({\n id: doc.path,\n title: doc.name,\n description: isNonMarkdown ? doc.name : doc.snippet,\n path: doc.path,\n type: doc.type,\n metadata: {\n matchType: doc.matchType,\n ...(doc.documentType ? { documentType: doc.documentType } : {}),\n ...(doc.externalUrl ? { externalUrl: doc.externalUrl } : {}),\n ...(doc.targetPlatform != null\n ? { targetPlatform: doc.targetPlatform }\n : {}),\n ...(doc.sourceRepo ? { sourceRepo: doc.sourceRepo } : {}),\n ...(doc.entityId ? { id: doc.entityId } : {}),\n },\n })\n }\n }\n\n return results\n}\n","/**\n * Resolve what should happen when the user picks a search result.\n * Returns one of five typed actions so the caller is a single switch.\n *\n * Resolution order:\n * 1. `externalUrl` present → resolve the href through the host's\n * `composeContentUrl` seam (when wired), then use `decideNewTab` to\n * choose same-tab vs new-tab against the resolved `targetPlatform`.\n * 2. Row has `id` + `sourceRepo` + `documentType` → synth an Ask-AI\n * action (entity drill-in via primary key, no URL).\n * 3. Row has only `path` → legacy navigation fallback.\n * 4. Nothing actionable → noop.\n *\n * Lifted from the hub's `hooks/use-docs.ts:resolveSearchResultAction`.\n * Pure — no React, no telemetry.\n */\n\nimport type { SearchResult } from '../../ui/search-input'\nimport type { ChatRef } from '../../chat/chat-ref.types'\nimport type { ComposeContentUrl } from '../../../utils/content-href'\nimport { decideNewTab } from '../../chat/utils/decide-new-tab'\n\n/** True for `https://…` and protocol-relative `//…`. A composed href that is\n * NOT absolute is an in-app route the host claimed via `hostedTypes` /\n * `overrides`. */\nfunction isAbsoluteHref(href: string): boolean {\n return /^(?:[a-z][a-z0-9+.-]*:)?\\/\\//i.test(href)\n}\n\nexport type SearchResultAction =\n | { kind: 'navigate-same-tab'; href: string }\n | { kind: 'navigate-new-tab'; href: string }\n | { kind: 'ask-ai'; detail: { source: string; ref: ChatRef } }\n | { kind: 'route'; path: string }\n | { kind: 'noop' }\n\nexport function resolveSearchResultAction(\n result: SearchResult,\n source: string,\n runtimeMode?: 'host' | 'embed',\n /** The host's unified content-href seam (`runtime.composeContentUrl`).\n * When wired, an entity row's RAG `externalUrl` is re-resolved through it,\n * so a type the host serves in-app (`hostedTypes`) or deep-links itself\n * (`overrides`) lands on the SAME href the catalog cards and chat cards\n * use. Omitted → the legacy verbatim-`externalUrl` behavior. */\n composeContentUrl?: ComposeContentUrl,\n): SearchResultAction {\n const meta = result.metadata ?? {}\n const externalUrl = meta.externalUrl as string | undefined\n const rowId = meta.id as string | undefined\n const sourceRepo = meta.sourceRepo as string | undefined\n const documentType = meta.documentType as string | undefined\n if (externalUrl) {\n const targetPlatform = meta.targetPlatform as string | null | undefined\n // Unified content-href seam — the same call `resolveSourceRowCTA` makes\n // for chat rows. Hosted types relativize the slug out of `externalUrl`;\n // everything else comes back verbatim, so an unwired host (or a row with\n // no `documentType`) keeps today's behavior byte-for-byte.\n const composed =\n composeContentUrl && documentType\n ? composeContentUrl({\n type: documentType,\n identifier: rowId ?? '',\n externalUrl,\n targetPlatform: targetPlatform ?? null,\n })\n : null\n const href = composed?.href || externalUrl\n // A RELATIVE composed href means the host claimed this row as in-app.\n // Short-circuit BEFORE `decideNewTab`: in embed mode that helper forces\n // new-tab unconditionally, which would fire `window.open()` on a path\n // that only resolves inside this app.\n if (composed && !isAbsoluteHref(href)) {\n return { kind: 'navigate-same-tab', href }\n }\n // Same pure helper `useNavLink` and `useUnifiedNav` call — single\n // decision rule across cards, chips, and autocomplete rows. Thread\n // the caller's `source` as `currentSource` so the platform-vs-\n // platform comparison matches the hub's pre-migration behavior.\n const isNewTab = decideNewTab({\n href,\n targetPlatform: composed ? composed.targetPlatform : targetPlatform,\n surface: 'useUnifiedNav',\n runtimeMode,\n currentSource: source,\n })\n return isNewTab\n ? { kind: 'navigate-new-tab', href }\n : { kind: 'navigate-same-tab', href }\n }\n if (rowId && sourceRepo && documentType) {\n return {\n kind: 'ask-ai',\n detail: {\n source,\n ref: { type: documentType, id: rowId, title: result.title, url: null },\n },\n }\n }\n if (result.path) {\n return { kind: 'route', path: result.path }\n }\n return { kind: 'noop' }\n}\n","'use client'\n\n/**\n * `useDocSearch` — debounced RAG-search hook against `/api/docs/search`.\n *\n * Pure fetch + navigation glue. Embedders can mount this directly\n * (any host with a reverse-proxy that exposes `/api/docs/search` will\n * work). Hub callers wire it into the lib `<DocSearchBar>` for the\n * canonical typeahead dropdown.\n *\n * ## What moved from hub to lib\n *\n * Lifted from `multi-platform-hub/hooks/use-docs.ts:useDocSearch`. Two\n * hub-only concerns are now optional injection points instead of\n * direct imports:\n *\n * - `useDocNavigation()` (hub's in-page doc-tree swap) → optional\n * `onInPageSwap?: (path: string) => boolean` config callback. When\n * present and returns true, the hook treats a same-origin result\n * click as \"handled in-page\"; when absent or returns false, the\n * hook falls back to `onNavigate(path)` (`router.push` on hub,\n * `window.location.assign` on bare embedders).\n * - `traceCompose` (hub-only telemetry) → dropped. The lib has no\n * equivalent runtime-context yet; bring it back when there is one.\n *\n * Everything else (debounce, `useChatRuntime` for embed-mode short-\n * circuit, embed-shim router, the action-resolver + result-mapper) is\n * now lib-resident.\n *\n * ## Result hrefs go through the content-href seam\n *\n * A row's href is NOT the RAG `externalUrl` verbatim any more: when the\n * host wires `runtime.composeContentUrl` (or passes `composeContentUrl`\n * here), the row is re-resolved through it — the SAME seam the catalog\n * cards and the chat entity cards use. So a host that serves onboarding\n * guides at `/help-center/onboarding-guides/<slug>` gets that path from\n * the dropdown too, instead of bouncing the user to the canonical hub\n * URL. Unwired hosts keep the verbatim-`externalUrl` behavior.\n */\n\nimport { useState, useEffect, useCallback } from 'react'\nimport { useRouter } from '../../../embed-shims'\nimport { useDebounce } from '../../../hooks/ui/use-debounce'\nimport { useChatRuntime } from '../../../contexts/chat-runtime-context'\nimport { contentFetch } from '../../../utils/embed-content-fetch'\nimport type { SearchResult } from '../../ui/search-input'\nimport {\n resolveExternalNavigation,\n stripSameOriginToPath,\n NEW_TAB_FEATURES,\n} from '../../chat/utils/chat-nav-resolution'\nimport type { ComposeContentUrl } from '../../../utils/content-href'\nimport type { DocSearchResult } from './types'\nimport { mapDocSearchResults } from './map-doc-search-results'\nimport { resolveSearchResultAction } from './resolve-search-result-action'\n\nexport interface UseDocSearchConfig {\n /** Discriminator passed to `/api/docs/search?source=` (e.g.\n * `'openframe'`). Embedders set it to whatever discriminator their\n * reverse-proxy expects. */\n source: string\n /** Base route prefix this search lives under (e.g. `'/onboarding-guides'`).\n * When a result's href starts with `${baseRoute}/`, the hook\n * attempts the optional in-page swap path before falling through\n * to a full nav. */\n baseRoute: string\n /** Imperative navigation fallback. Called when no override\n * (in-page swap, new-tab) applies. Hub callers pass\n * `(path) => router.push(path)`; embedders pass an equivalent. */\n onNavigate: (path: string) => void\n /** Optional `RagTableConfig.id` list to narrow the search to specific\n * tables (e.g. `['onboarding-guides']`). Forwarded to\n * `/api/docs/search?tableIds=…` which intersects with the source's\n * standing set. */\n tableIds?: string[]\n /** Optional in-page swap callback. When the result's href is under\n * `baseRoute` AND this callback returns true, the hook treats the\n * click as handled in-page (no router push). Hub's\n * `<DocumentationSection>` wires this to\n * `useDocNavigation().navigate(path)`. */\n onInPageSwap?: (path: string) => boolean\n /** Optional endpoint override. Defaults to `'/api/docs/search'`\n * (the hub's reverse-proxy route). Embedders with a different\n * path can override. */\n searchEndpoint?: string\n /** Optional content-href seam override. Same fall-back chain as\n * `searchEndpoint`: prop → `runtime.composeContentUrl` → none. Wired,\n * it makes a result row honor the host's `hostedTypes` / `overrides`\n * instead of navigating to the RAG's canonical hub URL — so a row\n * lands where the catalog card for the same entity lands. */\n composeContentUrl?: ComposeContentUrl\n}\n\nexport function useDocSearch(config: UseDocSearchConfig) {\n const {\n source,\n baseRoute,\n onNavigate,\n tableIds,\n onInPageSwap,\n searchEndpoint,\n composeContentUrl,\n } = config\n const tableIdsKey = tableIds && tableIds.length > 0 ? tableIds.join(',') : ''\n\n const router = useRouter()\n // Optional chat-runtime read — when present and mode='embed' the\n // search-result row click short-circuits to a new-tab open against\n // the absolutized URL. Null/host preserves today's behavior.\n // Also used as the proxy-prefix fallback for `searchEndpoint`, matching\n // how tickets resolves `findTicketUrl`.\n const runtime = useChatRuntime()\n const resolvedSearchEndpoint =\n searchEndpoint ?? runtime?.endpoints.docsSearchUrl ?? '/api/docs/search'\n // Content-href seam, same prop → runtime → none chain. Threading it into\n // `resolveSearchResultAction` is what makes the dropdown obey the host's\n // route map; without it the row navigates to the RAG's canonical hub URL\n // even when the host serves that content in-app under a different path.\n const resolvedComposeContentUrl = composeContentUrl ?? runtime?.composeContentUrl\n\n const [query, setQuery] = useState('')\n const [results, setResults] = useState<SearchResult[]>([])\n const [isFetching, setIsFetching] = useState(false)\n const debouncedQuery = useDebounce(query, 300)\n\n useEffect(() => {\n if (!debouncedQuery || debouncedQuery.trim().length < 2) {\n setResults([])\n setIsFetching(false)\n return\n }\n\n let cancelled = false\n\n async function fetchResults() {\n setIsFetching(true)\n try {\n const params = new URLSearchParams({\n q: debouncedQuery,\n source,\n limit: '10',\n })\n if (tableIdsKey) params.set('tableIds', tableIdsKey)\n\n const response = await contentFetch(`${resolvedSearchEndpoint}?${params.toString()}`)\n if (!response.ok) {\n throw new Error(`Search request failed: ${response.status}`)\n }\n\n const json = await response.json()\n\n if (!cancelled && json.success && Array.isArray(json.data)) {\n const mapped = mapDocSearchResults(json.data as DocSearchResult[])\n setResults(mapped)\n }\n } catch (error) {\n console.error('Doc search error:', error)\n if (!cancelled) {\n setResults([])\n }\n } finally {\n if (!cancelled) {\n setIsFetching(false)\n }\n }\n }\n\n fetchResults()\n\n return () => {\n cancelled = true\n }\n }, [debouncedQuery, source, tableIdsKey, resolvedSearchEndpoint])\n\n // Derived loading state — single source of truth for \"should the\n // dropdown show 'Loading...' instead of 'No results found'\":\n const isLoading =\n query.trim().length >= 2 && (query !== debouncedQuery || isFetching)\n\n // Track whether dropdown should stay open (external link opened in new tab).\n const [keepOpen, setKeepOpen] = useState(false)\n\n const handleResultSelect = useCallback(\n (\n result: SearchResult,\n modifiers?: {\n metaKey?: boolean\n ctrlKey?: boolean\n shiftKey?: boolean\n altKey?: boolean\n button?: number\n },\n ) => {\n const action = resolveSearchResultAction(\n result,\n source,\n runtime?.navigation.mode,\n resolvedComposeContentUrl,\n )\n // Modifier / non-primary mouse click → force new tab regardless of\n // same-tab/new-tab decision. The dropdown row is a `<div>`, not an\n // `<a target=\"_blank\">`, so the browser doesn't background-tab\n // natively on cmd-click. Honor it explicitly here for parity with\n // the anchor-based surfaces (cards, chips, related-content). Plain\n // Enter from the keyboard passes `modifiers === undefined`.\n const wantsNewTab =\n modifiers &&\n (modifiers.metaKey ||\n modifiers.ctrlKey ||\n modifiers.shiftKey ||\n modifiers.altKey ||\n (typeof modifiers.button === 'number' && modifiers.button !== 0))\n switch (action.kind) {\n case 'navigate-same-tab': {\n if (wantsNewTab) {\n setKeepOpen(true)\n window.open(action.href, '_blank', NEW_TAB_FEATURES)\n return\n }\n // Same-origin click:\n // 1. If the href is under the current doc-tree's baseRoute AND\n // an `onInPageSwap` callback is wired AND returns true →\n // consider in-page swap handled.\n // 2. Otherwise → embed-shim `router.push()` (soft RSC nav on\n // Next.js hosts, window.location.assign on bare hosts).\n setKeepOpen(false)\n const path =\n baseRoute && action.href.startsWith(`${baseRoute}/`)\n ? action.href.slice(baseRoute.length + 1)\n : null\n if (path && onInPageSwap?.(path)) return\n router.push(stripSameOriginToPath(action.href))\n return\n }\n case 'navigate-new-tab':\n // Cross-origin (e.g. clicking a flamingo.run release from\n // product-hub) — open in a new tab. Keep dropdown open so the\n // user can pick another result without re-searching.\n setKeepOpen(true)\n // Embed-mode short-circuit — the row was clicked while the panel is\n // hosted inside an embedding app, so absolutize against the\n // embedder-supplied content origin and honor its `openExternal`\n // override. Not the only path an embed host takes: a composed\n // RELATIVE href resolves to `navigate-same-tab` above and never\n // reaches `decideNewTab`, which is what lets an embedder keep its\n // own in-app routes in-app.\n if (runtime?.navigation.mode === 'embed') {\n const targetPlatform =\n (result.metadata?.targetPlatform as string | null | undefined) ?? null\n resolveExternalNavigation({\n href: action.href,\n targetPlatform,\n runtime,\n }).open()\n return\n }\n window.open(action.href, '_blank', NEW_TAB_FEATURES)\n return\n case 'ask-ai':\n // Row is searchable-but-not-openable (cap_table positions,\n // financial-kpi snapshots, anything backed by\n // `resolveUrl: () => null`). Dispatch a CustomEvent that\n // GlobalAskAI listens for — opens chat + drills via\n // `entityIdFilter` (primary-key only, same as inline-card Ask).\n setKeepOpen(false)\n window.dispatchEvent(\n new CustomEvent('ask-ai:open-with-ref', { detail: action.detail }),\n )\n return\n case 'route':\n // Final fallback: legacy navigation by path. Hits when a row\n // has neither URL nor pk metadata — a mapper/API regression.\n setKeepOpen(false)\n onNavigate(action.path)\n return\n case 'noop':\n return\n }\n },\n [\n onNavigate,\n source,\n baseRoute,\n router,\n onInPageSwap,\n runtime,\n resolvedComposeContentUrl,\n ],\n )\n\n // Reset keepOpen when query changes.\n useEffect(() => {\n setKeepOpen(false)\n }, [query])\n\n return {\n query,\n setQuery,\n results,\n isLoading,\n handleResultSelect,\n keepDropdownOpen: keepOpen,\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-N3OGB543.cjs","../src/components/shared/doc-search/format-relative-path.ts","../src/components/shared/doc-search/doc-search-result-row.tsx","../src/components/shared/doc-search/doc-search-bar.tsx","../src/components/shared/doc-search/map-doc-search-results.ts","../src/components/shared/doc-search/resolve-search-result-action.ts","../src/components/shared/doc-search/use-doc-search.ts"],"names":["jsx"],"mappings":"AAAA,6rBAAY;AACZ;AACE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F,IAAA;AACA,IAAA;AACE,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACA,MAAA;AACF,IAAA;AACF,EAAA;AAGgB,EAAA;AACG,IAAA;AACT,EAAA;AAEH,EAAA;AACL,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACkB,IAAA;AACpB,EAAA;AACF;AN4DqG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/openframe-oss-lib/openframe-oss-lib/openframe-frontend-core/dist/chunk-N3OGB543.cjs","sourcesContent":[null,"/**\n * Format a full document path as a breadcrumb trail.\n * Shows parent folders only (excludes the last segment / filename).\n *\n * @example\n * formatRelativePath('openframe-oss-tenant/architecture/api-controllers.md')\n * // → 'Openframe oss tenant / Architecture'\n */\nexport function formatRelativePath(fullPath: string): string {\n if (!fullPath) return ''\n const segments = fullPath.replace(/\\.md$/, '').split('/')\n // Show only parent path (exclude the filename itself since the title already shows it)\n const parentSegments = segments.length > 1 ? segments.slice(0, -1) : segments\n return parentSegments\n .map((seg) => seg.charAt(0).toUpperCase() + seg.slice(1).replace(/-/g, ' '))\n .join(' / ')\n}\n","'use client'\n\n/**\n * Single row in the `<SearchInput>` dropdown — the standard layout\n * used by every doc-search-backed surface (company-hub data-room\n * search bar, onboarding-guide catalog search, …). Single source of\n * truth for the row appearance so search dropdowns are visually\n * identical everywhere.\n *\n * Resolves the source icon via the same `resolveSourceIcon()`\n * registry the inline chat-card refs use, so a row pointing at e.g.\n * an onboarding-guide surfaces the SAME `<GraduationCap>` glyph the\n * chat card surfaces — no cross-surface drift.\n */\n\nimport { resolveSourceIcon } from '../../chat/utils/source-row-cta'\nimport { formatRelativePath } from './format-relative-path'\n\n/**\n * Minimal result shape this row renders. Compatible with any\n * doc-search hook whose result type exposes `{ title?, path?,\n * metadata? }`. The two hub consumers (onboarding-guide catalog,\n * data-room sidebar) both satisfy this shape via their\n * `useDocSearch` hook result.\n */\nexport interface DocSearchResultRowEntry {\n title?: string\n path?: string\n metadata?: Record<string, unknown>\n}\n\nexport interface DocSearchResultRowProps {\n result: DocSearchResultRowEntry\n isHighlighted: boolean\n}\n\nexport function DocSearchResultRow({\n result,\n isHighlighted,\n}: DocSearchResultRowProps) {\n const docType = (result.metadata?.documentType as string) || undefined\n const sourceRepo = (result.metadata?.sourceRepo as string) || undefined\n const { Icon: SourceIcon, label: iconLabel } = resolveSourceIcon({\n sourceRepo,\n documentType: docType,\n })\n const isGroup = result.metadata?.isGroup as boolean | undefined\n\n return (\n <div className=\"flex items-center gap-3 w-full min-w-0\">\n <span\n className=\"flex-shrink-0 text-ods-text-secondary\"\n title={iconLabel}\n >\n <SourceIcon className=\"size-4\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <div\n className={`text-h6 truncate ${\n isHighlighted ? 'text-ods-accent' : 'text-ods-text-primary'\n }`}\n >\n {result.title || result.path}\n </div>\n {!isGroup && result.path?.includes('/') && (\n <div className=\"text-h6 text-ods-text-secondary truncate mt-0.5\">\n {formatRelativePath(result.path)}\n </div>\n )}\n </div>\n </div>\n )\n}\n","'use client'\n\n/**\n * `<DocSearchBar>` — the canonical RAG-search dropdown surface.\n *\n * Mounted by every doc-search consumer (data-room sidebar, onboarding-\n * guide catalog, and any future surface that needs typeahead against\n * `/api/docs/search`). Wraps `<SearchInput>` with the lib's standard\n * `<DocSearchResultRow>` so the dropdown looks identical everywhere.\n *\n * ## Why a presentation component, not a \"search bar that owns its\n * own hook\"\n *\n * The data-fetching hook (`useDocSearch`) lives hub-side because it\n * depends on hub-only context (`useDocNavigation`, the rag-table-\n * config registry, the hub's `decideNewTab` helper). Moving the hook\n * would cascade ~5 more file migrations into the lib.\n *\n * Instead, the hook stays hub-side and callers pass its result into\n * this component as plain props. Both consumers shrink to ~5 lines.\n */\n\nimport type { ReactNode } from 'react'\nimport { SearchInput, type SearchResult } from '../../ui/search-input'\nimport { DocSearchResultRow } from './doc-search-result-row'\n\nexport interface DocSearchBarProps {\n placeholder: string\n query: string\n onQueryChange: (value: string) => void\n /** Hook-fetched results. Reuses the lib's `<SearchInput>` `SearchResult`\n * shape directly so callers don't translate. */\n results: SearchResult[]\n isLoading: boolean\n /** Result selection handler. Mirrors `<SearchInput>` — the second\n * `modifiers` argument is preserved so cmd-click / shift-click on\n * a result row still forces new-tab behavior. Hub `useDocSearch`\n * reads these to short-circuit to `window.open()`. */\n onResultSelect: (\n result: SearchResult,\n modifiers?: {\n metaKey?: boolean\n ctrlKey?: boolean\n shiftKey?: boolean\n altKey?: boolean\n button?: number\n },\n ) => void\n /** Lets the caller's hook force the dropdown open after a recent\n * internal action (e.g. result navigation). `undefined` falls back\n * to `<SearchInput>`'s built-in focus/hover heuristics. */\n showDropdown?: boolean\n /** Defaults to 2 — matches the existing data-room and onboarding-\n * guide consumers. Override only if a surface needs different\n * typeahead semantics. */\n minQueryLength?: number\n /** Defaults to 0 — both existing consumers debounce inside the\n * hook, not the input. */\n debounceMs?: number\n className?: string\n /** Optional row-renderer override. Defaults to the lib's standard\n * `<DocSearchResultRow>` (source icon + title + path breadcrumb).\n * Override only when a surface needs custom row chrome. */\n renderResult?: (result: SearchResult, isHighlighted: boolean) => ReactNode\n}\n\nexport function DocSearchBar({\n placeholder,\n query,\n onQueryChange,\n results,\n isLoading,\n onResultSelect,\n showDropdown,\n minQueryLength = 2,\n debounceMs = 0,\n className = 'w-full',\n renderResult,\n}: DocSearchBarProps) {\n return (\n <SearchInput\n placeholder={placeholder}\n value={query}\n onChange={onQueryChange}\n results={results}\n isLoading={isLoading}\n onResultSelect={onResultSelect}\n showDropdown={showDropdown || undefined}\n debounceMs={debounceMs}\n minQueryLength={minQueryLength}\n className={className}\n renderResult={\n renderResult ??\n ((result, isHighlighted) => (\n <DocSearchResultRow result={result} isHighlighted={isHighlighted} />\n ))\n }\n />\n )\n}\n","/**\n * Map RAG `/api/docs/search` wire results into the `<DocSearchBar>`\n * dropdown's row shape, collapsing entity-table rows into grouped\n * results so the dropdown lists ONE \"Cap Table (12 records)\" row\n * instead of 12 individual rows.\n *\n * Pure transform — no telemetry, no navigation, no React deps. Lifted\n * from the hub's `hooks/use-docs.ts:mapDocSearchResults` (the hub's\n * `traceCompose` call was hub-only telemetry and is intentionally\n * dropped — callers that want logging can wrap this helper).\n */\n\nimport type { SearchResult } from '../../ui/search-input'\nimport type { DocSearchResult } from './types'\n\n/** Source repos that should be collapsed into grouped results in the search bar.\n * Only financial tables (all rows link to the same admin page).\n * Content tables (blog, webinar, podcast, etc.) stay individual since each has a unique URL. */\nconst SEARCH_GROUP_REPOS = new Set([\n 'financial-cap-table',\n 'financial-kpis',\n 'financial-pnl',\n 'financial-balance-sheet',\n 'financial-cash-flow',\n])\n\nconst ENTITY_LABELS: Record<string, string> = {\n 'financial-cap-table': 'Cap Table',\n 'financial-kpis': 'Financial KPIs',\n 'financial-pnl': 'Profit & Loss',\n 'financial-balance-sheet': 'Balance Sheets',\n 'financial-cash-flow': 'Cash Flow',\n 'blog-posts': 'Blog Posts',\n 'product-releases': 'Product Releases',\n 'case-studies': 'Case Studies',\n webinars: 'Webinars',\n events: 'Events',\n podcasts: 'Podcasts',\n}\n\nexport function mapDocSearchResults(docs: DocSearchResult[]): SearchResult[] {\n const entityGroups = new Map<string, DocSearchResult[]>()\n // Track insertion order — groups appear where the FIRST row of that\n // repo appeared in the response.\n const order: Array<\n { type: 'entity'; repo: string } | { type: 'doc'; doc: DocSearchResult }\n > = []\n const seenRepos = new Set<string>()\n\n for (const doc of docs) {\n if (doc.sourceRepo && SEARCH_GROUP_REPOS.has(doc.sourceRepo)) {\n const group = entityGroups.get(doc.sourceRepo) || []\n group.push(doc)\n entityGroups.set(doc.sourceRepo, group)\n if (!seenRepos.has(doc.sourceRepo)) {\n seenRepos.add(doc.sourceRepo)\n order.push({ type: 'entity', repo: doc.sourceRepo })\n }\n } else {\n order.push({ type: 'doc', doc })\n }\n }\n\n const results: SearchResult[] = []\n for (const entry of order) {\n if (entry.type === 'entity') {\n const rows = entityGroups.get(entry.repo)!\n const label = ENTITY_LABELS[entry.repo] || entry.repo\n results.push({\n id: `group-${entry.repo}`,\n title: `${label} (${rows.length} ${rows.length === 1 ? 'record' : 'records'})`,\n path: rows[0].path,\n type: 'file',\n metadata: {\n documentType: rows[0].documentType,\n externalUrl: rows[0].externalUrl,\n sourceRepo: entry.repo,\n id: rows[0].entityId,\n isGroup: true,\n items: rows.map((r) => ({\n name: r.name,\n externalUrl: r.externalUrl,\n id: r.entityId,\n sourceRepo: r.sourceRepo,\n documentType: r.documentType,\n })),\n },\n })\n } else {\n const doc = entry.doc\n const isNonMarkdown = doc.documentType && doc.documentType !== 'markdown'\n results.push({\n id: doc.path,\n title: doc.name,\n description: isNonMarkdown ? doc.name : doc.snippet,\n path: doc.path,\n type: doc.type,\n metadata: {\n matchType: doc.matchType,\n ...(doc.documentType ? { documentType: doc.documentType } : {}),\n ...(doc.externalUrl ? { externalUrl: doc.externalUrl } : {}),\n ...(doc.targetPlatform != null\n ? { targetPlatform: doc.targetPlatform }\n : {}),\n ...(doc.sourceRepo ? { sourceRepo: doc.sourceRepo } : {}),\n ...(doc.entityId ? { id: doc.entityId } : {}),\n },\n })\n }\n }\n\n return results\n}\n","/**\n * Resolve what should happen when the user picks a search result.\n * Returns one of five typed actions so the caller is a single switch.\n *\n * Resolution order:\n * 1. `externalUrl` present → resolve the href through the host's\n * `composeContentUrl` seam (when wired), then use `decideNewTab` to\n * choose same-tab vs new-tab against the resolved `targetPlatform`.\n * 2. Row has `id` + `sourceRepo` + `documentType` → synth an Ask-AI\n * action (entity drill-in via primary key, no URL).\n * 3. Row has only `path` → legacy navigation fallback.\n * 4. Nothing actionable → noop.\n *\n * Lifted from the hub's `hooks/use-docs.ts:resolveSearchResultAction`.\n * Pure — no React, no telemetry.\n */\n\nimport type { SearchResult } from '../../ui/search-input'\nimport type { ChatRef } from '../../chat/chat-ref.types'\nimport type { ComposeContentUrl } from '../../../utils/content-href'\nimport { decideNewTab } from '../../chat/utils/decide-new-tab'\n\n/** True for `https://…` and protocol-relative `//…`. A composed href that is\n * NOT absolute is an in-app route the host claimed via `hostedTypes` /\n * `overrides`. */\nfunction isAbsoluteHref(href: string): boolean {\n return /^(?:[a-z][a-z0-9+.-]*:)?\\/\\//i.test(href)\n}\n\nexport type SearchResultAction =\n | { kind: 'navigate-same-tab'; href: string }\n | { kind: 'navigate-new-tab'; href: string }\n | { kind: 'ask-ai'; detail: { source: string; ref: ChatRef } }\n | { kind: 'route'; path: string }\n | { kind: 'noop' }\n\nexport function resolveSearchResultAction(\n result: SearchResult,\n source: string,\n runtimeMode?: 'host' | 'embed',\n /** The host's unified content-href seam (`runtime.composeContentUrl`).\n * When wired, an entity row's RAG `externalUrl` is re-resolved through it,\n * so a type the host serves in-app (`hostedTypes`) or deep-links itself\n * (`overrides`) lands on the SAME href the catalog cards and chat cards\n * use. Omitted → the legacy verbatim-`externalUrl` behavior. */\n composeContentUrl?: ComposeContentUrl,\n): SearchResultAction {\n const meta = result.metadata ?? {}\n const externalUrl = meta.externalUrl as string | undefined\n const rowId = meta.id as string | undefined\n const sourceRepo = meta.sourceRepo as string | undefined\n const documentType = meta.documentType as string | undefined\n if (externalUrl) {\n const targetPlatform = meta.targetPlatform as string | null | undefined\n // Unified content-href seam — the same call `resolveSourceRowCTA` makes\n // for chat rows. Hosted types relativize the slug out of `externalUrl`;\n // everything else comes back verbatim, so an unwired host (or a row with\n // no `documentType`) keeps today's behavior byte-for-byte.\n const composed =\n composeContentUrl && documentType\n ? composeContentUrl({\n type: documentType,\n identifier: rowId ?? '',\n externalUrl,\n targetPlatform: targetPlatform ?? null,\n })\n : null\n const href = composed?.href || externalUrl\n // A RELATIVE composed href means the host claimed this row as in-app.\n // Short-circuit BEFORE `decideNewTab`: in embed mode that helper forces\n // new-tab unconditionally, which would fire `window.open()` on a path\n // that only resolves inside this app.\n if (composed && !isAbsoluteHref(href)) {\n return { kind: 'navigate-same-tab', href }\n }\n // Same pure helper `useNavLink` and `useUnifiedNav` call — single\n // decision rule across cards, chips, and autocomplete rows. Thread\n // the caller's `source` as `currentSource` so the platform-vs-\n // platform comparison matches the hub's pre-migration behavior.\n const isNewTab = decideNewTab({\n href,\n targetPlatform: composed ? composed.targetPlatform : targetPlatform,\n surface: 'useUnifiedNav',\n runtimeMode,\n currentSource: source,\n })\n return isNewTab\n ? { kind: 'navigate-new-tab', href }\n : { kind: 'navigate-same-tab', href }\n }\n if (rowId && sourceRepo && documentType) {\n return {\n kind: 'ask-ai',\n detail: {\n source,\n ref: { type: documentType, id: rowId, title: result.title, url: null },\n },\n }\n }\n if (result.path) {\n return { kind: 'route', path: result.path }\n }\n return { kind: 'noop' }\n}\n","'use client'\n\n/**\n * `useDocSearch` — debounced RAG-search hook against `/api/docs/search`.\n *\n * Pure fetch + navigation glue. Embedders can mount this directly\n * (any host with a reverse-proxy that exposes `/api/docs/search` will\n * work). Hub callers wire it into the lib `<DocSearchBar>` for the\n * canonical typeahead dropdown.\n *\n * ## What moved from hub to lib\n *\n * Lifted from `multi-platform-hub/hooks/use-docs.ts:useDocSearch`. Two\n * hub-only concerns are now optional injection points instead of\n * direct imports:\n *\n * - `useDocNavigation()` (hub's in-page doc-tree swap) → optional\n * `onInPageSwap?: (path: string) => boolean` config callback. When\n * present and returns true, the hook treats a same-origin result\n * click as \"handled in-page\"; when absent or returns false, the\n * hook falls back to `onNavigate(path)` (`router.push` on hub,\n * `window.location.assign` on bare embedders).\n * - `traceCompose` (hub-only telemetry) → dropped. The lib has no\n * equivalent runtime-context yet; bring it back when there is one.\n *\n * Everything else (debounce, `useChatRuntime` for embed-mode short-\n * circuit, embed-shim router, the action-resolver + result-mapper) is\n * now lib-resident.\n *\n * ## Result hrefs go through the content-href seam\n *\n * A row's href is NOT the RAG `externalUrl` verbatim any more: when the\n * host wires `runtime.composeContentUrl` (or passes `composeContentUrl`\n * here), the row is re-resolved through it — the SAME seam the catalog\n * cards and the chat entity cards use. So a host that serves onboarding\n * guides at `/help-center/onboarding-guides/<slug>` gets that path from\n * the dropdown too, instead of bouncing the user to the canonical hub\n * URL. Unwired hosts keep the verbatim-`externalUrl` behavior.\n */\n\nimport { useState, useEffect, useCallback } from 'react'\nimport { useRouter } from '../../../embed-shims'\nimport { useDebounce } from '../../../hooks/ui/use-debounce'\nimport { useChatRuntime } from '../../../contexts/chat-runtime-context'\nimport { contentFetch } from '../../../utils/embed-content-fetch'\nimport type { SearchResult } from '../../ui/search-input'\nimport {\n resolveExternalNavigation,\n stripSameOriginToPath,\n NEW_TAB_FEATURES,\n} from '../../chat/utils/chat-nav-resolution'\nimport type { ComposeContentUrl } from '../../../utils/content-href'\nimport type { DocSearchResult } from './types'\nimport { mapDocSearchResults } from './map-doc-search-results'\nimport { resolveSearchResultAction } from './resolve-search-result-action'\n\nexport interface UseDocSearchConfig {\n /** Discriminator passed to `/api/docs/search?source=` (e.g.\n * `'openframe'`). Embedders set it to whatever discriminator their\n * reverse-proxy expects. */\n source: string\n /** Base route prefix this search lives under (e.g. `'/onboarding-guides'`).\n * When a result's href starts with `${baseRoute}/`, the hook\n * attempts the optional in-page swap path before falling through\n * to a full nav. */\n baseRoute: string\n /** Imperative navigation fallback. Called when no override\n * (in-page swap, new-tab) applies. Hub callers pass\n * `(path) => router.push(path)`; embedders pass an equivalent. */\n onNavigate: (path: string) => void\n /** Optional `RagTableConfig.id` list to narrow the search to specific\n * tables (e.g. `['onboarding-guides']`). Forwarded to\n * `/api/docs/search?tableIds=…` which intersects with the source's\n * standing set. */\n tableIds?: string[]\n /** Optional in-page swap callback. When the result's href is under\n * `baseRoute` AND this callback returns true, the hook treats the\n * click as handled in-page (no router push). Hub's\n * `<DocumentationSection>` wires this to\n * `useDocNavigation().navigate(path)`. */\n onInPageSwap?: (path: string) => boolean\n /** Optional endpoint override. Defaults to `'/api/docs/search'`\n * (the hub's reverse-proxy route). Embedders with a different\n * path can override. */\n searchEndpoint?: string\n /** Optional content-href seam override. Same fall-back chain as\n * `searchEndpoint`: prop → `runtime.composeContentUrl` → none. Wired,\n * it makes a result row honor the host's `hostedTypes` / `overrides`\n * instead of navigating to the RAG's canonical hub URL — so a row\n * lands where the catalog card for the same entity lands. */\n composeContentUrl?: ComposeContentUrl\n}\n\nexport function useDocSearch(config: UseDocSearchConfig) {\n const {\n source,\n baseRoute,\n onNavigate,\n tableIds,\n onInPageSwap,\n searchEndpoint,\n composeContentUrl,\n } = config\n const tableIdsKey = tableIds && tableIds.length > 0 ? tableIds.join(',') : ''\n\n const router = useRouter()\n // Optional chat-runtime read — when present and mode='embed' the\n // search-result row click short-circuits to a new-tab open against\n // the absolutized URL. Null/host preserves today's behavior.\n // Also used as the proxy-prefix fallback for `searchEndpoint`, matching\n // how tickets resolves `findTicketUrl`.\n const runtime = useChatRuntime()\n const resolvedSearchEndpoint =\n searchEndpoint ?? runtime?.endpoints.docsSearchUrl ?? '/api/docs/search'\n // Content-href seam, same prop → runtime → none chain. Threading it into\n // `resolveSearchResultAction` is what makes the dropdown obey the host's\n // route map; without it the row navigates to the RAG's canonical hub URL\n // even when the host serves that content in-app under a different path.\n const resolvedComposeContentUrl = composeContentUrl ?? runtime?.composeContentUrl\n\n const [query, setQuery] = useState('')\n const [results, setResults] = useState<SearchResult[]>([])\n const [isFetching, setIsFetching] = useState(false)\n const debouncedQuery = useDebounce(query, 300)\n\n useEffect(() => {\n if (!debouncedQuery || debouncedQuery.trim().length < 2) {\n setResults([])\n setIsFetching(false)\n return\n }\n\n let cancelled = false\n\n async function fetchResults() {\n setIsFetching(true)\n try {\n const params = new URLSearchParams({\n q: debouncedQuery,\n source,\n limit: '10',\n })\n if (tableIdsKey) params.set('tableIds', tableIdsKey)\n\n const response = await contentFetch(`${resolvedSearchEndpoint}?${params.toString()}`)\n if (!response.ok) {\n throw new Error(`Search request failed: ${response.status}`)\n }\n\n const json = await response.json()\n\n if (!cancelled && json.success && Array.isArray(json.data)) {\n const mapped = mapDocSearchResults(json.data as DocSearchResult[])\n setResults(mapped)\n }\n } catch (error) {\n console.error('Doc search error:', error)\n if (!cancelled) {\n setResults([])\n }\n } finally {\n if (!cancelled) {\n setIsFetching(false)\n }\n }\n }\n\n fetchResults()\n\n return () => {\n cancelled = true\n }\n }, [debouncedQuery, source, tableIdsKey, resolvedSearchEndpoint])\n\n // Derived loading state — single source of truth for \"should the\n // dropdown show 'Loading...' instead of 'No results found'\":\n const isLoading =\n query.trim().length >= 2 && (query !== debouncedQuery || isFetching)\n\n // Track whether dropdown should stay open (external link opened in new tab).\n const [keepOpen, setKeepOpen] = useState(false)\n\n const handleResultSelect = useCallback(\n (\n result: SearchResult,\n modifiers?: {\n metaKey?: boolean\n ctrlKey?: boolean\n shiftKey?: boolean\n altKey?: boolean\n button?: number\n },\n ) => {\n const action = resolveSearchResultAction(\n result,\n source,\n runtime?.navigation.mode,\n resolvedComposeContentUrl,\n )\n // Modifier / non-primary mouse click → force new tab regardless of\n // same-tab/new-tab decision. The dropdown row is a `<div>`, not an\n // `<a target=\"_blank\">`, so the browser doesn't background-tab\n // natively on cmd-click. Honor it explicitly here for parity with\n // the anchor-based surfaces (cards, chips, related-content). Plain\n // Enter from the keyboard passes `modifiers === undefined`.\n const wantsNewTab =\n modifiers &&\n (modifiers.metaKey ||\n modifiers.ctrlKey ||\n modifiers.shiftKey ||\n modifiers.altKey ||\n (typeof modifiers.button === 'number' && modifiers.button !== 0))\n switch (action.kind) {\n case 'navigate-same-tab': {\n if (wantsNewTab) {\n setKeepOpen(true)\n window.open(action.href, '_blank', NEW_TAB_FEATURES)\n return\n }\n // Same-origin click:\n // 1. If the href is under the current doc-tree's baseRoute AND\n // an `onInPageSwap` callback is wired AND returns true →\n // consider in-page swap handled.\n // 2. Otherwise → embed-shim `router.push()` (soft RSC nav on\n // Next.js hosts, window.location.assign on bare hosts).\n setKeepOpen(false)\n const path =\n baseRoute && action.href.startsWith(`${baseRoute}/`)\n ? action.href.slice(baseRoute.length + 1)\n : null\n if (path && onInPageSwap?.(path)) return\n router.push(stripSameOriginToPath(action.href))\n return\n }\n case 'navigate-new-tab':\n // Cross-origin (e.g. clicking a flamingo.run release from\n // product-hub) — open in a new tab. Keep dropdown open so the\n // user can pick another result without re-searching.\n setKeepOpen(true)\n // Embed-mode short-circuit — the row was clicked while the panel is\n // hosted inside an embedding app, so absolutize against the\n // embedder-supplied content origin and honor its `openExternal`\n // override. Not the only path an embed host takes: a composed\n // RELATIVE href resolves to `navigate-same-tab` above and never\n // reaches `decideNewTab`, which is what lets an embedder keep its\n // own in-app routes in-app.\n if (runtime?.navigation.mode === 'embed') {\n const targetPlatform =\n (result.metadata?.targetPlatform as string | null | undefined) ?? null\n resolveExternalNavigation({\n href: action.href,\n targetPlatform,\n runtime,\n }).open()\n return\n }\n window.open(action.href, '_blank', NEW_TAB_FEATURES)\n return\n case 'ask-ai':\n // Row is searchable-but-not-openable (cap_table positions,\n // financial-kpi snapshots, anything backed by\n // `resolveUrl: () => null`). Dispatch a CustomEvent that\n // GlobalAskAI listens for — opens chat + drills via\n // `entityIdFilter` (primary-key only, same as inline-card Ask).\n setKeepOpen(false)\n window.dispatchEvent(\n new CustomEvent('ask-ai:open-with-ref', { detail: action.detail }),\n )\n return\n case 'route':\n // Final fallback: legacy navigation by path. Hits when a row\n // has neither URL nor pk metadata — a mapper/API regression.\n setKeepOpen(false)\n onNavigate(action.path)\n return\n case 'noop':\n return\n }\n },\n [\n onNavigate,\n source,\n baseRoute,\n router,\n onInPageSwap,\n runtime,\n resolvedComposeContentUrl,\n ],\n )\n\n // Reset keepOpen when query changes.\n useEffect(() => {\n setKeepOpen(false)\n }, [query])\n\n return {\n query,\n setQuery,\n results,\n isLoading,\n handleResultSelect,\n keepDropdownOpen: keepOpen,\n }\n}\n"]}
|
|
@@ -1940,17 +1940,18 @@ function hasEmbedAuthAdapter() {
|
|
|
1940
1940
|
function needsBearerAssetFetch(url) {
|
|
1941
1941
|
if (typeof window === "undefined") return false;
|
|
1942
1942
|
const adapter2 = getRegisteredAuthAdapter();
|
|
1943
|
-
if (!
|
|
1944
|
-
return false;
|
|
1945
|
-
}
|
|
1943
|
+
if (!adapter2 || _optionalChain([adapter2, 'access', _48 => _48.getHeaders, 'optionalCall', _49 => _49(), 'access', _50 => _50.Authorization]) === void 0) return false;
|
|
1946
1944
|
let target;
|
|
1945
|
+
let pageOrigin;
|
|
1947
1946
|
try {
|
|
1948
1947
|
target = new URL(url, window.location.href);
|
|
1948
|
+
pageOrigin = new URL(window.location.href).origin;
|
|
1949
1949
|
} catch (e5) {
|
|
1950
1950
|
return false;
|
|
1951
1951
|
}
|
|
1952
1952
|
if (target.protocol !== "http:" && target.protocol !== "https:") return false;
|
|
1953
|
-
|
|
1953
|
+
if (target.origin === pageOrigin) return true;
|
|
1954
|
+
return _nullishCoalesce(_optionalChain([adapter2, 'access', _51 => _51.allowedOrigins, 'optionalAccess', _52 => _52.includes, 'call', _53 => _53(target.origin)]), () => ( false));
|
|
1954
1955
|
}
|
|
1955
1956
|
function embedAuthedFetch(url, init = {}) {
|
|
1956
1957
|
assertSameOrigin(url);
|
|
@@ -1982,7 +1983,7 @@ function setInFlightRefresh(refresh) {
|
|
|
1982
1983
|
}
|
|
1983
1984
|
function dedupedRefresh() {
|
|
1984
1985
|
const adapter2 = getRegisteredAuthAdapter();
|
|
1985
|
-
if (!_optionalChain([adapter2, 'optionalAccess',
|
|
1986
|
+
if (!_optionalChain([adapter2, 'optionalAccess', _54 => _54.refresh])) return Promise.resolve(false);
|
|
1986
1987
|
let inFlightRefresh = getInFlightRefresh();
|
|
1987
1988
|
if (!inFlightRefresh) {
|
|
1988
1989
|
inFlightRefresh = Promise.resolve().then(() => adapter2.refresh()).catch(() => false).finally(() => {
|
|
@@ -1995,12 +1996,12 @@ function dedupedRefresh() {
|
|
|
1995
1996
|
async function fetchWithRefresh(url, init, baseHeaders, isRetry) {
|
|
1996
1997
|
const { url: authedUrl, headers } = applyProxyAuth(url, { ...baseHeaders });
|
|
1997
1998
|
const adapter2 = getRegisteredAuthAdapter();
|
|
1998
|
-
if (_optionalChain([adapter2, 'optionalAccess',
|
|
1999
|
+
if (_optionalChain([adapter2, 'optionalAccess', _55 => _55.getHeaders])) {
|
|
1999
2000
|
for (const [k, v] of Object.entries(adapter2.getHeaders())) {
|
|
2000
2001
|
if (v !== void 0) headers[k] = v;
|
|
2001
2002
|
}
|
|
2002
2003
|
}
|
|
2003
|
-
const credentials = _nullishCoalesce(_nullishCoalesce(_optionalChain([adapter2, 'optionalAccess',
|
|
2004
|
+
const credentials = _nullishCoalesce(_nullishCoalesce(_optionalChain([adapter2, 'optionalAccess', _56 => _56.credentials]), () => ( init.credentials)), () => ( "same-origin"));
|
|
2004
2005
|
const response = await fetch(authedUrl, {
|
|
2005
2006
|
...init,
|
|
2006
2007
|
headers,
|
|
@@ -2011,7 +2012,7 @@ async function fetchWithRefresh(url, init, baseHeaders, isRetry) {
|
|
|
2011
2012
|
// `SameSite=None` must be configured server-side for that to work).
|
|
2012
2013
|
credentials
|
|
2013
2014
|
});
|
|
2014
|
-
if (response.status === 401 && !isRetry && _optionalChain([adapter2, 'optionalAccess',
|
|
2015
|
+
if (response.status === 401 && !isRetry && _optionalChain([adapter2, 'optionalAccess', _57 => _57.refresh])) {
|
|
2015
2016
|
const refreshed = await dedupedRefresh();
|
|
2016
2017
|
if (refreshed) {
|
|
2017
2018
|
return fetchWithRefresh(url, init, baseHeaders, true);
|
|
@@ -2035,7 +2036,7 @@ function assertSameOrigin(url) {
|
|
|
2035
2036
|
);
|
|
2036
2037
|
}
|
|
2037
2038
|
if (target.origin !== pageOrigin) {
|
|
2038
|
-
if (_optionalChain([getRegisteredAuthAdapter, 'call',
|
|
2039
|
+
if (_optionalChain([getRegisteredAuthAdapter, 'call', _58 => _58(), 'optionalAccess', _59 => _59.allowedOrigins, 'optionalAccess', _60 => _60.includes, 'call', _61 => _61(target.origin)])) {
|
|
2039
2040
|
return;
|
|
2040
2041
|
}
|
|
2041
2042
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -2417,23 +2418,23 @@ function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
|
2417
2418
|
return { imageUrl: fetchedImageUrl, isLoading, error };
|
|
2418
2419
|
}
|
|
2419
2420
|
|
|
2420
|
-
// src/hooks/use-authed-
|
|
2421
|
+
// src/hooks/use-authed-asset-src.ts
|
|
2421
2422
|
|
|
2422
2423
|
var resolvedCache = /* @__PURE__ */ new Map();
|
|
2423
2424
|
var inFlight = /* @__PURE__ */ new Map();
|
|
2424
2425
|
var cacheGeneration = 0;
|
|
2425
|
-
function
|
|
2426
|
+
function clearAuthedAssetCache() {
|
|
2426
2427
|
cacheGeneration++;
|
|
2427
2428
|
for (const url of resolvedCache.values()) URL.revokeObjectURL(url);
|
|
2428
2429
|
resolvedCache.clear();
|
|
2429
2430
|
inFlight.clear();
|
|
2430
2431
|
}
|
|
2431
|
-
function fetchAsBlobUrl(src) {
|
|
2432
|
+
function fetchAsBlobUrl(src, accept) {
|
|
2432
2433
|
let pending = inFlight.get(src);
|
|
2433
2434
|
if (!pending) {
|
|
2434
2435
|
const startedGeneration = cacheGeneration;
|
|
2435
|
-
pending = embedAuthedFetch(src, { headers: { Accept:
|
|
2436
|
-
if (!response.ok) throw new Error(`
|
|
2436
|
+
pending = embedAuthedFetch(src, { headers: { Accept: accept } }).then(async (response) => {
|
|
2437
|
+
if (!response.ok) throw new Error(`asset fetch failed: ${response.status}`);
|
|
2437
2438
|
const blobUrl = URL.createObjectURL(await response.blob());
|
|
2438
2439
|
if (startedGeneration === cacheGeneration) {
|
|
2439
2440
|
resolvedCache.set(src, blobUrl);
|
|
@@ -2447,25 +2448,31 @@ function fetchAsBlobUrl(src) {
|
|
|
2447
2448
|
}
|
|
2448
2449
|
return pending;
|
|
2449
2450
|
}
|
|
2450
|
-
function
|
|
2451
|
+
function useAuthedAssetSrc(src, accept = "*/*") {
|
|
2451
2452
|
const bearerSrc = src && needsBearerAssetFetch(src) ? src : null;
|
|
2452
2453
|
const [, rerender] = _react.useReducer.call(void 0, (c) => c + 1, 0);
|
|
2453
2454
|
_react.useEffect.call(void 0, () => {
|
|
2454
2455
|
if (!bearerSrc || resolvedCache.has(bearerSrc)) return;
|
|
2455
2456
|
let cancelled = false;
|
|
2456
|
-
fetchAsBlobUrl(bearerSrc).catch(() => {
|
|
2457
|
+
fetchAsBlobUrl(bearerSrc, accept).catch(() => {
|
|
2457
2458
|
}).finally(() => {
|
|
2458
2459
|
if (!cancelled) rerender();
|
|
2459
2460
|
});
|
|
2460
2461
|
return () => {
|
|
2461
2462
|
cancelled = true;
|
|
2462
2463
|
};
|
|
2463
|
-
}, [bearerSrc]);
|
|
2464
|
+
}, [bearerSrc, accept]);
|
|
2464
2465
|
if (!src) return void 0;
|
|
2465
2466
|
if (!bearerSrc) return src;
|
|
2466
2467
|
return resolvedCache.get(bearerSrc);
|
|
2467
2468
|
}
|
|
2468
2469
|
|
|
2470
|
+
// src/hooks/use-authed-image-src.ts
|
|
2471
|
+
function useAuthedImageSrc(src) {
|
|
2472
|
+
return useAuthedAssetSrc(src, "image/*");
|
|
2473
|
+
}
|
|
2474
|
+
var clearAuthedImageCache = clearAuthedAssetCache;
|
|
2475
|
+
|
|
2469
2476
|
// src/hooks/state/use-query-params.ts
|
|
2470
2477
|
_chunkSSJNN5BScjs.init_next_navigation.call(void 0, );
|
|
2471
2478
|
|
|
@@ -2683,7 +2690,7 @@ function setNestedValue(obj, path, value) {
|
|
|
2683
2690
|
}
|
|
2684
2691
|
function getNestedValue(obj, path) {
|
|
2685
2692
|
return path.split(".").reduce((current, key) => {
|
|
2686
|
-
return _optionalChain([current, 'optionalAccess',
|
|
2693
|
+
return _optionalChain([current, 'optionalAccess', _62 => _62[key]]);
|
|
2687
2694
|
}, obj);
|
|
2688
2695
|
}
|
|
2689
2696
|
function mergeVariables(currentVariables, updates, schema) {
|
|
@@ -3458,7 +3465,7 @@ function useNearViewport(rootMargin = NEAR_VIEWPORT_ROOT_MARGIN, threshold = 0)
|
|
|
3458
3465
|
const stillOurs = subscribers.get(prev);
|
|
3459
3466
|
if (stillOurs) {
|
|
3460
3467
|
subscribers.delete(prev);
|
|
3461
|
-
_optionalChain([observers, 'access',
|
|
3468
|
+
_optionalChain([observers, 'access', _63 => _63.get, 'call', _64 => _64(key), 'optionalAccess', _65 => _65.unobserve, 'call', _66 => _66(prev)]);
|
|
3462
3469
|
}
|
|
3463
3470
|
}
|
|
3464
3471
|
elRef.current = node;
|
|
@@ -3475,7 +3482,7 @@ function useNearViewport(rootMargin = NEAR_VIEWPORT_ROOT_MARGIN, threshold = 0)
|
|
|
3475
3482
|
if (!el) return;
|
|
3476
3483
|
if (subscribers.get(el)) {
|
|
3477
3484
|
subscribers.delete(el);
|
|
3478
|
-
_optionalChain([observers, 'access',
|
|
3485
|
+
_optionalChain([observers, 'access', _67 => _67.get, 'call', _68 => _68(key), 'optionalAccess', _69 => _69.unobserve, 'call', _70 => _70(el)]);
|
|
3479
3486
|
}
|
|
3480
3487
|
};
|
|
3481
3488
|
}, [key]);
|
|
@@ -3590,8 +3597,8 @@ function useAccessCodeIntegration() {
|
|
|
3590
3597
|
// src/utils/og-placeholder.ts
|
|
3591
3598
|
var DEFAULT_OG_PLACEHOLDER_PATH = "/api/og-placeholder";
|
|
3592
3599
|
function resolveOgPlaceholderBase(endpoints) {
|
|
3593
|
-
if (_optionalChain([endpoints, 'optionalAccess',
|
|
3594
|
-
const imageProxy = _optionalChain([endpoints, 'optionalAccess',
|
|
3600
|
+
if (_optionalChain([endpoints, 'optionalAccess', _71 => _71.ogPlaceholderUrl])) return endpoints.ogPlaceholderUrl;
|
|
3601
|
+
const imageProxy = _optionalChain([endpoints, 'optionalAccess', _72 => _72.imageProxyUrlPrefix]);
|
|
3595
3602
|
if (imageProxy) {
|
|
3596
3603
|
const derived = imageProxy.replace(/\/image-proxy(?=$|[?/])/, "/og-placeholder");
|
|
3597
3604
|
if (derived !== imageProxy) return derived;
|
|
@@ -3619,7 +3626,7 @@ function useOgPlaceholderUrl({
|
|
|
3619
3626
|
aspect = "wide",
|
|
3620
3627
|
enabled = true
|
|
3621
3628
|
}) {
|
|
3622
|
-
const endpoints = _optionalChain([_chunkCEAAOVCVcjs.useChatRuntime.call(void 0, ), 'optionalAccess',
|
|
3629
|
+
const endpoints = _optionalChain([_chunkCEAAOVCVcjs.useChatRuntime.call(void 0, ), 'optionalAccess', _73 => _73.endpoints]);
|
|
3623
3630
|
return _react.useMemo.call(void 0, () => {
|
|
3624
3631
|
if (!enabled || !title) return null;
|
|
3625
3632
|
return buildOgPlaceholderUrl(endpoints, title, { site: siteName || void 0, aspect });
|
|
@@ -3766,7 +3773,7 @@ function scanHeadings(content, options = {}) {
|
|
|
3766
3773
|
const lines = content.split("\n");
|
|
3767
3774
|
const fences = skipFences ? createFenceTracker() : null;
|
|
3768
3775
|
let start = 0;
|
|
3769
|
-
if (skipFrontmatter && _optionalChain([lines, 'access',
|
|
3776
|
+
if (skipFrontmatter && _optionalChain([lines, 'access', _74 => _74[0], 'optionalAccess', _75 => _75.trim, 'call', _76 => _76()]) === "---") {
|
|
3770
3777
|
for (let i = 1; i < lines.length; i++) {
|
|
3771
3778
|
if (lines[i].trim() === "---" || lines[i].trim() === "...") {
|
|
3772
3779
|
start = i + 1;
|
|
@@ -3784,7 +3791,7 @@ function scanHeadings(content, options = {}) {
|
|
|
3784
3791
|
continue;
|
|
3785
3792
|
}
|
|
3786
3793
|
}
|
|
3787
|
-
const prefix = _nullishCoalesce(_optionalChain([CONTAINER_PREFIX_RE, 'access',
|
|
3794
|
+
const prefix = _nullishCoalesce(_optionalChain([CONTAINER_PREFIX_RE, 'access', _77 => _77.exec, 'call', _78 => _78(line), 'optionalAccess', _79 => _79[0]]), () => ( ""));
|
|
3788
3795
|
const body = prefix ? line.slice(prefix.length) : line;
|
|
3789
3796
|
const setext = SETEXT_UNDERLINE_RE.exec(body);
|
|
3790
3797
|
if (setext) {
|
|
@@ -3951,7 +3958,7 @@ function navigateSamePageHash(target, options = {}) {
|
|
|
3951
3958
|
// src/hooks/use-scroll-to-hash.ts
|
|
3952
3959
|
var MAX_POLL_FRAMES = 60;
|
|
3953
3960
|
function useScrollToHash(readyDep = true, options) {
|
|
3954
|
-
const headerOffset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
3961
|
+
const headerOffset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _80 => _80.headerOffset]), () => ( 0));
|
|
3955
3962
|
_react.useEffect.call(void 0, () => {
|
|
3956
3963
|
if (typeof window === "undefined") return;
|
|
3957
3964
|
if (readyDep === null || readyDep === false) return;
|
|
@@ -4013,7 +4020,7 @@ function evaluateHumanitySignals(body, opts) {
|
|
|
4013
4020
|
if (elapsedMs !== null && elapsedMs < opts.minFillMs) return { ok: false, reason: "too_fast" };
|
|
4014
4021
|
return { ok: true };
|
|
4015
4022
|
}
|
|
4016
|
-
var splitCsvEnv = (s) => _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
4023
|
+
var splitCsvEnv = (s) => _nullishCoalesce(_optionalChain([s, 'optionalAccess', _81 => _81.split, 'call', _82 => _82(","), 'access', _83 => _83.map, 'call', _84 => _84((t) => t.trim()), 'access', _85 => _85.filter, 'call', _86 => _86(Boolean)]), () => ( []));
|
|
4017
4024
|
|
|
4018
4025
|
// src/hooks/use-humanity-signals.ts
|
|
4019
4026
|
function useHumanitySignals() {
|
|
@@ -4021,7 +4028,7 @@ function useHumanitySignals() {
|
|
|
4021
4028
|
const mountedAt = _react.useRef.call(void 0, typeof performance !== "undefined" ? performance.now() : 0);
|
|
4022
4029
|
const getSignals = _react.useCallback.call(void 0,
|
|
4023
4030
|
() => ({
|
|
4024
|
-
[HONEYPOT_FIELD]: _nullishCoalesce(_optionalChain([ref, 'access',
|
|
4031
|
+
[HONEYPOT_FIELD]: _nullishCoalesce(_optionalChain([ref, 'access', _87 => _87.current, 'optionalAccess', _88 => _88.value]), () => ( "")),
|
|
4025
4032
|
[ELAPSED_MS_FIELD]: typeof performance !== "undefined" ? Math.round(performance.now() - mountedAt.current) : 0
|
|
4026
4033
|
}),
|
|
4027
4034
|
[]
|
|
@@ -4169,5 +4176,7 @@ function useHumanitySignals() {
|
|
|
4169
4176
|
|
|
4170
4177
|
|
|
4171
4178
|
|
|
4172
|
-
|
|
4173
|
-
|
|
4179
|
+
|
|
4180
|
+
|
|
4181
|
+
exports.useIsTruncated = useIsTruncated; exports.useAutoLimitTags = useAutoLimitTags; exports.useKeyboardCollisionPadding = useKeyboardCollisionPadding; exports.useDebounce = useDebounce; exports.useDeferredError = useDeferredError; exports.useFocusTrap = useFocusTrap; exports.useHeaderHeight = useHeaderHeight; exports.useHorizontalScrollbar = useHorizontalScrollbar; exports.useImageEdgeColor = useImageEdgeColor; exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect; exports.useLocalStorage = useLocalStorage; exports.useMarqueeEngine = useMarqueeEngine; exports.useMediaQuery = useMediaQuery; exports.breakpoints = breakpoints; exports.useSmUp = useSmUp; exports.useMdUp = useMdUp; exports.useLgUp = useLgUp; exports.useMemoizedCallback = useMemoizedCallback; exports.useNotificationPermission = useNotificationPermission; exports.useOnboardingState = useOnboardingState; exports.useResetOnPageHidden = useResetOnPageHidden; exports.useSearch = useSearch; exports.useSuppressCloneFocus = useSuppressCloneFocus; exports.useTablePagination = useTablePagination; exports.useThrottle = useThrottle; exports.useWindowSize = useWindowSize; exports.usePreventScroll = _overlays.usePreventScroll; exports.platformIcons = platformIcons; exports.platformColors = platformColors; exports.platformDisplayNames = platformDisplayNames; exports.platformDescriptions = platformDescriptions; exports.platformSlogans = platformSlogans; exports.platformHexColors = platformHexColors; exports.platformIconNames = platformIconNames; exports.getDefaultColorForPlatform = getDefaultColorForPlatform; exports.getDefaultIconForPlatform = getDefaultIconForPlatform; exports.transformPlatformConfigsToOptions = transformPlatformConfigsToOptions; exports.getPlatformIcon = getPlatformIcon; exports.getPlatformColor = getPlatformColor; exports.getPlatformDisplayName = getPlatformDisplayName; exports.getPlatformDescription = getPlatformDescription; exports.getPlatformSlogan = getPlatformSlogan; exports.getSmallPlatformIcon = getSmallPlatformIcon; exports.getPlatformIconComponent = getPlatformIconComponent; exports.usePlatformConfig = usePlatformConfig; exports.usePlatformByValue = usePlatformByValue; exports.useValidatePlatform = useValidatePlatform; exports.ToolTypeValues = ToolTypeValues; exports.toolLabels = toolLabels; exports.ToolIcon = ToolIcon; exports.dotColorByVariant = dotColorByVariant; exports.progressColorByVariant = progressColorByVariant; exports.ToastCard = ToastCard; exports.CommandApprovalToast = CommandApprovalToast; exports.Toaster = Toaster; exports.showToast = showToast; exports.showCommandApprovalToast = showCommandApprovalToast; exports.toast = toast; exports.useToast = useToast; exports.createLocalStorageAdapter = createLocalStorageAdapter; exports.getAppType = getAppType; exports.getEmbedProxyAuth = getEmbedProxyAuth; exports.getPersistedProxyEmail = getPersistedProxyEmail; exports.setEmbedProxyAuth = setEmbedProxyAuth; exports.clearEmbedProxyAuth = clearEmbedProxyAuth; exports.applyProxyAuth = applyProxyAuth; exports.setEmbedAuthAdapter = setEmbedAuthAdapter; exports.embedAuthedFetch = embedAuthedFetch; exports.contentFetch = contentFetch; exports.useContactSubmission = useContactSubmission; exports.useCopyToClipboard = useCopyToClipboard; exports.configureBatchImageFetch = configureBatchImageFetch; exports.batchFetchAuthenticatedImages = batchFetchAuthenticatedImages; exports.useBatchImages = useBatchImages; exports.configureAuthenticatedImage = configureAuthenticatedImage; exports.useAuthenticatedImage = useAuthenticatedImage; exports.clearAuthedAssetCache = clearAuthedAssetCache; exports.useAuthedAssetSrc = useAuthedAssetSrc; exports.useAuthedImageSrc = useAuthedImageSrc; exports.clearAuthedImageCache = clearAuthedImageCache; exports.extractVariablesFromQuery = extractVariablesFromQuery; exports.isScalarType = isScalarType; exports.isInputObjectType = isInputObjectType; exports.flattenQueryVariables = flattenQueryVariables; exports.mergeDefaults = mergeDefaults; exports.validateSchema = validateSchema; exports.getArrayParams = getArrayParams; exports.getRequiredParams = getRequiredParams; exports.shouldIncludeInUrl = shouldIncludeInUrl; exports.urlParamsToVariables = urlParamsToVariables; exports.variablesToUrlParams = variablesToUrlParams; exports.coerceValue = coerceValue; exports.setNestedValue = setNestedValue; exports.getNestedValue = getNestedValue; exports.mergeVariables = mergeVariables; exports.clearParams = clearParams; exports.validateVariables = validateVariables; exports.GraphQLIntrospector = GraphQLIntrospector; exports.introspector = introspector; exports.useQueryParams = useQueryParams; exports.useApiParams = useApiParams; exports.createSearchParams = createSearchParams; exports.useCursorPaginationState = useCursorPaginationState; exports.useNatsClient = useNatsClient; exports.NEAR_VIEWPORT_ROOT_MARGIN = NEAR_VIEWPORT_ROOT_MARGIN; exports.useNearViewport = useNearViewport; exports.validateAccessCode = validateAccessCode; exports.consumeAccessCode = consumeAccessCode; exports.validateAndConsumeAccessCode = validateAndConsumeAccessCode; exports.useAccessCodeIntegration = useAccessCodeIntegration; exports.buildOgPlaceholderUrl = buildOgPlaceholderUrl; exports.useOgPlaceholderUrl = useOgPlaceholderUrl; exports.scrollElementIntoView = scrollElementIntoView; exports.isBlankLine = isBlankLine; exports.createFenceTracker = createFenceTracker; exports.HEADING_EMOJI_RE = HEADING_EMOJI_RE; exports.stripHeadingEmojis = stripHeadingEmojis; exports.slugifyHeadingBase = slugifyHeadingBase; exports.slugifyHeadingText = slugifyHeadingText; exports.scanHeadings = scanHeadings; exports.createHeadingIdDeduper = createHeadingIdDeduper; exports.normalizeAnchorId = normalizeAnchorId; exports.findAnchorElementByNormalizedId = findAnchorElementByNormalizedId; exports.STICKY_HEADER_OFFSET_PX = STICKY_HEADER_OFFSET_PX; exports.HUB_HEADER_OFFSET_PX = HUB_HEADER_OFFSET_PX; exports.normalizeHashFragment = normalizeHashFragment; exports.getHashTargetElement = getHashTargetElement; exports.navigateSamePageHash = navigateSamePageHash; exports.useScrollToHash = useScrollToHash; exports.HONEYPOT_FIELD = HONEYPOT_FIELD; exports.ELAPSED_MS_FIELD = ELAPSED_MS_FIELD; exports.DEFAULT_MIN_FILL_MS = DEFAULT_MIN_FILL_MS; exports.HUMANITY_SIGNAL_KEYS = HUMANITY_SIGNAL_KEYS; exports.extractHumanitySignals = extractHumanitySignals; exports.evaluateHumanitySignals = evaluateHumanitySignals; exports.splitCsvEnv = splitCsvEnv; exports.useHumanitySignals = useHumanitySignals;
|
|
4182
|
+
//# sourceMappingURL=chunk-NK3M6F5A.cjs.map
|