@sia.soul/sia-react-ui 0.1.115 → 0.1.117

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 CHANGED
@@ -1608,9 +1608,10 @@ var filledIconPaths = {
1608
1608
  var FILLED_ICON_NAMES = Object.freeze(Object.keys(filledIconPaths));
1609
1609
  var normalizedOutlinePaths = normalizeIconPaths(iconPaths, outlineIconBounds);
1610
1610
  var normalizedFilledPaths = normalizeIconPaths(filledIconPaths, filledIconBounds);
1611
- var Icon = (0, import_react3.forwardRef)(function Icon2({ name, size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
1611
+ var Icon = (0, import_react3.forwardRef)(function Icon2({ name, tone = "inherit", size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
1612
1612
  const resolvedSize = typeof size === "number" ? `${size}px` : size;
1613
- const mergedStyle = { "--sia-icon-size": resolvedSize, "--sia-icon-rotate": `${rotate}deg`, ...style };
1613
+ const toneColor = tone === "inherit" ? void 0 : `var(--sia-color-${tone === "danger" ? "error" : tone === "primary" ? "primary-text" : tone})`;
1614
+ const mergedStyle = { "--sia-icon-size": resolvedSize, "--sia-icon-rotate": `${rotate}deg`, color: toneColor, ...style };
1614
1615
  const animationClass = spin ? " sia-icon--spin" : pulse ? " sia-icon--pulse" : "";
1615
1616
  const filledPath = filledIconPaths[name];
1616
1617
  const resolvedVariant = variant === "filled" && filledPath ? "filled" : "outline";
@@ -2136,7 +2137,7 @@ function Image2({ fallback, placeholder, preview = true, rootClassName = "", cla
2136
2137
 
2137
2138
  // src/components/CursorPreview.tsx
2138
2139
  var import_jsx_runtime8 = require("react/jsx-runtime");
2139
- function CursorPreview({ frames, size = 48, playing = true, followPointer = true, showHotspot = false, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerEnter, onPointerMove, onPointerLeave, ...props }) {
2140
+ function CursorPreview({ frames, size = 48, sizeUnit = "css", playing = true, followPointer = true, showHotspot = false, height = 180, empty = "\u6682\u65E0\u6307\u9488\u9884\u89C8", alt = "\u9F20\u6807\u6307\u9488\u9884\u89C8", className = "", style, children, onPointerEnter, onPointerMove, onPointerLeave, ...props }) {
2140
2141
  const rootRef = (0, import_react8.useRef)(null);
2141
2142
  const [bounds, setBounds] = (0, import_react8.useState)({ width: 0, height: 0 });
2142
2143
  const [hovered, setHovered] = (0, import_react8.useState)(false);
@@ -2144,17 +2145,36 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
2144
2145
  const [point, setPoint] = (0, import_react8.useState)(null);
2145
2146
  const [reduced, setReduced] = (0, import_react8.useState)(false);
2146
2147
  const [failed, setFailed] = (0, import_react8.useState)(false);
2147
- const safeSize = Math.max(8, Number.isFinite(size) ? size : 48);
2148
+ const [density, setDensity] = (0, import_react8.useState)(() => typeof window === "undefined" ? 1 : window.devicePixelRatio || 1);
2149
+ const scale = sizeUnit === "device" ? density : 1;
2150
+ const safeSize = Math.max(8, Number.isFinite(size) ? size : 48) / scale;
2151
+ (0, import_react8.useEffect)(() => {
2152
+ if (sizeUnit !== "device") return;
2153
+ let media;
2154
+ const update = () => {
2155
+ media?.removeEventListener("change", update);
2156
+ const next = window.devicePixelRatio || 1;
2157
+ setDensity(next);
2158
+ media = window.matchMedia(`(resolution: ${next}dppx)`);
2159
+ media.addEventListener("change", update);
2160
+ };
2161
+ update();
2162
+ window.addEventListener("resize", update);
2163
+ return () => {
2164
+ media.removeEventListener("change", update);
2165
+ window.removeEventListener("resize", update);
2166
+ };
2167
+ }, [sizeUnit]);
2148
2168
  const frame = frames[playing && !reduced ? index % Math.max(1, frames.length) : 0];
2149
2169
  (0, import_react8.useLayoutEffect)(() => {
2150
2170
  const root = rootRef.current;
2151
- if (!showHotspot || !root) return;
2171
+ if (!showHotspot && sizeUnit !== "device" || !root) return;
2152
2172
  const measure = () => setBounds({ width: root.clientWidth, height: root.clientHeight });
2153
2173
  measure();
2154
2174
  const observer = new ResizeObserver(measure);
2155
2175
  observer.observe(root);
2156
2176
  return () => observer.disconnect();
2157
- }, [showHotspot]);
2177
+ }, [showHotspot, sizeUnit]);
2158
2178
  (0, import_react8.useEffect)(() => {
2159
2179
  setIndex(0);
2160
2180
  }, [frames]);
@@ -2179,8 +2199,12 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
2179
2199
  }
2180
2200
  const following = !!point && followPointer && !!frame && !failed;
2181
2201
  const offset = (value) => Math.max(0, Math.min(1, Number.isFinite(value) ? value : 0)) * safeSize;
2182
- const hotspotX = (bounds.width - safeSize) / 2 + offset(frame?.hotspotX);
2183
- const hotspotY = (bounds.height - safeSize) / 2 + offset(frame?.hotspotY);
2202
+ const origin = rootRef.current?.getBoundingClientRect();
2203
+ const snap = (value, base) => sizeUnit === "device" ? Math.round((value + base) * density) / density - base : value;
2204
+ const bitmapX = snap(following ? point.x - offset(frame.hotspotX) : (bounds.width - safeSize) / 2, origin?.left ?? 0);
2205
+ const bitmapY = snap(following ? point.y - offset(frame.hotspotY) : (bounds.height - safeSize) / 2, origin?.top ?? 0);
2206
+ const hotspotX = bitmapX + offset(frame?.hotspotX);
2207
+ const hotspotY = bitmapY + offset(frame?.hotspotY);
2184
2208
  const direction = bounds.width - hotspotX >= 130 ? 1 : -1;
2185
2209
  const lineY = Math.max(18, hotspotY - 42);
2186
2210
  const elbowX = hotspotX + direction * 28;
@@ -2203,7 +2227,7 @@ function CursorPreview({ frames, size = 48, playing = true, followPointer = true
2203
2227
  onPointerLeave?.(event);
2204
2228
  },
2205
2229
  children: [
2206
- frame ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__bitmap", style: { width: safeSize, height: safeSize, left: following ? point.x - offset(frame.hotspotX) : "50%", top: following ? point.y - offset(frame.hotspotY) : "50%", transform: following ? void 0 : "translate(-50%, -50%)" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Image2, { src: frame.src, width: safeSize, height: safeSize, alt, preview: false, draggable: false, onLoad: () => setFailed(false), onError: () => setFailed(true) }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__empty", children: empty }),
2230
+ frame ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__bitmap", style: { width: safeSize, height: safeSize, left: sizeUnit === "device" || following ? bitmapX : "50%", top: sizeUnit === "device" || following ? bitmapY : "50%", transform: sizeUnit === "device" || following ? void 0 : "translate(-50%, -50%)" }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Image2, { src: frame.src, width: safeSize, height: safeSize, alt, preview: false, draggable: false, onLoad: () => setFailed(false), onError: () => setFailed(true) }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "sia-cursor-preview__empty", children: empty }),
2207
2231
  showHotspot && !hovered && frame && !failed && bounds.width > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { className: "sia-cursor-preview__hotspot", width: "100%", height: "100%", role: "img", "aria-label": "\u6307\u9488\u70B9\uFF1A\u9F20\u6807\u70B9\u51FB\u7684\u5B9E\u9645\u4F4D\u7F6E", children: [
2208
2232
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("polyline", { points: `${hotspotX},${hotspotY} ${elbowX},${lineY} ${endX},${lineY}` }),
2209
2233
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: hotspotX, cy: hotspotY, r: 2.5 }),
@@ -2428,12 +2452,13 @@ function MenuEntry({
2428
2452
  ...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
2429
2453
  disabled: item.disabled,
2430
2454
  "aria-current": isSelected ? "page" : void 0,
2455
+ "data-menu-key": item.key,
2431
2456
  "data-applied": item.applied || void 0,
2432
2457
  "aria-expanded": hasChildren ? isOpen : void 0,
2433
2458
  onClick: (event) => hasChildren ? props.toggle(item.key) : props.select(item, path, event),
2434
2459
  children: [
2435
2460
  reserveIcon ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__icon", style: item.iconSize ? { width: item.iconSize, height: item.iconSize, flexBasis: item.iconSize } : void 0, "aria-hidden": !item.icon || void 0, children: item.icon }) : null,
2436
- item.applied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: "circle-check", size: 32 }) }) : null,
2461
+ item.applied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__applied", role: "img", "aria-label": item.appliedLabel ?? "\u5F53\u524D\u4F7F\u7528", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { name: "circle-check", variant: "filled", size: 32 }) }) : null,
2437
2462
  !collapsed ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__label", children: item.label }) : null,
2438
2463
  !collapsed && item.extra ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sia-menu__extra", children: item.extra }) : null,
2439
2464
  !collapsed && hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { className: "sia-menu__expand-icon", name: "chevron-down", size: 13 }) : null
@@ -2482,6 +2507,7 @@ function Menu({
2482
2507
  gridColumns = 2,
2483
2508
  theme = "light",
2484
2509
  selectedKeys,
2510
+ autoScrollSelected = false,
2485
2511
  defaultSelectedKeys = [],
2486
2512
  openKeys,
2487
2513
  defaultOpenKeys = [],
@@ -2502,6 +2528,30 @@ function Menu({
2502
2528
  const rootRef = (0, import_react10.useRef)(null);
2503
2529
  const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
2504
2530
  const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
2531
+ const revealedKey = (0, import_react10.useRef)();
2532
+ const firstSelected = selected[0];
2533
+ (0, import_react10.useLayoutEffect)(() => {
2534
+ if (!autoScrollSelected || firstSelected === void 0) {
2535
+ revealedKey.current = void 0;
2536
+ return;
2537
+ }
2538
+ const root = rootRef.current;
2539
+ if (!root || revealedKey.current === firstSelected || mode === "horizontal") return;
2540
+ const reveal = () => {
2541
+ if (revealedKey.current === firstSelected || root.clientHeight === 0) return;
2542
+ const target = Array.from(root.querySelectorAll(".sia-menu__item")).find((element) => element.dataset.menuKey === firstSelected && element.getBoundingClientRect().height > 0);
2543
+ if (!target) return;
2544
+ const bounds = root.getBoundingClientRect(), item = target.getBoundingClientRect();
2545
+ const top = bounds.top + root.clientTop, bottom = top + root.clientHeight;
2546
+ if (item.top < top || item.bottom > bottom)
2547
+ root.scrollTop += item.top - top - Math.max(0, (root.clientHeight - item.height) / 2);
2548
+ revealedKey.current = firstSelected;
2549
+ };
2550
+ reveal();
2551
+ const observer = new ResizeObserver(reveal);
2552
+ observer.observe(root);
2553
+ return () => observer.disconnect();
2554
+ }, [autoScrollSelected, firstSelected, items, mode]);
2505
2555
  (0, import_react10.useEffect)(() => {
2506
2556
  if (mode === "inline" || !open.length) return void 0;
2507
2557
  const closeOutside = (event) => {
@@ -6623,6 +6673,7 @@ function ToolPanel({
6623
6673
  }
6624
6674
 
6625
6675
  // src/components/WindowFrame.tsx
6676
+ var import_react32 = require("react");
6626
6677
  var import_jsx_runtime30 = require("react/jsx-runtime");
6627
6678
  var DEFAULT_LABELS = {
6628
6679
  minimize: "\u6700\u5C0F\u5316",
@@ -6746,13 +6797,40 @@ function WindowTitleBar({
6746
6797
  onMouseDown,
6747
6798
  ...props
6748
6799
  }) {
6800
+ const cancelDrag = (0, import_react32.useRef)(null);
6801
+ (0, import_react32.useEffect)(() => () => cancelDrag.current?.(), [draggable]);
6749
6802
  function handleMouseDown(event) {
6803
+ cancelDrag.current?.();
6750
6804
  onMouseDown?.(event);
6751
6805
  if (event.defaultPrevented || !draggable || !onWindowAction || event.button !== 0) return;
6752
6806
  const target = event.target;
6753
6807
  if (!(target instanceof Element) || target.closest(NON_DRAG_SELECTOR)) return;
6754
6808
  event.preventDefault();
6755
- void onWindowAction(event.detail > 1 ? "toggle-maximize" : "start-dragging");
6809
+ if (event.detail > 1) {
6810
+ void onWindowAction("toggle-maximize");
6811
+ return;
6812
+ }
6813
+ const origin = { x: event.clientX, y: event.clientY };
6814
+ const run = onWindowAction;
6815
+ function cancel() {
6816
+ document.removeEventListener("mousemove", move);
6817
+ document.removeEventListener("mouseup", cancel, true);
6818
+ window.removeEventListener("blur", cancel);
6819
+ cancelDrag.current = null;
6820
+ }
6821
+ function move(next) {
6822
+ if ((next.buttons & 1) === 0) {
6823
+ cancel();
6824
+ return;
6825
+ }
6826
+ if (Math.hypot(next.clientX - origin.x, next.clientY - origin.y) < 2) return;
6827
+ cancel();
6828
+ void run("start-dragging");
6829
+ }
6830
+ cancelDrag.current = cancel;
6831
+ document.addEventListener("mousemove", move);
6832
+ document.addEventListener("mouseup", cancel, true);
6833
+ window.addEventListener("blur", cancel);
6756
6834
  }
6757
6835
  const renderedControls = controls === true ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6758
6836
  WindowControls,
@@ -6784,20 +6862,20 @@ function WindowTitleBar({
6784
6862
  }
6785
6863
 
6786
6864
  // src/components/Drawer.tsx
6787
- var import_react32 = require("react");
6865
+ var import_react33 = require("react");
6788
6866
  var import_client4 = require("react-dom/client");
6789
6867
  var import_jsx_runtime31 = require("react/jsx-runtime");
6790
6868
  var drawerHandles = /* @__PURE__ */ new Set();
6791
6869
  var DRAWER_MOTION_DURATION = 400;
6792
6870
  var DEFAULT_DRAWER_PUSH_DISTANCE = 180;
6793
- var DrawerStackContext = (0, import_react32.createContext)(null);
6871
+ var DrawerStackContext = (0, import_react33.createContext)(null);
6794
6872
  function createPushOffset(distance3, depth, negative) {
6795
6873
  if (depth <= 0) return "0px";
6796
6874
  if (typeof distance3 === "number") return `${(negative ? -1 : 1) * distance3 * depth}px`;
6797
6875
  const operator = negative ? " - " : " + ";
6798
6876
  return `calc(0px${operator}${Array.from({ length: depth }, () => distance3).join(operator)})`;
6799
6877
  }
6800
- var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
6878
+ var DrawerRoot = (0, import_react33.forwardRef)(function Drawer({
6801
6879
  open,
6802
6880
  title,
6803
6881
  children,
@@ -6820,19 +6898,19 @@ var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
6820
6898
  style,
6821
6899
  ...props
6822
6900
  }, forwardedRef) {
6823
- const localRef = (0, import_react32.useRef)(null);
6824
- const bodyRef = (0, import_react32.useRef)(null);
6825
- const titleId = (0, import_react32.useId)();
6826
- const drawerId = (0, import_react32.useId)();
6827
- const parentStack = (0, import_react32.useContext)(DrawerStackContext);
6828
- const afterOpenRef = (0, import_react32.useRef)(afterOpen);
6829
- const afterCloseRef = (0, import_react32.useRef)(afterClose);
6901
+ const localRef = (0, import_react33.useRef)(null);
6902
+ const bodyRef = (0, import_react33.useRef)(null);
6903
+ const titleId = (0, import_react33.useId)();
6904
+ const drawerId = (0, import_react33.useId)();
6905
+ const parentStack = (0, import_react33.useContext)(DrawerStackContext);
6906
+ const afterOpenRef = (0, import_react33.useRef)(afterOpen);
6907
+ const afterCloseRef = (0, import_react33.useRef)(afterClose);
6830
6908
  afterOpenRef.current = afterOpen;
6831
6909
  afterCloseRef.current = afterClose;
6832
- const [rendered, setRendered] = (0, import_react32.useState)(open);
6833
- const [closing, setClosing] = (0, import_react32.useState)(false);
6834
- const [openChildIds, setOpenChildIds] = (0, import_react32.useState)(() => /* @__PURE__ */ new Set());
6835
- const setChildOpen = (0, import_react32.useCallback)((id, childOpen) => {
6910
+ const [rendered, setRendered] = (0, import_react33.useState)(open);
6911
+ const [closing, setClosing] = (0, import_react33.useState)(false);
6912
+ const [openChildIds, setOpenChildIds] = (0, import_react33.useState)(() => /* @__PURE__ */ new Set());
6913
+ const setChildOpen = (0, import_react33.useCallback)((id, childOpen) => {
6836
6914
  setOpenChildIds((current) => {
6837
6915
  const hasId = current.has(id);
6838
6916
  if (hasId === childOpen) return current;
@@ -6842,8 +6920,8 @@ var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
6842
6920
  return next;
6843
6921
  });
6844
6922
  }, []);
6845
- const stackContextValue = (0, import_react32.useMemo)(() => ({ setChildOpen }), [setChildOpen]);
6846
- (0, import_react32.useEffect)(() => {
6923
+ const stackContextValue = (0, import_react33.useMemo)(() => ({ setChildOpen }), [setChildOpen]);
6924
+ (0, import_react33.useEffect)(() => {
6847
6925
  if (open) {
6848
6926
  setRendered(true);
6849
6927
  setClosing(false);
@@ -6858,12 +6936,12 @@ var DrawerRoot = (0, import_react32.forwardRef)(function Drawer({
6858
6936
  }, DRAWER_MOTION_DURATION);
6859
6937
  return () => window.clearTimeout(timer);
6860
6938
  }, [open, rendered]);
6861
- (0, import_react32.useEffect)(() => {
6939
+ (0, import_react33.useEffect)(() => {
6862
6940
  if (!open || !rendered) return void 0;
6863
6941
  const timer = window.setTimeout(() => afterOpenRef.current?.(), DRAWER_MOTION_DURATION);
6864
6942
  return () => window.clearTimeout(timer);
6865
6943
  }, [open, rendered]);
6866
- (0, import_react32.useEffect)(() => {
6944
+ (0, import_react33.useEffect)(() => {
6867
6945
  if (!parentStack) return void 0;
6868
6946
  parentStack.setChildOpen(drawerId, open);
6869
6947
  return () => parentStack.setChildOpen(drawerId, false);
@@ -6989,9 +7067,9 @@ var Drawer2 = Object.assign(DrawerRoot, {
6989
7067
  });
6990
7068
 
6991
7069
  // src/components/Form.tsx
6992
- var import_react33 = require("react");
7070
+ var import_react34 = require("react");
6993
7071
  var import_jsx_runtime32 = require("react/jsx-runtime");
6994
- var Switch = (0, import_react33.forwardRef)(function Switch2({
7072
+ var Switch = (0, import_react34.forwardRef)(function Switch2({
6995
7073
  label,
6996
7074
  variant = "standard",
6997
7075
  size: sizeProp,
@@ -7220,9 +7298,9 @@ var FormStore = class {
7220
7298
  window.requestAnimationFrame(() => focusTarget?.focus({ preventScroll: true }));
7221
7299
  };
7222
7300
  };
7223
- var FormContext = (0, import_react33.createContext)(null);
7301
+ var FormContext = (0, import_react34.createContext)(null);
7224
7302
  function useForm(form) {
7225
- const ref = (0, import_react33.useRef)(form ?? new FormStore());
7303
+ const ref = (0, import_react34.useRef)(form ?? new FormStore());
7226
7304
  return [ref.current];
7227
7305
  }
7228
7306
  function FormRoot({
@@ -7245,9 +7323,9 @@ function FormRoot({
7245
7323
  const [internalForm] = useForm(form);
7246
7324
  const instance = internalForm;
7247
7325
  instance.configure(initialValues, { onFinish, onFinishFailed, onValuesChange });
7248
- const context = (0, import_react33.useMemo)(() => instance, [instance]);
7249
- const formRef = (0, import_react33.useRef)(null);
7250
- (0, import_react33.useLayoutEffect)(() => {
7326
+ const context = (0, import_react34.useMemo)(() => instance, [instance]);
7327
+ const formRef = (0, import_react34.useRef)(null);
7328
+ (0, import_react34.useLayoutEffect)(() => {
7251
7329
  const root = formRef.current;
7252
7330
  if (!root) return;
7253
7331
  let frame = 0;
@@ -7311,6 +7389,7 @@ function defaultEventValue(valuePropName, args) {
7311
7389
  function FormItem({
7312
7390
  name,
7313
7391
  label,
7392
+ align = "start",
7314
7393
  rules = [],
7315
7394
  required,
7316
7395
  extra,
@@ -7324,11 +7403,11 @@ function FormItem({
7324
7403
  children,
7325
7404
  className = ""
7326
7405
  }) {
7327
- const form = (0, import_react33.useContext)(FormContext);
7328
- const id = (0, import_react33.useId)();
7329
- const itemRef = (0, import_react33.useRef)(null);
7406
+ const form = (0, import_react34.useContext)(FormContext);
7407
+ const id = (0, import_react34.useId)();
7408
+ const itemRef = (0, import_react34.useRef)(null);
7330
7409
  if (!form) throw new Error("Form.Item \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
7331
- (0, import_react33.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
7410
+ (0, import_react34.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
7332
7411
  const path = name === void 0 ? void 0 : pathArray(name);
7333
7412
  const key = path ? pathKey2(path) : "";
7334
7413
  const ruleRequired = required ?? rules.some((rule) => rule.required);
@@ -7337,7 +7416,7 @@ function FormItem({
7337
7416
  const helpContent = help ?? errors[0];
7338
7417
  const labelId = label && !noStyle ? `${id}-label` : void 0;
7339
7418
  const errorId = `${id}-error`;
7340
- (0, import_react33.useEffect)(() => {
7419
+ (0, import_react34.useEffect)(() => {
7341
7420
  if (!path) return void 0;
7342
7421
  return form.registerField({
7343
7422
  name: path,
@@ -7349,13 +7428,13 @@ function FormItem({
7349
7428
  if (typeof children === "function") {
7350
7429
  content = children(form);
7351
7430
  } else {
7352
- const childArray = import_react33.Children.toArray(children);
7353
- const child = childArray.length === 1 && (0, import_react33.isValidElement)(childArray[0]) ? childArray[0] : null;
7431
+ const childArray = import_react34.Children.toArray(children);
7432
+ const child = childArray.length === 1 && (0, import_react34.isValidElement)(childArray[0]) ? childArray[0] : null;
7354
7433
  if (child && path) {
7355
7434
  const childProps = child.props;
7356
7435
  const originalTrigger = childProps[trigger];
7357
7436
  const validationEvents = Array.isArray(validateTrigger) ? validateTrigger : [validateTrigger];
7358
- content = (0, import_react33.cloneElement)(child, {
7437
+ content = (0, import_react34.cloneElement)(child, {
7359
7438
  id: childProps.id ?? id,
7360
7439
  [valuePropName]: form.getFieldValue(path) ?? (valuePropName === "checked" ? false : ""),
7361
7440
  [trigger]: (...args) => {
@@ -7383,7 +7462,7 @@ function FormItem({
7383
7462
  if (noStyle) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: content });
7384
7463
  const inputWrap = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "sia-form-item__input-wrap", children: content });
7385
7464
  const hasError = status === "error" && Boolean(helpContent);
7386
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref: itemRef, className: `sia-form-item${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
7465
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { ref: itemRef, className: `sia-form-item${align === "center" ? " sia-form-item--align-center" : ""}${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
7387
7466
  label ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "sia-form-item__label-content", children: [
7388
7467
  ruleRequired ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
7389
7468
  label
@@ -7411,9 +7490,9 @@ function FormItem({
7411
7490
  ] });
7412
7491
  }
7413
7492
  function FormList({ name, children }) {
7414
- const form = (0, import_react33.useContext)(FormContext);
7493
+ const form = (0, import_react34.useContext)(FormContext);
7415
7494
  if (!form) throw new Error("Form.List \u5FC5\u987B\u5728 Form \u5185\u4F7F\u7528");
7416
- (0, import_react33.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
7495
+ (0, import_react34.useSyncExternalStore)(form.subscribe, form.getSnapshot, form.getSnapshot);
7417
7496
  const current = form.getFieldValue(name);
7418
7497
  const values = Array.isArray(current) ? current : [];
7419
7498
  const operations = {
@@ -7450,13 +7529,13 @@ var Form = Object.assign(FormRoot, {
7450
7529
  });
7451
7530
 
7452
7531
  // src/components/Radio.tsx
7453
- var import_react34 = require("react");
7532
+ var import_react35 = require("react");
7454
7533
  var import_jsx_runtime33 = require("react/jsx-runtime");
7455
- var RadioContext = (0, import_react34.createContext)(null);
7456
- var RadioRoot = (0, import_react34.forwardRef)(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
7534
+ var RadioContext = (0, import_react35.createContext)(null);
7535
+ var RadioRoot = (0, import_react35.forwardRef)(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
7457
7536
  const size = useControlSize(sizeProp);
7458
- const group = (0, import_react34.useContext)(RadioContext);
7459
- const fallbackId = (0, import_react34.useId)();
7537
+ const group = (0, import_react35.useContext)(RadioContext);
7538
+ const fallbackId = (0, import_react35.useId)();
7460
7539
  const grouped = group !== null;
7461
7540
  const currentChecked = grouped ? group.value === value : checked;
7462
7541
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("label", { className: `sia-radio sia-radio--${size}${button ? " sia-radio--button" : ""}${button && group?.buttonStyle === "solid" ? " sia-radio--solid" : ""}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
@@ -7500,7 +7579,7 @@ function RadioGroup({
7500
7579
  onChange
7501
7580
  }) {
7502
7581
  const size = useControlSize(sizeProp);
7503
- const fallbackName = (0, import_react34.useId)();
7582
+ const fallbackName = (0, import_react35.useId)();
7504
7583
  const [currentValue, setValue2] = useControllableState({
7505
7584
  value,
7506
7585
  defaultValue,
@@ -7508,7 +7587,7 @@ function RadioGroup({
7508
7587
  if (next !== void 0) onChange?.(next);
7509
7588
  }
7510
7589
  });
7511
- const context = (0, import_react34.useMemo)(() => ({
7590
+ const context = (0, import_react35.useMemo)(() => ({
7512
7591
  value: currentValue,
7513
7592
  name: name ?? fallbackName,
7514
7593
  disabled,
@@ -7532,7 +7611,7 @@ var Radio2 = Object.assign(RadioRoot, {
7532
7611
  });
7533
7612
 
7534
7613
  // src/components/Slider.tsx
7535
- var import_react35 = require("react");
7614
+ var import_react36 = require("react");
7536
7615
  var import_jsx_runtime34 = require("react/jsx-runtime");
7537
7616
  function percent(value, min, max) {
7538
7617
  return (value - min) / (max - min) * 100;
@@ -7556,7 +7635,7 @@ function Slider({
7556
7635
  }) {
7557
7636
  const fallback = defaultValue ?? (range ? [min, max] : min);
7558
7637
  const [currentValue, setValue2] = useControllableState({ value, defaultValue: fallback, onChange });
7559
- const [activeThumb, setActiveThumb] = (0, import_react35.useState)(null);
7638
+ const [activeThumb, setActiveThumb] = (0, import_react36.useState)(null);
7560
7639
  const values = Array.isArray(currentValue) ? [...currentValue] : [currentValue];
7561
7640
  const start = range ? percent(Math.min(values[0], values[1]), min, max) : 0;
7562
7641
  const end = percent(range ? Math.max(values[0], values[1]) : values[0], min, max);
@@ -7653,7 +7732,7 @@ function Slider({
7653
7732
  }
7654
7733
 
7655
7734
  // src/components/ColorPicker.tsx
7656
- var import_react36 = require("react");
7735
+ var import_react37 = require("react");
7657
7736
  var import_jsx_runtime35 = require("react/jsx-runtime");
7658
7737
  var DEFAULT_MODES = ["solid", "gradient"];
7659
7738
  var gradientStopSeed = 0;
@@ -7744,12 +7823,12 @@ function ColorPicker({
7744
7823
  ...props
7745
7824
  }) {
7746
7825
  const size = useControlSize(sizeProp);
7747
- const rootRef = (0, import_react36.useRef)(null);
7748
- const popupRef = (0, import_react36.useRef)(null);
7749
- const lastEmittedValue = (0, import_react36.useRef)();
7826
+ const rootRef = (0, import_react37.useRef)(null);
7827
+ const popupRef = (0, import_react37.useRef)(null);
7828
+ const lastEmittedValue = (0, import_react37.useRef)();
7750
7829
  const initialGradient = parseGradient(value ?? defaultValue);
7751
7830
  const initialSolid = initialGradient?.stops[0]?.color ?? normalizeHex(value || defaultValue);
7752
- const [open, setOpen] = (0, import_react36.useState)(false);
7831
+ const [open, setOpen] = (0, import_react37.useState)(false);
7753
7832
  const [color, setColor] = useControllableState({
7754
7833
  value,
7755
7834
  defaultValue: initialGradient ? formatGradient(initialGradient.angle, initialGradient.stops.map((stop, index) => ({ id: index, ...stop }))) : normalizeHex(defaultValue),
@@ -7760,17 +7839,17 @@ function ColorPicker({
7760
7839
  defaultValue: initialGradient ? "gradient" : defaultMode,
7761
7840
  onChange: onModeChange
7762
7841
  });
7763
- const [solidColor, setSolidColor] = (0, import_react36.useState)(initialSolid);
7764
- const [gradientAngle, setGradientAngle] = (0, import_react36.useState)(initialGradient?.angle ?? 90);
7765
- const [gradientStops, setGradientStops] = (0, import_react36.useState)(() => initialGradient ? initialGradient.stops.map((stop) => createStop(stop.color, stop.position)) : createDefaultStops(initialSolid));
7766
- const [activeStopId, setActiveStopId] = (0, import_react36.useState)(() => gradientStops[0]?.id ?? 0);
7842
+ const [solidColor, setSolidColor] = (0, import_react37.useState)(initialSolid);
7843
+ const [gradientAngle, setGradientAngle] = (0, import_react37.useState)(initialGradient?.angle ?? 90);
7844
+ const [gradientStops, setGradientStops] = (0, import_react37.useState)(() => initialGradient ? initialGradient.stops.map((stop) => createStop(stop.color, stop.position)) : createDefaultStops(initialSolid));
7845
+ const [activeStopId, setActiveStopId] = (0, import_react37.useState)(() => gradientStops[0]?.id ?? 0);
7767
7846
  const activeStop = gradientStops.find((stop) => stop.id === activeStopId) ?? gradientStops[0];
7768
7847
  const editingColor = currentMode === "gradient" ? activeStop?.color ?? solidColor : solidColor;
7769
7848
  const rgba = parseHex(editingColor) ?? parseHex("#1677FF");
7770
7849
  const hsv = rgbToHsv(rgba);
7771
- const [hexDraft, setHexDraft] = (0, import_react36.useState)(editingColor);
7850
+ const [hexDraft, setHexDraft] = (0, import_react37.useState)(editingColor);
7772
7851
  const gradientValue = formatGradient(gradientAngle, gradientStops);
7773
- (0, import_react36.useEffect)(() => {
7852
+ (0, import_react37.useEffect)(() => {
7774
7853
  if (!open) return void 0;
7775
7854
  const close = (event) => {
7776
7855
  const target = event.target;
@@ -7779,10 +7858,10 @@ function ColorPicker({
7779
7858
  document.addEventListener("pointerdown", close);
7780
7859
  return () => document.removeEventListener("pointerdown", close);
7781
7860
  }, [open]);
7782
- (0, import_react36.useEffect)(() => {
7861
+ (0, import_react37.useEffect)(() => {
7783
7862
  setHexDraft(editingColor);
7784
7863
  }, [editingColor]);
7785
- (0, import_react36.useEffect)(() => {
7864
+ (0, import_react37.useEffect)(() => {
7786
7865
  if (value === void 0 || value === lastEmittedValue.current) return;
7787
7866
  const parsed = parseGradient(value);
7788
7867
  if (parsed) {
@@ -7969,10 +8048,10 @@ function ColorPicker({
7969
8048
  }
7970
8049
 
7971
8050
  // src/components/DatePicker.tsx
7972
- var import_react38 = require("react");
8051
+ var import_react39 = require("react");
7973
8052
 
7974
8053
  // src/components/DatePickerPanel.tsx
7975
- var import_react37 = require("react");
8054
+ var import_react38 = require("react");
7976
8055
  var import_jsx_runtime36 = require("react/jsx-runtime");
7977
8056
  function pad2(value) {
7978
8057
  return String(value).padStart(2, "0");
@@ -8116,12 +8195,12 @@ function TimePanel({
8116
8195
  onChange
8117
8196
  }) {
8118
8197
  const [hour = "00", minute = "00", second = "00"] = value.split(":");
8119
- const columnsRef = (0, import_react37.useRef)(null);
8120
- const hourRef = (0, import_react37.useRef)(null);
8121
- const minuteRef = (0, import_react37.useRef)(null);
8122
- const secondRef = (0, import_react37.useRef)(null);
8198
+ const columnsRef = (0, import_react38.useRef)(null);
8199
+ const hourRef = (0, import_react38.useRef)(null);
8200
+ const minuteRef = (0, import_react38.useRef)(null);
8201
+ const secondRef = (0, import_react38.useRef)(null);
8123
8202
  const columnRefs = [hourRef, minuteRef, secondRef];
8124
- (0, import_react37.useLayoutEffect)(() => {
8203
+ (0, import_react38.useLayoutEffect)(() => {
8125
8204
  for (const column of columnsRef.current?.children ?? []) {
8126
8205
  const selected = column.querySelector('[aria-selected="true"]');
8127
8206
  const first = column.firstElementChild;
@@ -8262,23 +8341,23 @@ function DatePicker({
8262
8341
  ...props
8263
8342
  }) {
8264
8343
  const size = useControlSize(sizeProp);
8265
- const id = (0, import_react38.useId)();
8266
- const rootRef = (0, import_react38.useRef)(null);
8267
- const popupRef = (0, import_react38.useRef)(null);
8344
+ const id = (0, import_react39.useId)();
8345
+ const rootRef = (0, import_react39.useRef)(null);
8346
+ const popupRef = (0, import_react39.useRef)(null);
8268
8347
  const initialValue = defaultValue ?? (multiple ? [] : "");
8269
8348
  const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue: initialValue, onChange });
8270
8349
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
8271
- const [draftValue, setDraftValue] = (0, import_react38.useState)(currentValue);
8350
+ const [draftValue, setDraftValue] = (0, import_react39.useState)(currentValue);
8272
8351
  const firstCurrent = Array.isArray(currentValue) ? currentValue[0] : currentValue;
8273
- const [viewMonth, setViewMonth] = (0, import_react38.useState)(() => startOfMonth(parseDate2(dayFromValue(firstCurrent)) ?? /* @__PURE__ */ new Date()));
8274
- const [draftTime, setDraftTime] = (0, import_react38.useState)(() => timePart(firstCurrent, defaultTimeFrom(showTime)));
8352
+ const [viewMonth, setViewMonth] = (0, import_react39.useState)(() => startOfMonth(parseDate2(dayFromValue(firstCurrent)) ?? /* @__PURE__ */ new Date()));
8353
+ const [draftTime, setDraftTime] = (0, import_react39.useState)(() => timePart(firstCurrent, defaultTimeFrom(showTime)));
8275
8354
  const resolvedNeedConfirm = needConfirm ?? Boolean(showTime);
8276
8355
  const showSecond = showSecondFrom(showTime);
8277
- const selectedDates = (0, import_react38.useMemo)(() => {
8356
+ const selectedDates = (0, import_react39.useMemo)(() => {
8278
8357
  const values = Array.isArray(draftValue) ? draftValue : draftValue ? [draftValue] : [];
8279
8358
  return values.map(dayFromValue).filter(Boolean);
8280
8359
  }, [draftValue]);
8281
- (0, import_react38.useEffect)(() => {
8360
+ (0, import_react39.useEffect)(() => {
8282
8361
  if (!visible) return void 0;
8283
8362
  const close = (event) => {
8284
8363
  const target = event.target;
@@ -8452,15 +8531,15 @@ function DateRangePicker({
8452
8531
  ...props
8453
8532
  }) {
8454
8533
  const size = useControlSize(sizeProp);
8455
- const id = (0, import_react38.useId)();
8456
- const rootRef = (0, import_react38.useRef)(null);
8457
- const popupRef = (0, import_react38.useRef)(null);
8534
+ const id = (0, import_react39.useId)();
8535
+ const rootRef = (0, import_react39.useRef)(null);
8536
+ const popupRef = (0, import_react39.useRef)(null);
8458
8537
  const [currentValue, setCurrentValue] = useControllableState({ value: value === void 0 ? void 0 : Array.isArray(value) ? value : ["", ""], defaultValue, onChange });
8459
8538
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
8460
- const [draftValue, setDraftValue] = (0, import_react38.useState)(currentValue);
8461
- const [activeIndex, setActiveIndex] = (0, import_react38.useState)(endpointDisabled[0] || currentValue[0] && !currentValue[1] ? 1 : 0);
8462
- const indicatorRef = (0, import_react38.useRef)(null);
8463
- (0, import_react38.useLayoutEffect)(() => {
8539
+ const [draftValue, setDraftValue] = (0, import_react39.useState)(currentValue);
8540
+ const [activeIndex, setActiveIndex] = (0, import_react39.useState)(endpointDisabled[0] || currentValue[0] && !currentValue[1] ? 1 : 0);
8541
+ const indicatorRef = (0, import_react39.useRef)(null);
8542
+ (0, import_react39.useLayoutEffect)(() => {
8464
8543
  const field = rootRef.current?.querySelector(`[data-range-endpoint="${activeIndex}"]`);
8465
8544
  const indicator = indicatorRef.current;
8466
8545
  if (!field || !indicator) return;
@@ -8477,22 +8556,22 @@ function DateRangePicker({
8477
8556
  }
8478
8557
  return () => observer.disconnect();
8479
8558
  });
8480
- const [confirmedIndex, setConfirmedIndex] = (0, import_react38.useState)(null);
8481
- const [presetSelected, setPresetSelected] = (0, import_react38.useState)(false);
8482
- const [hoverDate, setHoverDate] = (0, import_react38.useState)("");
8483
- const [viewMonth, setViewMonth] = (0, import_react38.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date()));
8484
- const [endViewMonth, setEndViewMonth] = (0, import_react38.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[1])) ?? addMonths(parseDate2(dayFromValue(currentValue[0])) ?? /* @__PURE__ */ new Date(), 1)));
8559
+ const [confirmedIndex, setConfirmedIndex] = (0, import_react39.useState)(null);
8560
+ const [presetSelected, setPresetSelected] = (0, import_react39.useState)(false);
8561
+ const [hoverDate, setHoverDate] = (0, import_react39.useState)("");
8562
+ const [viewMonth, setViewMonth] = (0, import_react39.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[0] || currentValue[1])) ?? /* @__PURE__ */ new Date()));
8563
+ const [endViewMonth, setEndViewMonth] = (0, import_react39.useState)(() => startOfMonth(parseDate2(dayFromValue(currentValue[1])) ?? addMonths(parseDate2(dayFromValue(currentValue[0])) ?? /* @__PURE__ */ new Date(), 1)));
8485
8564
  const showSecond = showSecondFrom(showTime);
8486
8565
  const defaultTime = defaultTimeFrom(showTime);
8487
8566
  const defaultEndTime = defaultTimeFrom(showTime, 1);
8488
- const [times, setTimes] = (0, import_react38.useState)([
8567
+ const [times, setTimes] = (0, import_react39.useState)([
8489
8568
  timePart(currentValue[0], defaultTime),
8490
8569
  timePart(currentValue[1], defaultEndTime)
8491
8570
  ]);
8492
8571
  const resolvedNeedConfirm = needConfirm ?? Boolean(showTime);
8493
8572
  const rangeDates = [dayFromValue(draftValue[0]), dayFromValue(draftValue[1])];
8494
8573
  const invalidDateTimeRange = Boolean(showTime && draftValue[0] && draftValue[1] && draftValue[0] > draftValue[1]);
8495
- (0, import_react38.useEffect)(() => {
8574
+ (0, import_react39.useEffect)(() => {
8496
8575
  if (!visible) return void 0;
8497
8576
  const close = (event) => {
8498
8577
  const target = event.target;
@@ -8881,7 +8960,7 @@ function SelectDateRange({
8881
8960
  }
8882
8961
 
8883
8962
  // src/components/TimePicker.tsx
8884
- var import_react39 = require("react");
8963
+ var import_react40 = require("react");
8885
8964
  var import_jsx_runtime39 = require("react/jsx-runtime");
8886
8965
  function seconds(value) {
8887
8966
  const [h = 0, m = 0, s = 0] = value.split(":").map(Number);
@@ -8911,14 +8990,14 @@ function TimePicker({
8911
8990
  ...props
8912
8991
  }) {
8913
8992
  const size = useControlSize(sizeProp);
8914
- const id = (0, import_react39.useId)();
8915
- const rootRef = (0, import_react39.useRef)(null);
8916
- const inputRef = (0, import_react39.useRef)(null);
8917
- const popupRef = (0, import_react39.useRef)(null);
8918
- const focusPanel = (0, import_react39.useRef)(false);
8993
+ const id = (0, import_react40.useId)();
8994
+ const rootRef = (0, import_react40.useRef)(null);
8995
+ const inputRef = (0, import_react40.useRef)(null);
8996
+ const popupRef = (0, import_react40.useRef)(null);
8997
+ const focusPanel = (0, import_react40.useRef)(false);
8919
8998
  const [currentValue, setValue2] = useControllableState({ value, defaultValue, onChange });
8920
- const [open, setOpen] = (0, import_react39.useState)(false);
8921
- const [draft, setDraft] = (0, import_react39.useState)("00:00:00");
8999
+ const [open, setOpen] = (0, import_react40.useState)(false);
9000
+ const [draft, setDraft] = (0, import_react40.useState)("00:00:00");
8922
9001
  const normalize = (time) => showSecond ? (time + ":00").slice(0, 8) : time.slice(0, 5);
8923
9002
  const unavailable = (time) => {
8924
9003
  const normalized = normalize(time);
@@ -8936,7 +9015,7 @@ function TimePicker({
8936
9015
  setOpen(next);
8937
9016
  onOpenChange?.(next);
8938
9017
  }
8939
- (0, import_react39.useEffect)(() => {
9018
+ (0, import_react40.useEffect)(() => {
8940
9019
  if (!open) return;
8941
9020
  if (focusPanel.current) {
8942
9021
  popupRef.current?.querySelector('[aria-selected="true"]')?.focus();
@@ -9055,7 +9134,7 @@ function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F0
9055
9134
  })(TimePicker || (TimePicker = {}));
9056
9135
 
9057
9136
  // src/components/TreeSelect.tsx
9058
- var import_react40 = require("react");
9137
+ var import_react41 = require("react");
9059
9138
  var import_jsx_runtime40 = require("react/jsx-runtime");
9060
9139
  function flattenTree(nodes, expanded, search, filter, depth = 0, parents = [], ancestorMatched = false) {
9061
9140
  const result = [];
@@ -9118,9 +9197,9 @@ function TreeSelect({
9118
9197
  ...props
9119
9198
  }) {
9120
9199
  const size = useControlSize(sizeProp);
9121
- const rootRef = (0, import_react40.useRef)(null);
9122
- const popupRef = (0, import_react40.useRef)(null);
9123
- const nodeIndex = (0, import_react40.useMemo)(() => {
9200
+ const rootRef = (0, import_react41.useRef)(null);
9201
+ const popupRef = (0, import_react41.useRef)(null);
9202
+ const nodeIndex = (0, import_react41.useMemo)(() => {
9124
9203
  const index = /* @__PURE__ */ new Map();
9125
9204
  const visit = (nodes) => nodes.forEach((node) => {
9126
9205
  index.set(node.value, node);
@@ -9139,7 +9218,7 @@ function TreeSelect({
9139
9218
  });
9140
9219
  const [open, setOpen] = useControllableState({ value: controlledOpen, defaultValue: defaultOpen, onChange: onDropdownVisibleChange });
9141
9220
  const [search, setSearch] = useControllableState({ value: searchValue, defaultValue: "", onChange: onSearch });
9142
- const [expanded, setExpanded] = (0, import_react40.useState)(() => {
9221
+ const [expanded, setExpanded] = (0, import_react41.useState)(() => {
9143
9222
  if (!treeDefaultExpandAll) return new Set(treeDefaultExpandedKeys);
9144
9223
  const values = [];
9145
9224
  const collect = (nodes) => nodes.forEach((node) => {
@@ -9155,7 +9234,7 @@ function TreeSelect({
9155
9234
  const expandedSet = treeExpandedKeys ? new Set(treeExpandedKeys) : expanded;
9156
9235
  const selectedNodes = resolveNodes(selectedValues);
9157
9236
  const visibleNodes = flattenTree(treeData, expandedSet, search, filterTreeNode);
9158
- (0, import_react40.useEffect)(() => {
9237
+ (0, import_react41.useEffect)(() => {
9159
9238
  if (!open || treeExpandedKeys) return;
9160
9239
  const keys = new Set(expanded);
9161
9240
  const walk = (nodes, parents) => nodes.forEach((node) => {
@@ -9215,7 +9294,7 @@ function TreeSelect({
9215
9294
  setCurrentValue(multi ? [] : void 0);
9216
9295
  onClear?.();
9217
9296
  }
9218
- (0, import_react40.useEffect)(() => {
9297
+ (0, import_react41.useEffect)(() => {
9219
9298
  if (!open) return void 0;
9220
9299
  const close = (event) => {
9221
9300
  const target = event.target;
@@ -9374,7 +9453,7 @@ function buildFlatTree(items, options = {}) {
9374
9453
  }
9375
9454
 
9376
9455
  // src/components/Upload.tsx
9377
- var import_react41 = require("react");
9456
+ var import_react42 = require("react");
9378
9457
 
9379
9458
  // src/components/uploadFiles.ts
9380
9459
  function acceptsUploadFile(file, accept) {
@@ -9613,8 +9692,8 @@ var message = {
9613
9692
  var import_jsx_runtime42 = require("react/jsx-runtime");
9614
9693
  var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
9615
9694
  function useThumbnail(file, accept) {
9616
- const [local, setLocal] = (0, import_react41.useState)();
9617
- (0, import_react41.useEffect)(() => {
9695
+ const [local, setLocal] = (0, import_react42.useState)();
9696
+ (0, import_react42.useEffect)(() => {
9618
9697
  if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
9619
9698
  const url = URL.createObjectURL(file.originFileObj);
9620
9699
  setLocal(url);
@@ -9626,9 +9705,9 @@ function useThumbnail(file, accept) {
9626
9705
  }
9627
9706
  function UploadItem({ file, files, props, actions }) {
9628
9707
  const source = useThumbnail(file, props.accept);
9629
- const [failed, setFailed] = (0, import_react41.useState)(false);
9630
- const [downloading, setDownloading] = (0, import_react41.useState)(false);
9631
- const downloadingRef = (0, import_react41.useRef)(false);
9708
+ const [failed, setFailed] = (0, import_react42.useState)(false);
9709
+ const [downloading, setDownloading] = (0, import_react42.useState)(false);
9710
+ const downloadingRef = (0, import_react42.useRef)(false);
9632
9711
  const canPreview = !!(source || file.url || file.originFileObj || props.onPreview);
9633
9712
  const canDownload = !!(file.url || file.originFileObj || props.downloadRequest);
9634
9713
  async function download() {
@@ -9644,7 +9723,7 @@ function UploadItem({ file, files, props, actions }) {
9644
9723
  setDownloading(false);
9645
9724
  }
9646
9725
  }
9647
- (0, import_react41.useEffect)(() => setFailed(false), [source]);
9726
+ (0, import_react42.useEffect)(() => setFailed(false), [source]);
9648
9727
  const node = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: `sia-upload__item sia-upload__item--${file.status ?? "ready"}`, children: [
9649
9728
  props.listType !== "text" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { variant: "text", className: "sia-upload__thumbnail", "aria-label": `\u9884\u89C8\u7F29\u7565\u56FE ${file.name}`, onClick: actions.preview, disabled: !canPreview, children: source && !failed ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("img", { src: source, alt: file.name, onError: () => setFailed(true) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: file.type?.startsWith("image/") ? "image" : "file", size: 28 }) }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sia-upload__file-icon", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: file.status === "done" ? "circle-check" : "file", size: 24 }) }),
9650
9729
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sia-upload__name", ...withTitleTooltip({ title: file.relativePath || file.name }), children: file.url ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("a", { href: file.url, target: "_blank", rel: "noreferrer", children: file.name }) : file.name }),
@@ -9666,7 +9745,7 @@ function UploadItem({ file, files, props, actions }) {
9666
9745
  ] });
9667
9746
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children: props.itemRender ? props.itemRender(node, file, files, actions) : node });
9668
9747
  }
9669
- var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
9748
+ var UploadRoot = (0, import_react42.forwardRef)(function UploadRoot2({
9670
9749
  accept,
9671
9750
  multiple = false,
9672
9751
  directory = false,
@@ -9705,19 +9784,19 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
9705
9784
  const cardWidth = cardDimension(typeof cardSize === "number" ? cardSize : cardSize?.width);
9706
9785
  const cardHeight = cardDimension(typeof cardSize === "number" ? cardSize : cardSize?.height);
9707
9786
  const compactCard = listType === "picture-card" && (cardWidth < 88 || cardHeight < 88);
9708
- const inputRef = (0, import_react41.useRef)(null);
9709
- const [internalFiles, setInternalFiles] = (0, import_react41.useState)(defaultFileList);
9787
+ const inputRef = (0, import_react42.useRef)(null);
9788
+ const [internalFiles, setInternalFiles] = (0, import_react42.useState)(defaultFileList);
9710
9789
  const files = fileList ?? internalFiles;
9711
- const filesRef = (0, import_react41.useRef)(files);
9790
+ const filesRef = (0, import_react42.useRef)(files);
9712
9791
  filesRef.current = files;
9713
- const tasks = (0, import_react41.useRef)(/* @__PURE__ */ new Map());
9714
- const mounted = (0, import_react41.useRef)(true);
9715
- const [dragging, setDragging] = (0, import_react41.useState)(false);
9716
- const [preview, setPreview] = (0, import_react41.useState)();
9792
+ const tasks = (0, import_react42.useRef)(/* @__PURE__ */ new Map());
9793
+ const mounted = (0, import_react42.useRef)(true);
9794
+ const [dragging, setDragging] = (0, import_react42.useState)(false);
9795
+ const [preview, setPreview] = (0, import_react42.useState)();
9717
9796
  const previewSource = useThumbnail(preview, accept);
9718
9797
  const limit = maxCount2 === void 0 || !Number.isFinite(maxCount2) ? Infinity : Math.max(0, Math.floor(maxCount2));
9719
9798
  const full = files.length >= limit;
9720
- const current = (0, import_react41.useRef)({ disabled, directory, recursive });
9799
+ const current = (0, import_react42.useRef)({ disabled, directory, recursive });
9721
9800
  current.current = { disabled, directory, recursive };
9722
9801
  function cancel(uid) {
9723
9802
  const task = tasks.current.get(uid);
@@ -9729,14 +9808,14 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
9729
9808
  }
9730
9809
  task?.finish();
9731
9810
  }
9732
- (0, import_react41.useEffect)(() => {
9811
+ (0, import_react42.useEffect)(() => {
9733
9812
  mounted.current = true;
9734
9813
  return () => {
9735
9814
  mounted.current = false;
9736
9815
  [...tasks.current.keys()].forEach(cancel);
9737
9816
  };
9738
9817
  }, []);
9739
- (0, import_react41.useEffect)(() => {
9818
+ (0, import_react42.useEffect)(() => {
9740
9819
  for (const uid of tasks.current.keys()) if (!files.some((file) => file.uid === uid)) cancel(uid);
9741
9820
  if (preview && !files.some((file) => file.uid === preview.uid)) setPreview(void 0);
9742
9821
  }, [files, preview]);
@@ -9842,7 +9921,7 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
9842
9921
  } catch {
9843
9922
  }
9844
9923
  }
9845
- (0, import_react41.useImperativeHandle)(ref, () => ({
9924
+ (0, import_react42.useImperativeHandle)(ref, () => ({
9846
9925
  upload: async (uid) => {
9847
9926
  await Promise.all(filesRef.current.filter((file) => (!uid || file.uid === uid) && file.status !== "done").map(start));
9848
9927
  },
@@ -9970,7 +10049,7 @@ var UploadRoot = (0, import_react41.forwardRef)(function UploadRoot2({
9970
10049
  }
9971
10050
  );
9972
10051
  });
9973
- var UploadDragger = (0, import_react41.forwardRef)(function UploadDragger2({ hint = "\u652F\u6301\u5355\u4E2A\u6216\u6279\u91CF\u4E0A\u4F20", children, className = "", ...props }, ref) {
10052
+ var UploadDragger = (0, import_react42.forwardRef)(function UploadDragger2({ hint = "\u652F\u6301\u5355\u4E2A\u6216\u6279\u91CF\u4E0A\u4F20", children, className = "", ...props }, ref) {
9974
10053
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(UploadRoot, { ...props, ref, className: `sia-upload-dragger ${className}`.trim(), children: children ?? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "sia-upload-dragger__content", children: [
9975
10054
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: "upload", size: 32 }),
9976
10055
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("strong", { children: [
@@ -9990,7 +10069,7 @@ var Upload = Object.assign(UploadRoot, {
9990
10069
  });
9991
10070
 
9992
10071
  // src/components/RichTextEditor.tsx
9993
- var import_react42 = require("react");
10072
+ var import_react43 = require("react");
9994
10073
  var import_dompurify = __toESM(require("dompurify"), 1);
9995
10074
  var import_core = require("@tiptap/core");
9996
10075
  var import_starter_kit = __toESM(require("@tiptap/starter-kit"), 1);
@@ -10019,7 +10098,7 @@ function sanitizeContent(value) {
10019
10098
  }).replace(/<img\b/giu, '<img loading="lazy" decoding="async"');
10020
10099
  }
10021
10100
  function RichTextContent({ content, emptyText = "\u6682\u65E0\u5185\u5BB9", className = "", ...props }) {
10022
- const html = (0, import_react42.useMemo)(() => sanitizeContent(content), [content]);
10101
+ const html = (0, import_react43.useMemo)(() => sanitizeContent(content), [content]);
10023
10102
  if (!html.trim()) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: `sia-rich-text-content sia-rich-text-content--empty ${className}`.trim(), children: emptyText });
10024
10103
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("article", { className: `sia-rich-text-content ${className}`.trim(), dangerouslySetInnerHTML: { __html: html }, ...withTitleTooltip(props) });
10025
10104
  }
@@ -10042,31 +10121,31 @@ function RichTextEditor({
10042
10121
  "aria-label": ariaLabel,
10043
10122
  ...props
10044
10123
  }) {
10045
- const initialValueRef = (0, import_react42.useRef)(value ?? defaultValue);
10046
- const lastEmittedValueRef = (0, import_react42.useRef)(value ?? defaultValue);
10047
- const onChangeRef = (0, import_react42.useRef)(onChange);
10048
- const onPasteImageRef = (0, import_react42.useRef)(onPasteImage);
10049
- const saveShortcutRef = (0, import_react42.useRef)(saveShortcut);
10050
- const contentFormatRef = (0, import_react42.useRef)(contentFormat);
10051
- const editorElementRef = (0, import_react42.useRef)(null);
10052
- const editorRef = (0, import_react42.useRef)(null);
10053
- const [editor, setEditor] = (0, import_react42.useState)(null);
10054
- const [linkEditorOpen, setLinkEditorOpen] = (0, import_react42.useState)(false);
10055
- const [linkHref, setLinkHref] = (0, import_react42.useState)("");
10056
- const [, setEditorRevision] = (0, import_react42.useState)(0);
10057
- (0, import_react42.useEffect)(() => {
10124
+ const initialValueRef = (0, import_react43.useRef)(value ?? defaultValue);
10125
+ const lastEmittedValueRef = (0, import_react43.useRef)(value ?? defaultValue);
10126
+ const onChangeRef = (0, import_react43.useRef)(onChange);
10127
+ const onPasteImageRef = (0, import_react43.useRef)(onPasteImage);
10128
+ const saveShortcutRef = (0, import_react43.useRef)(saveShortcut);
10129
+ const contentFormatRef = (0, import_react43.useRef)(contentFormat);
10130
+ const editorElementRef = (0, import_react43.useRef)(null);
10131
+ const editorRef = (0, import_react43.useRef)(null);
10132
+ const [editor, setEditor] = (0, import_react43.useState)(null);
10133
+ const [linkEditorOpen, setLinkEditorOpen] = (0, import_react43.useState)(false);
10134
+ const [linkHref, setLinkHref] = (0, import_react43.useState)("");
10135
+ const [, setEditorRevision] = (0, import_react43.useState)(0);
10136
+ (0, import_react43.useEffect)(() => {
10058
10137
  onChangeRef.current = onChange;
10059
10138
  }, [onChange]);
10060
- (0, import_react42.useEffect)(() => {
10139
+ (0, import_react43.useEffect)(() => {
10061
10140
  onPasteImageRef.current = onPasteImage;
10062
10141
  }, [onPasteImage]);
10063
- (0, import_react42.useEffect)(() => {
10142
+ (0, import_react43.useEffect)(() => {
10064
10143
  saveShortcutRef.current = saveShortcut;
10065
10144
  }, [saveShortcut]);
10066
- (0, import_react42.useEffect)(() => {
10145
+ (0, import_react43.useEffect)(() => {
10067
10146
  contentFormatRef.current = contentFormat;
10068
10147
  }, [contentFormat]);
10069
- const extensions = (0, import_react42.useMemo)(() => [
10148
+ const extensions = (0, import_react43.useMemo)(() => [
10070
10149
  import_starter_kit.default.configure({
10071
10150
  heading: { levels: [1, 2, 3, 4, 5, 6] },
10072
10151
  link: { openOnClick: false, autolink: true, linkOnPaste: true },
@@ -10082,7 +10161,7 @@ function RichTextEditor({
10082
10161
  import_extension_task_item.default.configure({ nested: true }),
10083
10162
  import_markdown.Markdown.configure({ markedOptions: { gfm: true } })
10084
10163
  ], [placeholder]);
10085
- (0, import_react42.useEffect)(() => {
10164
+ (0, import_react43.useEffect)(() => {
10086
10165
  const element = editorElementRef.current;
10087
10166
  if (!element) return;
10088
10167
  const nextEditor = new import_core.Editor({
@@ -10139,10 +10218,10 @@ function RichTextEditor({
10139
10218
  nextEditor.destroy();
10140
10219
  };
10141
10220
  }, [ariaLabel, extensions]);
10142
- (0, import_react42.useEffect)(() => {
10221
+ (0, import_react43.useEffect)(() => {
10143
10222
  editor?.setEditable(!disabled);
10144
10223
  }, [disabled, editor]);
10145
- (0, import_react42.useEffect)(() => {
10224
+ (0, import_react43.useEffect)(() => {
10146
10225
  if (!editor || value === void 0 || value === lastEmittedValueRef.current) return;
10147
10226
  editor.commands.setContent(value, { emitUpdate: false, contentType: contentFormat });
10148
10227
  lastEmittedValueRef.current = value;
@@ -10277,7 +10356,7 @@ function RichTextEditor({
10277
10356
  }
10278
10357
 
10279
10358
  // src/components/MarkdownEditor.tsx
10280
- var import_react43 = require("react");
10359
+ var import_react44 = require("react");
10281
10360
  var import_dist = require("vditor/dist/index.css");
10282
10361
 
10283
10362
  // src/components/markdownPaste.ts
@@ -10504,21 +10583,21 @@ function MarkdownEditor({
10504
10583
  style,
10505
10584
  ...props
10506
10585
  }) {
10507
- const mountRef = (0, import_react43.useRef)(null);
10508
- const editorRef = (0, import_react43.useRef)(null);
10509
- const onChangeRef = (0, import_react43.useRef)(onChange);
10510
- const saveShortcutRef = (0, import_react43.useRef)(saveShortcut);
10511
- const uploadImageRef = (0, import_react43.useRef)(onUploadImage);
10512
- const disabledRef = (0, import_react43.useRef)(disabled);
10513
- const smartMarkdownPasteRef = (0, import_react43.useRef)(smartMarkdownPaste);
10514
- const valueRef = (0, import_react43.useRef)(value ?? defaultValue);
10515
- const lastEmittedValueRef = (0, import_react43.useRef)(value ?? defaultValue);
10516
- const [hasContent, setHasContent] = (0, import_react43.useState)(Boolean((value ?? defaultValue).trim()));
10586
+ const mountRef = (0, import_react44.useRef)(null);
10587
+ const editorRef = (0, import_react44.useRef)(null);
10588
+ const onChangeRef = (0, import_react44.useRef)(onChange);
10589
+ const saveShortcutRef = (0, import_react44.useRef)(saveShortcut);
10590
+ const uploadImageRef = (0, import_react44.useRef)(onUploadImage);
10591
+ const disabledRef = (0, import_react44.useRef)(disabled);
10592
+ const smartMarkdownPasteRef = (0, import_react44.useRef)(smartMarkdownPaste);
10593
+ const valueRef = (0, import_react44.useRef)(value ?? defaultValue);
10594
+ const lastEmittedValueRef = (0, import_react44.useRef)(value ?? defaultValue);
10595
+ const [hasContent, setHasContent] = (0, import_react44.useState)(Boolean((value ?? defaultValue).trim()));
10517
10596
  const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: hasContent });
10518
- const [ready, setReady] = (0, import_react43.useState)(false);
10519
- const [loadError, setLoadError] = (0, import_react43.useState)("");
10597
+ const [ready, setReady] = (0, import_react44.useState)(false);
10598
+ const [loadError, setLoadError] = (0, import_react44.useState)("");
10520
10599
  const hasImageUpload = Boolean(onUploadImage);
10521
- (0, import_react43.useEffect)(() => {
10600
+ (0, import_react44.useEffect)(() => {
10522
10601
  if (value !== void 0) setHasContent(Boolean(value.trim()));
10523
10602
  }, [value]);
10524
10603
  onChangeRef.current = onChange;
@@ -10527,7 +10606,7 @@ function MarkdownEditor({
10527
10606
  disabledRef.current = disabled;
10528
10607
  smartMarkdownPasteRef.current = smartMarkdownPaste;
10529
10608
  valueRef.current = value ?? valueRef.current;
10530
- (0, import_react43.useEffect)(() => {
10609
+ (0, import_react44.useEffect)(() => {
10531
10610
  const mount = mountRef.current;
10532
10611
  if (!mount) return;
10533
10612
  let disposed = false;
@@ -10629,14 +10708,14 @@ function MarkdownEditor({
10629
10708
  if (editorInitialized) createdEditor?.destroy();
10630
10709
  };
10631
10710
  }, [ariaLabel, assetBaseUrl, hasImageUpload, minHeight, mode, placeholder, floating.enabled]);
10632
- (0, import_react43.useEffect)(() => {
10711
+ (0, import_react44.useEffect)(() => {
10633
10712
  const editor = editorRef.current;
10634
10713
  if (!editor || value === void 0) return;
10635
10714
  if (value === lastEmittedValueRef.current || editor.getValue() === value) return;
10636
10715
  lastEmittedValueRef.current = value;
10637
10716
  editor.setValue(value, true);
10638
10717
  }, [ready, value]);
10639
- (0, import_react43.useEffect)(() => {
10718
+ (0, import_react44.useEffect)(() => {
10640
10719
  const editor = editorRef.current;
10641
10720
  if (!editor) return;
10642
10721
  if (disabled) editor.disabled();
@@ -10668,7 +10747,7 @@ function MarkdownEditor({
10668
10747
  }
10669
10748
 
10670
10749
  // src/components/Editor.tsx
10671
- var import_react44 = require("react");
10750
+ var import_react45 = require("react");
10672
10751
  var import_editor_worker = __toESM(require("monaco-editor/editor/editor.worker.js?worker"), 1);
10673
10752
 
10674
10753
  // src/components/jsonLanguage.ts
@@ -11343,30 +11422,30 @@ function Editor({
11343
11422
  ariaLabel = "\u4EE3\u7801\u7F16\u8F91\u5668",
11344
11423
  loadingText = "\u6B63\u5728\u52A0\u8F7D\u7F16\u8F91\u5668\u2026"
11345
11424
  }) {
11346
- const generatedId = (0, import_react44.useId)();
11347
- const containerRef = (0, import_react44.useRef)(null);
11348
- const rangeHighlightRef = (0, import_react44.useRef)(null);
11349
- const editorRef = (0, import_react44.useRef)(null);
11350
- const modelRef = (0, import_react44.useRef)(null);
11351
- const apiRef = (0, import_react44.useRef)(null);
11352
- const applyingControlledValueRef = (0, import_react44.useRef)(false);
11353
- const updateHighlightRef = (0, import_react44.useRef)(() => void 0);
11354
- const changeHandlerRef = (0, import_react44.useRef)(onChange);
11355
- const readyHandlerRef = (0, import_react44.useRef)(onReady);
11356
- const selectionHandlerRef = (0, import_react44.useRef)(onSelectionChange);
11357
- const keyDownHandlerRef = (0, import_react44.useRef)(onKeyDown);
11358
- const highlightRangeRef = (0, import_react44.useRef)(highlightRange);
11359
- const markersRef = (0, import_react44.useRef)(markers);
11360
- const contextMenuItemsRef = (0, import_react44.useRef)(contextMenuItems);
11361
- const completionProviderRef = (0, import_react44.useRef)(completionProvider);
11362
- const refreshSuggestionOnSpaceRef = (0, import_react44.useRef)(refreshSuggestionOnSpace);
11363
- const initialValueRef = (0, import_react44.useRef)(value);
11364
- const initialLanguageRef = (0, import_react44.useRef)(language);
11365
- const initialPathRef = (0, import_react44.useRef)(path);
11366
- const initialThemeRef = (0, import_react44.useRef)(theme);
11367
- const initialOptionsRef = (0, import_react44.useRef)(options);
11368
- const [loading, setLoading] = (0, import_react44.useState)(true);
11369
- const [, setSelectionVersion] = (0, import_react44.useState)(0);
11425
+ const generatedId = (0, import_react45.useId)();
11426
+ const containerRef = (0, import_react45.useRef)(null);
11427
+ const rangeHighlightRef = (0, import_react45.useRef)(null);
11428
+ const editorRef = (0, import_react45.useRef)(null);
11429
+ const modelRef = (0, import_react45.useRef)(null);
11430
+ const apiRef = (0, import_react45.useRef)(null);
11431
+ const applyingControlledValueRef = (0, import_react45.useRef)(false);
11432
+ const updateHighlightRef = (0, import_react45.useRef)(() => void 0);
11433
+ const changeHandlerRef = (0, import_react45.useRef)(onChange);
11434
+ const readyHandlerRef = (0, import_react45.useRef)(onReady);
11435
+ const selectionHandlerRef = (0, import_react45.useRef)(onSelectionChange);
11436
+ const keyDownHandlerRef = (0, import_react45.useRef)(onKeyDown);
11437
+ const highlightRangeRef = (0, import_react45.useRef)(highlightRange);
11438
+ const markersRef = (0, import_react45.useRef)(markers);
11439
+ const contextMenuItemsRef = (0, import_react45.useRef)(contextMenuItems);
11440
+ const completionProviderRef = (0, import_react45.useRef)(completionProvider);
11441
+ const refreshSuggestionOnSpaceRef = (0, import_react45.useRef)(refreshSuggestionOnSpace);
11442
+ const initialValueRef = (0, import_react45.useRef)(value);
11443
+ const initialLanguageRef = (0, import_react45.useRef)(language);
11444
+ const initialPathRef = (0, import_react45.useRef)(path);
11445
+ const initialThemeRef = (0, import_react45.useRef)(theme);
11446
+ const initialOptionsRef = (0, import_react45.useRef)(options);
11447
+ const [loading, setLoading] = (0, import_react45.useState)(true);
11448
+ const [, setSelectionVersion] = (0, import_react45.useState)(0);
11370
11449
  initialValueRef.current = value;
11371
11450
  initialLanguageRef.current = language;
11372
11451
  initialPathRef.current = path;
@@ -11381,7 +11460,7 @@ function Editor({
11381
11460
  contextMenuItemsRef.current = contextMenuItems;
11382
11461
  completionProviderRef.current = completionProvider;
11383
11462
  refreshSuggestionOnSpaceRef.current = refreshSuggestionOnSpace;
11384
- (0, import_react44.useEffect)(() => {
11463
+ (0, import_react45.useEffect)(() => {
11385
11464
  let disposed = false;
11386
11465
  const subscriptions = [];
11387
11466
  async function mountEditor() {
@@ -11725,7 +11804,7 @@ function Editor({
11725
11804
  updateHighlightRef.current = () => void 0;
11726
11805
  };
11727
11806
  }, [generatedId]);
11728
- (0, import_react44.useEffect)(() => {
11807
+ (0, import_react45.useEffect)(() => {
11729
11808
  const model = modelRef.current;
11730
11809
  if (!model || model.getValue() === value) return;
11731
11810
  applyingControlledValueRef.current = true;
@@ -11735,7 +11814,7 @@ function Editor({
11735
11814
  applyingControlledValueRef.current = false;
11736
11815
  }
11737
11816
  }, [loading, value]);
11738
- (0, import_react44.useEffect)(() => {
11817
+ (0, import_react45.useEffect)(() => {
11739
11818
  if (loading) return;
11740
11819
  void loadMonaco().then((monaco) => {
11741
11820
  const model = modelRef.current;
@@ -11744,7 +11823,7 @@ function Editor({
11744
11823
  }, [language, loading]);
11745
11824
  const completionEnabled = Boolean(completionProvider);
11746
11825
  const completionTriggerKey = completionTriggerCharacters.join("\0");
11747
- (0, import_react44.useEffect)(() => {
11826
+ (0, import_react45.useEffect)(() => {
11748
11827
  if (loading || !completionEnabled) return void 0;
11749
11828
  let disposed = false;
11750
11829
  let subscription;
@@ -11818,23 +11897,23 @@ function Editor({
11818
11897
  subscription?.dispose();
11819
11898
  };
11820
11899
  }, [completionEnabled, completionTriggerKey, language, loading]);
11821
- (0, import_react44.useEffect)(() => {
11900
+ (0, import_react45.useEffect)(() => {
11822
11901
  if (loading) return;
11823
11902
  void loadMonaco().then((monaco) => {
11824
11903
  if (editorRef.current) monaco.editor.setTheme(theme === "dark" ? "vs-dark" : "vs");
11825
11904
  });
11826
11905
  }, [loading, theme]);
11827
- (0, import_react44.useEffect)(() => {
11906
+ (0, import_react45.useEffect)(() => {
11828
11907
  if (loading) return;
11829
11908
  editorRef.current?.updateOptions({
11830
11909
  ...options ?? {},
11831
11910
  contextmenu: contextMenuItems.length === 0 ? options?.contextmenu ?? true : false
11832
11911
  });
11833
11912
  }, [contextMenuItems.length, loading, options]);
11834
- (0, import_react44.useEffect)(() => {
11913
+ (0, import_react45.useEffect)(() => {
11835
11914
  updateHighlightRef.current();
11836
11915
  }, [highlightRange]);
11837
- (0, import_react44.useEffect)(() => {
11916
+ (0, import_react45.useEffect)(() => {
11838
11917
  if (loading) return;
11839
11918
  void loadMonaco().then((monaco) => {
11840
11919
  const model = modelRef.current;
@@ -11902,19 +11981,19 @@ function Editor({
11902
11981
  }
11903
11982
 
11904
11983
  // src/components/Markdown.tsx
11905
- var import_react45 = require("react");
11984
+ var import_react46 = require("react");
11906
11985
  var import_dompurify2 = __toESM(require("dompurify"), 1);
11907
11986
  var import_marked = require("marked");
11908
11987
  var import_jsx_runtime46 = require("react/jsx-runtime");
11909
11988
  function Markdown2({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9", resolveImageSrc, imagePreview = true, className = "", onClick, onKeyDown, ...props }) {
11910
- const rootRef = (0, import_react45.useRef)(null);
11911
- const [previewImage, setPreviewImage] = (0, import_react45.useState)(null);
11912
- const html = (0, import_react45.useMemo)(() => {
11989
+ const rootRef = (0, import_react46.useRef)(null);
11990
+ const [previewImage, setPreviewImage] = (0, import_react46.useState)(null);
11991
+ const html = (0, import_react46.useMemo)(() => {
11913
11992
  const rendered = import_marked.marked.parse(content, { breaks: true, gfm: true });
11914
11993
  const sanitized = import_dompurify2.default.sanitize(rendered, { USE_PROFILES: { html: true } });
11915
11994
  return sanitized.replace(/<img\b/giu, '<img loading="lazy" decoding="async" referrerpolicy="no-referrer"');
11916
11995
  }, [content]);
11917
- (0, import_react45.useEffect)(() => {
11996
+ (0, import_react46.useEffect)(() => {
11918
11997
  const root = rootRef.current;
11919
11998
  if (!root) return void 0;
11920
11999
  let cancelled = false;
@@ -11982,13 +12061,13 @@ function Markdown2({ content, emptyText = "\u6682\u65E0 Markdown \u5185\u5BB9",
11982
12061
  }
11983
12062
 
11984
12063
  // src/components/InputNumber.tsx
11985
- var import_react46 = require("react");
12064
+ var import_react47 = require("react");
11986
12065
  var import_jsx_runtime47 = require("react/jsx-runtime");
11987
12066
  function formatValue(value, precision) {
11988
12067
  if (value === null || !Number.isFinite(value)) return "";
11989
12068
  return precision === void 0 ? String(value) : value.toFixed(precision);
11990
12069
  }
11991
- var InputNumber = (0, import_react46.forwardRef)(function InputNumber2({
12070
+ var InputNumber = (0, import_react47.forwardRef)(function InputNumber2({
11992
12071
  value,
11993
12072
  defaultValue = null,
11994
12073
  onChange,
@@ -12014,16 +12093,16 @@ var InputNumber = (0, import_react46.forwardRef)(function InputNumber2({
12014
12093
  ...props
12015
12094
  }, forwardedRef) {
12016
12095
  const size = useControlSize(sizeProp);
12017
- const fallbackId = (0, import_react46.useId)();
12096
+ const fallbackId = (0, import_react47.useId)();
12018
12097
  const inputId = id ?? fallbackId;
12019
- const localRef = (0, import_react46.useRef)(null);
12098
+ const localRef = (0, import_react47.useRef)(null);
12020
12099
  const [currentValue, setCurrentValue] = useControllableState({ value, defaultValue, onChange });
12021
12100
  const displayValue = (next) => {
12022
12101
  const plain = formatValue(next, precision);
12023
12102
  return plain && formatter ? formatter(plain) : plain;
12024
12103
  };
12025
- const [text, setText] = (0, import_react46.useState)(() => displayValue(currentValue));
12026
- (0, import_react46.useEffect)(() => {
12104
+ const [text, setText] = (0, import_react47.useState)(() => displayValue(currentValue));
12105
+ (0, import_react47.useEffect)(() => {
12027
12106
  setText(displayValue(currentValue));
12028
12107
  }, [currentValue, precision, formatter]);
12029
12108
  function setRef(node) {
@@ -12129,11 +12208,11 @@ var InputNumber = (0, import_react46.forwardRef)(function InputNumber2({
12129
12208
  });
12130
12209
 
12131
12210
  // src/components/SelectModal.tsx
12132
- var import_react47 = require("react");
12211
+ var import_react48 = require("react");
12133
12212
  var import_jsx_runtime48 = require("react/jsx-runtime");
12134
12213
  function SelectModalBody({ config, values, disabled, onChange }) {
12135
- const [query, setQuery] = (0, import_react47.useState)("");
12136
- const [selectedOnly, setSelectedOnly] = (0, import_react47.useState)(false);
12214
+ const [query, setQuery] = (0, import_react48.useState)("");
12215
+ const [selectedOnly, setSelectedOnly] = (0, import_react48.useState)(false);
12137
12216
  const multiple = config.mode === "multiple";
12138
12217
  const search = query.trim();
12139
12218
  const filtered = config.options.filter((option) => !search || (config.filterOption ? config.filterOption(search, option) : [option.label, option.value].some((text) => String(text ?? "").toLowerCase().includes(search.toLowerCase()))));
@@ -12307,9 +12386,9 @@ function Tag({
12307
12386
  }
12308
12387
 
12309
12388
  // src/components/Tabs.tsx
12310
- var import_react48 = require("react");
12311
- var import_jsx_runtime50 = require("react/jsx-runtime");
12312
12389
  var import_react49 = require("react");
12390
+ var import_jsx_runtime50 = require("react/jsx-runtime");
12391
+ var import_react50 = require("react");
12313
12392
  function Tabs({
12314
12393
  items,
12315
12394
  activeKey,
@@ -12334,22 +12413,22 @@ function Tabs({
12334
12413
  ...props
12335
12414
  }) {
12336
12415
  const firstEnabledKey = items.find((item) => !item.disabled)?.key ?? "";
12337
- const [internalActiveKey, setInternalActiveKey] = (0, import_react48.useState)(defaultActiveKey ?? firstEnabledKey);
12416
+ const [internalActiveKey, setInternalActiveKey] = (0, import_react49.useState)(defaultActiveKey ?? firstEnabledKey);
12338
12417
  const currentKey = activeKey ?? internalActiveKey;
12339
12418
  const selectedKey = items.some((item) => item.key === currentKey && !item.disabled) ? currentKey : firstEnabledKey;
12340
- const baseId = (0, import_react48.useId)().replace(/:/g, "");
12341
- const enabledItems = (0, import_react48.useMemo)(() => items.filter((item) => !item.disabled), [items]);
12419
+ const baseId = (0, import_react49.useId)().replace(/:/g, "");
12420
+ const enabledItems = (0, import_react49.useMemo)(() => items.filter((item) => !item.disabled), [items]);
12342
12421
  const resolvedPosition = tabPosition ?? (orientation === "vertical" ? "left" : "top");
12343
12422
  const resolvedOrientation = resolvedPosition === "left" || resolvedPosition === "right" ? "vertical" : "horizontal";
12344
12423
  const sliding = ["capsule", "line", "underline", "tech", "tech-line"].includes(type);
12345
- const listRef = (0, import_react48.useRef)(null);
12346
- const indicatorRef = (0, import_react48.useRef)(null);
12347
- const moreRef = (0, import_react48.useRef)(null);
12348
- const [overflow, setOverflow] = (0, import_react48.useState)({ count: items.length, width: 0 });
12349
- const [moreOpen, setMoreOpen] = (0, import_react48.useState)(false);
12424
+ const listRef = (0, import_react49.useRef)(null);
12425
+ const indicatorRef = (0, import_react49.useRef)(null);
12426
+ const moreRef = (0, import_react49.useRef)(null);
12427
+ const [overflow, setOverflow] = (0, import_react49.useState)({ count: items.length, width: 0 });
12428
+ const [moreOpen, setMoreOpen] = (0, import_react49.useState)(false);
12350
12429
  const visibleCount = resolvedOrientation === "horizontal" ? overflow.count : items.length;
12351
12430
  const hiddenItems = items.slice(visibleCount);
12352
- (0, import_react48.useLayoutEffect)(() => {
12431
+ (0, import_react49.useLayoutEffect)(() => {
12353
12432
  const list = listRef.current;
12354
12433
  if (!list || resolvedOrientation !== "horizontal") return;
12355
12434
  const entries = Array.from(list.children).filter((node) => node instanceof HTMLElement && node.hasAttribute("data-tab-entry"));
@@ -12380,13 +12459,13 @@ function Tabs({
12380
12459
  entries.forEach((entry) => observer.observe(entry));
12381
12460
  return () => observer.disconnect();
12382
12461
  }, [items, type, size, closable, resolvedOrientation, tabBarTitle, tabBarExtraContent]);
12383
- const [contentState, setContentState] = (0, import_react48.useState)(() => ({ key: selectedKey, visited: /* @__PURE__ */ new Set([selectedKey]) }));
12384
- const settledKeyRef = (0, import_react48.useRef)(selectedKey);
12385
- const afterChangeRef = (0, import_react48.useRef)(onAfterChange);
12386
- (0, import_react48.useLayoutEffect)(() => {
12462
+ const [contentState, setContentState] = (0, import_react49.useState)(() => ({ key: selectedKey, visited: /* @__PURE__ */ new Set([selectedKey]) }));
12463
+ const settledKeyRef = (0, import_react49.useRef)(selectedKey);
12464
+ const afterChangeRef = (0, import_react49.useRef)(onAfterChange);
12465
+ (0, import_react49.useLayoutEffect)(() => {
12387
12466
  afterChangeRef.current = onAfterChange;
12388
12467
  }, [onAfterChange]);
12389
- (0, import_react48.useLayoutEffect)(() => {
12468
+ (0, import_react49.useLayoutEffect)(() => {
12390
12469
  if (!sliding) return;
12391
12470
  const list = listRef.current;
12392
12471
  const indicator = indicatorRef.current;
@@ -12416,7 +12495,7 @@ function Tabs({
12416
12495
  list.querySelectorAll('[role="tab"]').forEach((tab) => observer.observe(tab));
12417
12496
  return () => observer.disconnect();
12418
12497
  }, [sliding, type, selectedKey, items, size, resolvedPosition, centered, closable, visibleCount]);
12419
- (0, import_react48.useEffect)(() => {
12498
+ (0, import_react49.useEffect)(() => {
12420
12499
  let cancelled = false;
12421
12500
  let frame = 0;
12422
12501
  frame = requestAnimationFrame(() => {
@@ -12483,7 +12562,7 @@ function Tabs({
12483
12562
  const canClose = item.closable ?? closable;
12484
12563
  const contextMenuItems = typeof tabContextMenu === "function" ? tabContextMenu(item) : tabContextMenu;
12485
12564
  const entryProps = { "data-tab-entry": "", "data-tab-hidden": index >= visibleCount, "aria-hidden": index >= visibleCount || void 0 };
12486
- const tabNode = /* @__PURE__ */ (0, import_react49.createElement)("span", { ...!contextMenuItems?.length ? entryProps : {}, className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, key: item.key }, /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
12565
+ const tabNode = /* @__PURE__ */ (0, import_react50.createElement)("span", { ...!contextMenuItems?.length ? entryProps : {}, className: `sia-tabs__tab-wrap${canClose ? " is-closable" : ""}`, key: item.key }, /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
12487
12566
  "button",
12488
12567
  {
12489
12568
  id: `${baseId}-tab-${item.key}`,
@@ -12514,7 +12593,7 @@ function Tabs({
12514
12593
  }
12515
12594
  ) : null);
12516
12595
  if (!contextMenuItems?.length) return tabNode;
12517
- return /* @__PURE__ */ (0, import_react49.createElement)(
12596
+ return /* @__PURE__ */ (0, import_react50.createElement)(
12518
12597
  Dropdown,
12519
12598
  {
12520
12599
  ...entryProps,
@@ -12577,9 +12656,9 @@ function Tabs({
12577
12656
  }
12578
12657
 
12579
12658
  // src/components/Treemap.tsx
12580
- var import_react50 = require("react");
12581
- var import_jsx_runtime51 = require("react/jsx-runtime");
12582
12659
  var import_react51 = require("react");
12660
+ var import_jsx_runtime51 = require("react/jsx-runtime");
12661
+ var import_react52 = require("react");
12583
12662
  function positiveValue(value) {
12584
12663
  return Number.isFinite(value) && value > 0 ? value : 1;
12585
12664
  }
@@ -12950,19 +13029,19 @@ function Treemap({
12950
13029
  style,
12951
13030
  ...props
12952
13031
  }) {
12953
- const containerRef = (0, import_react50.useRef)(null);
12954
- const [size, setSize] = (0, import_react50.useState)({ width: 0, height: 0 });
12955
- const [internalExpandedKeys, setInternalExpandedKeys] = (0, import_react50.useState)(() => [...defaultExpandedKeys]);
12956
- const [internalFocusedKey, setInternalFocusedKey] = (0, import_react50.useState)(defaultFocusedKey);
13032
+ const containerRef = (0, import_react51.useRef)(null);
13033
+ const [size, setSize] = (0, import_react51.useState)({ width: 0, height: 0 });
13034
+ const [internalExpandedKeys, setInternalExpandedKeys] = (0, import_react51.useState)(() => [...defaultExpandedKeys]);
13035
+ const [internalFocusedKey, setInternalFocusedKey] = (0, import_react51.useState)(defaultFocusedKey);
12957
13036
  const currentExpandedKeys = expandedKeys ?? internalExpandedKeys;
12958
13037
  const currentFocusedKey = focusedKey === void 0 ? internalFocusedKey : focusedKey;
12959
- const expandedSet = (0, import_react50.useMemo)(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
12960
- const focusedNode = (0, import_react50.useMemo)(
13038
+ const expandedSet = (0, import_react51.useMemo)(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
13039
+ const focusedNode = (0, import_react51.useMemo)(
12961
13040
  () => currentFocusedKey ? findNode(data, currentFocusedKey) : null,
12962
13041
  [currentFocusedKey, data]
12963
13042
  );
12964
13043
  const effectiveFocusedNode = focusedNode && expandedSet.has(focusedNode.key) && Boolean(focusedNode.children?.length) ? focusedNode : null;
12965
- const positions = (0, import_react50.useMemo)(
13044
+ const positions = (0, import_react51.useMemo)(
12966
13045
  () => collectPositions(
12967
13046
  effectiveFocusedNode ? [effectiveFocusedNode] : data,
12968
13047
  { x: 0, y: 0, ...size },
@@ -12978,7 +13057,7 @@ function Treemap({
12978
13057
  ),
12979
13058
  [activeKey, aggregateOverflow, data, effectiveFocusedNode, expandedSet, gap, headerHeight, maxVisibleNodes, minTileHeight, minTileWidth, overflowLabel, size]
12980
13059
  );
12981
- (0, import_react50.useEffect)(() => {
13060
+ (0, import_react51.useEffect)(() => {
12982
13061
  const element = containerRef.current;
12983
13062
  if (!element) return void 0;
12984
13063
  const updateSize = () => {
@@ -12990,7 +13069,7 @@ function Treemap({
12990
13069
  observer.observe(element);
12991
13070
  return () => observer.disconnect();
12992
13071
  }, []);
12993
- (0, import_react50.useEffect)(() => {
13072
+ (0, import_react51.useEffect)(() => {
12994
13073
  if (!currentFocusedKey || effectiveFocusedNode) return;
12995
13074
  if (focusedKey === void 0) setInternalFocusedKey(null);
12996
13075
  onFocusedChange?.(null);
@@ -13038,7 +13117,7 @@ function Treemap({
13038
13117
  const hasChildren = Boolean(node.hasChildren || node.children?.length);
13039
13118
  const title = `${node.label} \xB7 ${String(valueFormatter(node.value, node))}`;
13040
13119
  if (expanded) {
13041
- return /* @__PURE__ */ (0, import_react51.createElement)(
13120
+ return /* @__PURE__ */ (0, import_react52.createElement)(
13042
13121
  "div",
13043
13122
  {
13044
13123
  className: `sia-treemap__tile sia-treemap__tile--directory is-expanded${effectiveFocusedNode?.key === node.key ? " is-focused" : ""}${active ? " is-active" : ""}`,
@@ -13077,7 +13156,7 @@ function Treemap({
13077
13156
  ] })
13078
13157
  );
13079
13158
  }
13080
- return /* @__PURE__ */ (0, import_react51.createElement)(
13159
+ return /* @__PURE__ */ (0, import_react52.createElement)(
13081
13160
  "button",
13082
13161
  {
13083
13162
  type: "button",
@@ -13103,7 +13182,7 @@ function Treemap({
13103
13182
  }
13104
13183
 
13105
13184
  // src/components/Table/TableCellContent.tsx
13106
- var import_react52 = require("react");
13185
+ var import_react53 = require("react");
13107
13186
  var import_jsx_runtime52 = require("react/jsx-runtime");
13108
13187
  var pendingLayouts = /* @__PURE__ */ new Map();
13109
13188
  var layoutFrame;
@@ -13122,10 +13201,10 @@ function scheduleLayout(element, task) {
13122
13201
  });
13123
13202
  }
13124
13203
  function TableCellContent({ children, ellipsis, title }) {
13125
- const ref = (0, import_react52.useRef)(null);
13126
- const [overflowing, setOverflowing] = (0, import_react52.useState)(false);
13204
+ const ref = (0, import_react53.useRef)(null);
13205
+ const [overflowing, setOverflowing] = (0, import_react53.useState)(false);
13127
13206
  const customContent = typeof children !== "string" && typeof children !== "number" && children != null;
13128
- (0, import_react52.useLayoutEffect)(() => {
13207
+ (0, import_react53.useLayoutEffect)(() => {
13129
13208
  const element = ref.current;
13130
13209
  if (!element || !ellipsis || !customContent) return;
13131
13210
  const normalizeLayouts = (parent, layouts) => {
@@ -13161,14 +13240,14 @@ function TableCellContent({ children, ellipsis, title }) {
13161
13240
  }
13162
13241
 
13163
13242
  // src/components/Table/useRemainingHeight.ts
13164
- var import_react53 = require("react");
13243
+ var import_react54 = require("react");
13165
13244
  function useRemainingHeight(rootRef, options) {
13166
- const [height, setHeight] = (0, import_react53.useState)();
13245
+ const [height, setHeight] = (0, import_react54.useState)();
13167
13246
  const enabled = !!options;
13168
13247
  const container = typeof options === "object" ? options.container : void 0;
13169
13248
  const bottomOffset = typeof options === "object" ? options.bottomOffset ?? 0 : 0;
13170
13249
  const minHeight = typeof options === "object" ? options.minHeight ?? 0 : 0;
13171
- (0, import_react53.useLayoutEffect)(() => {
13250
+ (0, import_react54.useLayoutEffect)(() => {
13172
13251
  const root = rootRef.current;
13173
13252
  if (!enabled || !root) return;
13174
13253
  const win = root.ownerDocument.defaultView;
@@ -13239,7 +13318,7 @@ function useRemainingHeight(rootRef, options) {
13239
13318
  }
13240
13319
 
13241
13320
  // src/components/Table/TableCanvasLayer.tsx
13242
- var import_react54 = require("react");
13321
+ var import_react55 = require("react");
13243
13322
 
13244
13323
  // src/components/Table/utils.ts
13245
13324
  var AUTO_WIDTH_COLUMN_KEYS = /* @__PURE__ */ new Set(["action", "actions", "operation", "operations"]);
@@ -13294,8 +13373,8 @@ function toTablePageParams(current, pageSize) {
13294
13373
  // src/components/Table/TableCanvasLayer.tsx
13295
13374
  var import_jsx_runtime53 = require("react/jsx-runtime");
13296
13375
  function TableCanvasLayer({ viewport, rows, columns, widths, rowHeight, headerHeight }) {
13297
- const canvasRef = (0, import_react54.useRef)(null);
13298
- (0, import_react54.useLayoutEffect)(() => {
13376
+ const canvasRef = (0, import_react55.useRef)(null);
13377
+ (0, import_react55.useLayoutEffect)(() => {
13299
13378
  const canvas = canvasRef.current;
13300
13379
  const scroller = viewport.current;
13301
13380
  if (!canvas || !scroller) return;
@@ -13438,10 +13517,10 @@ function createRowIdentity() {
13438
13517
  }
13439
13518
 
13440
13519
  // src/components/Table/Table.tsx
13441
- var import_react56 = require("react");
13520
+ var import_react57 = require("react");
13442
13521
 
13443
13522
  // src/components/Table/plugins.tsx
13444
- var import_react55 = require("react");
13523
+ var import_react56 = require("react");
13445
13524
 
13446
13525
  // src/components/Table/columnSettings.ts
13447
13526
  function reconcileColumnSettings(columns, defaults, saved) {
@@ -14154,7 +14233,7 @@ function TableSelectedItemsPanel({
14154
14233
  onRemove,
14155
14234
  onClear
14156
14235
  }) {
14157
- const [showAll, setShowAll] = (0, import_react55.useState)(false);
14236
+ const [showAll, setShowAll] = (0, import_react56.useState)(false);
14158
14237
  const visibleEntries = showAll ? entries : entries.slice(0, maxCount2);
14159
14238
  const hiddenCount = Math.max(0, entries.length - visibleEntries.length);
14160
14239
  const baseColumnMap = new Map(
@@ -14560,10 +14639,10 @@ function TableFilterControl({
14560
14639
  placeholder,
14561
14640
  onApply
14562
14641
  }) {
14563
- const [open, setOpen] = (0, import_react55.useState)(false);
14564
- const [draft, setDraft] = (0, import_react55.useState)(value);
14642
+ const [open, setOpen] = (0, import_react56.useState)(false);
14643
+ const [draft, setDraft] = (0, import_react56.useState)(value);
14565
14644
  const label = getColumnLabel(column);
14566
- (0, import_react55.useEffect)(() => {
14645
+ (0, import_react56.useEffect)(() => {
14567
14646
  if (open) setDraft(value);
14568
14647
  }, [open, value]);
14569
14648
  const apply = (nextValue) => {
@@ -15001,17 +15080,17 @@ function EditableTableCell({
15001
15080
  trigger
15002
15081
  }) {
15003
15082
  const config = typeof editable === "object" ? editable : { type: "input" };
15004
- const [editValue, setEditValue] = (0, import_react55.useState)(value);
15005
- const [saving, setSaving] = (0, import_react55.useState)(false);
15006
- const inputRef = (0, import_react55.useRef)(null);
15007
- const editorRef = (0, import_react55.useRef)(null);
15008
- const editValueRef = (0, import_react55.useRef)(value);
15009
- const savingRef = (0, import_react55.useRef)(false);
15010
- const saveRef = (0, import_react55.useRef)(
15083
+ const [editValue, setEditValue] = (0, import_react56.useState)(value);
15084
+ const [saving, setSaving] = (0, import_react56.useState)(false);
15085
+ const inputRef = (0, import_react56.useRef)(null);
15086
+ const editorRef = (0, import_react56.useRef)(null);
15087
+ const editValueRef = (0, import_react56.useRef)(value);
15088
+ const savingRef = (0, import_react56.useRef)(false);
15089
+ const saveRef = (0, import_react56.useRef)(
15011
15090
  async () => {
15012
15091
  }
15013
15092
  );
15014
- (0, import_react55.useEffect)(() => {
15093
+ (0, import_react56.useEffect)(() => {
15015
15094
  if (!active) return;
15016
15095
  editValueRef.current = value;
15017
15096
  setEditValue(value);
@@ -15042,7 +15121,7 @@ function EditableTableCell({
15042
15121
  }
15043
15122
  }
15044
15123
  saveRef.current = save;
15045
- (0, import_react55.useEffect)(() => {
15124
+ (0, import_react56.useEffect)(() => {
15046
15125
  if (!active || config.type === "select" || config.type === "custom") return;
15047
15126
  const handleOutsidePointerDown = (event) => {
15048
15127
  const target = event.target;
@@ -15347,15 +15426,15 @@ function ColumnSettingPanel({
15347
15426
  onClose,
15348
15427
  onApply
15349
15428
  }) {
15350
- const [draft, setDraft] = (0, import_react55.useState)(items);
15351
- const listRef = (0, import_react55.useRef)(null);
15352
- const cancelDrag = (0, import_react55.useRef)(null);
15353
- const [preview, setPreview] = (0, import_react55.useState)(null);
15354
- (0, import_react55.useEffect)(() => {
15429
+ const [draft, setDraft] = (0, import_react56.useState)(items);
15430
+ const listRef = (0, import_react56.useRef)(null);
15431
+ const cancelDrag = (0, import_react56.useRef)(null);
15432
+ const [preview, setPreview] = (0, import_react56.useState)(null);
15433
+ (0, import_react56.useEffect)(() => {
15355
15434
  cancelDrag.current?.();
15356
15435
  if (open) setDraft(orderColumnSettings(items));
15357
15436
  }, [items, open]);
15358
- (0, import_react55.useEffect)(() => () => cancelDrag.current?.(), []);
15437
+ (0, import_react56.useEffect)(() => () => cancelDrag.current?.(), []);
15359
15438
  const labels = new Map(
15360
15439
  flattenTableColumns(columns).map((column) => [
15361
15440
  column.key,
@@ -15882,7 +15961,7 @@ function tableExportText(node) {
15882
15961
  if (typeof node === "string" || typeof node === "number" || typeof node === "bigint")
15883
15962
  return String(node);
15884
15963
  if (Array.isArray(node)) return node.map(tableExportText).join("");
15885
- if ((0, import_react55.isValidElement)(node))
15964
+ if ((0, import_react56.isValidElement)(node))
15886
15965
  return tableExportText(node.props.children);
15887
15966
  return "";
15888
15967
  }
@@ -15981,7 +16060,7 @@ var SIZE_ROW_HEIGHT = { small: 28, medium: 36, large: 46 };
15981
16060
  function getHeaderTitleText(content) {
15982
16061
  if (typeof content === "string" || typeof content === "number") return String(content);
15983
16062
  if (Array.isArray(content)) return content.map(getHeaderTitleText).join("");
15984
- if ((0, import_react56.isValidElement)(content)) return getHeaderTitleText(content.props.children);
16063
+ if ((0, import_react57.isValidElement)(content)) return getHeaderTitleText(content.props.children);
15985
16064
  return "";
15986
16065
  }
15987
16066
  function getColumnDepth(columns) {
@@ -16061,7 +16140,7 @@ function getTableHorizontalMetrics(viewport, table) {
16061
16140
  const contentWidth = Math.max(viewport.clientWidth, table?.getBoundingClientRect().width ?? viewport.clientWidth);
16062
16141
  return { contentWidth, maxLeft: Math.max(0, contentWidth - viewport.clientWidth) };
16063
16142
  }
16064
- var TableBodyRow = (0, import_react56.memo)(function TableBodyRow2({
16143
+ var TableBodyRow = (0, import_react57.memo)(function TableBodyRow2({
16065
16144
  canvas,
16066
16145
  visibleColumns,
16067
16146
  row,
@@ -16178,25 +16257,25 @@ function TableInner(props, ref) {
16178
16257
  style,
16179
16258
  ...htmlProps
16180
16259
  } = props;
16181
- const rootRef = (0, import_react56.useRef)(null);
16260
+ const rootRef = (0, import_react57.useRef)(null);
16182
16261
  const remainingHeight = useRemainingHeight(rootRef, height == null && tableHeight == null ? fillRemaining : false);
16183
- const scrollRef = (0, import_react56.useRef)(null);
16184
- const tableRef = (0, import_react56.useRef)(null);
16262
+ const scrollRef = (0, import_react57.useRef)(null);
16263
+ const tableRef = (0, import_react57.useRef)(null);
16185
16264
  useScrollbarProximity();
16186
- const scrollbarDragRef = (0, import_react56.useRef)(null);
16187
- const [internalLoading, setInternalLoading] = (0, import_react56.useState)(false);
16188
- const [scrollTop, setScrollTop] = (0, import_react56.useState)(0);
16189
- const [scrollLeft, setScrollLeft] = (0, import_react56.useState)(0);
16190
- const [viewportHeight, setViewportHeight] = (0, import_react56.useState)(420);
16191
- const [viewportWidth, setViewportWidth] = (0, import_react56.useState)(0);
16192
- const [autoColumnWidths, setAutoColumnWidths] = (0, import_react56.useState)({});
16193
- const [resolveRowIdentity] = (0, import_react56.useState)(createRowIdentity);
16194
- const getRowKey = (0, import_react56.useCallback)((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
16195
- const builtInResizePlugin = (0, import_react56.useMemo)(() => createResizePlugin(), []);
16196
- const builtInHighlightPlugin = (0, import_react56.useMemo)(() => createHighlightPlugin(), []);
16197
- const builtInCellSelectionPlugin = (0, import_react56.useMemo)(() => createCellSelectionPlugin(), []);
16198
- const builtInIndexPlugin = (0, import_react56.useMemo)(() => createIndexPlugin(), []);
16199
- const activePlugins = (0, import_react56.useMemo)(() => {
16265
+ const scrollbarDragRef = (0, import_react57.useRef)(null);
16266
+ const [internalLoading, setInternalLoading] = (0, import_react57.useState)(false);
16267
+ const [scrollTop, setScrollTop] = (0, import_react57.useState)(0);
16268
+ const [scrollLeft, setScrollLeft] = (0, import_react57.useState)(0);
16269
+ const [viewportHeight, setViewportHeight] = (0, import_react57.useState)(420);
16270
+ const [viewportWidth, setViewportWidth] = (0, import_react57.useState)(0);
16271
+ const [autoColumnWidths, setAutoColumnWidths] = (0, import_react57.useState)({});
16272
+ const [resolveRowIdentity] = (0, import_react57.useState)(createRowIdentity);
16273
+ const getRowKey = (0, import_react57.useCallback)((record, index) => resolveRowIdentity(record, index, typeof rowKey === "function" ? rowKey : rowKey == null ? void 0 : String(rowKey)), [rowKey, resolveRowIdentity]);
16274
+ const builtInResizePlugin = (0, import_react57.useMemo)(() => createResizePlugin(), []);
16275
+ const builtInHighlightPlugin = (0, import_react57.useMemo)(() => createHighlightPlugin(), []);
16276
+ const builtInCellSelectionPlugin = (0, import_react57.useMemo)(() => createCellSelectionPlugin(), []);
16277
+ const builtInIndexPlugin = (0, import_react57.useMemo)(() => createIndexPlugin(), []);
16278
+ const activePlugins = (0, import_react57.useMemo)(() => {
16200
16279
  const plugins = providedPlugins.filter((plugin) => (resizable || plugin.id !== "resize") && (cellSelection || plugin.id !== "cellSelection") && (showIndex || plugin.id !== "index"));
16201
16280
  if (!plugins.some((plugin) => plugin.id === "highlight")) plugins.push(builtInHighlightPlugin);
16202
16281
  if (resizable && !plugins.some((plugin) => plugin.id === "resize")) plugins.push(builtInResizePlugin);
@@ -16204,19 +16283,19 @@ function TableInner(props, ref) {
16204
16283
  if (showIndex && !plugins.some((plugin) => plugin.id === "index")) plugins.push(builtInIndexPlugin);
16205
16284
  return plugins;
16206
16285
  }, [builtInHighlightPlugin, builtInResizePlugin, builtInCellSelectionPlugin, builtInIndexPlugin, providedPlugins, resizable, cellSelection, showIndex]);
16207
- const sortedPlugins = (0, import_react56.useMemo)(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
16208
- const pluginsByIdRef = (0, import_react56.useRef)(/* @__PURE__ */ new Map());
16286
+ const sortedPlugins = (0, import_react57.useMemo)(() => [...activePlugins].sort((a, b) => (a.order ?? 100) - (b.order ?? 100)), [activePlugins]);
16287
+ const pluginsByIdRef = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
16209
16288
  pluginsByIdRef.current = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
16210
- const [pluginStates, setPluginStates] = (0, import_react56.useState)(() => Object.fromEntries(
16289
+ const [pluginStates, setPluginStates] = (0, import_react57.useState)(() => Object.fromEntries(
16211
16290
  sortedPlugins.map((plugin) => [plugin.id, resolveInitialState(plugin)])
16212
16291
  ));
16213
- const pluginApisRef = (0, import_react56.useRef)({});
16214
- const contextsRef = (0, import_react56.useRef)(/* @__PURE__ */ new Map());
16215
- const mountedPluginsRef = (0, import_react56.useRef)(/* @__PURE__ */ new Map());
16292
+ const pluginApisRef = (0, import_react57.useRef)({});
16293
+ const contextsRef = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
16294
+ const mountedPluginsRef = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
16216
16295
  const pipeline = { columns: baseColumns, rows: createTableRows(dataSource, getRowKey) };
16217
16296
  const nextApis = {};
16218
16297
  const contexts = /* @__PURE__ */ new Map();
16219
- const setPluginState = (0, import_react56.useCallback)((pluginId, next) => {
16298
+ const setPluginState = (0, import_react57.useCallback)((pluginId, next) => {
16220
16299
  setPluginStates((previous) => {
16221
16300
  const plugin = pluginsByIdRef.current.get(pluginId);
16222
16301
  const previousValue = previous[pluginId] !== void 0 ? previous[pluginId] : plugin ? resolveInitialState(plugin) : void 0;
@@ -16269,7 +16348,7 @@ function TableInner(props, ref) {
16269
16348
  });
16270
16349
  pluginApisRef.current = nextApis;
16271
16350
  contextsRef.current = contexts;
16272
- (0, import_react56.useEffect)(() => {
16351
+ (0, import_react57.useEffect)(() => {
16273
16352
  const activePlugins2 = new Map(sortedPlugins.map((plugin) => [plugin.id, plugin]));
16274
16353
  for (const [pluginId, mounted] of mountedPluginsRef.current) {
16275
16354
  if (activePlugins2.get(pluginId) === mounted.plugin) continue;
@@ -16281,11 +16360,11 @@ function TableInner(props, ref) {
16281
16360
  mountedPluginsRef.current.set(plugin.id, { plugin, cleanup: plugin.onMount(contextsRef.current.get(plugin.id)) });
16282
16361
  }
16283
16362
  }, [sortedPlugins]);
16284
- (0, import_react56.useEffect)(() => () => {
16363
+ (0, import_react57.useEffect)(() => () => {
16285
16364
  for (const mounted of mountedPluginsRef.current.values()) mounted.cleanup?.();
16286
16365
  mountedPluginsRef.current.clear();
16287
16366
  }, []);
16288
- const updateScrollMetrics = (0, import_react56.useCallback)(() => {
16367
+ const updateScrollMetrics = (0, import_react57.useCallback)(() => {
16289
16368
  const root = rootRef.current;
16290
16369
  const element = scrollRef.current;
16291
16370
  if (!root || !element) return;
@@ -16325,7 +16404,7 @@ function TableInner(props, ref) {
16325
16404
  verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-size", `${verticalThumb}px`);
16326
16405
  verticalTrackElement?.style.setProperty("--sia-table-scrollbar-y-position", `${verticalPosition}px`);
16327
16406
  }, []);
16328
- (0, import_react56.useEffect)(() => {
16407
+ (0, import_react57.useEffect)(() => {
16329
16408
  const element = scrollRef.current;
16330
16409
  if (!element || typeof ResizeObserver === "undefined") return;
16331
16410
  const observer = new ResizeObserver(() => {
@@ -16338,19 +16417,19 @@ function TableInner(props, ref) {
16338
16417
  updateScrollMetrics();
16339
16418
  return () => observer.disconnect();
16340
16419
  }, [updateScrollMetrics]);
16341
- (0, import_react56.useEffect)(() => {
16420
+ (0, import_react57.useEffect)(() => {
16342
16421
  updateScrollMetrics();
16343
16422
  });
16344
- const orderedColumns = (0, import_react56.useMemo)(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
16345
- const leafColumns = (0, import_react56.useMemo)(() => flattenTableColumns(orderedColumns), [orderedColumns]);
16346
- const headerRows = (0, import_react56.useMemo)(() => buildHeaderRows(orderedColumns), [orderedColumns]);
16347
- const measuredCells = (0, import_react56.useRef)(/* @__PURE__ */ new WeakSet());
16423
+ const orderedColumns = (0, import_react57.useMemo)(() => sortTableColumnsByFixed(pipeline.columns), [pipeline.columns]);
16424
+ const leafColumns = (0, import_react57.useMemo)(() => flattenTableColumns(orderedColumns), [orderedColumns]);
16425
+ const headerRows = (0, import_react57.useMemo)(() => buildHeaderRows(orderedColumns), [orderedColumns]);
16426
+ const measuredCells = (0, import_react57.useRef)(/* @__PURE__ */ new WeakSet());
16348
16427
  const autoWidthSignature = leafColumns.map((column) => `${column.key}:${column.autoWidth}:${resizedWidths[column.key] ?? ""}`).join("|");
16349
- (0, import_react56.useEffect)(() => {
16428
+ (0, import_react57.useEffect)(() => {
16350
16429
  measuredCells.current = /* @__PURE__ */ new WeakSet();
16351
16430
  setAutoColumnWidths({});
16352
16431
  }, [dataSource, baseColumns, size, autoWidthSignature]);
16353
- (0, import_react56.useEffect)(() => {
16432
+ (0, import_react57.useEffect)(() => {
16354
16433
  const autoWidthColumns = leafColumns.filter((column) => column.autoWidth && resizedWidths[column.key] === void 0);
16355
16434
  const root = rootRef.current;
16356
16435
  if (!root || autoWidthColumns.length === 0) return;
@@ -16434,7 +16513,7 @@ function TableInner(props, ref) {
16434
16513
  }
16435
16514
  const topSpacer = shouldVirtualize ? startIndex * rowHeight : 0;
16436
16515
  const bottomSpacer = shouldVirtualize ? Math.max(0, (pipeline.rows.length - endIndex) * rowHeight) : 0;
16437
- const rowElements = (0, import_react56.useMemo)(() => /* @__PURE__ */ new Map(), [
16516
+ const rowElements = (0, import_react57.useMemo)(() => /* @__PURE__ */ new Map(), [
16438
16517
  dataSource,
16439
16518
  baseColumns,
16440
16519
  sortedPlugins,
@@ -16454,20 +16533,20 @@ function TableInner(props, ref) {
16454
16533
  ]);
16455
16534
  const toolbarStart = sortedPlugins.map((plugin) => {
16456
16535
  const content = plugin.renderToolbarStart?.(getContext(plugin));
16457
- return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react56.Fragment, { children: content }, `toolbar-start-${plugin.id}`) : null;
16536
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `toolbar-start-${plugin.id}`) : null;
16458
16537
  }).filter(Boolean);
16459
16538
  const toolbarEnd = sortedPlugins.map((plugin) => {
16460
16539
  const content = plugin.renderToolbarEnd?.(getContext(plugin));
16461
- return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react56.Fragment, { children: content }, `toolbar-end-${plugin.id}`) : null;
16540
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `toolbar-end-${plugin.id}`) : null;
16462
16541
  }).filter(Boolean);
16463
16542
  const summaries = sortedPlugins.flatMap((plugin) => plugin.renderSummary?.(getContext(plugin)) ?? []);
16464
16543
  const footers = sortedPlugins.map((plugin) => {
16465
16544
  const content = plugin.renderFooter?.(getContext(plugin));
16466
- return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react56.Fragment, { children: content }, `footer-${plugin.id}`) : null;
16545
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `footer-${plugin.id}`) : null;
16467
16546
  }).filter(Boolean);
16468
16547
  const overlays = sortedPlugins.map((plugin) => {
16469
16548
  const content = plugin.renderOverlay?.(getContext(plugin));
16470
- return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react56.Fragment, { children: content }, `overlay-${plugin.id}`) : null;
16549
+ return content ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_react57.Fragment, { children: content }, `overlay-${plugin.id}`) : null;
16471
16550
  }).filter(Boolean);
16472
16551
  const hasToolbar = toolbarStart.length > 0 || toolbarEnd.length > 0;
16473
16552
  const effectiveHeight = height ?? tableHeight ?? remainingHeight ?? (shouldVirtualize ? 420 : void 0);
@@ -16478,13 +16557,13 @@ function TableInner(props, ref) {
16478
16557
  // 空态占位只覆盖内容区,必须给仍有业务意义的合计行留出空间。
16479
16558
  "--sia-table-summary-height": `${summaries.length * rowHeight}px`
16480
16559
  };
16481
- const handleScroll = (0, import_react56.useCallback)((event) => {
16560
+ const handleScroll = (0, import_react57.useCallback)((event) => {
16482
16561
  const element = event.currentTarget;
16483
16562
  if (shouldVirtualize) setScrollTop((previous) => Math.floor(previous / rowHeight) === Math.floor(element.scrollTop / rowHeight) ? previous : element.scrollTop);
16484
16563
  if (canvas) setScrollLeft(element.scrollLeft);
16485
16564
  updateScrollMetrics();
16486
16565
  }, [canvas, shouldVirtualize, rowHeight, updateScrollMetrics]);
16487
- const handleScrollbarPointerDown = (0, import_react56.useCallback)((axis, event, track = event.currentTarget) => {
16566
+ const handleScrollbarPointerDown = (0, import_react57.useCallback)((axis, event, track = event.currentTarget) => {
16488
16567
  const element = scrollRef.current;
16489
16568
  const thumb = track.firstElementChild;
16490
16569
  if (!element || !thumb || event.button !== 0) return;
@@ -16513,7 +16592,7 @@ function TableInner(props, ref) {
16513
16592
  };
16514
16593
  if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "true";
16515
16594
  }, []);
16516
- const handleScrollbarPointerMove = (0, import_react56.useCallback)((event) => {
16595
+ const handleScrollbarPointerMove = (0, import_react57.useCallback)((event) => {
16517
16596
  const drag = scrollbarDragRef.current;
16518
16597
  const element = scrollRef.current;
16519
16598
  if (!drag || !element || drag.pointerId !== event.pointerId) return;
@@ -16522,12 +16601,12 @@ function TableInner(props, ref) {
16522
16601
  if (drag.axis === "x") element.scrollLeft = nextScroll;
16523
16602
  else element.scrollTop = nextScroll;
16524
16603
  }, []);
16525
- const handleScrollbarPointerEnd = (0, import_react56.useCallback)((event) => {
16604
+ const handleScrollbarPointerEnd = (0, import_react57.useCallback)((event) => {
16526
16605
  if (scrollbarDragRef.current?.pointerId !== event.pointerId) return;
16527
16606
  scrollbarDragRef.current = null;
16528
16607
  if (rootRef.current) rootRef.current.dataset.scrollbarDragging = "false";
16529
16608
  }, []);
16530
- (0, import_react56.useImperativeHandle)(ref, () => ({
16609
+ (0, import_react57.useImperativeHandle)(ref, () => ({
16531
16610
  getRows: () => pipeline.rows.map((row) => row.record),
16532
16611
  getColumns: () => pipeline.columns,
16533
16612
  getPluginApi: (pluginId) => pluginApisRef.current[pluginId],
@@ -16809,12 +16888,12 @@ function TableInner(props, ref) {
16809
16888
  }
16810
16889
  );
16811
16890
  }
16812
- var Table2 = (0, import_react56.forwardRef)(TableInner);
16891
+ var Table2 = (0, import_react57.forwardRef)(TableInner);
16813
16892
 
16814
16893
  // src/components/ThemeSwitch.tsx
16815
- var import_react57 = require("react");
16894
+ var import_react58 = require("react");
16816
16895
  var import_jsx_runtime56 = require("react/jsx-runtime");
16817
- var ThemeSwitch = (0, import_react57.forwardRef)(function ThemeSwitch2({
16896
+ var ThemeSwitch = (0, import_react58.forwardRef)(function ThemeSwitch2({
16818
16897
  checked,
16819
16898
  onCheckedChange,
16820
16899
  lightLabel = "\u4EAE\u8272\u6A21\u5F0F",
@@ -16908,7 +16987,7 @@ function Breadcrumb({ items, separator = "/", itemRender, className = "", ...pro
16908
16987
  }
16909
16988
 
16910
16989
  // src/components/Typography.tsx
16911
- var import_react58 = require("react");
16990
+ var import_react59 = require("react");
16912
16991
  var import_jsx_runtime58 = require("react/jsx-runtime");
16913
16992
  function TypographyContent({
16914
16993
  as: Tag2 = "span",
@@ -16928,26 +17007,26 @@ function TypographyContent({
16928
17007
  className = "",
16929
17008
  ...props
16930
17009
  }) {
16931
- const contentRef = (0, import_react58.useRef)(null);
16932
- const editRef = (0, import_react58.useRef)(null);
16933
- const timer = (0, import_react58.useRef)();
16934
- const [localText, setLocalText] = (0, import_react58.useState)();
16935
- const [draft, setDraft] = (0, import_react58.useState)("");
16936
- const [editing, setEditing] = (0, import_react58.useState)(false);
16937
- const [copied, setCopied] = (0, import_react58.useState)(false);
16938
- const [copyError, setCopyError] = (0, import_react58.useState)(false);
16939
- const [expanded, setExpanded] = (0, import_react58.useState)(false);
16940
- const [overflow, setOverflow] = (0, import_react58.useState)(false);
17010
+ const contentRef = (0, import_react59.useRef)(null);
17011
+ const editRef = (0, import_react59.useRef)(null);
17012
+ const timer = (0, import_react59.useRef)();
17013
+ const [localText, setLocalText] = (0, import_react59.useState)();
17014
+ const [draft, setDraft] = (0, import_react59.useState)("");
17015
+ const [editing, setEditing] = (0, import_react59.useState)(false);
17016
+ const [copied, setCopied] = (0, import_react59.useState)(false);
17017
+ const [copyError, setCopyError] = (0, import_react59.useState)(false);
17018
+ const [expanded, setExpanded] = (0, import_react59.useState)(false);
17019
+ const [overflow, setOverflow] = (0, import_react59.useState)(false);
16941
17020
  const editConfig = typeof editable === "object" ? editable : void 0;
16942
17021
  const content = editConfig?.text ?? localText ?? children;
16943
17022
  const requestedRows = typeof ellipsis === "object" ? ellipsis.rows ?? 1 : 1;
16944
17023
  const rows = Number.isFinite(requestedRows) ? Math.max(1, Math.floor(requestedRows)) : 1;
16945
17024
  const expandable = typeof ellipsis === "object" && ellipsis.expandable;
16946
- (0, import_react58.useEffect)(() => {
17025
+ (0, import_react59.useEffect)(() => {
16947
17026
  setLocalText(void 0);
16948
17027
  }, [children]);
16949
- (0, import_react58.useEffect)(() => () => clearTimeout(timer.current), []);
16950
- (0, import_react58.useLayoutEffect)(() => {
17028
+ (0, import_react59.useEffect)(() => () => clearTimeout(timer.current), []);
17029
+ (0, import_react59.useLayoutEffect)(() => {
16951
17030
  const element = contentRef.current;
16952
17031
  if (!element || !ellipsis || !expandable || editing || expanded) return;
16953
17032
  const measure = () => setOverflow(element.scrollHeight > element.clientHeight + 1 || element.scrollWidth > element.clientWidth + 1);
@@ -17065,10 +17144,10 @@ var Typography = Object.assign(TypographyRoot, {
17065
17144
  });
17066
17145
 
17067
17146
  // src/components/FloatButton.tsx
17068
- var import_react59 = require("react");
17147
+ var import_react60 = require("react");
17069
17148
  var import_jsx_runtime59 = require("react/jsx-runtime");
17070
- var GroupShape = (0, import_react59.createContext)(void 0);
17071
- var FloatButtonRoot = (0, import_react59.forwardRef)(function FloatButton({
17149
+ var GroupShape = (0, import_react60.createContext)(void 0);
17150
+ var FloatButtonRoot = (0, import_react60.forwardRef)(function FloatButton({
17072
17151
  icon,
17073
17152
  description,
17074
17153
  tooltip,
@@ -17081,7 +17160,7 @@ var FloatButtonRoot = (0, import_react59.forwardRef)(function FloatButton({
17081
17160
  children,
17082
17161
  ...props
17083
17162
  }, ref) {
17084
- const groupShape = (0, import_react59.useContext)(GroupShape);
17163
+ const groupShape = (0, import_react60.useContext)(GroupShape);
17085
17164
  const label = props["aria-label"] ?? (typeof tooltip === "string" ? tooltip : typeof description === "string" ? description : "\u60AC\u6D6E\u64CD\u4F5C");
17086
17165
  const button = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
17087
17166
  "button",
@@ -17119,10 +17198,10 @@ function FloatButtonGroup({
17119
17198
  ...props
17120
17199
  }) {
17121
17200
  const [visible, setVisible] = useControllableState({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
17122
- const rootRef = (0, import_react59.useRef)(null);
17123
- const triggerRef = (0, import_react59.useRef)(null);
17124
- const id = (0, import_react59.useId)();
17125
- (0, import_react59.useEffect)(() => {
17201
+ const rootRef = (0, import_react60.useRef)(null);
17202
+ const triggerRef = (0, import_react60.useRef)(null);
17203
+ const id = (0, import_react60.useId)();
17204
+ (0, import_react60.useEffect)(() => {
17126
17205
  if (!trigger || !visible) return;
17127
17206
  const close = (event) => {
17128
17207
  if (!rootRef.current?.contains(event.target)) setVisible(false);
@@ -17176,8 +17255,8 @@ function FloatButtonGroup({
17176
17255
  ) });
17177
17256
  }
17178
17257
  function FloatButtonBackTop({ target, visibilityHeight = 400, behavior = "smooth", onClick, icon, tooltip = "\u8FD4\u56DE\u9876\u90E8", ...props }) {
17179
- const [visible, setVisible] = (0, import_react59.useState)(false);
17180
- (0, import_react59.useEffect)(() => {
17258
+ const [visible, setVisible] = (0, import_react60.useState)(false);
17259
+ (0, import_react60.useEffect)(() => {
17181
17260
  const element = target ? target() : window;
17182
17261
  if (!element) return;
17183
17262
  const update = () => setVisible((element === window ? window.scrollY : element.scrollTop) >= visibilityHeight);
@@ -17201,11 +17280,11 @@ var FloatButton2 = Object.assign(FloatButtonRoot, {
17201
17280
  });
17202
17281
 
17203
17282
  // src/components/ChartWhirlingLoading.tsx
17204
- var import_react60 = require("react");
17283
+ var import_react61 = require("react");
17205
17284
  var import_jsx_runtime60 = require("react/jsx-runtime");
17206
17285
  function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\u83B7\u53D6\u4E2D", textWidth, frame }) {
17207
- const [tick, setTick] = (0, import_react60.useState)(0);
17208
- (0, import_react60.useEffect)(() => {
17286
+ const [tick, setTick] = (0, import_react61.useState)(0);
17287
+ (0, import_react61.useEffect)(() => {
17209
17288
  if (frame != null) return;
17210
17289
  const media = window.matchMedia("(prefers-reduced-motion: reduce)");
17211
17290
  let timer;
@@ -17236,20 +17315,20 @@ function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\
17236
17315
  }
17237
17316
 
17238
17317
  // src/components/SvgMapPlot.tsx
17239
- var import_react72 = require("react");
17318
+ var import_react73 = require("react");
17240
17319
 
17241
17320
  // src/components/ChartBrush.tsx
17242
- var import_react61 = require("react");
17321
+ var import_react62 = require("react");
17243
17322
  var import_jsx_runtime61 = require("react/jsx-runtime");
17244
17323
  function ChartBrush({ bounds, onSelect, onCancel, selectionShape = "band", selectionStyle, minSelectionSize }) {
17245
- const [vertical, setVertical] = (0, import_react61.useState)(null);
17246
- const startY = (0, import_react61.useRef)(0);
17324
+ const [vertical, setVertical] = (0, import_react62.useState)(null);
17325
+ const startY = (0, import_react62.useRef)(0);
17247
17326
  const y = (event) => {
17248
17327
  const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
17249
17328
  return matrix ? Math.max(bounds.y, Math.min(bounds.y + bounds.height, new DOMPoint(event.clientX, event.clientY).matrixTransform(matrix.inverse()).y)) : bounds.y;
17250
17329
  };
17251
- const drag = (0, import_react61.useRef)(null);
17252
- const [selection, setSelection] = (0, import_react61.useState)(null);
17330
+ const drag = (0, import_react62.useRef)(null);
17331
+ const [selection, setSelection] = (0, import_react62.useState)(null);
17253
17332
  const x = (event) => {
17254
17333
  const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
17255
17334
  if (!matrix) return null;
@@ -17372,7 +17451,7 @@ function appendChartExportHeadings(original, clone, host) {
17372
17451
  }
17373
17452
 
17374
17453
  // src/components/ChartNodeTimeline.tsx
17375
- var import_react63 = require("react");
17454
+ var import_react64 = require("react");
17376
17455
 
17377
17456
  // src/components/timelinePositions.ts
17378
17457
  function timelineRatios(count, dates) {
@@ -17398,7 +17477,7 @@ function nearestTimelineIndex(ratios, ratio) {
17398
17477
  }
17399
17478
 
17400
17479
  // src/components/ChartPointMotion.tsx
17401
- var import_react62 = require("react");
17480
+ var import_react63 = require("react");
17402
17481
 
17403
17482
  // src/components/chartMotion.ts
17404
17483
  function chartMotionBaseline(points, horizontal = false) {
@@ -17419,11 +17498,11 @@ function interpolateChartPoints(from, to, progress) {
17419
17498
  var import_jsx_runtime62 = require("react/jsx-runtime");
17420
17499
  function ChartPointMotion({ points, enabled, duration, updateDuration = 500, animateInitial = true, easing = "linear", progress, horizontal = false, origin, children }) {
17421
17500
  const baseline = (target) => origin ? target.map(() => origin) : chartMotionBaseline(target, horizontal);
17422
- const [frame, setFrame] = (0, import_react62.useState)(() => enabled && animateInitial ? baseline(points) : points);
17423
- const displayed = (0, import_react62.useRef)(frame);
17424
- const initialized = (0, import_react62.useRef)(!animateInitial);
17501
+ const [frame, setFrame] = (0, import_react63.useState)(() => enabled && animateInitial ? baseline(points) : points);
17502
+ const displayed = (0, import_react63.useRef)(frame);
17503
+ const initialized = (0, import_react63.useRef)(!animateInitial);
17425
17504
  const signature = JSON.stringify(points);
17426
- (0, import_react62.useEffect)(() => {
17505
+ (0, import_react63.useEffect)(() => {
17427
17506
  const target = points;
17428
17507
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
17429
17508
  if (!enabled || progress != null || reduced.matches) {
@@ -17462,8 +17541,8 @@ function ChartPointMotion({ points, enabled, duration, updateDuration = 500, ani
17462
17541
  // src/components/ChartNodeTimeline.tsx
17463
17542
  var import_jsx_runtime63 = require("react/jsx-runtime");
17464
17543
  function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, x = 80, y = 520, width = 840 }) {
17465
- const [playing, setPlaying] = (0, import_react63.useState)(autoPlay), dragging = (0, import_react63.useRef)();
17466
- const [draft, setDraft] = (0, import_react63.useState)(), pending = (0, import_react63.useRef)(), draftRef = (0, import_react63.useRef)();
17544
+ const [playing, setPlaying] = (0, import_react64.useState)(autoPlay), dragging = (0, import_react64.useRef)();
17545
+ const [draft, setDraft] = (0, import_react64.useState)(), pending = (0, import_react64.useRef)(), draftRef = (0, import_react64.useRef)();
17467
17546
  const shown = draft ?? value;
17468
17547
  const cancelPending = () => {
17469
17548
  clearTimeout(pending.current);
@@ -17471,8 +17550,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
17471
17550
  draftRef.current = void 0;
17472
17551
  setDraft(void 0);
17473
17552
  };
17474
- (0, import_react63.useEffect)(() => () => clearTimeout(pending.current), []);
17475
- (0, import_react63.useEffect)(() => {
17553
+ (0, import_react64.useEffect)(() => () => clearTimeout(pending.current), []);
17554
+ (0, import_react64.useEffect)(() => {
17476
17555
  cancelPending();
17477
17556
  }, [value]);
17478
17557
  const preview = (index) => {
@@ -17487,8 +17566,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
17487
17566
  draftRef.current = void 0;
17488
17567
  }, 200);
17489
17568
  };
17490
- (0, import_react63.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
17491
- (0, import_react63.useEffect)(() => {
17569
+ (0, import_react64.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
17570
+ (0, import_react64.useEffect)(() => {
17492
17571
  if (!playing || labels.length < 2) return;
17493
17572
  const timer = window.setTimeout(() => {
17494
17573
  if (value + 1 < labels.length) onChange(value + 1);
@@ -17597,7 +17676,7 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
17597
17676
  }
17598
17677
 
17599
17678
  // src/components/ChartVerticalRange.tsx
17600
- var import_react64 = require("react");
17679
+ var import_react65 = require("react");
17601
17680
 
17602
17681
  // src/components/chartColorRamp.ts
17603
17682
  function chartColorRamp(colors, ratio) {
@@ -17617,16 +17696,16 @@ function chartColorRamp(colors, ratio) {
17617
17696
  // src/components/ChartVerticalRange.tsx
17618
17697
  var import_jsx_runtime64 = require("react/jsx-runtime");
17619
17698
  function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true, readOnly = false }) {
17620
- const id = (0, import_react64.useId)().replaceAll(":", "");
17621
- const drag = (0, import_react64.useRef)();
17622
- const [draft, setDraft] = (0, import_react64.useState)();
17623
- const pending = (0, import_react64.useRef)();
17699
+ const id = (0, import_react65.useId)().replaceAll(":", "");
17700
+ const drag = (0, import_react65.useRef)();
17701
+ const [draft, setDraft] = (0, import_react65.useState)();
17702
+ const pending = (0, import_react65.useRef)();
17624
17703
  const cancel = () => {
17625
17704
  drag.current = void 0;
17626
17705
  pending.current = void 0;
17627
17706
  setDraft(void 0);
17628
17707
  };
17629
- (0, import_react64.useEffect)(() => {
17708
+ (0, import_react65.useEffect)(() => {
17630
17709
  if (!realtime) cancel();
17631
17710
  }, [range[0], range[1], min, max, realtime]);
17632
17711
  const shown = draft ?? range;
@@ -17707,18 +17786,18 @@ function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range,
17707
17786
  }
17708
17787
 
17709
17788
  // src/components/ChartHorizontalRange.tsx
17710
- var import_react65 = require("react");
17789
+ var import_react66 = require("react");
17711
17790
  var import_jsx_runtime65 = require("react/jsx-runtime");
17712
17791
  function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true }) {
17713
- const id = (0, import_react65.useId)().replaceAll(":", ""), span = max - min;
17714
- const drag = (0, import_react65.useRef)();
17715
- const [draft, setDraft] = (0, import_react65.useState)(), pending = (0, import_react65.useRef)();
17792
+ const id = (0, import_react66.useId)().replaceAll(":", ""), span = max - min;
17793
+ const drag = (0, import_react66.useRef)();
17794
+ const [draft, setDraft] = (0, import_react66.useState)(), pending = (0, import_react66.useRef)();
17716
17795
  const cancel = () => {
17717
17796
  drag.current = void 0;
17718
17797
  pending.current = void 0;
17719
17798
  setDraft(void 0);
17720
17799
  };
17721
- (0, import_react65.useEffect)(() => {
17800
+ (0, import_react66.useEffect)(() => {
17722
17801
  if (!realtime) cancel();
17723
17802
  }, [range[0], range[1], min, max, realtime]);
17724
17803
  const shown = draft ?? range, low = Math.max(min, Math.min(max, shown[0])), high = Math.max(low, Math.min(max, shown[1]));
@@ -17796,7 +17875,7 @@ function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range
17796
17875
  }
17797
17876
 
17798
17877
  // src/components/Chart.tsx
17799
- var import_react66 = require("react");
17878
+ var import_react67 = require("react");
17800
17879
 
17801
17880
  // src/components/chartCompositeExport.ts
17802
17881
  function serializeChartComposite(host) {
@@ -17920,20 +17999,20 @@ var DEFAULT_CHART_PALETTE = [
17920
17999
  "#2f54eb",
17921
18000
  "#a0d911"
17922
18001
  ];
17923
- var ChartContext = (0, import_react66.createContext)(null);
18002
+ var ChartContext = (0, import_react67.createContext)(null);
17924
18003
  function toCssSize(value, fallback) {
17925
18004
  if (typeof value === "number") return `${value}px`;
17926
18005
  return value ?? fallback;
17927
18006
  }
17928
- var ChartComposite = (0, import_react66.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
17929
- const host = (0, import_react66.useRef)(null);
17930
- (0, import_react66.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
18007
+ var ChartComposite = (0, import_react67.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
18008
+ const host = (0, import_react67.useRef)(null);
18009
+ (0, import_react67.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
17931
18010
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ...withTitleTooltip(props), ref: host, className: `sia-chart-composite${className ? ` ${className}` : ""}`, style: { ...style, width: toCssSize(width, "100%"), height: toCssSize(height, "320px") }, role: "group", "aria-label": ariaLabel, children: layers.map((layer, index) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "sia-chart-composite__layer", style: { left: layer.left ?? 0, top: layer.top ?? 0, width: layer.width ?? "100%", height: layer.height ?? "100%", zIndex: layer.zIndex ?? index, pointerEvents: layer.pointerEvents }, children: layer.content }, layer.key ?? index)) });
17932
18011
  });
17933
- var useTooltipLayoutEffect = typeof window === "undefined" ? import_react66.useEffect : import_react66.useLayoutEffect;
18012
+ var useTooltipLayoutEffect = typeof window === "undefined" ? import_react67.useEffect : import_react67.useLayoutEffect;
17934
18013
  function ChartTooltip({ open, left, top, children, enterable = false, inheritTextStyle = false, placement = "above", className = "", style, ...props }) {
17935
- const elementRef = (0, import_react66.useRef)(null);
17936
- const [position, setPosition] = (0, import_react66.useState)([left, top]);
18014
+ const elementRef = (0, import_react67.useRef)(null);
18015
+ const [position, setPosition] = (0, import_react67.useState)([left, top]);
17937
18016
  useTooltipLayoutEffect(() => {
17938
18017
  const element = elementRef.current, host = element?.parentElement;
17939
18018
  if (!open || placement !== "axis" || !element || !host) return;
@@ -18057,7 +18136,7 @@ function ChartToolbox({
18057
18136
  ))
18058
18137
  ] });
18059
18138
  }
18060
- var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
18139
+ var SiaChart = (0, import_react67.forwardRef)(function SiaChart2({
18061
18140
  children,
18062
18141
  width = "100%",
18063
18142
  height = 320,
@@ -18084,19 +18163,19 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
18084
18163
  style,
18085
18164
  ...rest
18086
18165
  }, ref) {
18087
- const hostRef = (0, import_react66.useRef)(null);
18088
- const svgRef = (0, import_react66.useRef)(null);
18089
- const titleId = (0, import_react66.useId)();
18090
- const descriptionId = (0, import_react66.useId)();
18091
- const [tooltip, setTooltip] = (0, import_react66.useState)(null);
18092
- const tooltipHideTimer = (0, import_react66.useRef)();
18093
- const tooltipHeld = (0, import_react66.useRef)(false);
18166
+ const hostRef = (0, import_react67.useRef)(null);
18167
+ const svgRef = (0, import_react67.useRef)(null);
18168
+ const titleId = (0, import_react67.useId)();
18169
+ const descriptionId = (0, import_react67.useId)();
18170
+ const [tooltip, setTooltip] = (0, import_react67.useState)(null);
18171
+ const tooltipHideTimer = (0, import_react67.useRef)();
18172
+ const tooltipHeld = (0, import_react67.useRef)(false);
18094
18173
  const cancelTooltipHide = () => {
18095
18174
  clearTimeout(tooltipHideTimer.current);
18096
18175
  };
18097
- (0, import_react66.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
18098
- const [linkedPosition, setLinkedPosition] = (0, import_react66.useState)({ left: 0, top: 0 });
18099
- (0, import_react66.useEffect)(() => {
18176
+ (0, import_react67.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
18177
+ const [linkedPosition, setLinkedPosition] = (0, import_react67.useState)({ left: 0, top: 0 });
18178
+ (0, import_react67.useEffect)(() => {
18100
18179
  const host = hostRef.current, svg = svgRef.current;
18101
18180
  if (!controlledTooltip || !host || !svg) return;
18102
18181
  const position = () => {
@@ -18111,12 +18190,12 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
18111
18190
  observer.observe(host);
18112
18191
  return () => observer.disconnect();
18113
18192
  }, [controlledTooltip]);
18114
- const [dataViewOpen, setDataViewOpen] = (0, import_react66.useState)(false);
18115
- const [markMode, setMarkMode] = (0, import_react66.useState)(false);
18116
- const [markStart, setMarkStart] = (0, import_react66.useState)(null);
18117
- const [userMarks, setUserMarks] = (0, import_react66.useState)([]);
18193
+ const [dataViewOpen, setDataViewOpen] = (0, import_react67.useState)(false);
18194
+ const [markMode, setMarkMode] = (0, import_react67.useState)(false);
18195
+ const [markStart, setMarkStart] = (0, import_react67.useState)(null);
18196
+ const [userMarks, setUserMarks] = (0, import_react67.useState)([]);
18118
18197
  const toolboxOptions = toolbox === true ? {} : toolbox || void 0;
18119
- const rootStyle = (0, import_react66.useMemo)(() => ({
18198
+ const rootStyle = (0, import_react67.useMemo)(() => ({
18120
18199
  ...style,
18121
18200
  width: toCssSize(width, "100%"),
18122
18201
  height: toCssSize(height, "320px"),
@@ -18174,13 +18253,13 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
18174
18253
  anchor.href = canvas.toDataURL("image/png");
18175
18254
  anchor.click();
18176
18255
  }
18177
- (0, import_react66.useImperativeHandle)(ref, () => ({
18256
+ (0, import_react67.useImperativeHandle)(ref, () => ({
18178
18257
  getElement: () => svgRef.current,
18179
18258
  focus: () => svgRef.current?.focus(),
18180
18259
  toSvgString: serializeSvg,
18181
18260
  toDataUrl: svgDataUrl
18182
18261
  }), []);
18183
- const context = (0, import_react66.useMemo)(() => ({
18262
+ const context = (0, import_react67.useMemo)(() => ({
18184
18263
  palette,
18185
18264
  showTooltip: (event, content, point) => {
18186
18265
  cancelTooltipHide();
@@ -18367,7 +18446,7 @@ var SiaChart = (0, import_react66.forwardRef)(function SiaChart2({
18367
18446
  ) });
18368
18447
  });
18369
18448
  function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave, onFocus, onBlur, ...props }) {
18370
- const context = (0, import_react66.useContext)(ChartContext);
18449
+ const context = (0, import_react67.useContext)(ChartContext);
18371
18450
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
18372
18451
  "g",
18373
18452
  {
@@ -18396,7 +18475,7 @@ function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave
18396
18475
  );
18397
18476
  }
18398
18477
  function ChartLegend({ items, symbol = "rect", x = CHART_VIEWBOX_WIDTH / 2, y = 20, align = "center", itemGap = 18, orientation = "horizontal", selected, onItemClick, maxWidth, rowGap = 24, iconWidth, iconHeight = 14, textGap = 5, textStyle, inactiveColor, background }) {
18399
- const paintId = (0, import_react66.useId)().replaceAll(":", "");
18478
+ const paintId = (0, import_react67.useId)().replaceAll(":", "");
18400
18479
  const widths = items.map((item) => (iconWidth == null ? 18 : iconWidth + textGap) + (item.textWidth ?? Math.max(30, Array.from(item.name).reduce((width, character) => width + (character.charCodeAt(0) > 255 ? 13 : 7), 0))));
18401
18480
  const totalWidth = orientation === "horizontal" ? widths.reduce((sum, value) => sum + value, 0) + Math.max(0, items.length - 1) * itemGap : Math.max(0, ...widths);
18402
18481
  const startX = align === "start" ? x : align === "end" ? x - totalWidth : x - totalWidth / 2;
@@ -18525,7 +18604,7 @@ function ChartAxis({ layer = "all", orientation, x, y, length, labels, positions
18525
18604
  ] });
18526
18605
  }
18527
18606
  function ChartVisualMap({ min, max, colors = ["#e6f4ff", "#1677ff"], x = 16, y = 284, width = 110, height = 9, label, endLabels, indicatorValue, onHoverRange, realtime = true, svgHandles = false, orientation = "horizontal", calculable = false, value = max, onChange, range, onRangeChange, pieces, selectedPieces, onPieceToggle }) {
18528
- const id = (0, import_react66.useId)().replaceAll(":", "");
18607
+ const id = (0, import_react67.useId)().replaceAll(":", "");
18529
18608
  const vertical = orientation === "vertical";
18530
18609
  if (svgHandles && vertical && !calculable && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartVerticalRange, { readOnly: true, min, max, x, y, length: width, thickness: height, colors, range: [min, max], endLabels, indicatorValue, onHoverRange });
18531
18610
  if (svgHandles && vertical && calculable && range && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ChartVerticalRange, { min, max, x, y, length: width, thickness: height, colors, range, onChange: onRangeChange, endLabels, indicatorValue, onHoverRange, realtime });
@@ -18553,8 +18632,8 @@ function ChartVisualMap({ min, max, colors = ["#e6f4ff", "#1677ff"], x = 16, y =
18553
18632
  ] });
18554
18633
  }
18555
18634
  function ChartDataZoom({ value, min = 0, max = 100, ariaLabel = "\u56FE\u8868\u53EF\u89C1\u8303\u56F4", orientation = "horizontal", dataShadow = [], showDetail = false, minSpan = 1, formatter, onChange, panEnabled = false, shadowBounds, handleLabels }) {
18556
- const [activeHandle, setActiveHandle] = (0, import_react66.useState)(null);
18557
- const pan = (0, import_react66.useRef)();
18635
+ const [activeHandle, setActiveHandle] = (0, import_react67.useState)(null);
18636
+ const pan = (0, import_react67.useRef)();
18558
18637
  const start = Math.min(value[0], value[1]);
18559
18638
  const end = Math.max(value[0], value[1]);
18560
18639
  const startPercent = (start - min) / Math.max(1, max - min) * 100;
@@ -18628,9 +18707,9 @@ function ChartDataZoom({ value, min = 0, max = 100, ariaLabel = "\u56FE\u8868\u5
18628
18707
  ] });
18629
18708
  }
18630
18709
  function ChartTimeline({ labels, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, className = "", ...props }) {
18631
- const [playing, setPlaying] = (0, import_react66.useState)(autoPlay);
18632
- (0, import_react66.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
18633
- (0, import_react66.useEffect)(() => {
18710
+ const [playing, setPlaying] = (0, import_react67.useState)(autoPlay);
18711
+ (0, import_react67.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
18712
+ (0, import_react67.useEffect)(() => {
18634
18713
  if (!playing || labels.length <= 1) return void 0;
18635
18714
  const timer = window.setInterval(() => {
18636
18715
  const next = value + 1;
@@ -18740,7 +18819,7 @@ function parseSvgMapPaths(source) {
18740
18819
  }
18741
18820
 
18742
18821
  // src/components/useMapRoam.ts
18743
- var import_react67 = require("react");
18822
+ var import_react68 = require("react");
18744
18823
 
18745
18824
  // src/components/chartRoam.ts
18746
18825
  function zoomChartViewport(view, factor, point, limit = { min: 0.05, max: 20 }) {
@@ -18757,14 +18836,14 @@ var initial = { x: 0, y: 0, scale: 1 };
18757
18836
  function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.12, 0.9]) {
18758
18837
  const [zoomIn, zoomOut] = wheelFactors;
18759
18838
  const min = scaleLimit?.min, max = scaleLimit?.max, unlimited = scaleLimit === null;
18760
- const host = (0, import_react67.useRef)(null);
18761
- const [view, setView] = (0, import_react67.useState)(initial);
18762
- const drag = (0, import_react67.useRef)();
18839
+ const host = (0, import_react68.useRef)(null);
18840
+ const [view, setView] = (0, import_react68.useState)(initial);
18841
+ const drag = (0, import_react68.useRef)();
18763
18842
  const local = (x, y) => {
18764
18843
  const matrix = host.current?.ownerSVGElement?.getScreenCTM();
18765
18844
  return matrix ? new DOMPoint(x, y).matrixTransform(matrix.inverse()) : new DOMPoint(x, y);
18766
18845
  };
18767
- (0, import_react67.useEffect)(() => {
18846
+ (0, import_react68.useEffect)(() => {
18768
18847
  const node = host.current;
18769
18848
  if (!node || !mode || mode === "move") return;
18770
18849
  const wheel = (event) => {
@@ -18826,7 +18905,7 @@ function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.
18826
18905
  }
18827
18906
 
18828
18907
  // src/components/ChartMapLineReveal.tsx
18829
- var import_react68 = require("react");
18908
+ var import_react69 = require("react");
18830
18909
 
18831
18910
  // src/components/mapLineGeometry.ts
18832
18911
  function mapLineControl(source, target, curveness) {
@@ -18843,9 +18922,9 @@ function mapLineDuration(source, target, period) {
18843
18922
  // src/components/ChartMapLineReveal.tsx
18844
18923
  var import_jsx_runtime67 = require("react/jsx-runtime");
18845
18924
  function ChartMapLineReveal({ source, control, target, enabled, initialDuration = 2e3, updateDuration = 500, children }) {
18846
- const signature = JSON.stringify([source, control, target]), initialized = (0, import_react68.useRef)(false);
18847
- const [frame, setFrame] = (0, import_react68.useState)({ signature, progress: enabled ? 0 : 1 });
18848
- (0, import_react68.useEffect)(() => {
18925
+ const signature = JSON.stringify([source, control, target]), initialized = (0, import_react69.useRef)(false);
18926
+ const [frame, setFrame] = (0, import_react69.useState)({ signature, progress: enabled ? 0 : 1 });
18927
+ (0, import_react69.useEffect)(() => {
18849
18928
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
18850
18929
  const duration = Math.max(1, initialized.current ? updateDuration : initialDuration);
18851
18930
  if (!enabled || reduced.matches) {
@@ -18878,15 +18957,15 @@ function ChartMapLineReveal({ source, control, target, enabled, initialDuration
18878
18957
  }
18879
18958
 
18880
18959
  // src/components/ChartMapLineEffect.tsx
18881
- var import_react69 = require("react");
18960
+ var import_react70 = require("react");
18882
18961
  var import_jsx_runtime68 = require("react/jsx-runtime");
18883
18962
  function ChartMapLineEffect({ source, control, target, period = 30, color = "#fff", radius = 1, shadowBlur = 10, shadowColor = color, trailAlpha }) {
18884
- const ref = (0, import_react69.useRef)(null);
18885
- const trails = (0, import_react69.useRef)([]);
18963
+ const ref = (0, import_react70.useRef)(null);
18964
+ const trails = (0, import_react70.useRef)([]);
18886
18965
  const alpha = trailAlpha === void 0 ? 0 : Math.max(0, Math.min(0.999, trailAlpha));
18887
18966
  const count = alpha > 0 ? Math.min(240, Math.ceil(Math.log(5e-3) / Math.log(alpha))) : 0;
18888
18967
  const duration = mapLineDuration(source, target, period);
18889
- (0, import_react69.useEffect)(() => {
18968
+ (0, import_react70.useEffect)(() => {
18890
18969
  const started = performance.now();
18891
18970
  let frame = 0;
18892
18971
  const history = [];
@@ -18919,7 +18998,7 @@ function ChartMapLineEffect({ source, control, target, period = 30, color = "#ff
18919
18998
  }
18920
18999
 
18921
19000
  // src/components/ChartMapPointPulse.tsx
18922
- var import_react70 = require("react");
19001
+ var import_react71 = require("react");
18923
19002
 
18924
19003
  // src/components/mapPointPulse.ts
18925
19004
  function mapPointPulseDuration(period, random = Math.random) {
@@ -18929,7 +19008,7 @@ function mapPointPulseDuration(period, random = Math.random) {
18929
19008
  // src/components/ChartMapPointPulse.tsx
18930
19009
  var import_jsx_runtime69 = require("react/jsx-runtime");
18931
19010
  function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
18932
- const [duration] = (0, import_react70.useState)(() => mapPointPulseDuration(period));
19011
+ const [duration] = (0, import_react71.useState)(() => mapPointPulseDuration(period));
18933
19012
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("circle", { "data-svg-map-pulse": duration, cx: x, cy: y, r: size * scaleSize * 0.1, fill: "none", stroke: color, strokeWidth: 0.1, pointerEvents: "none", style: { filter: `drop-shadow(0 0 2px ${color})` }, children: [
18934
19013
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("animate", { attributeName: "r", values: `${size * scaleSize * 0.1};${size * scaleSize}`, dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" }),
18935
19014
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("animate", { attributeName: "stroke-width", values: ".1;1", dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" })
@@ -18937,11 +19016,11 @@ function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
18937
19016
  }
18938
19017
 
18939
19018
  // src/components/ChartMapPointEntrance.tsx
18940
- var import_react71 = require("react");
19019
+ var import_react72 = require("react");
18941
19020
  var import_jsx_runtime70 = require("react/jsx-runtime");
18942
19021
  function ChartMapPointEntrance({ enabled, x, y, children }) {
18943
- const [progress, setProgress] = (0, import_react71.useState)(enabled ? 0.01 : 1);
18944
- (0, import_react71.useEffect)(() => {
19022
+ const [progress, setProgress] = (0, import_react72.useState)(enabled ? 0.01 : 1);
19023
+ (0, import_react72.useEffect)(() => {
18945
19024
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
18946
19025
  if (!enabled || reduced.matches) {
18947
19026
  setProgress(1);
@@ -18984,8 +19063,8 @@ function mapLineEndLabel(source, target) {
18984
19063
  // src/components/SvgMapPlot.tsx
18985
19064
  var import_jsx_runtime71 = require("react/jsx-runtime");
18986
19065
  function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized, onHover, stroke, strokeWidth, opacity, hoverable = true, showLabel = true, tooltipNameOnly = false }) {
18987
- const path = (0, import_react72.useRef)(null), [center, setCenter] = (0, import_react72.useState)([0, 0]);
18988
- (0, import_react72.useLayoutEffect)(() => {
19066
+ const path = (0, import_react73.useRef)(null), [center, setCenter] = (0, import_react73.useState)([0, 0]);
19067
+ (0, import_react73.useLayoutEffect)(() => {
18989
19068
  const box = path.current?.getBBox();
18990
19069
  if (box) setCenter([box.x + box.width / 2, box.y + box.height / 2]);
18991
19070
  }, [d]);
@@ -19003,9 +19082,9 @@ function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized
19003
19082
  ] }), onPointerMove: () => onHover(true), onPointerLeave: () => onHover(false), onFocus: () => onHover(true), onBlur: () => onHover(false), children: content });
19004
19083
  }
19005
19084
  function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = domain, colors, labelOffsets, hoverRange, onHoverValue, roam = true, resetKey = 0, children, markPoints = [], markLines = [], lineAnimation = false, tooltipNameOnly = false, showLabels = true, pointAnimation = false, pointEntrance = false, pointAnimationEasing = "linear" }) {
19006
- const map = (0, import_react72.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react72.useState)();
19007
- const [hoveredLine, setHoveredLine] = (0, import_react72.useState)();
19008
- (0, import_react72.useEffect)(() => {
19085
+ const map = (0, import_react73.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react73.useState)();
19086
+ const [hoveredLine, setHoveredLine] = (0, import_react73.useState)();
19087
+ (0, import_react73.useEffect)(() => {
19009
19088
  control.reset();
19010
19089
  setHovered(void 0);
19011
19090
  }, [resetKey]);
@@ -19068,16 +19147,16 @@ function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = d
19068
19147
  }
19069
19148
 
19070
19149
  // src/components/ChartRoamController.tsx
19071
- var import_react73 = require("react");
19150
+ var import_react74 = require("react");
19072
19151
  var import_jsx_runtime72 = require("react/jsx-runtime");
19073
19152
  function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
19074
- const [hovered, setHovered] = (0, import_react73.useState)(), [focused, setFocused] = (0, import_react73.useState)();
19075
- const timer = (0, import_react73.useRef)();
19153
+ const [hovered, setHovered] = (0, import_react74.useState)(), [focused, setFocused] = (0, import_react74.useState)();
19154
+ const timer = (0, import_react74.useRef)();
19076
19155
  const stop = () => {
19077
19156
  if (timer.current !== void 0) clearInterval(timer.current);
19078
19157
  timer.current = void 0;
19079
19158
  };
19080
- (0, import_react73.useEffect)(() => {
19159
+ (0, import_react74.useEffect)(() => {
19081
19160
  window.addEventListener("blur", stop);
19082
19161
  return () => {
19083
19162
  stop();
@@ -19116,13 +19195,13 @@ function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
19116
19195
  }
19117
19196
 
19118
19197
  // src/components/LineShareChart.tsx
19119
- var import_react93 = require("react");
19198
+ var import_react94 = require("react");
19120
19199
 
19121
19200
  // src/components/Charts.tsx
19122
- var import_react91 = require("react");
19201
+ var import_react92 = require("react");
19123
19202
 
19124
19203
  // src/components/ChartScatterMotion.tsx
19125
- var import_react74 = require("react");
19204
+ var import_react75 = require("react");
19126
19205
 
19127
19206
  // src/components/scatterMotion.ts
19128
19207
  function scatterMotionEase(progress) {
@@ -19134,9 +19213,9 @@ function scatterMotionEase(progress) {
19134
19213
  var import_jsx_runtime73 = require("react/jsx-runtime");
19135
19214
  function ChartScatterMotion({ x, y, radius, enabled, duration = 2e3, updateDuration = 500, progress, children }) {
19136
19215
  const target = { x, y, radius };
19137
- const [frame, setFrame] = (0, import_react74.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
19138
- const displayed = (0, import_react74.useRef)(frame), started = (0, import_react74.useRef)(false);
19139
- (0, import_react74.useEffect)(() => {
19216
+ const [frame, setFrame] = (0, import_react75.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
19217
+ const displayed = (0, import_react75.useRef)(frame), started = (0, import_react75.useRef)(false);
19218
+ (0, import_react75.useEffect)(() => {
19140
19219
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
19141
19220
  let request = 0;
19142
19221
  const publish = (next) => {
@@ -19247,12 +19326,12 @@ function layoutEventRiver(series, tailLength, area) {
19247
19326
  }
19248
19327
 
19249
19328
  // src/components/EventRiverBubble.tsx
19250
- var import_react75 = require("react");
19329
+ var import_react76 = require("react");
19251
19330
  var import_jsx_runtime74 = require("react/jsx-runtime");
19252
19331
  function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerUp, ...props }) {
19253
- const [offset, setOffset] = (0, import_react75.useState)(0);
19254
- const drag = (0, import_react75.useRef)();
19255
- (0, import_react75.useEffect)(() => {
19332
+ const [offset, setOffset] = (0, import_react76.useState)(0);
19333
+ const drag = (0, import_react76.useRef)();
19334
+ (0, import_react76.useEffect)(() => {
19256
19335
  setOffset(0);
19257
19336
  drag.current = void 0;
19258
19337
  }, [resetKey]);
@@ -19303,13 +19382,13 @@ function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerU
19303
19382
  }
19304
19383
 
19305
19384
  // src/components/EventRiverMotion.tsx
19306
- var import_react76 = require("react");
19385
+ var import_react77 = require("react");
19307
19386
  var import_jsx_runtime75 = require("react/jsx-runtime");
19308
19387
  function EventRiverMotion({ geometry, enabled = true, duration = 2e3, updateDuration = 500, progress, children }) {
19309
- const [frame, setFrame] = (0, import_react76.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
19310
- const displayed = (0, import_react76.useRef)(frame), started = (0, import_react76.useRef)(false);
19388
+ const [frame, setFrame] = (0, import_react77.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
19389
+ const displayed = (0, import_react77.useRef)(frame), started = (0, import_react77.useRef)(false);
19311
19390
  const signature = JSON.stringify(geometry);
19312
- (0, import_react76.useEffect)(() => {
19391
+ (0, import_react77.useEffect)(() => {
19313
19392
  const preference = window.matchMedia("(prefers-reduced-motion: reduce)"), target = { ...geometry, scale: 1 };
19314
19393
  const from = started.current ? displayed.current : { ...geometry, scale: 0.1 };
19315
19394
  let request = 0;
@@ -19427,7 +19506,7 @@ function transferPieValue(series, source, target, connector = " & ") {
19427
19506
  }
19428
19507
 
19429
19508
  // src/components/ChartValueIsland.tsx
19430
- var import_react77 = require("react");
19509
+ var import_react78 = require("react");
19431
19510
 
19432
19511
  // src/components/cartesianTransfer.ts
19433
19512
  function addValues(a, b) {
@@ -19493,13 +19572,13 @@ function findCompositeValueTarget(element, x, y) {
19493
19572
  // src/components/ChartValueIsland.tsx
19494
19573
  var import_jsx_runtime76 = require("react/jsx-runtime");
19495
19574
  function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolveTarget = findCompositeValueTarget }) {
19496
- const drag = (0, import_react77.useRef)(null);
19497
- const [offset, setOffset] = (0, import_react77.useState)([0, 0]);
19575
+ const drag = (0, import_react78.useRef)(null);
19576
+ const [offset, setOffset] = (0, import_react78.useState)([0, 0]);
19498
19577
  const cancel = () => {
19499
19578
  drag.current = null;
19500
19579
  setOffset([0, 0]);
19501
19580
  };
19502
- (0, import_react77.useEffect)(cancel, [x, y]);
19581
+ (0, import_react78.useEffect)(cancel, [x, y]);
19503
19582
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
19504
19583
  ChartMark,
19505
19584
  {
@@ -19552,12 +19631,12 @@ function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolv
19552
19631
  }
19553
19632
 
19554
19633
  // src/components/ChartPulseRing.tsx
19555
- var import_react78 = require("react");
19634
+ var import_react79 = require("react");
19556
19635
  var import_jsx_runtime77 = require("react/jsx-runtime");
19557
19636
  function ChartPulseRing({ center, radius, scaleSize = 2, color = "gold", shadowBlur = 10, period = 15, progress, enabled = true }) {
19558
- const id = (0, import_react78.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react78.useState)(0);
19559
- const [reduced, setReduced] = (0, import_react78.useState)(false);
19560
- (0, import_react78.useEffect)(() => {
19637
+ const id = (0, import_react79.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react79.useState)(0);
19638
+ const [reduced, setReduced] = (0, import_react79.useState)(false);
19639
+ (0, import_react79.useEffect)(() => {
19561
19640
  const preference = window.matchMedia("(prefers-reduced-motion: reduce)");
19562
19641
  setReduced(preference.matches);
19563
19642
  let frame = 0;
@@ -19701,7 +19780,7 @@ function chartMarkerPath(kind, x, y, size) {
19701
19780
  }
19702
19781
 
19703
19782
  // src/components/ChartLargeMapPointCanvas.tsx
19704
- var import_react79 = require("react");
19783
+ var import_react80 = require("react");
19705
19784
 
19706
19785
  // src/components/largeMapPointPulse.ts
19707
19786
  function largeMapPointPulse(elapsed, period, initial3, delay) {
@@ -19717,8 +19796,8 @@ function largeMapPointSize(size, pulse) {
19717
19796
  // src/components/ChartLargeMapPointCanvas.tsx
19718
19797
  var import_jsx_runtime78 = require("react/jsx-runtime");
19719
19798
  function ChartLargeMapPointCanvas({ groups, width, height }) {
19720
- const canvas = (0, import_react79.useRef)(null), key = JSON.stringify(groups);
19721
- (0, import_react79.useEffect)(() => {
19799
+ const canvas = (0, import_react80.useRef)(null), key = JSON.stringify(groups);
19800
+ (0, import_react80.useEffect)(() => {
19722
19801
  const element = canvas.current, context = element?.getContext("2d");
19723
19802
  if (!element || !context) return;
19724
19803
  const ratio = window.devicePixelRatio || 1;
@@ -19777,12 +19856,12 @@ function ChartLargeMapPointCanvas({ groups, width, height }) {
19777
19856
  }
19778
19857
 
19779
19858
  // src/components/ChartCrosshair.tsx
19780
- var import_react80 = require("react");
19859
+ var import_react81 = require("react");
19781
19860
  var import_jsx_runtime79 = require("react/jsx-runtime");
19782
19861
  function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY = decimal }) {
19783
- const ref = (0, import_react80.useRef)(null);
19784
- const [point, setPoint] = (0, import_react80.useState)(null);
19785
- (0, import_react80.useEffect)(() => {
19862
+ const ref = (0, import_react81.useRef)(null);
19863
+ const [point, setPoint] = (0, import_react81.useState)(null);
19864
+ (0, import_react81.useEffect)(() => {
19786
19865
  const svg = ref.current?.ownerSVGElement;
19787
19866
  if (!svg) return;
19788
19867
  const clear = () => setPoint(null);
@@ -19802,7 +19881,7 @@ function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY =
19802
19881
  svg.removeEventListener("pointercancel", clear);
19803
19882
  };
19804
19883
  }, [bounds.x, bounds.y, bounds.width, bounds.height]);
19805
- (0, import_react80.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
19884
+ (0, import_react81.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
19806
19885
  const x = point ? xDomain[0] + (point.x - bounds.x) / bounds.width * (xDomain[1] - xDomain[0]) : 0;
19807
19886
  const y = point ? yDomain[1] - (point.y - bounds.y) / bounds.height * (yDomain[1] - yDomain[0]) : 0;
19808
19887
  return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("g", { ref, className: "sia-chart__crosshair", "aria-hidden": "true", children: [
@@ -19819,7 +19898,7 @@ function decimal(value) {
19819
19898
  }
19820
19899
 
19821
19900
  // src/components/HeatmapRasterLayer.tsx
19822
- var import_react81 = require("react");
19901
+ var import_react82 = require("react");
19823
19902
 
19824
19903
  // src/components/heatmapRaster.ts
19825
19904
  var defaultGradient = [{ offset: 0.2, color: [0, 0, 255] }, { offset: 0.4, color: [0, 255, 255] }, { offset: 0.6, color: [0, 255, 0] }, { offset: 0.8, color: [255, 255, 0] }, { offset: 1, color: [255, 0, 0] }];
@@ -19866,9 +19945,9 @@ function rasterizeHeatmap(width, height, points, options = {}) {
19866
19945
  // src/components/HeatmapRasterLayer.tsx
19867
19946
  var import_jsx_runtime80 = require("react/jsx-runtime");
19868
19947
  function HeatmapRaster({ width, height, points, options }) {
19869
- const [url, setUrl] = (0, import_react81.useState)();
19948
+ const [url, setUrl] = (0, import_react82.useState)();
19870
19949
  const optionsKey = JSON.stringify(options);
19871
- (0, import_react81.useEffect)(() => {
19950
+ (0, import_react82.useEffect)(() => {
19872
19951
  const canvas = document.createElement("canvas");
19873
19952
  canvas.width = width;
19874
19953
  canvas.height = height;
@@ -19968,10 +20047,10 @@ function chordMatrixLayout(matrix, options = {}) {
19968
20047
  }
19969
20048
 
19970
20049
  // src/components/MatrixChordPlot.tsx
19971
- var import_react82 = require("react");
20050
+ var import_react83 = require("react");
19972
20051
  var import_jsx_runtime81 = require("react/jsx-runtime");
19973
20052
  function MatrixChordPlot({ names, matrix, series, appearance, showNodeLabels = false, rotateNodeLabels = false, linkLabel, sort, sortSub, padAngle, clockwise, palette, geometry, legacySubSort = false, showScale = false }) {
19974
- const [hoveredLink, setHoveredLink] = (0, import_react82.useState)(null);
20053
+ const [hoveredLink, setHoveredLink] = (0, import_react83.useState)(null);
19975
20054
  const layout = series ? chordMultiMatrixLayout(series.map((s) => s.matrix), { padAngle, clockwise, startAngle: geometry?.startAngle }) : chordMatrixLayout(matrix, { sort, sortSub, padAngle, clockwise, legacySubSort, startAngle: geometry?.startAngle }), cx = geometry?.center[0] ?? 360, cy = geometry?.center[1] ?? 182, r = geometry?.innerRadius ?? 108, outer = geometry?.outerRadius ?? 128;
19976
20055
  const point = (angle) => [cx + Math.cos(angle) * r, cy + Math.sin(angle) * r];
19977
20056
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("g", { className: "sia-chart__matrix-chord", children: [
@@ -20318,13 +20397,13 @@ function transferRadarSeries(panels, source, target, connector = " & ") {
20318
20397
  }
20319
20398
 
20320
20399
  // src/components/ChartRoamGroup.tsx
20321
- var import_react83 = require("react");
20400
+ var import_react84 = require("react");
20322
20401
  var import_jsx_runtime83 = require("react/jsx-runtime");
20323
20402
  var initial2 = { x: 0, y: 0, scale: 1 };
20324
20403
  function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true, ariaLabel, resetSignal = 0 }) {
20325
- const group = (0, import_react83.useRef)(null), drag = (0, import_react83.useRef)();
20326
- const [view, setView] = (0, import_react83.useState)(initial2);
20327
- (0, import_react83.useEffect)(() => {
20404
+ const group = (0, import_react84.useRef)(null), drag = (0, import_react84.useRef)();
20405
+ const [view, setView] = (0, import_react84.useState)(initial2);
20406
+ (0, import_react84.useEffect)(() => {
20328
20407
  setView(initial2);
20329
20408
  drag.current = void 0;
20330
20409
  }, [resetSignal]);
@@ -20334,7 +20413,7 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
20334
20413
  const local = new DOMPoint(clientX, clientY).matrixTransform(matrix.inverse());
20335
20414
  return [local.x, local.y];
20336
20415
  };
20337
- (0, import_react83.useEffect)(() => {
20416
+ (0, import_react84.useEffect)(() => {
20338
20417
  const target = group.current;
20339
20418
  if (!target || !enabled || !zoomEnabled) return;
20340
20419
  const wheel = (event) => {
@@ -20395,11 +20474,11 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
20395
20474
  }
20396
20475
 
20397
20476
  // src/components/TreeNodeGlyph.tsx
20398
- var import_react84 = require("react");
20477
+ var import_react85 = require("react");
20399
20478
  var import_jsx_runtime84 = require("react/jsx-runtime");
20400
20479
  function TreeNodeGlyph({ symbol = "circle", x, y, width, height, color, itemStyle }) {
20401
- const [failed, setFailed] = (0, import_react84.useState)(false);
20402
- (0, import_react84.useEffect)(() => setFailed(false), [symbol]);
20480
+ const [failed, setFailed] = (0, import_react85.useState)(false);
20481
+ (0, import_react85.useEffect)(() => setFailed(false), [symbol]);
20403
20482
  const style = { fill: itemStyle.brushType === "stroke" ? "none" : color, stroke: itemStyle.borderColor, strokeWidth: itemStyle.borderWidth };
20404
20483
  if (symbol.startsWith("image://")) return failed ? /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("g", { role: "img", "aria-label": "\u539F\u59CB\u8282\u70B9\u56FE\u7247\u52A0\u8F7D\u5931\u8D25", children: [
20405
20484
  /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("rect", { x: x - width / 2, y: y - height / 2, width, height, fill: "none", stroke: "#999", strokeDasharray: "3 3" }),
@@ -20688,7 +20767,7 @@ function resolveMapRegionAppearance(base, datum, emphasized) {
20688
20767
  }
20689
20768
 
20690
20769
  // src/components/ChartBundledMapCanvas.tsx
20691
- var import_react85 = require("react");
20770
+ var import_react86 = require("react");
20692
20771
 
20693
20772
  // src/components/edgeBundling.ts
20694
20773
  var distance = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1]);
@@ -20832,9 +20911,9 @@ function sampleBundledPath(curves, progress) {
20832
20911
  var import_jsx_runtime85 = require("react/jsx-runtime");
20833
20912
  function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "rgba(2,166,253,0.05)", opacity = 0.2, lineWidth = 0.5, pointColor = "rgba(255,0,0,0.5)", pointRadius = 1.5, effect, width, height }) {
20834
20913
  const signature = JSON.stringify(edges), pointKey = JSON.stringify(points), effectKey = JSON.stringify(effect);
20835
- const paths = (0, import_react85.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
20836
- const base = (0, import_react85.useRef)(null), moving = (0, import_react85.useRef)(null);
20837
- (0, import_react85.useEffect)(() => {
20914
+ const paths = (0, import_react86.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
20915
+ const base = (0, import_react86.useRef)(null), moving = (0, import_react86.useRef)(null);
20916
+ (0, import_react86.useEffect)(() => {
20838
20917
  const node = base.current, ctx = node?.getContext("2d");
20839
20918
  if (!node || !ctx) return;
20840
20919
  const ratio = window.devicePixelRatio || 1;
@@ -20860,7 +20939,7 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
20860
20939
  ctx.fill();
20861
20940
  }
20862
20941
  }, [paths, pointKey, width, height, color, opacity, lineWidth, pointColor, pointRadius]);
20863
- (0, import_react85.useEffect)(() => {
20942
+ (0, import_react86.useEffect)(() => {
20864
20943
  const node = moving.current, ctx = node?.getContext("2d");
20865
20944
  if (!node || !ctx) return;
20866
20945
  const ratio = window.devicePixelRatio || 1;
@@ -20922,11 +21001,11 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
20922
21001
  }
20923
21002
 
20924
21003
  // src/components/ChartMapEffectCanvas.tsx
20925
- var import_react86 = require("react");
21004
+ var import_react87 = require("react");
20926
21005
  var import_jsx_runtime86 = require("react/jsx-runtime");
20927
21006
  function ChartMapEffectCanvas({ effects, width, height, alpha = 0.95 }) {
20928
- const canvas = (0, import_react86.useRef)(null), key = JSON.stringify(effects);
20929
- (0, import_react86.useEffect)(() => {
21007
+ const canvas = (0, import_react87.useRef)(null), key = JSON.stringify(effects);
21008
+ (0, import_react87.useEffect)(() => {
20930
21009
  const element = canvas.current;
20931
21010
  if (!element) return;
20932
21011
  const context = element.getContext("2d");
@@ -21072,12 +21151,12 @@ function layoutTreeNodes(root, options = {}) {
21072
21151
  }
21073
21152
 
21074
21153
  // src/components/ChartDataEditor.tsx
21075
- var import_react87 = require("react");
21154
+ var import_react88 = require("react");
21076
21155
  var import_jsx_runtime87 = require("react/jsx-runtime");
21077
21156
  function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false }) {
21078
- const [draft, setDraft] = (0, import_react87.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
21079
- const [error, setError] = (0, import_react87.useState)("");
21080
- const [applied, setApplied] = (0, import_react87.useState)(false);
21157
+ const [draft, setDraft] = (0, import_react88.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
21158
+ const [error, setError] = (0, import_react88.useState)("");
21159
+ const [applied, setApplied] = (0, import_react88.useState)(false);
21081
21160
  function apply() {
21082
21161
  try {
21083
21162
  const values = JSON.parse(draft);
@@ -21108,11 +21187,11 @@ function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false
21108
21187
  }
21109
21188
 
21110
21189
  // src/components/ChartBarStatistics.tsx
21111
- var import_react88 = require("react");
21190
+ var import_react89 = require("react");
21112
21191
  var import_jsx_runtime88 = require("react/jsx-runtime");
21113
21192
  function ChartBarStatistics({ values, kinds, project, plot, horizontal, color, gradient, seriesName }) {
21114
- const id = (0, import_react88.useId)().replaceAll(":", "");
21115
- const [active, setActive] = (0, import_react88.useState)();
21193
+ const id = (0, import_react89.useId)().replaceAll(":", "");
21194
+ const [active, setActive] = (0, import_react89.useState)();
21116
21195
  const paint = gradient ? `url(#${id})` : color;
21117
21196
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("g", { children: [
21118
21197
  gradient ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("linearGradient", { id, gradientUnits: "userSpaceOnUse", x1: gradient.start[0], y1: gradient.start[1], x2: gradient.end[0], y2: gradient.end[1], children: gradient.stops.map((stop, i) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
@@ -21167,7 +21246,7 @@ function lineSegments(points) {
21167
21246
  }
21168
21247
 
21169
21248
  // src/components/useBarMagicState.ts
21170
- var import_react89 = require("react");
21249
+ var import_react90 = require("react");
21171
21250
 
21172
21251
  // src/components/cartesianMagicState.ts
21173
21252
  function changeCartesianMagic(state, action) {
@@ -21182,8 +21261,8 @@ function changeCartesianMagic(state, action) {
21182
21261
  function useBarMagicState(toolbox, shape = "bar") {
21183
21262
  const initial3 = { shape, layout: "original" };
21184
21263
  const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
21185
- const [state, setState] = (0, import_react89.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
21186
- (0, import_react89.useEffect)(() => {
21264
+ const [state, setState] = (0, import_react90.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
21265
+ (0, import_react90.useEffect)(() => {
21187
21266
  if (options?.activeMagicType) setState((s) => changeCartesianMagic(s, options.activeMagicType));
21188
21267
  }, [options?.activeMagicType]);
21189
21268
  const resolved = options ? { ...options, activeMagicType: state.shape, activeMagicTypes: options.activeMagicTypes ?? (state.layout === "original" ? [state.shape] : [state.shape, state.layout]), onMagicTypeChange: (action) => {
@@ -21197,7 +21276,7 @@ function useBarMagicState(toolbox, shape = "bar") {
21197
21276
  }
21198
21277
 
21199
21278
  // src/components/useBarValueTransfer.ts
21200
- var import_react90 = require("react");
21279
+ var import_react91 = require("react");
21201
21280
 
21202
21281
  // src/components/barTransfer.ts
21203
21282
  function transferBarValue(series, source, target, categories) {
@@ -21214,10 +21293,10 @@ function transferBarValue(series, source, target, categories) {
21214
21293
 
21215
21294
  // src/components/useBarValueTransfer.ts
21216
21295
  function useBarValueTransfer(series, initial3, categories, enabled, publish, onError) {
21217
- const [islands, setIslands] = (0, import_react90.useState)([]);
21218
- const drag = (0, import_react90.useRef)();
21219
- const [offset, setOffset] = (0, import_react90.useState)();
21220
- (0, import_react90.useEffect)(() => {
21296
+ const [islands, setIslands] = (0, import_react91.useState)([]);
21297
+ const drag = (0, import_react91.useRef)();
21298
+ const [offset, setOffset] = (0, import_react91.useState)();
21299
+ (0, import_react91.useEffect)(() => {
21221
21300
  setIslands([]);
21222
21301
  drag.current = void 0;
21223
21302
  setOffset(void 0);
@@ -21318,12 +21397,12 @@ function logarithmicValueAt(progress, domain) {
21318
21397
 
21319
21398
  // src/components/Charts.tsx
21320
21399
  var import_jsx_runtime89 = require("react/jsx-runtime");
21321
- var import_react92 = require("react");
21400
+ var import_react93 = require("react");
21322
21401
  var PLOT = { x: 62, y: 48, width: 628, height: 250 };
21323
21402
  var PLOT_BOTTOM = PLOT.y + PLOT.height;
21324
21403
  function useLegendSelection(names, controlled, onChange) {
21325
- const [internal, setInternal] = (0, import_react91.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
21326
- (0, import_react91.useEffect)(() => {
21404
+ const [internal, setInternal] = (0, import_react92.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
21405
+ (0, import_react92.useEffect)(() => {
21327
21406
  setInternal((current) => {
21328
21407
  const next = { ...current };
21329
21408
  names.forEach((name) => {
@@ -21423,7 +21502,7 @@ function lineSymbol(type, x, y, size, color, image, strokeWidth = 2) {
21423
21502
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
21424
21503
  }
21425
21504
  function useZoom(value, defaultValue, onChange) {
21426
- const [internal, setInternal] = (0, import_react91.useState)([...defaultValue ?? [0, 100]]);
21505
+ const [internal, setInternal] = (0, import_react92.useState)([...defaultValue ?? [0, 100]]);
21427
21506
  const current = value ?? internal;
21428
21507
  const update = (next) => {
21429
21508
  if (!value) setInternal(next);
@@ -21433,8 +21512,8 @@ function useZoom(value, defaultValue, onChange) {
21433
21512
  }
21434
21513
  function useToolboxMagicType(toolbox, fallback) {
21435
21514
  const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
21436
- const [internal, setInternal] = (0, import_react91.useState)(options?.activeMagicType ?? fallback);
21437
- (0, import_react91.useEffect)(() => {
21515
+ const [internal, setInternal] = (0, import_react92.useState)(options?.activeMagicType ?? fallback);
21516
+ (0, import_react92.useEffect)(() => {
21438
21517
  if (options?.activeMagicType) setInternal(options.activeMagicType);
21439
21518
  }, [options?.activeMagicType]);
21440
21519
  const active = options?.activeMagicType ?? internal;
@@ -21452,15 +21531,15 @@ function useToolboxMagicType(toolbox, fallback) {
21452
21531
  } : toolbox;
21453
21532
  return [active, resolved];
21454
21533
  }
21455
- var LineChart = (0, import_react91.forwardRef)(function LineChart2({ calculableMode = "resize", onTransferError, grid, valueTransfer: externalValueTransfer, categories, series: sourceSeries, appearance = "sia", categoryLabelInterval = 0, boundaryGap = false, showCategorySplitLine = true, categoryAxisName, valueAxisName, legendLayout, logBase = 10, logExponentStep = 1, animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, stacked = false, orientation = "vertical", xAxisType = "category", valueAxisType = "value", valueAxisInverse = false, tooltipTrigger = "item", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, dataZoom = false, zoomIndexMode = "points", zoomPosition = "bottom", zoomControlBounds, zoomPan = false, zoomSelectionShape = "band", zoomSelectionStyle, zoomMinSelectionSize, calculable = false, zoom, defaultZoom, onZoomChange, onDataChange, palette, toolbox, ...props }, ref) {
21456
- const [hoverIndex, setHoverIndex] = (0, import_react91.useState)(null);
21457
- const [editableSeries, setEditableSeries] = (0, import_react91.useState)(sourceSeries);
21458
- const [dragPoint, setDragPoint] = (0, import_react91.useState)(null);
21459
- const linePaintId = (0, import_react91.useId)().replaceAll(":", "");
21460
- const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react91.useState)();
21461
- (0, import_react91.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
21534
+ var LineChart = (0, import_react92.forwardRef)(function LineChart2({ calculableMode = "resize", onTransferError, grid, valueTransfer: externalValueTransfer, categories, series: sourceSeries, appearance = "sia", categoryLabelInterval = 0, boundaryGap = false, showCategorySplitLine = true, categoryAxisName, valueAxisName, legendLayout, logBase = 10, logExponentStep = 1, animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, stacked = false, orientation = "vertical", xAxisType = "category", valueAxisType = "value", valueAxisInverse = false, tooltipTrigger = "item", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, dataZoom = false, zoomIndexMode = "points", zoomPosition = "bottom", zoomControlBounds, zoomPan = false, zoomSelectionShape = "band", zoomSelectionStyle, zoomMinSelectionSize, calculable = false, zoom, defaultZoom, onZoomChange, onDataChange, palette, toolbox, ...props }, ref) {
21535
+ const [hoverIndex, setHoverIndex] = (0, import_react92.useState)(null);
21536
+ const [editableSeries, setEditableSeries] = (0, import_react92.useState)(sourceSeries);
21537
+ const [dragPoint, setDragPoint] = (0, import_react92.useState)(null);
21538
+ const linePaintId = (0, import_react92.useId)().replaceAll(":", "");
21539
+ const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react92.useState)();
21540
+ (0, import_react92.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
21462
21541
  const series = externalValueTransfer ? sourceSeries : editableSeries;
21463
- const initialTransferSeries = (0, import_react91.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
21542
+ const initialTransferSeries = (0, import_react92.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
21464
21543
  const localTransfer = useBarValueTransfer(series.map((item) => ({ ...item, data: item.data.map(lineValue) })), initialTransferSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (nextBars) => {
21465
21544
  const next = series.map((item, row) => ({ ...item, data: item.data.map((datum, index) => {
21466
21545
  const value = barDatum(nextBars[row].data[index]).value;
@@ -21477,8 +21556,8 @@ var LineChart = (0, import_react91.forwardRef)(function LineChart2({ calculableM
21477
21556
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
21478
21557
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
21479
21558
  const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...withTitleTooltip(zoomControlBounds), children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartDataZoom, { handleLabels: [categories[Math.min(categories.length - 1, Math.floor(Math.min(...zoomValue) / 100 * categories.length))] ?? "", categories[Math.max(0, Math.ceil(Math.max(...zoomValue) / 100 * categories.length) - 1)] ?? ""], shadowBounds: zoomControlBounds, panEnabled: zoomPan, value: zoomValue, dataShadow: series[0]?.data.map(lineValue), onChange: setZoomValue }) }) : null;
21480
- const [zoomBrushActive, setZoomBrushActive] = (0, import_react91.useState)(false);
21481
- const [zoomHistory, setZoomHistory] = (0, import_react91.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
21559
+ const [zoomBrushActive, setZoomBrushActive] = (0, import_react92.useState)(false);
21560
+ const [zoomHistory, setZoomHistory] = (0, import_react92.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
21482
21561
  const zoomBrush = dataZoom && zoomBrushActive ? { minSelectionSize: zoomMinSelectionSize, selectionStyle: zoomSelectionStyle, selectionShape: zoomSelectionShape, bounds: PLOT2, onCancel: () => setZoomBrushActive(false), onSelect: (range) => {
21483
21562
  const start = Math.min(...zoomValue), span = Math.max(...zoomValue) - start;
21484
21563
  const next = [start + range[0] * span, start + range[1] * span];
@@ -21865,17 +21944,17 @@ function ChartPin({ point, color, label }) {
21865
21944
  function barDatum(datum) {
21866
21945
  return typeof datum === "number" ? { value: datum } : datum;
21867
21946
  }
21868
- var BarChart = (0, import_react91.forwardRef)(function BarChart2({ valueTransfer: externalValueTransfer, calculableMode = "resize", onTransferError, categories, series: sourceSeries, appearance = "sia", animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, grid, valueAxisPosition = "bottom", showValueAxis = true, showCategoryAxis = true, showCategorySplitLine = false, tooltipTrigger = "item", tooltipFormatter, stacked = false, orientation = "vertical", minBarSize = 1, calculable = false, onDataChange, showLegend = true, legendOrder, legendLayout, barCategoryGap = 0.2, valuePadding = 0, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
21869
- const [editableSeries, setEditableSeries] = (0, import_react91.useState)(sourceSeries);
21870
- const [dragBar, setDragBar] = (0, import_react91.useState)(null);
21871
- const [hoveredBar, setHoveredBar] = (0, import_react91.useState)();
21872
- const barPaintId = (0, import_react91.useId)().replaceAll(":", "");
21947
+ var BarChart = (0, import_react92.forwardRef)(function BarChart2({ valueTransfer: externalValueTransfer, calculableMode = "resize", onTransferError, categories, series: sourceSeries, appearance = "sia", animationProgress, animationDurationUpdate = 500, valueDomain, axisLabelFormatter, grid, valueAxisPosition = "bottom", showValueAxis = true, showCategoryAxis = true, showCategorySplitLine = false, tooltipTrigger = "item", tooltipFormatter, stacked = false, orientation = "vertical", minBarSize = 1, calculable = false, onDataChange, showLegend = true, legendOrder, legendLayout, barCategoryGap = 0.2, valuePadding = 0, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
21948
+ const [editableSeries, setEditableSeries] = (0, import_react92.useState)(sourceSeries);
21949
+ const [dragBar, setDragBar] = (0, import_react92.useState)(null);
21950
+ const [hoveredBar, setHoveredBar] = (0, import_react92.useState)();
21951
+ const barPaintId = (0, import_react92.useId)().replaceAll(":", "");
21873
21952
  const localTransfer = useBarValueTransfer(editableSeries, sourceSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (next) => {
21874
21953
  setEditableSeries(next);
21875
21954
  onDataChange?.(next);
21876
21955
  }, onTransferError);
21877
21956
  const transfer = externalValueTransfer ?? localTransfer;
21878
- (0, import_react91.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
21957
+ (0, import_react92.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
21879
21958
  const series = externalValueTransfer ? sourceSeries : editableSeries;
21880
21959
  const legacy = appearance === "macarons";
21881
21960
  const PLOT2 = legacy ? { x: grid?.left ?? 80, y: grid?.top ?? 60, width: (props.viewBoxSize?.[0] ?? 720) - (grid?.left ?? 80) - (grid?.right ?? 80), height: (props.viewBoxSize?.[1] ?? 360) - (grid?.top ?? 60) - (grid?.bottom ?? 70) } : { x: 62, y: 48, width: 628, height: 250 };
@@ -22122,17 +22201,17 @@ var BarChart = (0, import_react91.forwardRef)(function BarChart2({ valueTransfer
22122
22201
  ] }, `bar-island-${index}`)) : null
22123
22202
  ] });
22124
22203
  });
22125
- var ScatterChart = (0, import_react91.forwardRef)(function ScatterChart2({ symbolAnimation = false, animationProgress, animationDurationUpdate = 500, statisticPoints = [], statisticLines = [], annotations = [], data: initialData, toolbox, showXAxis = true, showXSplitLine = true, showYSplitLine = true, tooltipFormatter, plotBounds, xDomain: fixedXDomain, yDomain: fixedYDomain, showPointLabels = false, yAxisPosition = "left", xCategories, xFormatter, crosshair = false, markColor, xSplitNumber = 5, ySplitNumber = 5, symbolSize, markAppearance = "label", markByCategory = false, xUnit = "", yUnit = "", minSymbolRadius = 5, xLabel, yLabel, xAxisType = "value", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, dataZoom = false, zoom, defaultZoom, onZoomChange, visualMap, markAverage, markExtremes = false, largeThreshold = 1200, onDataClick, palette, ...props }, ref) {
22126
- const [data, setData] = (0, import_react91.useState)(initialData);
22127
- const [emphasizedPoint, setEmphasizedPoint] = (0, import_react91.useState)(null);
22128
- const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react91.useState)();
22129
- (0, import_react91.useEffect)(() => setData(initialData), [initialData]);
22204
+ var ScatterChart = (0, import_react92.forwardRef)(function ScatterChart2({ symbolAnimation = false, animationProgress, animationDurationUpdate = 500, statisticPoints = [], statisticLines = [], annotations = [], data: initialData, toolbox, showXAxis = true, showXSplitLine = true, showYSplitLine = true, tooltipFormatter, plotBounds, xDomain: fixedXDomain, yDomain: fixedYDomain, showPointLabels = false, yAxisPosition = "left", xCategories, xFormatter, crosshair = false, markColor, xSplitNumber = 5, ySplitNumber = 5, symbolSize, markAppearance = "label", markByCategory = false, xUnit = "", yUnit = "", minSymbolRadius = 5, xLabel, yLabel, xAxisType = "value", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, dataZoom = false, zoom, defaultZoom, onZoomChange, visualMap, markAverage, markExtremes = false, largeThreshold = 1200, onDataClick, palette, ...props }, ref) {
22205
+ const [data, setData] = (0, import_react92.useState)(initialData);
22206
+ const [emphasizedPoint, setEmphasizedPoint] = (0, import_react92.useState)(null);
22207
+ const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react92.useState)();
22208
+ (0, import_react92.useEffect)(() => setData(initialData), [initialData]);
22130
22209
  const plot = plotBounds ?? PLOT, bottom = plot.y + plot.height;
22131
22210
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
22132
22211
  const allCategories = [...new Set(data.map((item) => item.category).filter((value) => Boolean(value)))];
22133
22212
  const legend = useLegendSelection(allCategories, legendSelected, onLegendSelectionChange);
22134
22213
  const activeData = data.filter((item) => !item.category || legend.isSelected(item.category));
22135
- const sorted = (0, import_react91.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
22214
+ const sorted = (0, import_react92.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
22136
22215
  const startIndex = dataZoom ? Math.floor(Math.min(...zoomValue) / 100 * Math.max(0, sorted.length - 1)) : 0;
22137
22216
  const endIndex = dataZoom ? Math.max(startIndex + 1, Math.ceil(Math.max(...zoomValue) / 100 * sorted.length)) : sorted.length;
22138
22217
  const categoryWindow = xCategories ? scatterCategoryWindow(xCategories, dataZoom ? zoomValue : [0, 100]) : void 0;
@@ -22147,10 +22226,10 @@ var ScatterChart = (0, import_react91.forwardRef)(function ScatterChart2({ symbo
22147
22226
  const visualMinimum = visualMap?.min ?? (visualValues.length ? Math.min(...visualValues) : 0);
22148
22227
  const visualMaximum = visualMap?.max ?? (visualValues.length ? Math.max(...visualValues) : 1);
22149
22228
  const visualColors = visualMap?.colors ?? ["#e6f4ff", "#1677ff"];
22150
- const [selectedPieces, setSelectedPieces] = (0, import_react91.useState)([]);
22151
- const [visualRange, setVisualRange] = (0, import_react91.useState)();
22229
+ const [selectedPieces, setSelectedPieces] = (0, import_react92.useState)([]);
22230
+ const [visualRange, setVisualRange] = (0, import_react92.useState)();
22152
22231
  const piecesKey = JSON.stringify(visualMap?.pieces ?? []);
22153
- (0, import_react91.useEffect)(() => setSelectedPieces([]), [piecesKey]);
22232
+ (0, import_react92.useEffect)(() => setSelectedPieces([]), [piecesKey]);
22154
22233
  const statistics = scatterStatistics(visibleData, markByCategory);
22155
22234
  const plotted = visibleData.map((item, index) => {
22156
22235
  const x = linearScale(categoryWindow ? categoryWindow.indexOf(item.x) : item.x, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]);
@@ -22308,8 +22387,8 @@ var ScatterChart = (0, import_react91.forwardRef)(function ScatterChart2({ symbo
22308
22387
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue })
22309
22388
  ] }) : content;
22310
22389
  });
22311
- var CandlestickChart = (0, import_react91.forwardRef)(function CandlestickChart2({ showAxes = true, data: initialData, valueDomain, axisLabelFormatter, activeIndex, onActiveIndexChange, seriesVisible: controlledVisible, onSeriesVisibilityChange, showLegend = true, showCategoryLabels = true, plotBounds, markPoints, seriesName, risingBorderColor, fallingBorderColor, borderWidth = 2, risingEmphasisColor, fallingEmphasisColor, maxBarWidth = 34, appearance = "sia", risingColor = "#f5222d", fallingColor = "#52c41a", hollowRising = false, dataZoom = false, zoom, defaultZoom, onZoomChange, markExtremes = false, onDataClick, toolbox, ...props }, ref) {
22312
- const [data, setData] = (0, import_react91.useState)(initialData), [internalActive, setInternalActive] = (0, import_react91.useState)(null), [internalVisible, setInternalVisible] = (0, import_react91.useState)(true);
22390
+ var CandlestickChart = (0, import_react92.forwardRef)(function CandlestickChart2({ showAxes = true, data: initialData, valueDomain, axisLabelFormatter, activeIndex, onActiveIndexChange, seriesVisible: controlledVisible, onSeriesVisibilityChange, showLegend = true, showCategoryLabels = true, plotBounds, markPoints, seriesName, risingBorderColor, fallingBorderColor, borderWidth = 2, risingEmphasisColor, fallingEmphasisColor, maxBarWidth = 34, appearance = "sia", risingColor = "#f5222d", fallingColor = "#52c41a", hollowRising = false, dataZoom = false, zoom, defaultZoom, onZoomChange, markExtremes = false, onDataClick, toolbox, ...props }, ref) {
22391
+ const [data, setData] = (0, import_react92.useState)(initialData), [internalActive, setInternalActive] = (0, import_react92.useState)(null), [internalVisible, setInternalVisible] = (0, import_react92.useState)(true);
22313
22392
  const active = activeIndex === void 0 ? internalActive : activeIndex;
22314
22393
  const seriesVisible = controlledVisible ?? internalVisible;
22315
22394
  const setActive = (index) => {
@@ -22320,7 +22399,7 @@ var CandlestickChart = (0, import_react91.forwardRef)(function CandlestickChart2
22320
22399
  if (controlledVisible === void 0) setInternalVisible(visible);
22321
22400
  onSeriesVisibilityChange?.(visible);
22322
22401
  };
22323
- (0, import_react91.useEffect)(() => {
22402
+ (0, import_react92.useEffect)(() => {
22324
22403
  setData(initialData);
22325
22404
  }, [initialData]);
22326
22405
  const legacy = appearance === "macarons";
@@ -22411,20 +22490,20 @@ var CandlestickChart = (0, import_react91.forwardRef)(function CandlestickChart2
22411
22490
  ] }) : content;
22412
22491
  });
22413
22492
  var EMPTY_PIE_DATA = [];
22414
- var PieChart = (0, import_react91.forwardRef)(function PieChart2({ pulseRing, calculable = false, markPoints = [], data = EMPTY_PIE_DATA, series, innerRadius = 62, outerRadius = 124, rose = false, center = [360, 173], startAngle = -90, clockwise = true, padAngle = 0, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, showLabels = true, showLabelLines = true, centerLabel, selectedMode = false, selected, defaultSelected, selectedOffset = 9, onSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, animationDurationUpdate = 500, legendLayout, showGuideRings = false, onDataChange, transferId, onValueTransfer, onTransferError, onValueDragOut, outsideLabelLayout, ...props }, ref) {
22415
- const pieGradientId = (0, import_react91.useId)().replace(/:/g, "");
22416
- const [pieIslands, setPieIslands] = (0, import_react91.useState)([]);
22417
- const sourceRings = (0, import_react91.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
22418
- const [editableRings, setEditableRings] = (0, import_react91.useState)(sourceRings);
22419
- const valueDrag = (0, import_react91.useRef)(null);
22420
- const [valueOffset, setValueOffset] = (0, import_react91.useState)();
22421
- (0, import_react91.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
22493
+ var PieChart = (0, import_react92.forwardRef)(function PieChart2({ pulseRing, calculable = false, markPoints = [], data = EMPTY_PIE_DATA, series, innerRadius = 62, outerRadius = 124, rose = false, center = [360, 173], startAngle = -90, clockwise = true, padAngle = 0, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, showLabels = true, showLabelLines = true, centerLabel, selectedMode = false, selected, defaultSelected, selectedOffset = 9, onSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, animationDurationUpdate = 500, legendLayout, showGuideRings = false, onDataChange, transferId, onValueTransfer, onTransferError, onValueDragOut, outsideLabelLayout, ...props }, ref) {
22494
+ const pieGradientId = (0, import_react92.useId)().replace(/:/g, "");
22495
+ const [pieIslands, setPieIslands] = (0, import_react92.useState)([]);
22496
+ const sourceRings = (0, import_react92.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
22497
+ const [editableRings, setEditableRings] = (0, import_react92.useState)(sourceRings);
22498
+ const valueDrag = (0, import_react92.useRef)(null);
22499
+ const [valueOffset, setValueOffset] = (0, import_react92.useState)();
22500
+ (0, import_react92.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
22422
22501
  const allData = editableRings.flatMap((ring) => ring.data).filter((item) => !item.missing);
22423
22502
  const names = [...new Set(allData.map((item) => item.name))];
22424
22503
  const legend = useLegendSelection(names, legendSelected, onLegendSelectionChange);
22425
22504
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u997C\u56FE");
22426
- const [hovered, setHovered] = (0, import_react91.useState)();
22427
- const [internalSelected, setInternalSelected] = (0, import_react91.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
22505
+ const [hovered, setHovered] = (0, import_react92.useState)();
22506
+ const [internalSelected, setInternalSelected] = (0, import_react92.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
22428
22507
  const selectedNames = selected ?? internalSelected;
22429
22508
  const legacy = appearance === "macarons";
22430
22509
  const colorNames = [...new Set(allData.filter((item) => item.showInLegend !== false).map((item) => item.name))];
@@ -22644,15 +22723,15 @@ var PieChart = (0, import_react91.forwardRef)(function PieChart2({ pulseRing, ca
22644
22723
  });
22645
22724
  var EMPTY_RADAR_INDICATORS = [];
22646
22725
  var EMPTY_RADAR_SERIES = [];
22647
- var RadarChart = (0, import_react91.forwardRef)(function RadarChart2({ indicators = EMPTY_RADAR_INDICATORS, series = EMPTY_RADAR_SERIES, radars, calculable = false, onTransferError, markers, levels = 5, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
22726
+ var RadarChart = (0, import_react92.forwardRef)(function RadarChart2({ indicators = EMPTY_RADAR_INDICATORS, series = EMPTY_RADAR_SERIES, radars, calculable = false, onTransferError, markers, levels = 5, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
22648
22727
  const legacy = appearance === "macarons";
22649
- const initialPanels = (0, import_react91.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
22650
- const [sourcePanels, setSourcePanels] = (0, import_react91.useState)(initialPanels);
22651
- const [hoveredRadar, setHoveredRadar] = (0, import_react91.useState)(null);
22652
- const radarPaintId = `sia-radar-${(0, import_react91.useId)().replaceAll(":", "")}`;
22653
- const radarDrag = (0, import_react91.useRef)(null);
22654
- const [radarOffset, setRadarOffset] = (0, import_react91.useState)(null);
22655
- (0, import_react91.useEffect)(() => {
22728
+ const initialPanels = (0, import_react92.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
22729
+ const [sourcePanels, setSourcePanels] = (0, import_react92.useState)(initialPanels);
22730
+ const [hoveredRadar, setHoveredRadar] = (0, import_react92.useState)(null);
22731
+ const radarPaintId = `sia-radar-${(0, import_react92.useId)().replaceAll(":", "")}`;
22732
+ const radarDrag = (0, import_react92.useRef)(null);
22733
+ const [radarOffset, setRadarOffset] = (0, import_react92.useState)(null);
22734
+ (0, import_react92.useEffect)(() => {
22656
22735
  setSourcePanels(initialPanels);
22657
22736
  radarDrag.current = null;
22658
22737
  setRadarOffset(null);
@@ -22806,7 +22885,7 @@ var RadarChart = (0, import_react91.forwardRef)(function RadarChart2({ indicator
22806
22885
  })
22807
22886
  ] });
22808
22887
  });
22809
- var ChordChart = (0, import_react91.forwardRef)(function ChordChart2({ nodes, links, nodeGeometry, matrixAppearance, matrix, matrixSeries, showNodeLabels = false, rotateNodeLabels = false, matrixLinkLabel, matrixGeometry, legacySubSort = false, showScale = false, sortSub = "none", padAngle = 0.035, ribbon = true, clockwise = true, sort = "none", onNodeClick, onLinkClick, palette, toolbox, ...props }, ref) {
22888
+ var ChordChart = (0, import_react92.forwardRef)(function ChordChart2({ nodes, links, nodeGeometry, matrixAppearance, matrix, matrixSeries, showNodeLabels = false, rotateNodeLabels = false, matrixLinkLabel, matrixGeometry, legacySubSort = false, showScale = false, sortSub = "none", padAngle = 0.035, ribbon = true, clockwise = true, sort = "none", onNodeClick, onLinkClick, palette, toolbox, ...props }, ref) {
22810
22889
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u548C\u5F26");
22811
22890
  if (/force|力导向|关系/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
22812
22891
  GraphChart,
@@ -22879,11 +22958,11 @@ var ChordChart = (0, import_react91.forwardRef)(function ChordChart2({ nodes, li
22879
22958
  })
22880
22959
  ] });
22881
22960
  });
22882
- var GraphChart = (0, import_react91.forwardRef)(function GraphChart2({ nodes, links, roam = false, chordOptions, forceOptions, progressiveForce = false, layout = "circular", showLabels = true, draggable = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onNodeClick, palette, toolbox, ...props }, ref) {
22961
+ var GraphChart = (0, import_react92.forwardRef)(function GraphChart2({ nodes, links, roam = false, chordOptions, forceOptions, progressiveForce = false, layout = "circular", showLabels = true, draggable = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onNodeClick, palette, toolbox, ...props }, ref) {
22883
22962
  const categories = [...new Set(nodes.map((node) => node.category).filter((value) => Boolean(value)))];
22884
22963
  const legend = useLegendSelection(categories, legendSelected, onLegendSelectionChange);
22885
22964
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, layout === "force" ? "\u529B\u5BFC\u5411" : "\u5173\u7CFB");
22886
- const [roamReset, setRoamReset] = (0, import_react91.useState)(0);
22965
+ const [roamReset, setRoamReset] = (0, import_react92.useState)(0);
22887
22966
  const chartToolbox = typeof resolvedToolbox === "object" ? {
22888
22967
  ...resolvedToolbox,
22889
22968
  onRestore: () => {
@@ -22892,23 +22971,23 @@ var GraphChart = (0, import_react91.forwardRef)(function GraphChart2({ nodes, li
22892
22971
  resolvedToolbox.onRestore?.();
22893
22972
  }
22894
22973
  } : resolvedToolbox;
22895
- const activeNodes = (0, import_react91.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
22896
- const activeLinks = (0, import_react91.useMemo)(() => {
22974
+ const activeNodes = (0, import_react92.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
22975
+ const activeLinks = (0, import_react92.useMemo)(() => {
22897
22976
  const activeIds = new Set(activeNodes.map((node) => node.id));
22898
22977
  return links.filter((link) => activeIds.has(link.source) && activeIds.has(link.target));
22899
22978
  }, [activeNodes, links]);
22900
22979
  const progressive = progressiveForce && layout === "force" && props.animation !== false && !/chord|和弦/i.test(magicType);
22901
- const calculatedPositions = (0, import_react91.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
22902
- const [positions, setPositions] = (0, import_react91.useState)(calculatedPositions);
22903
- const [dragging, setDragging] = (0, import_react91.useState)(null);
22904
- const heldNode = (0, import_react91.useRef)(null);
22905
- const [forceRestart, setForceRestart] = (0, import_react91.useState)(0);
22906
- (0, import_react91.useEffect)(() => {
22980
+ const calculatedPositions = (0, import_react92.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
22981
+ const [positions, setPositions] = (0, import_react92.useState)(calculatedPositions);
22982
+ const [dragging, setDragging] = (0, import_react92.useState)(null);
22983
+ const heldNode = (0, import_react92.useRef)(null);
22984
+ const [forceRestart, setForceRestart] = (0, import_react92.useState)(0);
22985
+ (0, import_react92.useEffect)(() => {
22907
22986
  setPositions(calculatedPositions);
22908
22987
  setDragging(null);
22909
22988
  heldNode.current = null;
22910
22989
  }, [calculatedPositions, roamReset]);
22911
- (0, import_react91.useEffect)(() => {
22990
+ (0, import_react92.useEffect)(() => {
22912
22991
  if (!progressive || activeNodes.length > (forceOptions?.maxNodes ?? 80)) return;
22913
22992
  let frame = 0, remaining = Math.max(0, forceOptions?.iterations ?? 140), previous, carry = 0;
22914
22993
  const tick = (time) => {
@@ -23026,7 +23105,7 @@ var GraphChart = (0, import_react91.forwardRef)(function GraphChart2({ nodes, li
23026
23105
  ] })
23027
23106
  ] });
23028
23107
  });
23029
- var ForceGraphChart = (0, import_react91.forwardRef)(function ForceGraphChart2(props, ref) {
23108
+ var ForceGraphChart = (0, import_react92.forwardRef)(function ForceGraphChart2(props, ref) {
23030
23109
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(GraphChart, { ...props, layout: "force", ref });
23031
23110
  });
23032
23111
  var ForceChart = ForceGraphChart;
@@ -23055,12 +23134,12 @@ function colorBetween(start, end, ratio) {
23055
23134
  const to = read(end);
23056
23135
  return `rgb(${from.map((value, index) => Math.round(value + ((to[index] ?? value) - value) * Math.max(0, Math.min(1, ratio)))).join(" ")})`;
23057
23136
  }
23058
- var MapChart = (0, import_react91.forwardRef)(function MapChart2({ overlayProjection, bundledLines, largeMarkPoints, markLineEffectRenderer = "svg", insetStyle, insetLabelStyle, regionHoverable = true, markPointTooltipFormatter, emphasisValueRange, onRegionHover, coordinateTransform, specialAreas, labelCoordinates, labelOffsets, nameMap, wheelZoomFactors, clampVisualValues = false, showMap = true, visualMapLayout, labelStyle, emphasisLabelStyle, regionStyle, emphasisRegionStyle, outOfRangeColor, scaleLimit, roamController = false, map, geoJson, data, colors = ["#e6f4ff", "#1677ff"], nameProperty = "name", showLabels = true, showEmphasisLabels = false, tooltipFormatter, roam = false, selectedMode = false, selected, defaultSelected, onSelectionChange, calculableVisualMap = false, visualRange, defaultVisualRange, onVisualRangeChange, markPoints = [], markLines = [], onRegionClick, toolbox, plotBounds: sourcePlotBounds, longitudeRatio, geographicInsets = [], valueDomain, showVisualMap = true, seriesName, ...props }, ref) {
23059
- const [internalSelected, setInternalSelected] = (0, import_react91.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
23137
+ var MapChart = (0, import_react92.forwardRef)(function MapChart2({ overlayProjection, bundledLines, largeMarkPoints, markLineEffectRenderer = "svg", insetStyle, insetLabelStyle, regionHoverable = true, markPointTooltipFormatter, emphasisValueRange, onRegionHover, coordinateTransform, specialAreas, labelCoordinates, labelOffsets, nameMap, wheelZoomFactors, clampVisualValues = false, showMap = true, visualMapLayout, labelStyle, emphasisLabelStyle, regionStyle, emphasisRegionStyle, outOfRangeColor, scaleLimit, roamController = false, map, geoJson, data, colors = ["#e6f4ff", "#1677ff"], nameProperty = "name", showLabels = true, showEmphasisLabels = false, tooltipFormatter, roam = false, selectedMode = false, selected, defaultSelected, onSelectionChange, calculableVisualMap = false, visualRange, defaultVisualRange, onVisualRangeChange, markPoints = [], markLines = [], onRegionClick, toolbox, plotBounds: sourcePlotBounds, longitudeRatio, geographicInsets = [], valueDomain, showVisualMap = true, seriesName, ...props }, ref) {
23138
+ const [internalSelected, setInternalSelected] = (0, import_react92.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
23060
23139
  const selectedNames = selected ?? internalSelected;
23061
- const [hoveredRegion, setHoveredRegion] = (0, import_react91.useState)();
23062
- const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react91.useState)();
23063
- const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react91.useState)();
23140
+ const [hoveredRegion, setHoveredRegion] = (0, import_react92.useState)();
23141
+ const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react92.useState)();
23142
+ const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react92.useState)();
23064
23143
  const hoveredValueRange = emphasisValueRange ?? internalHoveredValueRange;
23065
23144
  const roamControl = useMapRoam(roam, scaleLimit, wheelZoomFactors);
23066
23145
  const { view } = roamControl;
@@ -23075,8 +23154,8 @@ var MapChart = (0, import_react91.forwardRef)(function MapChart2({ overlayProjec
23075
23154
  const values = data.map((item) => item.value);
23076
23155
  const minimum = valueDomain?.[0] ?? (values.length ? Math.min(...values) : 0);
23077
23156
  const maximum = valueDomain?.[1] ?? (values.length ? Math.max(...values) : 1);
23078
- const [internalVisualRange, setInternalVisualRange] = (0, import_react91.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
23079
- (0, import_react91.useEffect)(() => {
23157
+ const [internalVisualRange, setInternalVisualRange] = (0, import_react92.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
23158
+ (0, import_react92.useEffect)(() => {
23080
23159
  if (!visualRange && !defaultVisualRange) setInternalVisualRange([minimum, maximum]);
23081
23160
  }, [defaultVisualRange, maximum, minimum, visualRange]);
23082
23161
  const currentVisualRange = visualRange ?? internalVisualRange;
@@ -23252,7 +23331,7 @@ var MapChart = (0, import_react91.forwardRef)(function MapChart2({ overlayProjec
23252
23331
  roamController ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartRoamController, { x: (props.viewBoxSize?.[0] ?? 720) - 90, y: 5, onPan: roamControl.pan, onZoom: (factor) => roamControl.zoom(factor, [(props.viewBoxSize?.[0] ?? 720) / 2, (props.viewBoxSize?.[1] ?? 360) / 2]) }) : null
23253
23332
  ] });
23254
23333
  });
23255
- var GaugeChart = (0, import_react91.forwardRef)(function GaugeChart2({ tooltipFormatter, data, min = 0, max = 100, startAngle = 210, endAngle = -30, segments, splitNumber = 10, showAxisLabels = true, showProgress = true, detailOffset = 84, valueFormatter, onDataClick, palette, appearance = "sia", animationProgress, ...props }, ref) {
23334
+ var GaugeChart = (0, import_react92.forwardRef)(function GaugeChart2({ tooltipFormatter, data, min = 0, max = 100, startAngle = 210, endAngle = -30, segments, splitNumber = 10, showAxisLabels = true, showProgress = true, detailOffset = 84, valueFormatter, onDataClick, palette, appearance = "sia", animationProgress, ...props }, ref) {
23256
23335
  const count = Math.max(1, data.length);
23257
23336
  const legacy = appearance === "macarons";
23258
23337
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(SiaChart, { ...props, className: `${props.className ?? ""}${legacy ? " sia-chart--macarons" : ""}`, ref, palette, empty: !data.length, ariaLabel: props.ariaLabel ?? "\u4EEA\u8868\u76D8", children: [...data].sort((a, b) => (a.zIndex ?? 0) - (b.zIndex ?? 0)).map((item, index) => {
@@ -23335,12 +23414,12 @@ var GaugeChart = (0, import_react91.forwardRef)(function GaugeChart2({ tooltipFo
23335
23414
  ] }, `${item.name}-${index}`);
23336
23415
  }) });
23337
23416
  });
23338
- var FunnelChart = (0, import_react91.forwardRef)(function FunnelChart2({ data = EMPTY_PIE_DATA, series, sort = "descending", gap = 4, align = "center", orientation = "vertical", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
23417
+ var FunnelChart = (0, import_react92.forwardRef)(function FunnelChart2({ data = EMPTY_PIE_DATA, series, sort = "descending", gap = 4, align = "center", orientation = "vertical", showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, toolbox, appearance = "sia", animationProgress, legendOrder, legendLayout, onDataChange, ...props }, ref) {
23339
23418
  const legacy = appearance === "macarons";
23340
- const [activeFunnel, setActiveFunnel] = (0, import_react91.useState)(null);
23341
- const initialFunnels = (0, import_react91.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
23342
- const [sourceFunnels, setSourceFunnels] = (0, import_react91.useState)(initialFunnels);
23343
- (0, import_react91.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
23419
+ const [activeFunnel, setActiveFunnel] = (0, import_react92.useState)(null);
23420
+ const initialFunnels = (0, import_react92.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
23421
+ const [sourceFunnels, setSourceFunnels] = (0, import_react92.useState)(initialFunnels);
23422
+ (0, import_react92.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
23344
23423
  const allData = sourceFunnels.flatMap((funnel) => funnel.data);
23345
23424
  const legendData = [...new Map(allData.map((item) => [item.name, item])).values()];
23346
23425
  const legend = useLegendSelection(legendData.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -23431,7 +23510,7 @@ var FunnelChart = (0, import_react91.forwardRef)(function FunnelChart2({ data =
23431
23510
  })
23432
23511
  ] });
23433
23512
  });
23434
- var HeatmapChart = (0, import_react91.forwardRef)(function HeatmapChart2({ raster, xLabels = [], yLabels = [], data = [], points = [], colors = ["#e6f4ff", "#1677ff"], showValues = false, pointRadius = 30, blur = 16, minAlpha = 0.12, maxAlpha = 0.82, valueFormatter, onDataClick, ...props }, ref) {
23513
+ var HeatmapChart = (0, import_react92.forwardRef)(function HeatmapChart2({ raster, xLabels = [], yLabels = [], data = [], points = [], colors = ["#e6f4ff", "#1677ff"], showValues = false, pointRadius = 30, blur = 16, minAlpha = 0.12, maxAlpha = 0.82, valueFormatter, onDataClick, ...props }, ref) {
23435
23514
  const pointMode = points.length > 0;
23436
23515
  const values = pointMode ? points.map((point) => point.value) : data.flatMap((row) => [...row]);
23437
23516
  const minimum = values.length ? Math.min(...values) : 0;
@@ -23440,7 +23519,7 @@ var HeatmapChart = (0, import_react91.forwardRef)(function HeatmapChart2({ raste
23440
23519
  const cellHeight = PLOT.height / Math.max(1, yLabels.length);
23441
23520
  const pointXDomain = niceChartDomain(points.map((point) => point.x), false);
23442
23521
  const pointYDomain = niceChartDomain(points.map((point) => point.y), false);
23443
- const filterId = `sia-heat-${(0, import_react91.useId)().replaceAll(":", "")}`;
23522
+ const filterId = `sia-heat-${(0, import_react92.useId)().replaceAll(":", "")}`;
23444
23523
  if (raster) return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(SiaChart, { ...props, ref, empty: !points.length, ariaLabel: props.ariaLabel ?? "\u50CF\u7D20\u70ED\u529B\u56FE", children: [
23445
23524
  raster.backgroundImage ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("image", { href: raster.backgroundImage, x: 0, y: 0, width: raster.width, height: raster.height, preserveAspectRatio: "none", pointerEvents: "none" }) : null,
23446
23525
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(HeatmapRaster, { width: raster.width, height: raster.height, points, options: raster })
@@ -23476,7 +23555,7 @@ var HeatmapChart = (0, import_react91.forwardRef)(function HeatmapChart2({ raste
23476
23555
  ] })
23477
23556
  ] });
23478
23557
  });
23479
- var ThemeRiverChart = (0, import_react91.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
23558
+ var ThemeRiverChart = (0, import_react92.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
23480
23559
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
23481
23560
  const activeSeries = series.filter((item) => legend.isSelected(item.name));
23482
23561
  const totals = categories.map((_, index) => activeSeries.reduce((sum, item) => sum + Math.max(0, item.data[index] ?? 0), 0));
@@ -23514,8 +23593,8 @@ function eventTime(value) {
23514
23593
  if (typeof value === "number") return value;
23515
23594
  return Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value) ? value.replace(/-/g, "/") : value);
23516
23595
  }
23517
- var EventRiverChart = (0, import_react91.forwardRef)(function EventRiverChart2({ series, showLabels = true, draggable = true, appearance = "sia", plot = PLOT, animationProgress, boundaryGap = [0.05, 0.1], legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
23518
- const [restoreVersion, setRestoreVersion] = (0, import_react91.useState)(0);
23596
+ var EventRiverChart = (0, import_react92.forwardRef)(function EventRiverChart2({ series, showLabels = true, draggable = true, appearance = "sia", plot = PLOT, animationProgress, boundaryGap = [0.05, 0.1], legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
23597
+ const [restoreVersion, setRestoreVersion] = (0, import_react92.useState)(0);
23519
23598
  const area = plot;
23520
23599
  palette = palette ?? (appearance === "macarons" ? ["#2ec7c9", "#b6a2de"] : void 0);
23521
23600
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -23588,9 +23667,9 @@ function vennDistance(radiusA, radiusB, overlap) {
23588
23667
  }
23589
23668
  return (low + high) / 2;
23590
23669
  }
23591
- var VennChart = (0, import_react91.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
23592
- const [sets, setSets] = (0, import_react91.useState)(initialSets), [intersection, setIntersection] = (0, import_react91.useState)(initialIntersection), [active, setActive] = (0, import_react91.useState)();
23593
- (0, import_react91.useEffect)(() => {
23670
+ var VennChart = (0, import_react92.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
23671
+ const [sets, setSets] = (0, import_react92.useState)(initialSets), [intersection, setIntersection] = (0, import_react92.useState)(initialIntersection), [active, setActive] = (0, import_react92.useState)();
23672
+ (0, import_react92.useEffect)(() => {
23594
23673
  setSets(initialSets);
23595
23674
  setIntersection(initialIntersection);
23596
23675
  }, [initialSets, initialIntersection]);
@@ -23653,17 +23732,17 @@ function layoutTreemap(nodes, x, y, width, height, gap, maxDepth, depth = 0, see
23653
23732
  });
23654
23733
  return result;
23655
23734
  }
23656
- var TreemapChart = (0, import_react91.forwardRef)(function TreemapChart2({ data, gap = 4, maxDepth = 2, drilldown = false, showBreadcrumb = true, bounds, itemStyle, emphasis, cornerRadius = 5, showChildBoundaries = false, breadcrumbPosition = "top", breadcrumbRootName = "\u5168\u90E8", valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
23657
- const [path, setPath] = (0, import_react91.useState)([]);
23658
- const [sourceData, setSourceData] = (0, import_react91.useState)(data);
23659
- const [active, setActive] = (0, import_react91.useState)();
23660
- (0, import_react91.useEffect)(() => {
23735
+ var TreemapChart = (0, import_react92.forwardRef)(function TreemapChart2({ data, gap = 4, maxDepth = 2, drilldown = false, showBreadcrumb = true, bounds, itemStyle, emphasis, cornerRadius = 5, showChildBoundaries = false, breadcrumbPosition = "top", breadcrumbRootName = "\u5168\u90E8", valueFormatter, onDataClick, palette, toolbox, ...props }, ref) {
23736
+ const [path, setPath] = (0, import_react92.useState)([]);
23737
+ const [sourceData, setSourceData] = (0, import_react92.useState)(data);
23738
+ const [active, setActive] = (0, import_react92.useState)();
23739
+ (0, import_react92.useEffect)(() => {
23661
23740
  setSourceData(data);
23662
23741
  setPath([]);
23663
23742
  }, [data]);
23664
23743
  const currentData = path.reduce((nodes, name) => nodes.find((node) => node.name === name)?.children ?? nodes, sourceData);
23665
23744
  const top = drilldown && showBreadcrumb ? 52 : 28;
23666
- const rectangles = (0, import_react91.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
23745
+ const rectangles = (0, import_react92.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
23667
23746
  const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: currentData.map((node) => ({ name: node.name, data: [treemapValue(node)] })), onApply: (values) => {
23668
23747
  const update = (nodes, depth) => nodes.map((node, i) => depth === path.length ? { ...node, value: values[i][0] } : node.name === path[depth] ? { ...node, children: update(node.children ?? [], depth + 1) } : node);
23669
23748
  setSourceData(update(sourceData, 0));
@@ -23731,15 +23810,15 @@ function flattenTree2(root, collapsed) {
23731
23810
  visit(root, 0);
23732
23811
  return { nodes, leafCount: Math.max(1, leafOrder), maxDepth: Math.max(0, ...nodes.map((item) => item.depth)) };
23733
23812
  }
23734
- var TreeChart = (0, import_react91.forwardRef)(function TreeChart2({ data, itemStyle, emphasis, orientation = "horizontal", radial = false, nodeSize = 8, rootPosition, nodePadding, layerPadding, showLabels = true, emphasisShowLabels = true, nodeColor, edgeColor, edgeWidth, edgeShadow, roam = false, hoverable = true, labelFontSize, labelColor, linkStyle = "curve", collapsible = false, onToggle, onDataClick, palette, toolbox, ...props }, ref) {
23735
- const [sourceData, setSourceData] = (0, import_react91.useState)(data);
23736
- const [roamReset, setRoamReset] = (0, import_react91.useState)(0);
23737
- const [active, setActive] = (0, import_react91.useState)();
23738
- (0, import_react91.useEffect)(() => {
23813
+ var TreeChart = (0, import_react92.forwardRef)(function TreeChart2({ data, itemStyle, emphasis, orientation = "horizontal", radial = false, nodeSize = 8, rootPosition, nodePadding, layerPadding, showLabels = true, emphasisShowLabels = true, nodeColor, edgeColor, edgeWidth, edgeShadow, roam = false, hoverable = true, labelFontSize, labelColor, linkStyle = "curve", collapsible = false, onToggle, onDataClick, palette, toolbox, ...props }, ref) {
23814
+ const [sourceData, setSourceData] = (0, import_react92.useState)(data);
23815
+ const [roamReset, setRoamReset] = (0, import_react92.useState)(0);
23816
+ const [active, setActive] = (0, import_react92.useState)();
23817
+ (0, import_react92.useEffect)(() => {
23739
23818
  setSourceData(data);
23740
23819
  setActive(void 0);
23741
23820
  }, [data]);
23742
- const [collapsed, setCollapsed] = (0, import_react91.useState)(() => {
23821
+ const [collapsed, setCollapsed] = (0, import_react92.useState)(() => {
23743
23822
  const result = /* @__PURE__ */ new Set();
23744
23823
  const visit = (node) => {
23745
23824
  if (node.collapsed) result.add(node.name);
@@ -23748,8 +23827,8 @@ var TreeChart = (0, import_react91.forwardRef)(function TreeChart2({ data, itemS
23748
23827
  visit(data);
23749
23828
  return result;
23750
23829
  });
23751
- const layout = (0, import_react91.useMemo)(() => flattenTree2(sourceData, collapsed), [collapsed, sourceData]);
23752
- const fixedLayout = (0, import_react91.useMemo)(() => {
23830
+ const layout = (0, import_react92.useMemo)(() => flattenTree2(sourceData, collapsed), [collapsed, sourceData]);
23831
+ const fixedLayout = (0, import_react92.useMemo)(() => {
23753
23832
  const visible = (node) => ({ ...node, children: collapsed.has(node.name) ? [] : node.children?.map(visible) });
23754
23833
  return rootPosition ? layoutTreeNodes(visible(sourceData), { nodeSize, nodePadding, layerPadding, rootPosition, orientation }) : void 0;
23755
23834
  }, [sourceData, collapsed, rootPosition, nodeSize, nodePadding, layerPadding, orientation]);
@@ -23819,15 +23898,15 @@ var TreeChart = (0, import_react91.forwardRef)(function TreeChart2({ data, itemS
23819
23898
  })
23820
23899
  ] }) });
23821
23900
  });
23822
- var WordCloudChart = (0, import_react91.forwardRef)(function WordCloudChart2({ data, bounds, areaSizing = false, autoFit = false, onLayout, minFontSize = 14, maxFontSize = 52, rotations = [0, 0, -28, 28, 0], spiralStep = 9, shape = "ellipse", padding = 4, fontFamily, fontWeight = 650, onDataClick, palette, ...props }, ref) {
23823
- const placements = (0, import_react91.useMemo)(() => {
23901
+ var WordCloudChart = (0, import_react92.forwardRef)(function WordCloudChart2({ data, bounds, areaSizing = false, autoFit = false, onLayout, minFontSize = 14, maxFontSize = 52, rotations = [0, 0, -28, 28, 0], spiralStep = 9, shape = "ellipse", padding = 4, fontFamily, fontWeight = 650, onDataClick, palette, ...props }, ref) {
23902
+ const placements = (0, import_react92.useMemo)(() => {
23824
23903
  const context = typeof document === "undefined" ? null : document.createElement("canvas").getContext("2d");
23825
23904
  return layoutCloudWords(data, { bounds: bounds ?? { x: 18, y: 18, width: 684, height: 324 }, minFontSize, maxFontSize, rotations, spiralStep, shape, padding, autoFit, areaSizing, measure: context ? (word, size) => {
23826
23905
  context.font = `${word.fontWeight ?? fontWeight} ${size}px ${word.fontFamily ?? fontFamily ?? "Arial"}`;
23827
23906
  return context.measureText(word.name).width;
23828
23907
  } : void 0 });
23829
23908
  }, [data, bounds, autoFit, areaSizing, maxFontSize, minFontSize, padding, rotations, shape, spiralStep, fontFamily, fontWeight]);
23830
- (0, import_react91.useEffect)(() => {
23909
+ (0, import_react92.useEffect)(() => {
23831
23910
  const present = new Set(placements.map((p) => p.index));
23832
23911
  onLayout?.({ placed: placements.length, unplaced: data.filter((_, i) => !present.has(i)).map((item) => item.name) });
23833
23912
  }, [placements, data, onLayout]);
@@ -23836,30 +23915,30 @@ var WordCloudChart = (0, import_react91.forwardRef)(function WordCloudChart2({ d
23836
23915
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartMark, { label: `${placement.item.name}\uFF0C${placement.item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name: placement.item.name, value: placement.item.value }), tooltipPoint: [placement.x, placement.y], transform: `rotate(${placement.rotation} ${placement.x} ${placement.y})`, onPointerUp: (event) => onDataClick?.({ name: placement.item.name, value: placement.item.value, data: placement.item, nativeEvent: event }), children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("text", { x: placement.x, y: placement.y + placement.fontSize * 0.34, textAnchor: "middle", fill: color, style: { fontSize: placement.fontSize, fontFamily: placement.item.fontFamily ?? fontFamily, fontWeight: placement.item.fontWeight ?? fontWeight }, className: "sia-chart__word", children: placement.item.name }) }, `${placement.item.name}-${placement.index}`);
23837
23916
  }) });
23838
23917
  });
23839
- var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPointer, categoryAxisLabels, axisLayering = "inline", barSpacing, renderAxes, coordinateAnimation = false, animationProgress, animationDurationUpdate = 500, boundaryGap = true, categories, activeIndex, onActiveIndexChange, showCategoryLabels = true, categoryLabelInterval = 0, clipPlot = false, series: sourceSeries, valueAxes, stacked: sourceStacked = false, plotBounds, tooltipTrigger = "item", calculable = false, onTransferError, onDataChange, transferId, onValueTransfer, toolbox, legendNames, axisTooltipFormatter, legendLayout, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, ...props }, ref) {
23840
- const plotClipId = `sia-mixed-plot-${(0, import_react91.useId)().replaceAll(":", "")}`;
23841
- const [editableSeries, setEditableSeries] = (0, import_react91.useState)(sourceSeries);
23842
- const [geometry, setGeometry] = (0, import_react91.useState)();
23843
- const [pointerIndex, setPointerIndex] = (0, import_react91.useState)(null);
23844
- const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react91.useState)(0);
23845
- const [motionRevision, setMotionRevision] = (0, import_react91.useState)(0);
23846
- const [stackMode, setStackMode] = (0, import_react91.useState)();
23847
- const lastPublished = (0, import_react91.useRef)(null);
23918
+ var MixedChart = (0, import_react92.forwardRef)(function MixedChart2({ axisPointer, categoryAxisLabels, axisLayering = "inline", barSpacing, renderAxes, coordinateAnimation = false, animationProgress, animationDurationUpdate = 500, boundaryGap = true, categories, activeIndex, onActiveIndexChange, showCategoryLabels = true, categoryLabelInterval = 0, clipPlot = false, series: sourceSeries, valueAxes, stacked: sourceStacked = false, plotBounds, tooltipTrigger = "item", calculable = false, onTransferError, onDataChange, transferId, onValueTransfer, toolbox, legendNames, axisTooltipFormatter, legendLayout, showLegend = true, legendInteractive = true, legendSelected, onLegendSelectionChange, valueFormatter, onDataClick, palette, ...props }, ref) {
23919
+ const plotClipId = `sia-mixed-plot-${(0, import_react92.useId)().replaceAll(":", "")}`;
23920
+ const [editableSeries, setEditableSeries] = (0, import_react92.useState)(sourceSeries);
23921
+ const [geometry, setGeometry] = (0, import_react92.useState)();
23922
+ const [pointerIndex, setPointerIndex] = (0, import_react92.useState)(null);
23923
+ const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react92.useState)(0);
23924
+ const [motionRevision, setMotionRevision] = (0, import_react92.useState)(0);
23925
+ const [stackMode, setStackMode] = (0, import_react92.useState)();
23926
+ const lastPublished = (0, import_react92.useRef)(null);
23848
23927
  const publishData = (next) => {
23849
23928
  lastPublished.current = next;
23850
23929
  onDataChange?.(next);
23851
23930
  };
23852
- const [islands, setIslands] = (0, import_react91.useState)([]);
23853
- const drag = (0, import_react91.useRef)(null);
23854
- const [dragOffset, setDragOffset] = (0, import_react91.useState)();
23855
- (0, import_react91.useEffect)(() => {
23931
+ const [islands, setIslands] = (0, import_react92.useState)([]);
23932
+ const drag = (0, import_react92.useRef)(null);
23933
+ const [dragOffset, setDragOffset] = (0, import_react92.useState)();
23934
+ (0, import_react92.useEffect)(() => {
23856
23935
  if (sourceSeries === lastPublished.current) return;
23857
23936
  setEditableSeries(sourceSeries);
23858
23937
  setIslands([]);
23859
23938
  drag.current = null;
23860
23939
  setDragOffset(void 0);
23861
23940
  }, [sourceSeries]);
23862
- const series = (0, import_react91.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
23941
+ const series = (0, import_react92.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
23863
23942
  const stacked = stackMode ?? sourceStacked;
23864
23943
  const PLOT2 = plotBounds ?? { x: 62, y: 48, width: 628, height: 250 }, PLOT_BOTTOM2 = PLOT2.y + PLOT2.height;
23865
23944
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -24023,7 +24102,7 @@ var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPoint
24023
24102
  })
24024
24103
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(CartesianAxes, { categories, domain, band: categoryGap }),
24025
24104
  activeIndex != null && activeIndex >= 0 && activeIndex < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { "data-mixed-active-index": activeIndex, x: Math.max(PLOT2.x, categoryAt(activeIndex) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(activeIndex) + band / 2) - Math.max(PLOT2.x, categoryAt(activeIndex) - band / 2), height: PLOT2.height, fill: "currentColor", opacity: 0.06, pointerEvents: "none" }) : null,
24026
- tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react92.createElement)(ChartMark, { ...activeProps(index), key: `axis-${index}`, "data-mixed-axis-tooltip": index, label: `${name.trim()} \u5404\u6307\u6807`, tooltip: axisTooltip(index), tooltipPoint: [categoryAt(index), PLOT2.y + PLOT2.height / 2] }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: Math.max(PLOT2.x, categoryAt(index) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(index) + band / 2) - Math.max(PLOT2.x, categoryAt(index) - band / 2), height: PLOT2.height, fill: "transparent" }))) : null,
24105
+ tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react93.createElement)(ChartMark, { ...activeProps(index), key: `axis-${index}`, "data-mixed-axis-tooltip": index, label: `${name.trim()} \u5404\u6307\u6807`, tooltip: axisTooltip(index), tooltipPoint: [categoryAt(index), PLOT2.y + PLOT2.height / 2] }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: Math.max(PLOT2.x, categoryAt(index) - band / 2), y: PLOT2.y, width: Math.min(PLOT2.x + PLOT2.width, categoryAt(index) + band / 2) - Math.max(PLOT2.x, categoryAt(index) - band / 2), height: PLOT2.height, fill: "transparent" }))) : null,
24027
24106
  calculable ? activeSeries.flatMap((item) => item.data.map((value, index) => value === null ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartMark, { ...dragProps(series.indexOf(item), index), label: `${item.name}\uFF0C${categories[index]}\uFF0C\u7A7A\u69FD`, tooltip: "\u62D6\u5165\u6570\u636E\u4EE5\u586B\u5145", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: PLOT2.x + index * band + band * activeSeries.indexOf(item) / Math.max(1, activeSeries.length), y: PLOT_BOTTOM2 - 14, width: Math.max(4, band / Math.max(1, activeSeries.length) - 2), height: 14, fill: "transparent", stroke: getColor(series.indexOf(item), item.color, palette), strokeDasharray: "3 2" }) }, `empty-${item.name}-${index}`) : null)) : null,
24028
24107
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("clipPath", { id: plotClipId, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { x: PLOT2.x, y: PLOT2.y, width: PLOT2.width, height: PLOT2.height }) }) }),
24029
24108
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("g", { "data-mixed-plot": "", clipPath: clipPlot ? `url(#${plotClipId})` : void 0, children: renderSeries.map((item) => {
@@ -24062,7 +24141,7 @@ var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPoint
24062
24141
  const zero = linearScale(placement.start, [valueDomain[0], valueDomain[1]], [PLOT_BOTTOM2, PLOT2.y]);
24063
24142
  const rectY = barSpacing?.pixelAlign ? Math.floor(Math.min(y, zero)) : Math.min(y, zero);
24064
24143
  const rectHeight = barSpacing?.pixelAlign ? Math.ceil(Math.abs(zero - y)) : Math.abs(zero - y);
24065
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartPointMotion, { points: [[x, value >= 0 ? rectY + rectHeight : rectY], [x, rectY], [x + width, rectY + rectHeight]], enabled: coordinateAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: coordinateAnimation ? animationProgress : void 0, children: (frame) => /* @__PURE__ */ (0, import_react92.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
24144
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ChartPointMotion, { points: [[x, value >= 0 ? rectY + rectHeight : rectY], [x, rectY], [x + width, rectY + rectHeight]], enabled: coordinateAnimation && props.animation !== false, duration: props.animationDuration ?? 2e3, updateDuration: animationDurationUpdate, progress: coordinateAnimation ? animationProgress : void 0, children: (frame) => /* @__PURE__ */ (0, import_react93.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
24066
24145
  if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
24067
24146
  } }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { style: { animation: coordinateAnimation ? "none" : void 0 }, x: frame[1][0], y: Math.min(frame[1][1], frame[2][1]), width: Math.max(0, frame[2][0] - frame[1][0]), height: Math.abs(frame[2][1] - frame[1][1]), rx: item.barRadius ?? 4, fill: item.pointColors?.[index] ?? color, className: "sia-chart__bar" })) }, `${item.name}-${index}-${motionRevision}`);
24068
24147
  })
@@ -24091,7 +24170,7 @@ var MixedChart = (0, import_react91.forwardRef)(function MixedChart2({ axisPoint
24091
24170
  if (!placements[index]) return null;
24092
24171
  const name = categoryName(index, item.categoryAxisIndex);
24093
24172
  const value = item.data[index] ?? 0;
24094
- return /* @__PURE__ */ (0, import_react92.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
24173
+ return /* @__PURE__ */ (0, import_react93.createElement)(ChartMark, { ...dragProps(seriesIndex, index), key: `${name}-${index}`, label: `${item.name}\uFF0C${name}\uFF0C${value}`, tooltip: (item.tooltipTrigger ?? tooltipTrigger) === "axis" ? axisTooltip(index, item.categoryAxisIndex) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
24095
24174
  if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
24096
24175
  } }, /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("circle", { className: item.hollowSymbol ? "sia-chart__mixed-hollow-symbol" : void 0, cx: point[0], cy: point[1], r: Math.max(0, item.symbolSize ?? 9) / 2, fill: item.hollowSymbol ? "#fff" : color, stroke: item.hollowSymbol ? color : "var(--sia-color-surface)", strokeWidth: 2 }));
24097
24176
  })
@@ -24132,9 +24211,9 @@ var KLineChart = CandlestickChart;
24132
24211
 
24133
24212
  // src/components/LineShareChart.tsx
24134
24213
  var import_jsx_runtime90 = require("react/jsx-runtime");
24135
- var LineShareChart = (0, import_react93.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
24136
- const [selected, setSelected] = (0, import_react93.useState)(null);
24137
- const [maskHovered, setMaskHovered] = (0, import_react93.useState)(false);
24214
+ var LineShareChart = (0, import_react94.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
24215
+ const [selected, setSelected] = (0, import_react94.useState)(null);
24216
+ const [maskHovered, setMaskHovered] = (0, import_react94.useState)(false);
24138
24217
  const width = props.viewBoxSize?.[0] ?? 900, height = props.viewBoxSize?.[1] ?? 450;
24139
24218
  const total = data.reduce((sum, item2) => sum + item2.value, 0), gap = data.length ? Math.round(Math.max(...data.map((item2) => item2.value)) - Math.min(...data.map((item2) => item2.value))) : 0;
24140
24219
  const maximum = data.reduce((best, item2, i) => item2.value >= data[best].value ? i : best, 0);
@@ -24212,16 +24291,16 @@ function paddedValueExtent(values, padding = 0.05) {
24212
24291
  }
24213
24292
 
24214
24293
  // src/components/XYChart.tsx
24215
- var import_react94 = require("react");
24294
+ var import_react95 = require("react");
24216
24295
  var import_jsx_runtime91 = require("react/jsx-runtime");
24217
- var XYChart = (0, import_react94.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
24218
- const [series, setSeries] = (0, import_react94.useState)(source);
24219
- const [hidden, setHidden] = (0, import_react94.useState)([]);
24220
- const [crosshair, setCrosshair] = (0, import_react94.useState)();
24221
- const [drag, setDrag] = (0, import_react94.useState)();
24222
- const [geometry, setGeometry] = (0, import_react94.useState)();
24223
- const [zoom, setZoom] = (0, import_react94.useState)(defaultZoom);
24224
- (0, import_react94.useEffect)(() => setSeries(source), [source]);
24296
+ var XYChart = (0, import_react95.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
24297
+ const [series, setSeries] = (0, import_react95.useState)(source);
24298
+ const [hidden, setHidden] = (0, import_react95.useState)([]);
24299
+ const [crosshair, setCrosshair] = (0, import_react95.useState)();
24300
+ const [drag, setDrag] = (0, import_react95.useState)();
24301
+ const [geometry, setGeometry] = (0, import_react95.useState)();
24302
+ const [zoom, setZoom] = (0, import_react95.useState)(defaultZoom);
24303
+ (0, import_react95.useEffect)(() => setSeries(source), [source]);
24225
24304
  const window2 = dataZoom || xAxisType === "time" ? scatterValueWindow(series.flatMap((item) => item.data.map((point) => point[0])), dataZoom ? zoom : [0, 100]) : void 0;
24226
24305
  const active = series.filter((item) => !hidden.includes(item.name)).map((item) => ({ ...item, data: window2 ? item.data.filter((point) => point[0] >= window2[0] && point[0] <= window2[1]) : item.data }));
24227
24306
  const width = props.viewBoxSize?.[0] ?? 663, height = props.viewBoxSize?.[1] ?? 379;
@@ -24350,7 +24429,7 @@ var XYChart = (0, import_react94.forwardRef)(function XYChart2({ series: source,
24350
24429
  });
24351
24430
 
24352
24431
  // src/components/ChartMapOverlay.tsx
24353
- var import_react95 = require("react");
24432
+ var import_react96 = require("react");
24354
24433
 
24355
24434
  // src/components/mapOverlayHost.ts
24356
24435
  function observeMapOverlayHost(host, onChange) {
@@ -24389,11 +24468,11 @@ function observeMapOverlayHost(host, onChange) {
24389
24468
  // src/components/ChartMapOverlay.tsx
24390
24469
  var import_jsx_runtime92 = require("react/jsx-runtime");
24391
24470
  function ChartMapOverlay({ createHost, children, className, style, ariaLabel = "\u5730\u56FE\u53E0\u52A0\u56FE\u8868", onError }) {
24392
- const container = (0, import_react95.useRef)(null);
24393
- const errorHandler = (0, import_react95.useRef)(onError);
24471
+ const container = (0, import_react96.useRef)(null);
24472
+ const errorHandler = (0, import_react96.useRef)(onError);
24394
24473
  errorHandler.current = onError;
24395
- const [snapshot, setSnapshot] = (0, import_react95.useState)();
24396
- (0, import_react95.useEffect)(() => {
24474
+ const [snapshot, setSnapshot] = (0, import_react96.useState)();
24475
+ (0, import_react96.useEffect)(() => {
24397
24476
  setSnapshot(void 0);
24398
24477
  if (!container.current) return;
24399
24478
  try {
@@ -24470,9 +24549,9 @@ function createBaiduMapHost(element, sdk, options) {
24470
24549
  }
24471
24550
 
24472
24551
  // src/components/InputSelect.tsx
24473
- var import_react96 = require("react");
24552
+ var import_react97 = require("react");
24474
24553
  var import_jsx_runtime93 = require("react/jsx-runtime");
24475
- var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
24554
+ var InputSelect = (0, import_react97.forwardRef)(function InputSelect2({
24476
24555
  options,
24477
24556
  value,
24478
24557
  defaultValue,
@@ -24498,22 +24577,22 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
24498
24577
  ...inputProps
24499
24578
  }, forwardedRef) {
24500
24579
  const size = useControlSize(sizeProp);
24501
- const [internal, setInternal] = (0, import_react96.useState)(defaultValue);
24580
+ const [internal, setInternal] = (0, import_react97.useState)(defaultValue);
24502
24581
  const current = value !== void 0 ? value : internal;
24503
24582
  const values = current == null ? [] : Array.isArray(current) ? current : [current];
24504
24583
  const text = values.map((item) => displayField === "label" ? String(options.find((option) => option.optionType !== "divider" && option.value === item)?.label ?? item) : String(item)).join(",");
24505
- const [draft, setDraft] = (0, import_react96.useState)(text);
24506
- (0, import_react96.useEffect)(() => {
24584
+ const [draft, setDraft] = (0, import_react97.useState)(text);
24585
+ (0, import_react97.useEffect)(() => {
24507
24586
  setDraft(text);
24508
24587
  }, [text, current]);
24509
- const [open, setOpen] = (0, import_react96.useState)(false);
24510
- const [search, setSearch] = (0, import_react96.useState)("");
24511
- const [modalOpen, setModalOpen] = (0, import_react96.useState)(false);
24512
- const [modalValues, setModalValues] = (0, import_react96.useState)([]);
24513
- const [selectedOnly, setSelectedOnly] = (0, import_react96.useState)(false);
24514
- const rootRef = (0, import_react96.useRef)(null);
24515
- const popupRef = (0, import_react96.useRef)(null);
24516
- const inputRef = (0, import_react96.useRef)(null);
24588
+ const [open, setOpen] = (0, import_react97.useState)(false);
24589
+ const [search, setSearch] = (0, import_react97.useState)("");
24590
+ const [modalOpen, setModalOpen] = (0, import_react97.useState)(false);
24591
+ const [modalValues, setModalValues] = (0, import_react97.useState)([]);
24592
+ const [selectedOnly, setSelectedOnly] = (0, import_react97.useState)(false);
24593
+ const rootRef = (0, import_react97.useRef)(null);
24594
+ const popupRef = (0, import_react97.useRef)(null);
24595
+ const inputRef = (0, import_react97.useRef)(null);
24517
24596
  const config = typeof enableModal === "object" ? enableModal : {};
24518
24597
  function changeOpen(next) {
24519
24598
  if (next && (disabled || loading)) return;
@@ -24533,7 +24612,7 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
24533
24612
  inputRef.current?.focus();
24534
24613
  }
24535
24614
  }
24536
- (0, import_react96.useEffect)(() => {
24615
+ (0, import_react97.useEffect)(() => {
24537
24616
  if (!open) return;
24538
24617
  const outside = (event) => {
24539
24618
  if (!rootRef.current?.contains(event.target) && !popupRef.current?.contains(event.target)) changeOpen(false);
@@ -24541,7 +24620,7 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
24541
24620
  document.addEventListener("pointerdown", outside);
24542
24621
  return () => document.removeEventListener("pointerdown", outside);
24543
24622
  }, [open, onOpenChange]);
24544
- (0, import_react96.useEffect)(() => {
24623
+ (0, import_react97.useEffect)(() => {
24545
24624
  if (disabled || loading) {
24546
24625
  changeOpen(false);
24547
24626
  setModalOpen(false);
@@ -24674,13 +24753,13 @@ var InputSelect = (0, import_react96.forwardRef)(function InputSelect2({
24674
24753
  });
24675
24754
 
24676
24755
  // src/components/QueryForm.tsx
24677
- var import_react99 = require("react");
24756
+ var import_react100 = require("react");
24678
24757
 
24679
24758
  // src/components/QueryFormSettings.tsx
24680
- var import_react98 = require("react");
24759
+ var import_react99 = require("react");
24681
24760
 
24682
24761
  // src/components/useQueryFieldSort.ts
24683
- var import_react97 = require("react");
24762
+ var import_react98 = require("react");
24684
24763
  function getQuerySortPreview(keys, rects, from, dy, gap) {
24685
24764
  const center = rects[from].top + rects[from].height / 2 + dy;
24686
24765
  const rest = keys.map((_, index) => index).filter((index) => index !== from);
@@ -24699,13 +24778,13 @@ function getQuerySortPreview(keys, rects, from, dy, gap) {
24699
24778
  return { ordered, offsets };
24700
24779
  }
24701
24780
  function useQueryFieldSort(keys, enabled, onCommit) {
24702
- const listRef = (0, import_react97.useRef)(null);
24703
- const cancelRef = (0, import_react97.useRef)();
24704
- const commitRef = (0, import_react97.useRef)(onCommit);
24781
+ const listRef = (0, import_react98.useRef)(null);
24782
+ const cancelRef = (0, import_react98.useRef)();
24783
+ const commitRef = (0, import_react98.useRef)(onCommit);
24705
24784
  commitRef.current = onCommit;
24706
- const [preview, setPreview] = (0, import_react97.useState)();
24785
+ const [preview, setPreview] = (0, import_react98.useState)();
24707
24786
  const signature = JSON.stringify(keys);
24708
- (0, import_react97.useEffect)(() => {
24787
+ (0, import_react98.useEffect)(() => {
24709
24788
  cancelRef.current?.();
24710
24789
  return () => cancelRef.current?.();
24711
24790
  }, [enabled, signature]);
@@ -24830,16 +24909,16 @@ function countQueryFieldRows(centers) {
24830
24909
  // src/components/QueryFormSettings.tsx
24831
24910
  var import_jsx_runtime94 = require("react/jsx-runtime");
24832
24911
  function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed, disabled) {
24833
- const [snapshot, setSnapshot] = (0, import_react98.useState)();
24834
- const [draft, setDraft] = (0, import_react98.useState)({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
24835
- const [open, setOpen] = (0, import_react98.useState)(false);
24836
- const [loading, setLoading] = (0, import_react98.useState)(false);
24837
- const [saving, setSaving] = (0, import_react98.useState)(false);
24838
- const [error, setError] = (0, import_react98.useState)("");
24839
- const [loadFailed, setLoadFailed] = (0, import_react98.useState)(false);
24840
- const token = (0, import_react98.useRef)(0);
24841
- const saveLock = (0, import_react98.useRef)(false);
24842
- const latest = (0, import_react98.useRef)({ config, fields, defaultCollapsed, applyCollapsed });
24912
+ const [snapshot, setSnapshot] = (0, import_react99.useState)();
24913
+ const [draft, setDraft] = (0, import_react99.useState)({ fields: [], defaultCollapsed: defaultCollapsed ?? false });
24914
+ const [open, setOpen] = (0, import_react99.useState)(false);
24915
+ const [loading, setLoading] = (0, import_react99.useState)(false);
24916
+ const [saving, setSaving] = (0, import_react99.useState)(false);
24917
+ const [error, setError] = (0, import_react99.useState)("");
24918
+ const [loadFailed, setLoadFailed] = (0, import_react99.useState)(false);
24919
+ const token = (0, import_react99.useRef)(0);
24920
+ const saveLock = (0, import_react99.useRef)(false);
24921
+ const latest = (0, import_react99.useRef)({ config, fields, defaultCollapsed, applyCollapsed });
24843
24922
  latest.current = { config, fields, defaultCollapsed, applyCollapsed };
24844
24923
  const moduleName = config?.scope.moduleName;
24845
24924
  const businessKey = config?.scope.businessKey;
@@ -24867,7 +24946,7 @@ function useQueryFormSettings(config, fields, defaultCollapsed, applyCollapsed,
24867
24946
  if (request === token.current) setLoading(false);
24868
24947
  }
24869
24948
  }
24870
- (0, import_react98.useEffect)(() => {
24949
+ (0, import_react99.useEffect)(() => {
24871
24950
  setSnapshot(void 0);
24872
24951
  setOpen(false);
24873
24952
  setError("");
@@ -25025,27 +25104,27 @@ function QueryForm({
25025
25104
  ...formProps
25026
25105
  }) {
25027
25106
  const [form] = useForm(providedForm);
25028
- const [internalCollapsed, setInternalCollapsed] = (0, import_react99.useState)(defaultCollapsed);
25029
- const [expandedRows, setExpandedRows] = (0, import_react99.useState)(0);
25030
- const [needsCollapse, setNeedsCollapse] = (0, import_react99.useState)(false);
25107
+ const [internalCollapsed, setInternalCollapsed] = (0, import_react100.useState)(defaultCollapsed);
25108
+ const [expandedRows, setExpandedRows] = (0, import_react100.useState)(0);
25109
+ const [needsCollapse, setNeedsCollapse] = (0, import_react100.useState)(false);
25031
25110
  const collapsed = collapsible && needsCollapse && (controlledCollapsed ?? internalCollapsed ?? expandedRows >= 3);
25032
- const [searching, setSearching] = (0, import_react99.useState)(false);
25033
- const [saving, setSaving] = (0, import_react99.useState)(false);
25034
- const [removing, setRemoving] = (0, import_react99.useState)(false);
25035
- const [saveOpen, setSaveOpen] = (0, import_react99.useState)(false);
25036
- const [saveName, setSaveName] = (0, import_react99.useState)("");
25037
- const [saveError, setSaveError] = (0, import_react99.useState)("");
25038
- const [error, setError] = (0, import_react99.useState)("");
25039
- const [activeShortcut, setActiveShortcut] = (0, import_react99.useState)("");
25040
- const source = (0, import_react99.useRef)({ source: "submit" });
25041
- const searchLock = (0, import_react99.useRef)(false);
25042
- const saveLock = (0, import_react99.useRef)(false);
25043
- const removeLock = (0, import_react99.useRef)(false);
25044
- const snapshot = (0, import_react99.useRef)();
25111
+ const [searching, setSearching] = (0, import_react100.useState)(false);
25112
+ const [saving, setSaving] = (0, import_react100.useState)(false);
25113
+ const [removing, setRemoving] = (0, import_react100.useState)(false);
25114
+ const [saveOpen, setSaveOpen] = (0, import_react100.useState)(false);
25115
+ const [saveName, setSaveName] = (0, import_react100.useState)("");
25116
+ const [saveError, setSaveError] = (0, import_react100.useState)("");
25117
+ const [error, setError] = (0, import_react100.useState)("");
25118
+ const [activeShortcut, setActiveShortcut] = (0, import_react100.useState)("");
25119
+ const source = (0, import_react100.useRef)({ source: "submit" });
25120
+ const searchLock = (0, import_react100.useRef)(false);
25121
+ const saveLock = (0, import_react100.useRef)(false);
25122
+ const removeLock = (0, import_react100.useRef)(false);
25123
+ const snapshot = (0, import_react100.useRef)();
25045
25124
  const busy = disabled || loading || searching;
25046
25125
  const shortcutBusy = busy || shortcutsLoading || saving || removing;
25047
25126
  const fieldLabel = (content) => {
25048
- if (!(0, import_react99.isValidElement)(content)) return void 0;
25127
+ if (!(0, import_react100.isValidElement)(content)) return void 0;
25049
25128
  return content.props.label ?? content.props.placeholder ?? fieldLabel(content.props.children);
25050
25129
  };
25051
25130
  const sourceEntries = fields ? fields.map(({ key, width, settingsLabel, settingsHideDisabled, ...item }) => ({
@@ -25054,8 +25133,8 @@ function QueryForm({
25054
25133
  hideDisabled: settingsHideDisabled,
25055
25134
  label: settingsLabel ?? item.label ?? (typeof item.children === "function" ? void 0 : fieldLabel(item.children)) ?? key,
25056
25135
  content: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Form.Item, { noStyle: true, ...item })
25057
- })) : import_react99.Children.toArray(children).map((content, index) => ({
25058
- key: (0, import_react99.isValidElement)(content) && content.key != null ? String(content.key) : String(index),
25136
+ })) : import_react100.Children.toArray(children).map((content, index) => ({
25137
+ key: (0, import_react100.isValidElement)(content) && content.key != null ? String(content.key) : String(index),
25059
25138
  width: void 0,
25060
25139
  hideDisabled: false,
25061
25140
  label: fieldLabel(content) ?? `\u6761\u4EF6 ${index + 1}`,
@@ -25068,12 +25147,12 @@ function QueryForm({
25068
25147
  const entries = configured.map((item) => ({ ...entriesByKey.get(item.key), visible: item.visible, visibleIndex: item.visible ? visibleIndex++ : -1 }));
25069
25148
  const layoutKey = JSON.stringify(configured);
25070
25149
  const limit = Math.max(1, Math.floor(collapsedCount));
25071
- const rowRef = (0, import_react99.useRef)(null);
25072
- const actionsRef = (0, import_react99.useRef)(null);
25073
- const toggleRef = (0, import_react99.useRef)(null);
25074
- const [fittingCount, setFittingCount] = (0, import_react99.useState)(limit);
25075
- const [settingsRows, setSettingsRows] = (0, import_react99.useState)(0);
25076
- (0, import_react99.useLayoutEffect)(() => {
25150
+ const rowRef = (0, import_react100.useRef)(null);
25151
+ const actionsRef = (0, import_react100.useRef)(null);
25152
+ const toggleRef = (0, import_react100.useRef)(null);
25153
+ const [fittingCount, setFittingCount] = (0, import_react100.useState)(limit);
25154
+ const [settingsRows, setSettingsRows] = (0, import_react100.useState)(0);
25155
+ (0, import_react100.useLayoutEffect)(() => {
25077
25156
  const row = rowRef.current;
25078
25157
  const actions = actionsRef.current;
25079
25158
  if (!row || !actions) return;
@@ -25417,9 +25496,9 @@ function QueryForm({
25417
25496
  }
25418
25497
 
25419
25498
  // src/components/NumberRange.tsx
25420
- var import_react100 = require("react");
25499
+ var import_react101 = require("react");
25421
25500
  var import_jsx_runtime96 = require("react/jsx-runtime");
25422
- var NumberRange = (0, import_react100.forwardRef)(function NumberRange2({
25501
+ var NumberRange = (0, import_react101.forwardRef)(function NumberRange2({
25423
25502
  value,
25424
25503
  defaultValue = [null, null],
25425
25504
  onChange,