@nswds/app 1.85.0 → 1.85.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/index.cjs +158 -135
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +159 -136
- package/dist/index.js.map +1 -1
- package/dist/package.json +2 -4
- package/package.json +3 -5
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
6
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
7
7
|
import * as React5 from 'react';
|
|
8
|
-
import React5__default, { forwardRef, useEffect, createContext, useState, useContext, memo as memo$1,
|
|
8
|
+
import React5__default, { forwardRef, useEffect, createContext, useState, useContext, memo as memo$1, useRef, useMemo, useInsertionEffect, useLayoutEffect, Fragment as Fragment$1, createElement, useCallback, Suspense, useId, Children, useSyncExternalStore, Component } from 'react';
|
|
9
9
|
import * as Headless4 from '@headlessui/react';
|
|
10
10
|
import { PopoverGroup, Popover as Popover$1, PopoverButton, PopoverPanel, Dialog as Dialog$1, DialogPanel } from '@headlessui/react';
|
|
11
11
|
import Link12 from 'next/link';
|
|
@@ -7987,8 +7987,18 @@ var formatNumber = (num) => {
|
|
|
7987
7987
|
};
|
|
7988
7988
|
var BarLabels = ({ values }) => {
|
|
7989
7989
|
const sumValues = React5__default.useMemo(() => sumNumericArray(values), [values]);
|
|
7990
|
-
|
|
7991
|
-
|
|
7990
|
+
const prefixSums = values.reduce((acc, val, idx) => {
|
|
7991
|
+
acc.push((acc[idx - 1] ?? 0) + val);
|
|
7992
|
+
return acc;
|
|
7993
|
+
}, []);
|
|
7994
|
+
let runningSum = 0;
|
|
7995
|
+
const sumConsecutiveHiddenLabelsArr = values.map(() => 0);
|
|
7996
|
+
values.forEach((widthPercentage, index) => {
|
|
7997
|
+
const prefixSum = prefixSums[index];
|
|
7998
|
+
const showLabel = (widthPercentage >= 0.1 * sumValues || runningSum >= 0.09 * sumValues) && sumValues - prefixSum >= 0.1 * sumValues && prefixSum >= 0.1 * sumValues && prefixSum < 0.9 * sumValues;
|
|
7999
|
+
sumConsecutiveHiddenLabelsArr[index] = runningSum;
|
|
8000
|
+
runningSum = showLabel ? 0 : runningSum + widthPercentage;
|
|
8001
|
+
});
|
|
7992
8002
|
return /* @__PURE__ */ jsxs(
|
|
7993
8003
|
"div",
|
|
7994
8004
|
{
|
|
@@ -8001,9 +8011,9 @@ var BarLabels = ({ values }) => {
|
|
|
8001
8011
|
children: [
|
|
8002
8012
|
/* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-0 flex items-center", children: "0" }),
|
|
8003
8013
|
values.map((widthPercentage, index) => {
|
|
8004
|
-
prefixSum
|
|
8014
|
+
const prefixSum = prefixSums[index];
|
|
8015
|
+
const sumConsecutiveHiddenLabels = sumConsecutiveHiddenLabelsArr[index];
|
|
8005
8016
|
const showLabel = (widthPercentage >= 0.1 * sumValues || sumConsecutiveHiddenLabels >= 0.09 * sumValues) && sumValues - prefixSum >= 0.1 * sumValues && prefixSum >= 0.1 * sumValues && prefixSum < 0.9 * sumValues;
|
|
8006
|
-
sumConsecutiveHiddenLabels = showLabel ? 0 : sumConsecutiveHiddenLabels += widthPercentage;
|
|
8007
8017
|
const widthPositionLeft = getPositionLeft(widthPercentage, sumValues);
|
|
8008
8018
|
return /* @__PURE__ */ jsx(
|
|
8009
8019
|
"div",
|
|
@@ -17493,7 +17503,7 @@ function FormatToggle({ format, setFormat }) {
|
|
|
17493
17503
|
|
|
17494
17504
|
// package.json
|
|
17495
17505
|
var package_default = {
|
|
17496
|
-
version: "1.
|
|
17506
|
+
version: "1.85.0"};
|
|
17497
17507
|
var SluggerContext = React5__default.createContext(null);
|
|
17498
17508
|
function flattenText(nodes) {
|
|
17499
17509
|
if (nodes == null || typeof nodes === "boolean") return "";
|
|
@@ -18810,13 +18820,14 @@ function useSelectorHeight(selector = "header") {
|
|
|
18810
18820
|
const element = document.querySelector(selector);
|
|
18811
18821
|
if (!element) return;
|
|
18812
18822
|
elementRef.current = element;
|
|
18813
|
-
|
|
18814
|
-
|
|
18815
|
-
|
|
18816
|
-
|
|
18817
|
-
|
|
18823
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
18824
|
+
const entry = entries[0];
|
|
18825
|
+
const target = entry?.target ?? elementRef.current;
|
|
18826
|
+
if (!target) return;
|
|
18827
|
+
setHeight(target.offsetHeight);
|
|
18818
18828
|
});
|
|
18819
|
-
resizeObserverRef.current
|
|
18829
|
+
resizeObserverRef.current = resizeObserver;
|
|
18830
|
+
resizeObserver.observe(element);
|
|
18820
18831
|
return () => {
|
|
18821
18832
|
resizeObserverRef.current?.disconnect();
|
|
18822
18833
|
};
|
|
@@ -26074,6 +26085,7 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26074
26085
|
this.treeScale = { x: 1, y: 1 };
|
|
26075
26086
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
26076
26087
|
this.hasTreeAnimated = false;
|
|
26088
|
+
this.layoutVersion = 0;
|
|
26077
26089
|
this.updateScheduled = false;
|
|
26078
26090
|
this.scheduleUpdate = () => this.update();
|
|
26079
26091
|
this.projectionUpdateScheduled = false;
|
|
@@ -26091,6 +26103,7 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26091
26103
|
this.nodes.forEach(cleanDirtyNodes);
|
|
26092
26104
|
};
|
|
26093
26105
|
this.resolvedRelativeTargetAt = 0;
|
|
26106
|
+
this.linkedParentVersion = 0;
|
|
26094
26107
|
this.hasProjected = false;
|
|
26095
26108
|
this.isVisible = true;
|
|
26096
26109
|
this.animationProgress = 0;
|
|
@@ -26346,6 +26359,7 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26346
26359
|
}
|
|
26347
26360
|
const prevLayout = this.layout;
|
|
26348
26361
|
this.layout = this.measure(false);
|
|
26362
|
+
this.layoutVersion++;
|
|
26349
26363
|
this.layoutCorrected = createBox();
|
|
26350
26364
|
this.isLayoutDirty = false;
|
|
26351
26365
|
this.projectionDelta = void 0;
|
|
@@ -26513,17 +26527,15 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26513
26527
|
if (!this.layout || !(layout2 || layoutId))
|
|
26514
26528
|
return;
|
|
26515
26529
|
this.resolvedRelativeTargetAt = frameData.timestamp;
|
|
26530
|
+
const relativeParent = this.getClosestProjectingParent();
|
|
26531
|
+
if (relativeParent && this.linkedParentVersion !== relativeParent.layoutVersion && !relativeParent.options.layoutRoot) {
|
|
26532
|
+
this.removeRelativeTarget();
|
|
26533
|
+
}
|
|
26516
26534
|
if (!this.targetDelta && !this.relativeTarget) {
|
|
26517
|
-
|
|
26518
|
-
|
|
26519
|
-
this.relativeParent = relativeParent;
|
|
26520
|
-
this.forceRelativeParentToResolveTarget();
|
|
26521
|
-
this.relativeTarget = createBox();
|
|
26522
|
-
this.relativeTargetOrigin = createBox();
|
|
26523
|
-
calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
26524
|
-
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
26535
|
+
if (relativeParent && relativeParent.layout) {
|
|
26536
|
+
this.createRelativeTarget(relativeParent, this.layout.layoutBox, relativeParent.layout.layoutBox);
|
|
26525
26537
|
} else {
|
|
26526
|
-
this.
|
|
26538
|
+
this.removeRelativeTarget();
|
|
26527
26539
|
}
|
|
26528
26540
|
}
|
|
26529
26541
|
if (!this.relativeTarget && !this.targetDelta)
|
|
@@ -26547,14 +26559,8 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26547
26559
|
}
|
|
26548
26560
|
if (this.attemptToResolveRelativeTarget) {
|
|
26549
26561
|
this.attemptToResolveRelativeTarget = false;
|
|
26550
|
-
const relativeParent = this.getClosestProjectingParent();
|
|
26551
26562
|
if (relativeParent && Boolean(relativeParent.resumingFrom) === Boolean(this.resumingFrom) && !relativeParent.options.layoutScroll && relativeParent.target && this.animationProgress !== 1) {
|
|
26552
|
-
this.relativeParent
|
|
26553
|
-
this.forceRelativeParentToResolveTarget();
|
|
26554
|
-
this.relativeTarget = createBox();
|
|
26555
|
-
this.relativeTargetOrigin = createBox();
|
|
26556
|
-
calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
|
|
26557
|
-
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
26563
|
+
this.createRelativeTarget(relativeParent, this.target, relativeParent.target);
|
|
26558
26564
|
} else {
|
|
26559
26565
|
this.relativeParent = this.relativeTarget = void 0;
|
|
26560
26566
|
}
|
|
@@ -26573,6 +26579,18 @@ function createProjectionNode2({ attachResizeListener, defaultParent, measureScr
|
|
|
26573
26579
|
isProjecting() {
|
|
26574
26580
|
return Boolean((this.relativeTarget || this.targetDelta || this.options.layoutRoot) && this.layout);
|
|
26575
26581
|
}
|
|
26582
|
+
createRelativeTarget(relativeParent, layout2, parentLayout) {
|
|
26583
|
+
this.relativeParent = relativeParent;
|
|
26584
|
+
this.linkedParentVersion = relativeParent.layoutVersion;
|
|
26585
|
+
this.forceRelativeParentToResolveTarget();
|
|
26586
|
+
this.relativeTarget = createBox();
|
|
26587
|
+
this.relativeTargetOrigin = createBox();
|
|
26588
|
+
calcRelativePosition(this.relativeTargetOrigin, layout2, parentLayout);
|
|
26589
|
+
copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
|
|
26590
|
+
}
|
|
26591
|
+
removeRelativeTarget() {
|
|
26592
|
+
this.relativeParent = this.relativeTarget = void 0;
|
|
26593
|
+
}
|
|
26576
26594
|
calcProjection() {
|
|
26577
26595
|
const lead = this.getLead();
|
|
26578
26596
|
const isShared = Boolean(this.resumingFrom) || this !== lead;
|
|
@@ -28997,9 +29015,9 @@ function SidebarMenuSkeleton({
|
|
|
28997
29015
|
showIcon = false,
|
|
28998
29016
|
...props
|
|
28999
29017
|
}) {
|
|
29000
|
-
const width = React5.
|
|
29018
|
+
const [width] = React5.useState(() => {
|
|
29001
29019
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
29002
|
-
}
|
|
29020
|
+
});
|
|
29003
29021
|
return /* @__PURE__ */ jsxs(
|
|
29004
29022
|
"div",
|
|
29005
29023
|
{
|
|
@@ -30341,66 +30359,47 @@ function ThemeColorPaletteLoading() {
|
|
|
30341
30359
|
] }, i)) })
|
|
30342
30360
|
] });
|
|
30343
30361
|
}
|
|
30362
|
+
function getInitialThemeState(searchParams) {
|
|
30363
|
+
const themeParam = searchParams.get("theme");
|
|
30364
|
+
const primaryParam = searchParams.get("primary");
|
|
30365
|
+
const accentParam = searchParams.get("accent");
|
|
30366
|
+
const themeCategory = themeParam === "aboriginal" ? "aboriginal" : "brand";
|
|
30367
|
+
let primaryColor = "blue";
|
|
30368
|
+
let accentColor = "red";
|
|
30369
|
+
const availableColors = Object.keys(colorThemes[themeCategory]);
|
|
30370
|
+
if (primaryParam && availableColors.includes(primaryParam)) {
|
|
30371
|
+
primaryColor = primaryParam;
|
|
30372
|
+
} else if (!availableColors.includes(primaryColor)) {
|
|
30373
|
+
primaryColor = availableColors[0];
|
|
30374
|
+
}
|
|
30375
|
+
if (accentParam && availableColors.includes(accentParam) && accentParam !== primaryColor) {
|
|
30376
|
+
accentColor = accentParam;
|
|
30377
|
+
} else {
|
|
30378
|
+
const newAccent = availableColors.find((c) => c !== primaryColor);
|
|
30379
|
+
if (newAccent) accentColor = newAccent;
|
|
30380
|
+
}
|
|
30381
|
+
const neutralKey = Object.keys(colorThemes[themeCategory]).find((k) => k.toLowerCase().includes("grey")) ?? "grey";
|
|
30382
|
+
return { themeCategory, primaryColor, accentColor, greyColor: neutralKey };
|
|
30383
|
+
}
|
|
30344
30384
|
function ThemeColorPaletteContent() {
|
|
30345
30385
|
const searchParams = useSearchParams();
|
|
30346
30386
|
const baseColors = {
|
|
30347
30387
|
brand,
|
|
30348
30388
|
aboriginal
|
|
30349
30389
|
};
|
|
30390
|
+
const {
|
|
30391
|
+
themeCategory: initialThemeCategory,
|
|
30392
|
+
primaryColor: initialPrimaryColor,
|
|
30393
|
+
accentColor: initialAccentColor,
|
|
30394
|
+
greyColor: initialGreyColor
|
|
30395
|
+
} = getInitialThemeState(searchParams);
|
|
30350
30396
|
const [format, setFormat] = useState("hex");
|
|
30351
30397
|
const [viewMode, setViewMode] = useState("grid");
|
|
30352
|
-
const [themeCategory, setThemeCategory] = useState(
|
|
30353
|
-
const [primaryColor, setPrimaryColor] = useState(
|
|
30354
|
-
const [accentColor, setAccentColor] = useState(
|
|
30355
|
-
const [greyColor, setGreyColor] = useState(
|
|
30398
|
+
const [themeCategory, setThemeCategory] = useState(initialThemeCategory);
|
|
30399
|
+
const [primaryColor, setPrimaryColor] = useState(initialPrimaryColor);
|
|
30400
|
+
const [accentColor, setAccentColor] = useState(initialAccentColor);
|
|
30401
|
+
const [greyColor, setGreyColor] = useState(initialGreyColor);
|
|
30356
30402
|
const [sheetOpen, setSheetOpen] = useState(false);
|
|
30357
|
-
const [isInitialized, setIsInitialized] = useState(false);
|
|
30358
|
-
useEffect(() => {
|
|
30359
|
-
const themeParam = searchParams.get("theme");
|
|
30360
|
-
const primaryParam = searchParams.get("primary");
|
|
30361
|
-
const accentParam = searchParams.get("accent");
|
|
30362
|
-
const hasUrlParams = themeParam || primaryParam || accentParam;
|
|
30363
|
-
let newCategory = themeCategory;
|
|
30364
|
-
let newPrimary = primaryColor;
|
|
30365
|
-
let newAccent = accentColor;
|
|
30366
|
-
if (themeParam && (themeParam === "brand" || themeParam === "aboriginal")) {
|
|
30367
|
-
newCategory = themeParam;
|
|
30368
|
-
setThemeCategory(themeParam);
|
|
30369
|
-
}
|
|
30370
|
-
const availableColors = Object.keys(colorThemes[newCategory]);
|
|
30371
|
-
if (primaryParam && availableColors.includes(primaryParam)) {
|
|
30372
|
-
newPrimary = primaryParam;
|
|
30373
|
-
setPrimaryColor(primaryParam);
|
|
30374
|
-
} else if (!availableColors.includes(newPrimary)) {
|
|
30375
|
-
newPrimary = availableColors[0];
|
|
30376
|
-
setPrimaryColor(newPrimary);
|
|
30377
|
-
}
|
|
30378
|
-
if (accentParam && availableColors.includes(accentParam) && accentParam !== newPrimary) {
|
|
30379
|
-
newAccent = accentParam;
|
|
30380
|
-
setAccentColor(accentParam);
|
|
30381
|
-
} else if (hasUrlParams) {
|
|
30382
|
-
const newAccentColor = availableColors.find((color2) => color2 !== newPrimary);
|
|
30383
|
-
if (newAccentColor) {
|
|
30384
|
-
newAccent = newAccentColor;
|
|
30385
|
-
setAccentColor(newAccent);
|
|
30386
|
-
}
|
|
30387
|
-
} else {
|
|
30388
|
-
if (!availableColors.includes(newAccent) || newAccent === newPrimary) {
|
|
30389
|
-
const newAccentColor = availableColors.find((color2) => color2 !== newPrimary);
|
|
30390
|
-
if (newAccentColor) {
|
|
30391
|
-
newAccent = newAccentColor;
|
|
30392
|
-
setAccentColor(newAccent);
|
|
30393
|
-
}
|
|
30394
|
-
}
|
|
30395
|
-
}
|
|
30396
|
-
const neutralKey = Object.keys(colorThemes[newCategory]).find(
|
|
30397
|
-
(k) => k.toLowerCase().includes("grey")
|
|
30398
|
-
);
|
|
30399
|
-
if (neutralKey) {
|
|
30400
|
-
setGreyColor(neutralKey);
|
|
30401
|
-
}
|
|
30402
|
-
setIsInitialized(true);
|
|
30403
|
-
}, [searchParams, themeCategory, primaryColor, accentColor]);
|
|
30404
30403
|
const filteredColorThemes = useMemo(() => {
|
|
30405
30404
|
const filtered = {};
|
|
30406
30405
|
for (const category of Object.keys(colorThemes)) {
|
|
@@ -30416,27 +30415,41 @@ function ThemeColorPaletteContent() {
|
|
|
30416
30415
|
const allColors = Object.keys(filteredColorThemes[themeCategory]);
|
|
30417
30416
|
return allColors.filter((color2) => color2 !== primaryColor);
|
|
30418
30417
|
}, [filteredColorThemes, themeCategory, primaryColor]);
|
|
30419
|
-
|
|
30420
|
-
|
|
30421
|
-
const neutralKey = Object.keys(colorThemes[
|
|
30422
|
-
|
|
30423
|
-
|
|
30418
|
+
const handleThemeCategoryChange = (nextCategory) => {
|
|
30419
|
+
const availableColors = Object.keys(colorThemes[nextCategory]);
|
|
30420
|
+
const neutralKey = Object.keys(colorThemes[nextCategory]).find((k) => k.toLowerCase().includes("grey")) ?? greyColor;
|
|
30421
|
+
let nextPrimary = primaryColor;
|
|
30422
|
+
if (!availableColors.includes(nextPrimary)) {
|
|
30423
|
+
nextPrimary = availableColors[0];
|
|
30424
|
+
}
|
|
30425
|
+
let nextAccent = accentColor;
|
|
30426
|
+
if (!availableColors.includes(nextAccent) || nextAccent === nextPrimary) {
|
|
30427
|
+
const newAccent = availableColors.find((c) => c !== nextPrimary);
|
|
30428
|
+
if (newAccent) nextAccent = newAccent;
|
|
30429
|
+
}
|
|
30430
|
+
setThemeCategory(nextCategory);
|
|
30431
|
+
setPrimaryColor(nextPrimary);
|
|
30432
|
+
setAccentColor(nextAccent);
|
|
30433
|
+
setGreyColor(neutralKey);
|
|
30434
|
+
};
|
|
30435
|
+
const handlePrimaryColorChange = (nextPrimary) => {
|
|
30436
|
+
if (nextPrimary === primaryColor) return;
|
|
30437
|
+
setPrimaryColor(nextPrimary);
|
|
30438
|
+
if (nextPrimary === accentColor) {
|
|
30439
|
+
const availableColors = Object.keys(colorThemes[themeCategory]);
|
|
30440
|
+
const newAccent = availableColors.find((c) => c !== nextPrimary);
|
|
30441
|
+
if (newAccent) setAccentColor(newAccent);
|
|
30424
30442
|
}
|
|
30425
|
-
|
|
30426
|
-
|
|
30427
|
-
|
|
30428
|
-
if (availableColors.length > 1) {
|
|
30429
|
-
setAccentColor(availableColors[1]);
|
|
30430
|
-
}
|
|
30443
|
+
};
|
|
30444
|
+
const handleAccentColorChange = (nextAccent) => {
|
|
30445
|
+
if (nextAccent === primaryColor) {
|
|
30431
30446
|
return;
|
|
30432
30447
|
}
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
|
|
30438
|
-
}
|
|
30439
|
-
}, [themeCategory, primaryColor, accentColor, greyColor, isInitialized]);
|
|
30448
|
+
setAccentColor(nextAccent);
|
|
30449
|
+
};
|
|
30450
|
+
const handleGreyColorChange = (nextGrey) => {
|
|
30451
|
+
setGreyColor(nextGrey);
|
|
30452
|
+
};
|
|
30440
30453
|
const currentColorPalette = useMemo(() => {
|
|
30441
30454
|
if (!colorThemes[themeCategory] || !colorThemes[themeCategory][primaryColor] || !colorThemes[themeCategory][accentColor]) {
|
|
30442
30455
|
return [
|
|
@@ -30504,13 +30517,13 @@ function ThemeColorPaletteContent() {
|
|
|
30504
30517
|
ThemeSelector,
|
|
30505
30518
|
{
|
|
30506
30519
|
themeCategory,
|
|
30507
|
-
setThemeCategory,
|
|
30520
|
+
setThemeCategory: handleThemeCategoryChange,
|
|
30508
30521
|
primaryColor,
|
|
30509
|
-
setPrimaryColor,
|
|
30522
|
+
setPrimaryColor: handlePrimaryColorChange,
|
|
30510
30523
|
accentColor,
|
|
30511
|
-
setAccentColor,
|
|
30524
|
+
setAccentColor: handleAccentColorChange,
|
|
30512
30525
|
greyColor,
|
|
30513
|
-
setGreyColor,
|
|
30526
|
+
setGreyColor: handleGreyColorChange,
|
|
30514
30527
|
availableAccentColors,
|
|
30515
30528
|
colorThemes: filteredColorThemes
|
|
30516
30529
|
}
|
|
@@ -30540,25 +30553,17 @@ var TocContext = createContext({
|
|
|
30540
30553
|
setToc: () => {
|
|
30541
30554
|
}
|
|
30542
30555
|
});
|
|
30543
|
-
function
|
|
30556
|
+
function InnerTocProvider({ children }) {
|
|
30544
30557
|
const [toc, setToc] = useState(true);
|
|
30545
|
-
const pathname = usePathname();
|
|
30546
|
-
const isInitialMount = useRef(true);
|
|
30547
|
-
const tocExplicitlySet = useRef(false);
|
|
30548
|
-
useEffect(() => {
|
|
30549
|
-
if (isInitialMount.current) {
|
|
30550
|
-
isInitialMount.current = false;
|
|
30551
|
-
return;
|
|
30552
|
-
}
|
|
30553
|
-
tocExplicitlySet.current = false;
|
|
30554
|
-
setToc(true);
|
|
30555
|
-
}, [pathname]);
|
|
30556
30558
|
const handleSetToc = (value) => {
|
|
30557
|
-
tocExplicitlySet.current = true;
|
|
30558
30559
|
setToc(value);
|
|
30559
30560
|
};
|
|
30560
30561
|
return /* @__PURE__ */ jsx(TocContext.Provider, { value: { toc, setToc: handleSetToc }, children });
|
|
30561
30562
|
}
|
|
30563
|
+
function TocProvider({ children }) {
|
|
30564
|
+
const pathname = usePathname();
|
|
30565
|
+
return /* @__PURE__ */ jsx(InnerTocProvider, { children }, pathname);
|
|
30566
|
+
}
|
|
30562
30567
|
function useToc() {
|
|
30563
30568
|
return useContext(TocContext);
|
|
30564
30569
|
}
|
|
@@ -31801,24 +31806,41 @@ var InlineCitationCarouselHeader = ({
|
|
|
31801
31806
|
...props
|
|
31802
31807
|
}
|
|
31803
31808
|
);
|
|
31809
|
+
var useCarouselIndex = () => {
|
|
31810
|
+
const api = useCarouselApi();
|
|
31811
|
+
const subscribe = useCallback(
|
|
31812
|
+
(callback) => {
|
|
31813
|
+
if (!api) {
|
|
31814
|
+
return () => {
|
|
31815
|
+
};
|
|
31816
|
+
}
|
|
31817
|
+
api.on("select", callback);
|
|
31818
|
+
api.on("reInit", callback);
|
|
31819
|
+
return () => {
|
|
31820
|
+
api.off("select", callback);
|
|
31821
|
+
api.off("reInit", callback);
|
|
31822
|
+
};
|
|
31823
|
+
},
|
|
31824
|
+
[api]
|
|
31825
|
+
);
|
|
31826
|
+
const getSnapshot = useCallback(() => {
|
|
31827
|
+
if (!api) {
|
|
31828
|
+
return { current: 0, count: 0 };
|
|
31829
|
+
}
|
|
31830
|
+
return {
|
|
31831
|
+
current: api.selectedScrollSnap() + 1,
|
|
31832
|
+
count: api.scrollSnapList().length
|
|
31833
|
+
};
|
|
31834
|
+
}, [api]);
|
|
31835
|
+
const { current, count } = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
31836
|
+
return { current, count };
|
|
31837
|
+
};
|
|
31804
31838
|
var InlineCitationCarouselIndex = ({
|
|
31805
31839
|
children,
|
|
31806
31840
|
className,
|
|
31807
31841
|
...props
|
|
31808
31842
|
}) => {
|
|
31809
|
-
const
|
|
31810
|
-
const [current, setCurrent] = useState(0);
|
|
31811
|
-
const [count, setCount] = useState(0);
|
|
31812
|
-
useEffect(() => {
|
|
31813
|
-
if (!api) {
|
|
31814
|
-
return;
|
|
31815
|
-
}
|
|
31816
|
-
setCount(api.scrollSnapList().length);
|
|
31817
|
-
setCurrent(api.selectedScrollSnap() + 1);
|
|
31818
|
-
api.on("select", () => {
|
|
31819
|
-
setCurrent(api.selectedScrollSnap() + 1);
|
|
31820
|
-
});
|
|
31821
|
-
}, [api]);
|
|
31843
|
+
const { current, count } = useCarouselIndex();
|
|
31822
31844
|
return /* @__PURE__ */ jsx(
|
|
31823
31845
|
"div",
|
|
31824
31846
|
{
|
|
@@ -32738,17 +32760,18 @@ var Reasoning = memo$1(
|
|
|
32738
32760
|
defaultProp: 0
|
|
32739
32761
|
});
|
|
32740
32762
|
const [hasAutoClosed, setHasAutoClosed] = useState(false);
|
|
32741
|
-
const
|
|
32763
|
+
const startTimeRef = useRef(null);
|
|
32742
32764
|
useEffect(() => {
|
|
32743
32765
|
if (isStreaming) {
|
|
32744
|
-
if (
|
|
32745
|
-
|
|
32766
|
+
if (startTimeRef.current === null) {
|
|
32767
|
+
startTimeRef.current = Date.now();
|
|
32746
32768
|
}
|
|
32747
|
-
} else if (
|
|
32748
|
-
|
|
32749
|
-
|
|
32769
|
+
} else if (startTimeRef.current !== null) {
|
|
32770
|
+
const elapsedSeconds = Math.ceil((Date.now() - startTimeRef.current) / MS_IN_S);
|
|
32771
|
+
setDuration(elapsedSeconds);
|
|
32772
|
+
startTimeRef.current = null;
|
|
32750
32773
|
}
|
|
32751
|
-
}, [isStreaming,
|
|
32774
|
+
}, [isStreaming, setDuration]);
|
|
32752
32775
|
useEffect(() => {
|
|
32753
32776
|
if (defaultOpen && !isStreaming && isOpen && !hasAutoClosed) {
|
|
32754
32777
|
const timer = setTimeout(() => {
|