@sia.soul/sia-react-ui 0.1.141 → 0.1.143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/{Button-BiL3Wjsd.d.ts → Button-C8W8ZHWV.d.ts} +1 -1
  2. package/dist/{Button-O_pNB3SQ.d.cts → Button-CxKBjLda.d.cts} +1 -1
  3. package/dist/{Select-DeD4O8FL.d.ts → Select-CTSd8zum.d.ts} +14 -10
  4. package/dist/{Select-Y0e9kaxE.d.cts → Select-bKLket9n.d.cts} +14 -10
  5. package/dist/chart.cjs +1051 -335
  6. package/dist/chart.js +5 -5
  7. package/dist/chunk-4OHS7RXE.js +1004 -0
  8. package/dist/{chunk-WIRIEIRO.js → chunk-4TYHSAR3.js} +5 -5
  9. package/dist/{chunk-L2S7IPSM.js → chunk-566S64IP.js} +5 -5
  10. package/dist/{chunk-CZ2ITBRW.js → chunk-7SEGBB6V.js} +34 -5
  11. package/dist/{chunk-KY6A5IJH.js → chunk-ETQJ2DQ2.js} +1 -1
  12. package/dist/{chunk-WD56MJO2.js → chunk-F52O2MOV.js} +7 -3
  13. package/dist/{chunk-PQBCD54U.js → chunk-JRXYM5YH.js} +167 -64
  14. package/dist/{chunk-SCEHVGKV.js → chunk-LKLPCYEP.js} +2 -2
  15. package/dist/{chunk-DIRPOUVX.js → chunk-MD4CGSOR.js} +105 -61
  16. package/dist/{chunk-436QH6XH.js → chunk-ORSQAJ22.js} +160 -497
  17. package/dist/{chunk-SO7IJZIR.js → chunk-PD3K5U5Y.js} +2 -2
  18. package/dist/{chunk-UVHC6OEX.js → chunk-WCYVBO2N.js} +342 -123
  19. package/dist/{core-DYo5C4Si.d.cts → core-COaZfusa.d.cts} +51 -24
  20. package/dist/{core-sWwvVAmP.d.ts → core-CvfsQGuT.d.ts} +51 -24
  21. package/dist/core.cjs +2000 -1251
  22. package/dist/core.css +416 -344
  23. package/dist/core.d.cts +3 -3
  24. package/dist/core.d.ts +3 -3
  25. package/dist/core.js +18 -9
  26. package/dist/game.cjs +1984 -1169
  27. package/dist/game.css +182 -177
  28. package/dist/game.d.cts +1 -1
  29. package/dist/game.d.ts +1 -1
  30. package/dist/game.js +8 -3
  31. package/dist/index.cjs +4658 -3542
  32. package/dist/index.css +416 -344
  33. package/dist/index.d.cts +84 -81
  34. package/dist/index.d.ts +84 -81
  35. package/dist/index.js +1075 -713
  36. package/dist/markdown-editor.cjs +727 -40
  37. package/dist/markdown-editor.js +8 -3
  38. package/dist/rich-text-editor.cjs +1265 -308
  39. package/dist/rich-text-editor.js +12 -7
  40. package/dist/{select-date-range-X6a9Y-Te.d.ts → select-date-range-C8cacfmb.d.ts} +1 -1
  41. package/dist/{select-date-range-DiBQQ0Rn.d.cts → select-date-range-Dad0IdD4.d.cts} +1 -1
  42. package/dist/select-date-range.cjs +1281 -807
  43. package/dist/select-date-range.d.cts +3 -3
  44. package/dist/select-date-range.d.ts +3 -3
  45. package/dist/select-date-range.js +13 -8
  46. package/package.json +9 -2
  47. package/dist/chunk-NZMUW5XI.js +0 -292
package/dist/chart.cjs CHANGED
@@ -80,12 +80,492 @@ __export(chart_exports, {
80
80
  });
81
81
  module.exports = __toCommonJS(chart_exports);
82
82
 
83
- // src/components/ChartWhirlingLoading.tsx
83
+ // src/components/FloatingScrollbarProvider.tsx
84
+ var import_react2 = require("react");
85
+
86
+ // src/components/useScrollbarProximity.ts
84
87
  var import_react = require("react");
88
+ var users = 0;
89
+ var cleanup;
90
+ function acquireScrollbarProximity() {
91
+ if (users++ === 0) {
92
+ let frame = 0;
93
+ let x = -Infinity;
94
+ let y = -Infinity;
95
+ const nearby = /* @__PURE__ */ new Set();
96
+ const clear = () => {
97
+ nearby.forEach((track) => track.removeAttribute("data-scrollbar-near"));
98
+ nearby.clear();
99
+ };
100
+ const update = () => {
101
+ frame = 0;
102
+ const next = /* @__PURE__ */ new Set();
103
+ document.querySelectorAll(".sia-scrollbar-track").forEach((track) => {
104
+ const rect = track.getBoundingClientRect();
105
+ const proximity = Number.parseFloat(getComputedStyle(track).getPropertyValue("--sia-scrollbar-proximity")) || 16;
106
+ if (rect.width && rect.height && x >= rect.left - proximity && x <= rect.right + proximity && y >= rect.top - proximity && y <= rect.bottom + proximity) {
107
+ next.add(track);
108
+ if (!nearby.has(track)) track.setAttribute("data-scrollbar-near", "true");
109
+ }
110
+ });
111
+ nearby.forEach((track) => {
112
+ if (!next.has(track)) track.removeAttribute("data-scrollbar-near");
113
+ });
114
+ nearby.clear();
115
+ next.forEach((track) => nearby.add(track));
116
+ };
117
+ const move = (event) => {
118
+ if (event.pointerType === "touch") return;
119
+ x = event.clientX;
120
+ y = event.clientY;
121
+ if (!frame) frame = requestAnimationFrame(update);
122
+ };
123
+ const leave = () => {
124
+ x = y = -Infinity;
125
+ clear();
126
+ };
127
+ document.addEventListener("pointermove", move, { passive: true });
128
+ document.documentElement.addEventListener("pointerleave", leave);
129
+ window.addEventListener("blur", leave);
130
+ cleanup = () => {
131
+ if (frame) cancelAnimationFrame(frame);
132
+ document.removeEventListener("pointermove", move);
133
+ document.documentElement.removeEventListener("pointerleave", leave);
134
+ window.removeEventListener("blur", leave);
135
+ clear();
136
+ };
137
+ }
138
+ return () => {
139
+ if (--users === 0) {
140
+ cleanup?.();
141
+ cleanup = void 0;
142
+ }
143
+ };
144
+ }
145
+
146
+ // src/components/floatingScrollbarOwnership.ts
147
+ var targets = /* @__PURE__ */ new Map();
148
+ function registerFloatingScrollbar(track, target) {
149
+ targets.set(track, { target, dragging: false });
150
+ return () => {
151
+ targets.delete(track);
152
+ };
153
+ }
154
+ function setFloatingScrollbarDragging(track, dragging) {
155
+ const entry = targets.get(track);
156
+ if (entry) entry.dragging = dragging;
157
+ }
158
+
159
+ // src/components/FloatingScrollbarProvider.tsx
160
+ var scrollableOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
161
+ var clippingOverflow = /* @__PURE__ */ new Set(["auto", "scroll", "overlay", "hidden", "clip"]);
162
+ function isRootScroller(target) {
163
+ return target === document.scrollingElement || target === document.documentElement;
164
+ }
165
+ function canScroll(target, axis) {
166
+ if (target.matches(".sia-table__viewport, [data-sia-native-scrollbar]")) return false;
167
+ if (isRootScroller(target)) {
168
+ const rootStyle = getComputedStyle(target);
169
+ const bodyStyle = getComputedStyle(document.body);
170
+ const overflow2 = axis === "horizontal" ? [rootStyle.overflowX, bodyStyle.overflowX] : [rootStyle.overflowY, bodyStyle.overflowY];
171
+ if (overflow2.some((value) => value === "hidden" || value === "clip")) return false;
172
+ return axis === "horizontal" ? target.scrollWidth > target.clientWidth + 1 : target.scrollHeight > target.clientHeight + 1;
173
+ }
174
+ const style = getComputedStyle(target);
175
+ const overflow = axis === "horizontal" ? style.overflowX : style.overflowY;
176
+ if (!scrollableOverflow.has(overflow)) return false;
177
+ const hasOverflow = axis === "horizontal" ? target.scrollWidth > target.clientWidth + 1 : target.scrollHeight > target.clientHeight + 1;
178
+ return hasOverflow;
179
+ }
180
+ function visibleRect(target) {
181
+ if (isRootScroller(target)) {
182
+ return { top: 0, right: window.innerWidth, bottom: window.innerHeight, left: 0, width: window.innerWidth, height: window.innerHeight };
183
+ }
184
+ const ownRect = target.getBoundingClientRect();
185
+ let top = Math.max(0, ownRect.top);
186
+ let right = Math.min(window.innerWidth, ownRect.right);
187
+ let bottom = Math.min(window.innerHeight, ownRect.bottom);
188
+ let left = Math.max(0, ownRect.left);
189
+ let parent = target.parentElement;
190
+ while (parent && parent !== document.body && parent !== document.documentElement) {
191
+ const style = getComputedStyle(parent);
192
+ const clipX = clippingOverflow.has(style.overflowX);
193
+ const clipY = clippingOverflow.has(style.overflowY);
194
+ if (clipX || clipY) {
195
+ const rect = parent.getBoundingClientRect();
196
+ if (clipX) {
197
+ left = Math.max(left, rect.left);
198
+ right = Math.min(right, rect.right);
199
+ }
200
+ if (clipY) {
201
+ top = Math.max(top, rect.top);
202
+ bottom = Math.min(bottom, rect.bottom);
203
+ }
204
+ }
205
+ parent = parent.parentElement;
206
+ }
207
+ return {
208
+ top,
209
+ right,
210
+ bottom,
211
+ left,
212
+ width: Math.max(0, right - left),
213
+ height: Math.max(0, bottom - top)
214
+ };
215
+ }
216
+ function createTrack(axis) {
217
+ const track = document.createElement("div");
218
+ const thumb = document.createElement("div");
219
+ track.className = `sia-scrollbar-track sia-floating-scrollbar sia-floating-scrollbar--${axis}`;
220
+ thumb.className = "sia-floating-scrollbar__thumb";
221
+ track.dataset.axis = axis;
222
+ track.setAttribute("aria-hidden", "true");
223
+ track.append(thumb);
224
+ return { track, thumb };
225
+ }
226
+ var automatic = false;
227
+ var stopGlobal;
228
+ var globalProviders = /* @__PURE__ */ new Map();
229
+ function syncDefaultScrollbars() {
230
+ if (typeof document === "undefined" || !document.body) return;
231
+ const enabled = (automatic || globalProviders.size > 0) && ![...globalProviders.values()].includes(false);
232
+ if (enabled && !stopGlobal) stopGlobal = startFloatingScrollbars();
233
+ if (!enabled && stopGlobal) {
234
+ stopGlobal();
235
+ stopGlobal = void 0;
236
+ }
237
+ }
238
+ function initializeDefaultScrollbars() {
239
+ if (typeof document === "undefined" || automatic) return;
240
+ automatic = true;
241
+ if (document.body) syncDefaultScrollbars();
242
+ else document.addEventListener("DOMContentLoaded", syncDefaultScrollbars, { once: true });
243
+ }
244
+ function startFloatingScrollbars(targetRef) {
245
+ const releaseProximity = acquireScrollbarProximity();
246
+ const layer = document.createElement("div");
247
+ layer.className = "sia-floating-scrollbar-layer";
248
+ layer.setAttribute("aria-hidden", "true");
249
+ document.body.append(layer);
250
+ const entries = /* @__PURE__ */ new Map();
251
+ let scanFrame = 0;
252
+ let updateFrame = 0;
253
+ const dirtyStyles = /* @__PURE__ */ new Set();
254
+ let fullScan = true;
255
+ const setEntryVisible = (entry, visible) => {
256
+ entry.horizontalTrack.classList.toggle("sia-floating-scrollbar--visible", visible);
257
+ entry.verticalTrack.classList.toggle("sia-floating-scrollbar--visible", visible);
258
+ };
259
+ const showEntry = (entry) => {
260
+ if (entry.hideTimer !== null) window.clearTimeout(entry.hideTimer);
261
+ entry.hideTimer = null;
262
+ setEntryVisible(entry, true);
263
+ };
264
+ const scheduleHide = (entry, delay = 500) => {
265
+ if (entry.hideTimer !== null) window.clearTimeout(entry.hideTimer);
266
+ entry.hideTimer = window.setTimeout(() => {
267
+ entry.hideTimer = null;
268
+ if (!entry.hoveringTarget && !entry.hoveringTrack && !entry.dragging) setEntryVisible(entry, false);
269
+ }, delay);
270
+ };
271
+ const updateEntry = (entry) => {
272
+ const { target, horizontalTrack, horizontalThumb, verticalTrack, verticalThumb } = entry;
273
+ const hasHorizontal = canScroll(target, "horizontal");
274
+ const hasVertical = canScroll(target, "vertical");
275
+ const rect = visibleRect(target);
276
+ const thickness = 10;
277
+ horizontalTrack.hidden = !hasHorizontal || rect.width <= thickness || rect.height <= 0;
278
+ verticalTrack.hidden = !hasVertical || rect.height <= thickness || rect.width <= 0;
279
+ if (!horizontalTrack.hidden) {
280
+ const trackWidth = Math.max(0, rect.width - (hasVertical ? thickness : 0));
281
+ const thumbWidth = Math.max(24, Math.min(trackWidth, trackWidth * target.clientWidth / target.scrollWidth));
282
+ const travel = Math.max(0, trackWidth - thumbWidth);
283
+ const maxScroll = Math.max(1, target.scrollWidth - target.clientWidth);
284
+ horizontalTrack.style.left = `${rect.left}px`;
285
+ horizontalTrack.style.top = `${rect.bottom - thickness}px`;
286
+ horizontalTrack.style.width = `${trackWidth}px`;
287
+ horizontalTrack.style.height = `${thickness}px`;
288
+ horizontalThumb.style.width = `${thumbWidth}px`;
289
+ horizontalThumb.style.transform = `translate3d(${travel * target.scrollLeft / maxScroll}px, 0, 0)`;
290
+ }
291
+ if (!verticalTrack.hidden) {
292
+ const trackHeight = Math.max(0, rect.height - (hasHorizontal ? thickness : 0));
293
+ const thumbHeight = Math.max(24, Math.min(trackHeight, trackHeight * target.clientHeight / target.scrollHeight));
294
+ const travel = Math.max(0, trackHeight - thumbHeight);
295
+ const maxScroll = Math.max(1, target.scrollHeight - target.clientHeight);
296
+ verticalTrack.style.left = `${rect.right - thickness}px`;
297
+ verticalTrack.style.top = `${rect.top}px`;
298
+ verticalTrack.style.width = `${thickness}px`;
299
+ verticalTrack.style.height = `${trackHeight}px`;
300
+ verticalThumb.style.height = `${thumbHeight}px`;
301
+ verticalThumb.style.transform = `translate3d(0, ${travel * target.scrollTop / maxScroll}px, 0)`;
302
+ }
303
+ };
304
+ const scheduleUpdateAll = () => {
305
+ if (updateFrame) return;
306
+ updateFrame = window.requestAnimationFrame(() => {
307
+ updateFrame = 0;
308
+ entries.forEach(updateEntry);
309
+ });
310
+ };
311
+ const bindTrackDrag = (entry, axis, track, thumb) => {
312
+ const target = entry.target;
313
+ const onTrackPointerEnter = () => {
314
+ entry.hoveringTrack = true;
315
+ showEntry(entry);
316
+ };
317
+ const onTrackPointerLeave = () => {
318
+ entry.hoveringTrack = false;
319
+ scheduleHide(entry);
320
+ };
321
+ const onTrackPointerDown = (event) => {
322
+ if (event.target === thumb || event.button !== 0) return;
323
+ event.preventDefault();
324
+ event.stopPropagation();
325
+ const trackRect = track.getBoundingClientRect();
326
+ const thumbRect = thumb.getBoundingClientRect();
327
+ const trackLength = axis === "vertical" ? trackRect.height : trackRect.width;
328
+ const thumbLength = axis === "vertical" ? thumbRect.height : thumbRect.width;
329
+ const pointer = axis === "vertical" ? event.clientY - trackRect.top : event.clientX - trackRect.left;
330
+ const ratio = Math.max(0, Math.min(1, (pointer - thumbLength / 2) / Math.max(1, trackLength - thumbLength)));
331
+ if (axis === "vertical") target.scrollTop = ratio * (target.scrollHeight - target.clientHeight);
332
+ else target.scrollLeft = ratio * (target.scrollWidth - target.clientWidth);
333
+ };
334
+ const onThumbPointerDown = (event) => {
335
+ if (event.button !== 0) return;
336
+ event.preventDefault();
337
+ event.stopPropagation();
338
+ entry.dragging = true;
339
+ setFloatingScrollbarDragging(track, true);
340
+ showEntry(entry);
341
+ thumb.setPointerCapture(event.pointerId);
342
+ const startPointer = axis === "vertical" ? event.clientY : event.clientX;
343
+ const startScroll = axis === "vertical" ? target.scrollTop : target.scrollLeft;
344
+ const trackRect = track.getBoundingClientRect();
345
+ const thumbRect = thumb.getBoundingClientRect();
346
+ const trackLength = axis === "vertical" ? trackRect.height : trackRect.width;
347
+ const thumbLength = axis === "vertical" ? thumbRect.height : thumbRect.width;
348
+ const maxScroll = axis === "vertical" ? target.scrollHeight - target.clientHeight : target.scrollWidth - target.clientWidth;
349
+ const travel = Math.max(1, trackLength - thumbLength);
350
+ const onPointerMove = (moveEvent) => {
351
+ if (moveEvent.pointerId !== event.pointerId) return;
352
+ const pointer = axis === "vertical" ? moveEvent.clientY : moveEvent.clientX;
353
+ const nextScroll = startScroll + (pointer - startPointer) * maxScroll / travel;
354
+ if (axis === "vertical") target.scrollTop = nextScroll;
355
+ else target.scrollLeft = nextScroll;
356
+ };
357
+ const onPointerUp = (upEvent) => {
358
+ if (upEvent.pointerId !== event.pointerId) return;
359
+ entry.dragging = false;
360
+ setFloatingScrollbarDragging(track, false);
361
+ thumb.releasePointerCapture(event.pointerId);
362
+ window.removeEventListener("pointermove", onPointerMove);
363
+ window.removeEventListener("pointerup", onPointerUp);
364
+ window.removeEventListener("pointercancel", onPointerUp);
365
+ scheduleHide(entry);
366
+ };
367
+ window.addEventListener("pointermove", onPointerMove);
368
+ window.addEventListener("pointerup", onPointerUp);
369
+ window.addEventListener("pointercancel", onPointerUp);
370
+ };
371
+ track.addEventListener("pointerenter", onTrackPointerEnter);
372
+ track.addEventListener("pointerleave", onTrackPointerLeave);
373
+ track.addEventListener("pointerdown", onTrackPointerDown);
374
+ thumb.addEventListener("pointerdown", onThumbPointerDown);
375
+ return () => {
376
+ track.removeEventListener("pointerenter", onTrackPointerEnter);
377
+ track.removeEventListener("pointerleave", onTrackPointerLeave);
378
+ track.removeEventListener("pointerdown", onTrackPointerDown);
379
+ thumb.removeEventListener("pointerdown", onThumbPointerDown);
380
+ };
381
+ };
382
+ const resizeObserver = new ResizeObserver((observedEntries) => {
383
+ observedEntries.forEach(({ target }) => {
384
+ const entry = entries.get(target);
385
+ if (entry) updateEntry(entry);
386
+ });
387
+ });
388
+ const addTarget = (target) => {
389
+ if (entries.has(target)) return;
390
+ const horizontal = createTrack("horizontal");
391
+ const vertical = createTrack("vertical");
392
+ const releaseHorizontalOwner = registerFloatingScrollbar(horizontal.track, target);
393
+ const releaseVerticalOwner = registerFloatingScrollbar(vertical.track, target);
394
+ layer.append(horizontal.track, vertical.track);
395
+ const onPointerEnter = () => {
396
+ const entry2 = entries.get(target);
397
+ if (!entry2) return;
398
+ entry2.hoveringTarget = true;
399
+ showEntry(entry2);
400
+ };
401
+ const onPointerLeave = () => {
402
+ const entry2 = entries.get(target);
403
+ if (!entry2) return;
404
+ entry2.hoveringTarget = false;
405
+ scheduleHide(entry2);
406
+ };
407
+ const onScroll = () => {
408
+ const entry2 = entries.get(target);
409
+ if (!entry2) return;
410
+ updateEntry(entry2);
411
+ showEntry(entry2);
412
+ scheduleHide(entry2, 700);
413
+ };
414
+ target.addEventListener("pointerenter", onPointerEnter);
415
+ target.addEventListener("pointerleave", onPointerLeave);
416
+ target.addEventListener("scroll", onScroll, { passive: true });
417
+ const entry = {
418
+ target,
419
+ horizontalTrack: horizontal.track,
420
+ horizontalThumb: horizontal.thumb,
421
+ verticalTrack: vertical.track,
422
+ verticalThumb: vertical.thumb,
423
+ hideTimer: null,
424
+ hoveringTarget: target.matches(":hover"),
425
+ hoveringTrack: false,
426
+ dragging: false,
427
+ cleanup: () => void 0
428
+ };
429
+ const cleanupHorizontal = bindTrackDrag(entry, "horizontal", horizontal.track, horizontal.thumb);
430
+ const cleanupVertical = bindTrackDrag(entry, "vertical", vertical.track, vertical.thumb);
431
+ entry.cleanup = () => {
432
+ if (entry.hideTimer !== null) window.clearTimeout(entry.hideTimer);
433
+ cleanupHorizontal();
434
+ cleanupVertical();
435
+ releaseHorizontalOwner();
436
+ releaseVerticalOwner();
437
+ target.removeEventListener("pointerenter", onPointerEnter);
438
+ target.removeEventListener("pointerleave", onPointerLeave);
439
+ target.removeEventListener("scroll", onScroll);
440
+ resizeObserver.unobserve(target);
441
+ target.removeAttribute("data-sia-floating-scrollbar");
442
+ horizontal.track.remove();
443
+ vertical.track.remove();
444
+ };
445
+ entries.set(target, entry);
446
+ target.setAttribute("data-sia-floating-scrollbar", "");
447
+ resizeObserver.observe(target);
448
+ updateEntry(entry);
449
+ if (entry.hoveringTarget) showEntry(entry);
450
+ };
451
+ const removeTarget = (target) => {
452
+ const entry = entries.get(target);
453
+ if (!entry) return;
454
+ entry.cleanup();
455
+ entries.delete(target);
456
+ };
457
+ const scanTargets = () => {
458
+ scanFrame = 0;
459
+ const managedSelector = ".sia-table__viewport, .sia-scrollbar-track, .sia-floating-scrollbar-layer";
460
+ const discovered = /* @__PURE__ */ new Set();
461
+ if (!targetRef) {
462
+ const roots = fullScan ? [document.body] : [...dirtyStyles].filter((node) => node.isConnected);
463
+ for (const root of roots) {
464
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, {
465
+ acceptNode: (node) => node.matches(managedSelector) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
466
+ });
467
+ for (let node = walker.nextNode(); node; node = walker.nextNode()) {
468
+ if (node instanceof HTMLElement) discovered.add(node);
469
+ }
470
+ for (let node = root; node; node = node.parentElement) discovered.add(node);
471
+ }
472
+ }
473
+ const candidates = (targetRef ? [targetRef.current] : [document.scrollingElement, ...discovered]).filter((target) => target instanceof HTMLElement);
474
+ const nextTargets = /* @__PURE__ */ new Set();
475
+ candidates.forEach((target) => {
476
+ if (canScroll(target, "horizontal") || canScroll(target, "vertical")) {
477
+ nextTargets.add(target);
478
+ }
479
+ });
480
+ nextTargets.forEach((target) => {
481
+ if (entries.has(target) || !target.hasAttribute("data-sia-floating-scrollbar")) addTarget(target);
482
+ });
483
+ entries.forEach((_entry, target) => {
484
+ if (!target.isConnected || (fullScan || candidates.includes(target)) && !nextTargets.has(target)) removeTarget(target);
485
+ else updateEntry(_entry);
486
+ });
487
+ dirtyStyles.clear();
488
+ fullScan = false;
489
+ };
490
+ const scheduleScan = (complete = true) => {
491
+ fullScan ||= complete;
492
+ if (scanFrame) return;
493
+ scanFrame = window.requestAnimationFrame(scanTargets);
494
+ };
495
+ const previousStyle = document.createElement("div").style;
496
+ const positionProperties = /* @__PURE__ */ new Set(["left", "top", "transform"]);
497
+ const mutationObserver = new MutationObserver((mutations) => {
498
+ let relevant = false;
499
+ for (const mutation of mutations) {
500
+ const target = mutation.target instanceof Element ? mutation.target : mutation.target.parentElement;
501
+ if (!target || layer.contains(target) || target.closest(".sia-table__viewport, .sia-scrollbar-track, .sia-floating-scrollbar-layer")) continue;
502
+ if (mutation.type === "childList") {
503
+ const changed = [...mutation.addedNodes, ...mutation.removedNodes];
504
+ if (changed.length && changed.every((node) => node instanceof Element && node.matches(".sia-floating-scrollbar-layer, .sia-scrollbar-track"))) continue;
505
+ if (target === document.body && changed.length && changed.every((node) => node instanceof HTMLElement && node.matches(".sia-popup-portal"))) {
506
+ changed.forEach((node) => {
507
+ if (node instanceof HTMLElement && node.isConnected) dirtyStyles.add(node);
508
+ });
509
+ relevant = true;
510
+ continue;
511
+ }
512
+ }
513
+ const popup = target.closest(".sia-popup-portal");
514
+ if (popup) {
515
+ dirtyStyles.add(popup);
516
+ relevant = true;
517
+ continue;
518
+ }
519
+ if (mutation.type === "attributes" && mutation.attributeName === "class" && target instanceof HTMLElement && target.matches(".sia-select")) {
520
+ const oldClasses = new Set((mutation.oldValue ?? "").split(/\s+/).filter(Boolean));
521
+ const newClasses = new Set(target.classList);
522
+ const changed = [.../* @__PURE__ */ new Set([...oldClasses, ...newClasses])].filter((name) => oldClasses.has(name) !== newClasses.has(name));
523
+ if (changed.every((name) => name === "is-open")) {
524
+ dirtyStyles.add(target);
525
+ relevant = true;
526
+ continue;
527
+ }
528
+ }
529
+ relevant = true;
530
+ let positionOnly = false;
531
+ if (mutation.type === "attributes" && mutation.attributeName === "style" && target instanceof HTMLElement) {
532
+ previousStyle.cssText = mutation.oldValue ?? "";
533
+ const keys = /* @__PURE__ */ new Set([...Array.from(previousStyle), ...Array.from(target.style)]);
534
+ const changed = [...keys].filter((key) => previousStyle.getPropertyValue(key) !== target.style.getPropertyValue(key) || previousStyle.getPropertyPriority(key) !== target.style.getPropertyPriority(key));
535
+ if (!changed.length) continue;
536
+ const fixedSize = target.style.width.endsWith("px") && target.style.height.endsWith("px");
537
+ positionOnly = fixedSize && changed.every((key) => positionProperties.has(key)) && ["absolute", "fixed"].includes(getComputedStyle(target).position);
538
+ }
539
+ if (positionOnly && target instanceof HTMLElement) dirtyStyles.add(target);
540
+ else fullScan = true;
541
+ }
542
+ if (relevant) scheduleScan(false);
543
+ });
544
+ mutationObserver.observe(document.documentElement, { subtree: true, childList: true, attributes: true, attributeOldValue: true, attributeFilter: ["class", "style", "hidden", "data-sia-native-scrollbar", "data-sia-floating-scrollbar"] });
545
+ const onResize = () => scheduleScan();
546
+ window.addEventListener("resize", onResize);
547
+ window.addEventListener("scroll", scheduleUpdateAll, true);
548
+ scheduleScan();
549
+ return () => {
550
+ releaseProximity();
551
+ mutationObserver.disconnect();
552
+ resizeObserver.disconnect();
553
+ window.removeEventListener("resize", onResize);
554
+ window.removeEventListener("scroll", scheduleUpdateAll, true);
555
+ if (scanFrame) window.cancelAnimationFrame(scanFrame);
556
+ if (updateFrame) window.cancelAnimationFrame(updateFrame);
557
+ entries.forEach((entry) => entry.cleanup());
558
+ entries.clear();
559
+ layer.remove();
560
+ };
561
+ }
562
+
563
+ // src/components/ChartWhirlingLoading.tsx
564
+ var import_react3 = require("react");
85
565
  var import_jsx_runtime = require("react/jsx-runtime");
86
566
  function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\u83B7\u53D6\u4E2D", textWidth, frame }) {
87
- const [tick, setTick] = (0, import_react.useState)(0);
88
- (0, import_react.useEffect)(() => {
567
+ const [tick, setTick] = (0, import_react3.useState)(0);
568
+ (0, import_react3.useEffect)(() => {
89
569
  if (frame != null) return;
90
570
  const media = window.matchMedia("(prefers-reduced-motion: reduce)");
91
571
  let timer;
@@ -119,8 +599,178 @@ function ChartWhirlingLoading({ width = 720, height = 360, text = "\u6570\u636E\
119
599
  var import_client = require("react-dom/client");
120
600
 
121
601
  // src/components/PopupPortal.tsx
122
- var import_react2 = require("react");
602
+ var import_react5 = require("react");
123
603
  var import_react_dom = require("react-dom");
604
+
605
+ // src/components/overlayMotion.ts
606
+ var import_react4 = require("react");
607
+
608
+ // src/components/popupFluidMotion.ts
609
+ var popupEnterDuration = 260;
610
+ var popupExitDuration = 140;
611
+ var popupInitialScale = 0.88;
612
+ var popupTravelOffset = 6;
613
+ function popupFluidFrames(placement, open = true) {
614
+ const side = placement.split("-")[0];
615
+ const axis = side === "left" || side === "right" ? "X" : "Y";
616
+ const sign = side === "left" || side === "top" ? 1 : -1;
617
+ const hidden = { opacity: 0, transform: `translate${axis}(${sign * popupTravelOffset}px) scale(${popupInitialScale})` };
618
+ const visible = { opacity: 1, transform: "none" };
619
+ return open ? [
620
+ { ...hidden, offset: 0 },
621
+ { opacity: 1, transform: "scale(1.11, 1.085)", offset: 0.68 },
622
+ { opacity: 1, transform: "scale(.945, .965)", offset: 0.86 },
623
+ { ...visible, offset: 1 }
624
+ ] : [{ ...visible, offset: 0 }, { ...hidden, offset: 1 }];
625
+ }
626
+
627
+ // src/components/overlayMotion.ts
628
+ function motionFrames(kind, placement) {
629
+ if (kind === "fade") return [{ opacity: 0 }, { opacity: 1 }];
630
+ if (kind === "toast") return [
631
+ { opacity: 0, transform: "translateY(-6px)", offset: 0 },
632
+ { opacity: 1, transform: "translateY(3px)", offset: 0.68 },
633
+ { opacity: 1, transform: "translateY(-1px)", offset: 0.86 },
634
+ { opacity: 1, transform: "none", offset: 1 }
635
+ ];
636
+ if (kind === "drawer") {
637
+ const axis = placement === "left" || placement === "right" ? "X" : "Y";
638
+ const sign = placement === "left" || placement === "top" ? -1 : 1;
639
+ const outside = `translate${axis}(${sign * 100}%)`;
640
+ return [
641
+ { transform: outside, offset: 0 },
642
+ { transform: `translate${axis}(0) scale${axis}(1.065)`, offset: 0.68 },
643
+ { transform: `translate${axis}(0) scale${axis}(.975)`, offset: 0.86 },
644
+ { transform: "none", offset: 1 }
645
+ ];
646
+ }
647
+ const modal = kind === "modal";
648
+ return [
649
+ { opacity: 0, transform: `translateY(${modal ? 18 : -6}px) scale(${modal ? 0.9 : 0.88})`, offset: 0 },
650
+ { opacity: 1, transform: modal ? "scale(1.075, 1.05)" : "scale(1.11, 1.085)", offset: 0.68 },
651
+ { opacity: 1, transform: modal ? "scale(.965, .98)" : "scale(.945, .965)", offset: 0.86 },
652
+ { opacity: 1, transform: "none", offset: 1 }
653
+ ];
654
+ }
655
+ function useOverlayMotion(open, ref, kind, placement = "bottom", ready = true, onFinish, enabled = true) {
656
+ const [phase, setPhase] = (0, import_react4.useState)(open ? "entering" : "closed");
657
+ const present = open || phase !== "closed";
658
+ const [entered, setEntered] = (0, import_react4.useState)(false);
659
+ const position = (0, import_react4.useRef)();
660
+ const snapshot = (0, import_react4.useRef)();
661
+ const notify = (0, import_react4.useRef)();
662
+ const callback = (0, import_react4.useRef)(onFinish);
663
+ callback.current = onFinish;
664
+ (0, import_react4.useLayoutEffect)(() => {
665
+ const node = ref.current;
666
+ if (!present || !ready || !node) return;
667
+ let cancelled = false;
668
+ let animation;
669
+ let surfaceAnimation;
670
+ let maskAnimation;
671
+ const panel = kind === "drawer" || kind === "modal";
672
+ const fluid = kind === "popup";
673
+ const mask = kind === "modal" ? node.closest(".sia-modal-root") : kind === "drawer" ? node.closest(".sia-drawer-root")?.querySelector(".sia-drawer__mask") : null;
674
+ setPhase(open ? "entering" : "closing");
675
+ const finish = () => {
676
+ if (cancelled) return;
677
+ position.current = void 0;
678
+ snapshot.current = void 0;
679
+ if (open) {
680
+ animation?.cancel();
681
+ surfaceAnimation?.cancel();
682
+ maskAnimation?.cancel();
683
+ }
684
+ notify.current = open;
685
+ setEntered(open);
686
+ setPhase(open ? "open" : "closed");
687
+ node.dispatchEvent(new Event("sia-overlay-motion-end", { bubbles: true }));
688
+ };
689
+ const reduced = node.ownerDocument.defaultView?.matchMedia("(prefers-reduced-motion: reduce)");
690
+ const completeImmediately = () => {
691
+ animation?.cancel();
692
+ surfaceAnimation?.cancel();
693
+ maskAnimation?.cancel();
694
+ finish();
695
+ };
696
+ if (!enabled || reduced?.matches || !node.animate) {
697
+ finish();
698
+ } else {
699
+ let frames = fluid ? popupFluidFrames(placement, open) : motionFrames(kind, placement);
700
+ const start = snapshot.current;
701
+ const enterDuration = fluid ? popupEnterDuration : kind === "drawer" ? 320 : kind === "modal" ? 240 : kind === "fade" ? 180 : 280;
702
+ let duration = fluid && !open ? popupExitDuration : panel && !open ? kind === "drawer" ? 180 : 160 : enterDuration;
703
+ if (fluid && start) {
704
+ const current = new DOMMatrix(start.transform);
705
+ const destination = new DOMMatrix(String(frames[frames.length - 1].transform));
706
+ const remaining = Math.min(1, Math.max(0.15, Math.max(Math.abs(destination.a - current.a), Math.abs(destination.d - current.d)) / (1 - popupInitialScale), Math.hypot(current.e - destination.e, current.f - destination.f) / popupTravelOffset));
707
+ frames = [{ offset: 0, transform: start.transform, opacity: start.opacity }, { ...frames[frames.length - 1], offset: 1 }];
708
+ duration *= remaining;
709
+ }
710
+ if (panel) {
711
+ if (!open) frames = [{ transform: start?.transform ?? "none", opacity: start?.opacity ?? 1 }, { ...frames[0], offset: 1 }];
712
+ else if (start) frames = [{ ...frames[0], transform: start.transform, opacity: start.opacity }, ...frames.slice(1)];
713
+ }
714
+ const options = {
715
+ duration,
716
+ easing: fluid ? open ? "cubic-bezier(.2,.7,.2,1)" : "cubic-bezier(.4,0,1,1)" : panel && !open ? "cubic-bezier(.4,0,1,1)" : kind === "fade" ? "ease-in-out" : "cubic-bezier(.2,.7,.2,1)",
717
+ direction: panel || fluid || open ? "normal" : "reverse",
718
+ fill: "both"
719
+ };
720
+ animation = node.animate(frames, options);
721
+ if (!panel && !fluid && position.current !== void 0) animation.currentTime = open ? position.current : duration - position.current;
722
+ position.current = void 0;
723
+ snapshot.current = void 0;
724
+ if (mask) {
725
+ maskAnimation = mask.animate([{ opacity: start?.maskOpacity ?? (open ? 0 : 1) }, { opacity: open ? 1 : 0 }], { ...options, pseudoElement: kind === "modal" ? "::before" : void 0 });
726
+ maskAnimation.currentTime = animation.currentTime;
727
+ if (animation.startTime !== null) maskAnimation.startTime = animation.startTime;
728
+ }
729
+ if (kind === "toast") {
730
+ const surfaceFrames = motionFrames("message", placement).map((frame) => ({
731
+ offset: frame.offset,
732
+ transform: String(frame.transform).replace(/translateY\([^)]*\)\s*/g, "")
733
+ }));
734
+ surfaceAnimation = node.animate(surfaceFrames, { ...options, pseudoElement: "::before" });
735
+ surfaceAnimation.currentTime = animation.currentTime;
736
+ if (animation.startTime !== null) surfaceAnimation.startTime = animation.startTime;
737
+ }
738
+ animation.finished.then(finish, () => {
739
+ });
740
+ reduced?.addEventListener("change", completeImmediately, { once: true });
741
+ }
742
+ return () => {
743
+ cancelled = true;
744
+ reduced?.removeEventListener("change", completeImmediately);
745
+ if (animation && (animation.playState === "running" || animation.playState === "paused")) {
746
+ if (panel || fluid) {
747
+ const css = node.ownerDocument.defaultView.getComputedStyle(node);
748
+ snapshot.current = {
749
+ transform: css.transform,
750
+ opacity: css.opacity,
751
+ maskOpacity: mask ? node.ownerDocument.defaultView.getComputedStyle(mask, kind === "modal" ? "::before" : null).opacity : void 0
752
+ };
753
+ } else {
754
+ const time = Number(animation.currentTime ?? 0);
755
+ const duration = Number(animation.effect?.getTiming().duration ?? 0);
756
+ position.current = open ? time : duration - time;
757
+ }
758
+ }
759
+ animation?.cancel();
760
+ surfaceAnimation?.cancel();
761
+ maskAnimation?.cancel();
762
+ };
763
+ }, [open, present, ready, kind, placement, enabled, ref]);
764
+ (0, import_react4.useEffect)(() => {
765
+ if (notify.current === void 0) return;
766
+ const completedOpen = notify.current;
767
+ notify.current = void 0;
768
+ if (completedOpen === open) callback.current?.(completedOpen);
769
+ }, [phase, open]);
770
+ return { present, entered, settled: phase === "open", closing: !open, phase };
771
+ }
772
+
773
+ // src/components/PopupPortal.tsx
124
774
  var import_jsx_runtime2 = require("react/jsx-runtime");
125
775
  function setForwardedRef(ref, value) {
126
776
  if (typeof ref === "function") ref(value);
@@ -129,21 +779,23 @@ function setForwardedRef(ref, value) {
129
779
  function clamp(value, min, max) {
130
780
  return Math.min(Math.max(value, min), Math.max(min, max));
131
781
  }
132
- var PopupPortal = (0, import_react2.forwardRef)(function PopupPortal2({
782
+ var PopupPortal = (0, import_react5.forwardRef)(function PopupPortal2({
133
783
  anchorRef,
134
784
  open = true,
135
785
  placement = "bottom-start",
136
786
  offset = 6,
137
787
  viewportPadding = 8,
788
+ afterOpenChange,
138
789
  className = "",
139
790
  style,
140
791
  children,
141
792
  ...props
142
793
  }, forwardedRef) {
143
- const popupRef = (0, import_react2.useRef)(null);
144
- const [position, setPosition] = (0, import_react2.useState)();
145
- (0, import_react2.useLayoutEffect)(() => {
146
- if (!open || typeof document === "undefined") {
794
+ const popupRef = (0, import_react5.useRef)(null);
795
+ const [position, setPosition] = (0, import_react5.useState)();
796
+ const motion = useOverlayMotion(open, popupRef, "popup", position?.placement ?? placement, !!position, afterOpenChange);
797
+ (0, import_react5.useLayoutEffect)(() => {
798
+ if (!motion.present || typeof document === "undefined") {
147
799
  setPosition(void 0);
148
800
  return;
149
801
  }
@@ -152,7 +804,7 @@ var PopupPortal = (0, import_react2.forwardRef)(function PopupPortal2({
152
804
  const popup = popupRef.current;
153
805
  if (!anchor || !popup) return;
154
806
  const anchorRect = anchor.getBoundingClientRect();
155
- const popupRect = popup.getBoundingClientRect();
807
+ const popupRect = { width: popup.offsetWidth, height: popup.offsetHeight };
156
808
  const viewportWidth = document.documentElement.clientWidth;
157
809
  const viewportHeight = document.documentElement.clientHeight;
158
810
  let resolvedPlacement = placement;
@@ -194,18 +846,28 @@ var PopupPortal = (0, import_react2.forwardRef)(function PopupPortal2({
194
846
  setPosition((current) => current && current.top === next.top && current.left === next.left && current.anchorWidth === next.anchorWidth && current.availableHeight === next.availableHeight && current.placement === next.placement ? current : next);
195
847
  };
196
848
  update();
197
- window.addEventListener("resize", update);
198
- window.addEventListener("scroll", update, true);
199
- const observer = new ResizeObserver(update);
849
+ let frame = 0;
850
+ const schedule = () => {
851
+ if (!frame) frame = requestAnimationFrame(() => {
852
+ frame = 0;
853
+ update();
854
+ });
855
+ };
856
+ window.addEventListener("resize", schedule);
857
+ window.addEventListener("scroll", schedule, true);
858
+ window.addEventListener("sia-overlay-motion-end", schedule);
859
+ const observer = new ResizeObserver(schedule);
200
860
  if (anchorRef.current) observer.observe(anchorRef.current);
201
861
  if (popupRef.current) observer.observe(popupRef.current);
202
862
  return () => {
203
- window.removeEventListener("resize", update);
204
- window.removeEventListener("scroll", update, true);
863
+ window.removeEventListener("resize", schedule);
864
+ window.removeEventListener("scroll", schedule, true);
865
+ window.removeEventListener("sia-overlay-motion-end", schedule);
866
+ cancelAnimationFrame(frame);
205
867
  observer.disconnect();
206
868
  };
207
- }, [anchorRef, offset, open, placement, viewportPadding]);
208
- if (!open || typeof document === "undefined") return null;
869
+ }, [anchorRef, offset, motion.present, placement, viewportPadding]);
870
+ if (!motion.present || typeof document === "undefined") return null;
209
871
  return (0, import_react_dom.createPortal)(
210
872
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
211
873
  "div",
@@ -217,13 +879,19 @@ var PopupPortal = (0, import_react2.forwardRef)(function PopupPortal2({
217
879
  className: `sia-popup-portal ${className}`.trim(),
218
880
  "data-sia-popup-layer": "",
219
881
  "data-placement": position?.placement ?? placement,
882
+ "data-state": motion.closing ? "closing" : "open",
883
+ "aria-hidden": motion.closing || void 0,
220
884
  style: {
221
885
  ...style,
222
886
  "--sia-popup-anchor-width": `${position?.anchorWidth ?? anchorRef.current?.getBoundingClientRect().width ?? 0}px`,
223
887
  "--sia-popup-available-height": position ? `${position.availableHeight}px` : void 0,
224
888
  top: position?.top ?? 0,
225
889
  left: position?.left ?? 0,
226
- visibility: position ? "visible" : "hidden"
890
+ visibility: position ? "visible" : "hidden",
891
+ animation: "none",
892
+ pointerEvents: motion.closing ? "none" : style?.pointerEvents,
893
+ // 以靠近触发器的边缘中心为缩放原点,业务显式原点优先。
894
+ transformOrigin: style?.transformOrigin ?? ((position?.placement ?? placement).startsWith("left") ? "right center" : (position?.placement ?? placement).startsWith("right") ? "left center" : (position?.placement ?? placement).startsWith("top") ? "center bottom" : "center top")
227
895
  },
228
896
  ...withTitleTooltip(props),
229
897
  children
@@ -235,7 +903,7 @@ var PopupPortal = (0, import_react2.forwardRef)(function PopupPortal2({
235
903
 
236
904
  // src/components/titleTooltip.tsx
237
905
  var import_jsx_runtime3 = require("react/jsx-runtime");
238
- var documents = /* @__PURE__ */ new WeakSet();
906
+ var installedKey = /* @__PURE__ */ Symbol.for("sia.ui.titleTooltip.installed");
239
907
  function withTitleTooltip(props) {
240
908
  if (!props || typeof props !== "object" || !("title" in props)) return props;
241
909
  const { title, ...rest } = props;
@@ -243,8 +911,9 @@ function withTitleTooltip(props) {
243
911
  return { ...rest, "data-sia-title": title == null ? void 0 : String(title) };
244
912
  }
245
913
  function installTitleTooltips(doc) {
246
- if (documents.has(doc)) return;
247
- documents.add(doc);
914
+ const owner = doc;
915
+ if (owner[installedKey]) return;
916
+ owner[installedKey] = true;
248
917
  let hovered = null;
249
918
  let focused = null;
250
919
  let keyboardFocus = true;
@@ -278,8 +947,23 @@ function installTitleTooltips(doc) {
278
947
  if (ids.length) active.setAttribute("aria-describedby", ids.join(" "));
279
948
  else active.removeAttribute("aria-describedby");
280
949
  }
950
+ const closing = active;
281
951
  active = null;
282
- root?.render(null);
952
+ if (closing && root) root.render(/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
953
+ PopupPortal,
954
+ {
955
+ anchorRef: { current: closing },
956
+ open: false,
957
+ placement: "top-start",
958
+ id: tooltipId,
959
+ role: "tooltip",
960
+ className: "sia-title-tooltip",
961
+ afterOpenChange: (opened) => {
962
+ if (!opened && !active) root?.render(null);
963
+ },
964
+ children: closing.getAttribute("data-sia-title")
965
+ }
966
+ ));
283
967
  };
284
968
  const render = () => {
285
969
  const text = active?.getAttribute("data-sia-title");
@@ -377,20 +1061,20 @@ function installTitleTooltips(doc) {
377
1061
  }
378
1062
 
379
1063
  // src/components/SvgMapPlot.tsx
380
- var import_react14 = require("react");
1064
+ var import_react17 = require("react");
381
1065
 
382
1066
  // src/components/ChartBrush.tsx
383
- var import_react3 = require("react");
1067
+ var import_react6 = require("react");
384
1068
  var import_jsx_runtime4 = require("react/jsx-runtime");
385
1069
  function ChartBrush({ bounds, onSelect, onCancel, selectionShape = "band", selectionStyle, minSelectionSize }) {
386
- const [vertical, setVertical] = (0, import_react3.useState)(null);
387
- const startY = (0, import_react3.useRef)(0);
1070
+ const [vertical, setVertical] = (0, import_react6.useState)(null);
1071
+ const startY = (0, import_react6.useRef)(0);
388
1072
  const y = (event) => {
389
1073
  const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
390
1074
  return matrix ? Math.max(bounds.y, Math.min(bounds.y + bounds.height, new DOMPoint(event.clientX, event.clientY).matrixTransform(matrix.inverse()).y)) : bounds.y;
391
1075
  };
392
- const drag = (0, import_react3.useRef)(null);
393
- const [selection, setSelection] = (0, import_react3.useState)(null);
1076
+ const drag = (0, import_react6.useRef)(null);
1077
+ const [selection, setSelection] = (0, import_react6.useState)(null);
394
1078
  const x = (event) => {
395
1079
  const matrix = event.currentTarget.ownerSVGElement?.getScreenCTM();
396
1080
  if (!matrix) return null;
@@ -513,7 +1197,7 @@ function appendChartExportHeadings(original, clone, host) {
513
1197
  }
514
1198
 
515
1199
  // src/components/ChartNodeTimeline.tsx
516
- var import_react5 = require("react");
1200
+ var import_react8 = require("react");
517
1201
 
518
1202
  // src/components/timelinePositions.ts
519
1203
  function timelineRatios(count, dates) {
@@ -539,7 +1223,7 @@ function nearestTimelineIndex(ratios, ratio) {
539
1223
  }
540
1224
 
541
1225
  // src/components/ChartPointMotion.tsx
542
- var import_react4 = require("react");
1226
+ var import_react7 = require("react");
543
1227
 
544
1228
  // src/components/chartMotion.ts
545
1229
  function chartMotionBaseline(points, horizontal = false) {
@@ -560,11 +1244,11 @@ function interpolateChartPoints(from, to, progress) {
560
1244
  var import_jsx_runtime5 = require("react/jsx-runtime");
561
1245
  function ChartPointMotion({ points, enabled, duration, updateDuration = 500, animateInitial = true, easing = "linear", progress, horizontal = false, origin, children }) {
562
1246
  const baseline = (target) => origin ? target.map(() => origin) : chartMotionBaseline(target, horizontal);
563
- const [frame, setFrame] = (0, import_react4.useState)(() => enabled && animateInitial ? baseline(points) : points);
564
- const displayed = (0, import_react4.useRef)(frame);
565
- const initialized = (0, import_react4.useRef)(!animateInitial);
1247
+ const [frame, setFrame] = (0, import_react7.useState)(() => enabled && animateInitial ? baseline(points) : points);
1248
+ const displayed = (0, import_react7.useRef)(frame);
1249
+ const initialized = (0, import_react7.useRef)(!animateInitial);
566
1250
  const signature = JSON.stringify(points);
567
- (0, import_react4.useEffect)(() => {
1251
+ (0, import_react7.useEffect)(() => {
568
1252
  const target = points;
569
1253
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
570
1254
  if (!enabled || progress != null || reduced.matches) {
@@ -603,8 +1287,8 @@ function ChartPointMotion({ points, enabled, duration, updateDuration = 500, ani
603
1287
  // src/components/ChartNodeTimeline.tsx
604
1288
  var import_jsx_runtime6 = require("react/jsx-runtime");
605
1289
  function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, x = 80, y = 520, width = 840 }) {
606
- const [playing, setPlaying] = (0, import_react5.useState)(autoPlay), dragging = (0, import_react5.useRef)();
607
- const [draft, setDraft] = (0, import_react5.useState)(), pending = (0, import_react5.useRef)(), draftRef = (0, import_react5.useRef)();
1290
+ const [playing, setPlaying] = (0, import_react8.useState)(autoPlay), dragging = (0, import_react8.useRef)();
1291
+ const [draft, setDraft] = (0, import_react8.useState)(), pending = (0, import_react8.useRef)(), draftRef = (0, import_react8.useRef)();
608
1292
  const shown = draft ?? value;
609
1293
  const cancelPending = () => {
610
1294
  clearTimeout(pending.current);
@@ -612,8 +1296,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
612
1296
  draftRef.current = void 0;
613
1297
  setDraft(void 0);
614
1298
  };
615
- (0, import_react5.useEffect)(() => () => clearTimeout(pending.current), []);
616
- (0, import_react5.useEffect)(() => {
1299
+ (0, import_react8.useEffect)(() => () => clearTimeout(pending.current), []);
1300
+ (0, import_react8.useEffect)(() => {
617
1301
  cancelPending();
618
1302
  }, [value]);
619
1303
  const preview = (index) => {
@@ -628,8 +1312,8 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
628
1312
  draftRef.current = void 0;
629
1313
  }, 200);
630
1314
  };
631
- (0, import_react5.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
632
- (0, import_react5.useEffect)(() => {
1315
+ (0, import_react8.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
1316
+ (0, import_react8.useEffect)(() => {
633
1317
  if (!playing || labels.length < 2) return;
634
1318
  const timer = window.setTimeout(() => {
635
1319
  if (value + 1 < labels.length) onChange(value + 1);
@@ -738,7 +1422,7 @@ function ChartNodeTimeline({ labels, dates, value, onChange, autoPlay = false, p
738
1422
  }
739
1423
 
740
1424
  // src/components/ChartVerticalRange.tsx
741
- var import_react6 = require("react");
1425
+ var import_react9 = require("react");
742
1426
 
743
1427
  // src/components/chartColorRamp.ts
744
1428
  function chartColorRamp(colors, ratio) {
@@ -758,16 +1442,16 @@ function chartColorRamp(colors, ratio) {
758
1442
  // src/components/ChartVerticalRange.tsx
759
1443
  var import_jsx_runtime7 = require("react/jsx-runtime");
760
1444
  function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true, readOnly = false }) {
761
- const id = (0, import_react6.useId)().replaceAll(":", "");
762
- const drag = (0, import_react6.useRef)();
763
- const [draft, setDraft] = (0, import_react6.useState)();
764
- const pending = (0, import_react6.useRef)();
1445
+ const id = (0, import_react9.useId)().replaceAll(":", "");
1446
+ const drag = (0, import_react9.useRef)();
1447
+ const [draft, setDraft] = (0, import_react9.useState)();
1448
+ const pending = (0, import_react9.useRef)();
765
1449
  const cancel = () => {
766
1450
  drag.current = void 0;
767
1451
  pending.current = void 0;
768
1452
  setDraft(void 0);
769
1453
  };
770
- (0, import_react6.useEffect)(() => {
1454
+ (0, import_react9.useEffect)(() => {
771
1455
  if (!realtime) cancel();
772
1456
  }, [range[0], range[1], min, max, realtime]);
773
1457
  const shown = draft ?? range;
@@ -848,18 +1532,18 @@ function ChartVerticalRange({ min, max, x, y, length, thickness, colors, range,
848
1532
  }
849
1533
 
850
1534
  // src/components/ChartHorizontalRange.tsx
851
- var import_react7 = require("react");
1535
+ var import_react10 = require("react");
852
1536
  var import_jsx_runtime8 = require("react/jsx-runtime");
853
1537
  function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range, endLabels, onChange, indicatorValue, onHoverRange, realtime = true }) {
854
- const id = (0, import_react7.useId)().replaceAll(":", ""), span = max - min;
855
- const drag = (0, import_react7.useRef)();
856
- const [draft, setDraft] = (0, import_react7.useState)(), pending = (0, import_react7.useRef)();
1538
+ const id = (0, import_react10.useId)().replaceAll(":", ""), span = max - min;
1539
+ const drag = (0, import_react10.useRef)();
1540
+ const [draft, setDraft] = (0, import_react10.useState)(), pending = (0, import_react10.useRef)();
857
1541
  const cancel = () => {
858
1542
  drag.current = void 0;
859
1543
  pending.current = void 0;
860
1544
  setDraft(void 0);
861
1545
  };
862
- (0, import_react7.useEffect)(() => {
1546
+ (0, import_react10.useEffect)(() => {
863
1547
  if (!realtime) cancel();
864
1548
  }, [range[0], range[1], min, max, realtime]);
865
1549
  const shown = draft ?? range, low = Math.max(min, Math.min(max, shown[0])), high = Math.max(low, Math.min(max, shown[1]));
@@ -937,7 +1621,7 @@ function ChartHorizontalRange({ min, max, x, y, length, thickness, colors, range
937
1621
  }
938
1622
 
939
1623
  // src/components/Chart.tsx
940
- var import_react8 = require("react");
1624
+ var import_react11 = require("react");
941
1625
 
942
1626
  // src/components/chartCompositeExport.ts
943
1627
  function serializeChartComposite(host) {
@@ -1061,20 +1745,20 @@ var DEFAULT_CHART_PALETTE = [
1061
1745
  "#2f54eb",
1062
1746
  "#a0d911"
1063
1747
  ];
1064
- var ChartContext = (0, import_react8.createContext)(null);
1748
+ var ChartContext = (0, import_react11.createContext)(null);
1065
1749
  function toCssSize(value, fallback) {
1066
1750
  if (typeof value === "number") return `${value}px`;
1067
1751
  return value ?? fallback;
1068
1752
  }
1069
- var ChartComposite = (0, import_react8.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
1070
- const host = (0, import_react8.useRef)(null);
1071
- (0, import_react8.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
1753
+ var ChartComposite = (0, import_react11.forwardRef)(function ChartComposite2({ layers, width = "100%", height = 320, ariaLabel = "\u7EC4\u5408\u56FE\u8868", className = "", style, ...props }, ref) {
1754
+ const host = (0, import_react11.useRef)(null);
1755
+ (0, import_react11.useImperativeHandle)(ref, () => ({ toSvgString: () => host.current ? serializeChartComposite(host.current) : null, saveAsImage: (filename) => saveCompositeImage(host.current ? serializeChartComposite(host.current) : null, filename) }), []);
1072
1756
  return /* @__PURE__ */ (0, import_jsx_runtime9.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_runtime9.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)) });
1073
1757
  });
1074
- var useTooltipLayoutEffect = typeof window === "undefined" ? import_react8.useEffect : import_react8.useLayoutEffect;
1758
+ var useTooltipLayoutEffect = typeof window === "undefined" ? import_react11.useEffect : import_react11.useLayoutEffect;
1075
1759
  function ChartTooltip({ open, left, top, children, enterable = false, inheritTextStyle = false, placement = "above", className = "", style, ...props }) {
1076
- const elementRef = (0, import_react8.useRef)(null);
1077
- const [position, setPosition] = (0, import_react8.useState)([left, top]);
1760
+ const elementRef = (0, import_react11.useRef)(null);
1761
+ const [position, setPosition] = (0, import_react11.useState)([left, top]);
1078
1762
  useTooltipLayoutEffect(() => {
1079
1763
  const element = elementRef.current, host = element?.parentElement;
1080
1764
  if (!open || placement !== "axis" || !element || !host) return;
@@ -1198,7 +1882,7 @@ function ChartToolbox({
1198
1882
  ))
1199
1883
  ] });
1200
1884
  }
1201
- var SiaChart = (0, import_react8.forwardRef)(function SiaChart2({
1885
+ var SiaChart = (0, import_react11.forwardRef)(function SiaChart2({
1202
1886
  children,
1203
1887
  width = "100%",
1204
1888
  height = 320,
@@ -1225,19 +1909,19 @@ var SiaChart = (0, import_react8.forwardRef)(function SiaChart2({
1225
1909
  style,
1226
1910
  ...rest
1227
1911
  }, ref) {
1228
- const hostRef = (0, import_react8.useRef)(null);
1229
- const svgRef = (0, import_react8.useRef)(null);
1230
- const titleId = (0, import_react8.useId)();
1231
- const descriptionId = (0, import_react8.useId)();
1232
- const [tooltip, setTooltip] = (0, import_react8.useState)(null);
1233
- const tooltipHideTimer = (0, import_react8.useRef)();
1234
- const tooltipHeld = (0, import_react8.useRef)(false);
1912
+ const hostRef = (0, import_react11.useRef)(null);
1913
+ const svgRef = (0, import_react11.useRef)(null);
1914
+ const titleId = (0, import_react11.useId)();
1915
+ const descriptionId = (0, import_react11.useId)();
1916
+ const [tooltip, setTooltip] = (0, import_react11.useState)(null);
1917
+ const tooltipHideTimer = (0, import_react11.useRef)();
1918
+ const tooltipHeld = (0, import_react11.useRef)(false);
1235
1919
  const cancelTooltipHide = () => {
1236
1920
  clearTimeout(tooltipHideTimer.current);
1237
1921
  };
1238
- (0, import_react8.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
1239
- const [linkedPosition, setLinkedPosition] = (0, import_react8.useState)({ left: 0, top: 0 });
1240
- (0, import_react8.useEffect)(() => {
1922
+ (0, import_react11.useEffect)(() => () => clearTimeout(tooltipHideTimer.current), []);
1923
+ const [linkedPosition, setLinkedPosition] = (0, import_react11.useState)({ left: 0, top: 0 });
1924
+ (0, import_react11.useEffect)(() => {
1241
1925
  const host = hostRef.current, svg = svgRef.current;
1242
1926
  if (!controlledTooltip || !host || !svg) return;
1243
1927
  const position = () => {
@@ -1252,12 +1936,12 @@ var SiaChart = (0, import_react8.forwardRef)(function SiaChart2({
1252
1936
  observer.observe(host);
1253
1937
  return () => observer.disconnect();
1254
1938
  }, [controlledTooltip]);
1255
- const [dataViewOpen, setDataViewOpen] = (0, import_react8.useState)(false);
1256
- const [markMode, setMarkMode] = (0, import_react8.useState)(false);
1257
- const [markStart, setMarkStart] = (0, import_react8.useState)(null);
1258
- const [userMarks, setUserMarks] = (0, import_react8.useState)([]);
1939
+ const [dataViewOpen, setDataViewOpen] = (0, import_react11.useState)(false);
1940
+ const [markMode, setMarkMode] = (0, import_react11.useState)(false);
1941
+ const [markStart, setMarkStart] = (0, import_react11.useState)(null);
1942
+ const [userMarks, setUserMarks] = (0, import_react11.useState)([]);
1259
1943
  const toolboxOptions = toolbox === true ? {} : toolbox || void 0;
1260
- const rootStyle = (0, import_react8.useMemo)(() => ({
1944
+ const rootStyle = (0, import_react11.useMemo)(() => ({
1261
1945
  ...style,
1262
1946
  width: toCssSize(width, "100%"),
1263
1947
  height: toCssSize(height, "320px"),
@@ -1315,13 +1999,13 @@ var SiaChart = (0, import_react8.forwardRef)(function SiaChart2({
1315
1999
  anchor.href = canvas.toDataURL("image/png");
1316
2000
  anchor.click();
1317
2001
  }
1318
- (0, import_react8.useImperativeHandle)(ref, () => ({
2002
+ (0, import_react11.useImperativeHandle)(ref, () => ({
1319
2003
  getElement: () => svgRef.current,
1320
2004
  focus: () => svgRef.current?.focus(),
1321
2005
  toSvgString: serializeSvg,
1322
2006
  toDataUrl: svgDataUrl
1323
2007
  }), []);
1324
- const context = (0, import_react8.useMemo)(() => ({
2008
+ const context = (0, import_react11.useMemo)(() => ({
1325
2009
  palette,
1326
2010
  showTooltip: (event, content, point) => {
1327
2011
  cancelTooltipHide();
@@ -1508,7 +2192,7 @@ var SiaChart = (0, import_react8.forwardRef)(function SiaChart2({
1508
2192
  ) });
1509
2193
  });
1510
2194
  function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave, onFocus, onBlur, ...props }) {
1511
- const context = (0, import_react8.useContext)(ChartContext);
2195
+ const context = (0, import_react11.useContext)(ChartContext);
1512
2196
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1513
2197
  "g",
1514
2198
  {
@@ -1537,7 +2221,7 @@ function ChartMark({ tooltip, tooltipPoint, label, onPointerMove, onPointerLeave
1537
2221
  );
1538
2222
  }
1539
2223
  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 }) {
1540
- const paintId = (0, import_react8.useId)().replaceAll(":", "");
2224
+ const paintId = (0, import_react11.useId)().replaceAll(":", "");
1541
2225
  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))));
1542
2226
  const totalWidth = orientation === "horizontal" ? widths.reduce((sum, value) => sum + value, 0) + Math.max(0, items.length - 1) * itemGap : Math.max(0, ...widths);
1543
2227
  const startX = align === "start" ? x : align === "end" ? x - totalWidth : x - totalWidth / 2;
@@ -1666,7 +2350,7 @@ function ChartAxis({ layer = "all", orientation, x, y, length, labels, positions
1666
2350
  ] });
1667
2351
  }
1668
2352
  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 }) {
1669
- const id = (0, import_react8.useId)().replaceAll(":", "");
2353
+ const id = (0, import_react11.useId)().replaceAll(":", "");
1670
2354
  const vertical = orientation === "vertical";
1671
2355
  if (svgHandles && vertical && !calculable && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartVerticalRange, { readOnly: true, min, max, x, y, length: width, thickness: height, colors, range: [min, max], endLabels, indicatorValue, onHoverRange });
1672
2356
  if (svgHandles && vertical && calculable && range && !pieces?.length) return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartVerticalRange, { min, max, x, y, length: width, thickness: height, colors, range, onChange: onRangeChange, endLabels, indicatorValue, onHoverRange, realtime });
@@ -1694,8 +2378,8 @@ function ChartVisualMap({ min, max, colors = ["#e6f4ff", "#1677ff"], x = 16, y =
1694
2378
  ] });
1695
2379
  }
1696
2380
  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 }) {
1697
- const [activeHandle, setActiveHandle] = (0, import_react8.useState)(null);
1698
- const pan = (0, import_react8.useRef)();
2381
+ const [activeHandle, setActiveHandle] = (0, import_react11.useState)(null);
2382
+ const pan = (0, import_react11.useRef)();
1699
2383
  const start = Math.min(value[0], value[1]);
1700
2384
  const end = Math.max(value[0], value[1]);
1701
2385
  const startPercent = (start - min) / Math.max(1, max - min) * 100;
@@ -1769,9 +2453,9 @@ function ChartDataZoom({ value, min = 0, max = 100, ariaLabel = "\u56FE\u8868\u5
1769
2453
  ] });
1770
2454
  }
1771
2455
  function ChartTimeline({ labels, value, onChange, autoPlay = false, playInterval = 2e3, loop = true, className = "", ...props }) {
1772
- const [playing, setPlaying] = (0, import_react8.useState)(autoPlay);
1773
- (0, import_react8.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
1774
- (0, import_react8.useEffect)(() => {
2456
+ const [playing, setPlaying] = (0, import_react11.useState)(autoPlay);
2457
+ (0, import_react11.useEffect)(() => setPlaying(autoPlay), [autoPlay]);
2458
+ (0, import_react11.useEffect)(() => {
1775
2459
  if (!playing || labels.length <= 1) return void 0;
1776
2460
  const timer = window.setInterval(() => {
1777
2461
  const next = value + 1;
@@ -1881,7 +2565,7 @@ function parseSvgMapPaths(source) {
1881
2565
  }
1882
2566
 
1883
2567
  // src/components/useMapRoam.ts
1884
- var import_react9 = require("react");
2568
+ var import_react12 = require("react");
1885
2569
 
1886
2570
  // src/components/chartRoam.ts
1887
2571
  function zoomChartViewport(view, factor, point, limit = { min: 0.05, max: 20 }) {
@@ -1898,14 +2582,14 @@ var initial = { x: 0, y: 0, scale: 1 };
1898
2582
  function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.12, 0.9]) {
1899
2583
  const [zoomIn, zoomOut] = wheelFactors;
1900
2584
  const min = scaleLimit?.min, max = scaleLimit?.max, unlimited = scaleLimit === null;
1901
- const host = (0, import_react9.useRef)(null);
1902
- const [view, setView] = (0, import_react9.useState)(initial);
1903
- const drag = (0, import_react9.useRef)();
2585
+ const host = (0, import_react12.useRef)(null);
2586
+ const [view, setView] = (0, import_react12.useState)(initial);
2587
+ const drag = (0, import_react12.useRef)();
1904
2588
  const local = (x, y) => {
1905
2589
  const matrix = host.current?.ownerSVGElement?.getScreenCTM();
1906
2590
  return matrix ? new DOMPoint(x, y).matrixTransform(matrix.inverse()) : new DOMPoint(x, y);
1907
2591
  };
1908
- (0, import_react9.useEffect)(() => {
2592
+ (0, import_react12.useEffect)(() => {
1909
2593
  const node = host.current;
1910
2594
  if (!node || !mode || mode === "move") return;
1911
2595
  const wheel = (event) => {
@@ -1967,7 +2651,7 @@ function useMapRoam(mode, scaleLimit = { min: 0.65, max: 5 }, wheelFactors = [1.
1967
2651
  }
1968
2652
 
1969
2653
  // src/components/ChartMapLineReveal.tsx
1970
- var import_react10 = require("react");
2654
+ var import_react13 = require("react");
1971
2655
 
1972
2656
  // src/components/mapLineGeometry.ts
1973
2657
  function mapLineControl(source, target, curveness) {
@@ -1984,9 +2668,9 @@ function mapLineDuration(source, target, period) {
1984
2668
  // src/components/ChartMapLineReveal.tsx
1985
2669
  var import_jsx_runtime10 = require("react/jsx-runtime");
1986
2670
  function ChartMapLineReveal({ source, control, target, enabled, initialDuration = 2e3, updateDuration = 500, children }) {
1987
- const signature = JSON.stringify([source, control, target]), initialized = (0, import_react10.useRef)(false);
1988
- const [frame, setFrame] = (0, import_react10.useState)({ signature, progress: enabled ? 0 : 1 });
1989
- (0, import_react10.useEffect)(() => {
2671
+ const signature = JSON.stringify([source, control, target]), initialized = (0, import_react13.useRef)(false);
2672
+ const [frame, setFrame] = (0, import_react13.useState)({ signature, progress: enabled ? 0 : 1 });
2673
+ (0, import_react13.useEffect)(() => {
1990
2674
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
1991
2675
  const duration = Math.max(1, initialized.current ? updateDuration : initialDuration);
1992
2676
  if (!enabled || reduced.matches) {
@@ -2019,15 +2703,15 @@ function ChartMapLineReveal({ source, control, target, enabled, initialDuration
2019
2703
  }
2020
2704
 
2021
2705
  // src/components/ChartMapLineEffect.tsx
2022
- var import_react11 = require("react");
2706
+ var import_react14 = require("react");
2023
2707
  var import_jsx_runtime11 = require("react/jsx-runtime");
2024
2708
  function ChartMapLineEffect({ source, control, target, period = 30, color = "#fff", radius = 1, shadowBlur = 10, shadowColor = color, trailAlpha }) {
2025
- const ref = (0, import_react11.useRef)(null);
2026
- const trails = (0, import_react11.useRef)([]);
2709
+ const ref = (0, import_react14.useRef)(null);
2710
+ const trails = (0, import_react14.useRef)([]);
2027
2711
  const alpha = trailAlpha === void 0 ? 0 : Math.max(0, Math.min(0.999, trailAlpha));
2028
2712
  const count = alpha > 0 ? Math.min(240, Math.ceil(Math.log(5e-3) / Math.log(alpha))) : 0;
2029
2713
  const duration = mapLineDuration(source, target, period);
2030
- (0, import_react11.useEffect)(() => {
2714
+ (0, import_react14.useEffect)(() => {
2031
2715
  const started = performance.now();
2032
2716
  let frame = 0;
2033
2717
  const history = [];
@@ -2060,7 +2744,7 @@ function ChartMapLineEffect({ source, control, target, period = 30, color = "#ff
2060
2744
  }
2061
2745
 
2062
2746
  // src/components/ChartMapPointPulse.tsx
2063
- var import_react12 = require("react");
2747
+ var import_react15 = require("react");
2064
2748
 
2065
2749
  // src/components/mapPointPulse.ts
2066
2750
  function mapPointPulseDuration(period, random = Math.random) {
@@ -2070,7 +2754,7 @@ function mapPointPulseDuration(period, random = Math.random) {
2070
2754
  // src/components/ChartMapPointPulse.tsx
2071
2755
  var import_jsx_runtime12 = require("react/jsx-runtime");
2072
2756
  function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
2073
- const [duration] = (0, import_react12.useState)(() => mapPointPulseDuration(period));
2757
+ const [duration] = (0, import_react15.useState)(() => mapPointPulseDuration(period));
2074
2758
  return /* @__PURE__ */ (0, import_jsx_runtime12.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: [
2075
2759
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("animate", { attributeName: "r", values: `${size * scaleSize * 0.1};${size * scaleSize}`, dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" }),
2076
2760
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("animate", { attributeName: "stroke-width", values: ".1;1", dur: `${duration}ms`, repeatCount: "indefinite", calcMode: "linear" })
@@ -2078,11 +2762,11 @@ function ChartMapPointPulse({ x, y, size, color, period = 15, scaleSize = 2 }) {
2078
2762
  }
2079
2763
 
2080
2764
  // src/components/ChartMapPointEntrance.tsx
2081
- var import_react13 = require("react");
2765
+ var import_react16 = require("react");
2082
2766
  var import_jsx_runtime13 = require("react/jsx-runtime");
2083
2767
  function ChartMapPointEntrance({ enabled, x, y, children }) {
2084
- const [progress, setProgress] = (0, import_react13.useState)(enabled ? 0.01 : 1);
2085
- (0, import_react13.useEffect)(() => {
2768
+ const [progress, setProgress] = (0, import_react16.useState)(enabled ? 0.01 : 1);
2769
+ (0, import_react16.useEffect)(() => {
2086
2770
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
2087
2771
  if (!enabled || reduced.matches) {
2088
2772
  setProgress(1);
@@ -2125,8 +2809,8 @@ function mapLineEndLabel(source, target) {
2125
2809
  // src/components/SvgMapPlot.tsx
2126
2810
  var import_jsx_runtime14 = require("react/jsx-runtime");
2127
2811
  function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized, onHover, stroke, strokeWidth, opacity, hoverable = true, showLabel = true, tooltipNameOnly = false }) {
2128
- const path = (0, import_react14.useRef)(null), [center, setCenter] = (0, import_react14.useState)([0, 0]);
2129
- (0, import_react14.useLayoutEffect)(() => {
2812
+ const path = (0, import_react17.useRef)(null), [center, setCenter] = (0, import_react17.useState)([0, 0]);
2813
+ (0, import_react17.useLayoutEffect)(() => {
2130
2814
  const box = path.current?.getBBox();
2131
2815
  if (box) setCenter([box.x + box.width / 2, box.y + box.height / 2]);
2132
2816
  }, [d]);
@@ -2144,9 +2828,9 @@ function SvgMapRegion({ d, name, value, series, color, scale, offset, emphasized
2144
2828
  ] }), onPointerMove: () => onHover(true), onPointerLeave: () => onHover(false), onFocus: () => onHover(true), onBlur: () => onHover(false), children: content });
2145
2829
  }
2146
2830
  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" }) {
2147
- const map = (0, import_react14.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react14.useState)();
2148
- const [hoveredLine, setHoveredLine] = (0, import_react14.useState)();
2149
- (0, import_react14.useEffect)(() => {
2831
+ const map = (0, import_react17.useMemo)(() => parseSvgMapPaths(source), [source]), control = useMapRoam(roam, null, [1.2, 1 / 1.2]), [hovered, setHovered] = (0, import_react17.useState)();
2832
+ const [hoveredLine, setHoveredLine] = (0, import_react17.useState)();
2833
+ (0, import_react17.useEffect)(() => {
2150
2834
  control.reset();
2151
2835
  setHovered(void 0);
2152
2836
  }, [resetKey]);
@@ -2209,16 +2893,16 @@ function SvgMapPlot({ source, name, data, x, y, width, height, domain, range = d
2209
2893
  }
2210
2894
 
2211
2895
  // src/components/ChartRoamController.tsx
2212
- var import_react15 = require("react");
2896
+ var import_react18 = require("react");
2213
2897
  var import_jsx_runtime15 = require("react/jsx-runtime");
2214
2898
  function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
2215
- const [hovered, setHovered] = (0, import_react15.useState)(), [focused, setFocused] = (0, import_react15.useState)();
2216
- const timer = (0, import_react15.useRef)();
2899
+ const [hovered, setHovered] = (0, import_react18.useState)(), [focused, setFocused] = (0, import_react18.useState)();
2900
+ const timer = (0, import_react18.useRef)();
2217
2901
  const stop = () => {
2218
2902
  if (timer.current !== void 0) clearInterval(timer.current);
2219
2903
  timer.current = void 0;
2220
2904
  };
2221
- (0, import_react15.useEffect)(() => {
2905
+ (0, import_react18.useEffect)(() => {
2222
2906
  window.addEventListener("blur", stop);
2223
2907
  return () => {
2224
2908
  stop();
@@ -2257,13 +2941,13 @@ function ChartRoamController({ x = 800, y = 5, onPan, onZoom }) {
2257
2941
  }
2258
2942
 
2259
2943
  // src/components/LineShareChart.tsx
2260
- var import_react38 = require("react");
2944
+ var import_react41 = require("react");
2261
2945
 
2262
2946
  // src/components/Charts.tsx
2263
- var import_react36 = require("react");
2947
+ var import_react39 = require("react");
2264
2948
 
2265
2949
  // src/components/ChartScatterMotion.tsx
2266
- var import_react16 = require("react");
2950
+ var import_react19 = require("react");
2267
2951
 
2268
2952
  // src/components/scatterMotion.ts
2269
2953
  function scatterMotionEase(progress) {
@@ -2275,9 +2959,9 @@ function scatterMotionEase(progress) {
2275
2959
  var import_jsx_runtime16 = require("react/jsx-runtime");
2276
2960
  function ChartScatterMotion({ x, y, radius, enabled, duration = 2e3, updateDuration = 500, progress, children }) {
2277
2961
  const target = { x, y, radius };
2278
- const [frame, setFrame] = (0, import_react16.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
2279
- const displayed = (0, import_react16.useRef)(frame), started = (0, import_react16.useRef)(false);
2280
- (0, import_react16.useEffect)(() => {
2962
+ const [frame, setFrame] = (0, import_react19.useState)(() => ({ ...target, radius: enabled ? radius * 0.01 : radius }));
2963
+ const displayed = (0, import_react19.useRef)(frame), started = (0, import_react19.useRef)(false);
2964
+ (0, import_react19.useEffect)(() => {
2281
2965
  const reduced = window.matchMedia("(prefers-reduced-motion: reduce)");
2282
2966
  let request = 0;
2283
2967
  const publish = (next) => {
@@ -2388,12 +3072,12 @@ function layoutEventRiver(series, tailLength, area) {
2388
3072
  }
2389
3073
 
2390
3074
  // src/components/EventRiverBubble.tsx
2391
- var import_react17 = require("react");
3075
+ var import_react20 = require("react");
2392
3076
  var import_jsx_runtime17 = require("react/jsx-runtime");
2393
3077
  function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerUp, ...props }) {
2394
- const [offset, setOffset] = (0, import_react17.useState)(0);
2395
- const drag = (0, import_react17.useRef)();
2396
- (0, import_react17.useEffect)(() => {
3078
+ const [offset, setOffset] = (0, import_react20.useState)(0);
3079
+ const drag = (0, import_react20.useRef)();
3080
+ (0, import_react20.useEffect)(() => {
2397
3081
  setOffset(0);
2398
3082
  drag.current = void 0;
2399
3083
  }, [resetKey]);
@@ -2444,13 +3128,13 @@ function EventRiverBubble({ resetKey, draggable = true, tooltipPoint, onPointerU
2444
3128
  }
2445
3129
 
2446
3130
  // src/components/EventRiverMotion.tsx
2447
- var import_react18 = require("react");
3131
+ var import_react21 = require("react");
2448
3132
  var import_jsx_runtime18 = require("react/jsx-runtime");
2449
3133
  function EventRiverMotion({ geometry, enabled = true, duration = 2e3, updateDuration = 500, progress, children }) {
2450
- const [frame, setFrame] = (0, import_react18.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
2451
- const displayed = (0, import_react18.useRef)(frame), started = (0, import_react18.useRef)(false);
3134
+ const [frame, setFrame] = (0, import_react21.useState)(() => ({ ...geometry, scale: enabled ? 0.1 : 1 }));
3135
+ const displayed = (0, import_react21.useRef)(frame), started = (0, import_react21.useRef)(false);
2452
3136
  const signature = JSON.stringify(geometry);
2453
- (0, import_react18.useEffect)(() => {
3137
+ (0, import_react21.useEffect)(() => {
2454
3138
  const preference = window.matchMedia("(prefers-reduced-motion: reduce)"), target = { ...geometry, scale: 1 };
2455
3139
  const from = started.current ? displayed.current : { ...geometry, scale: 0.1 };
2456
3140
  let request = 0;
@@ -2568,7 +3252,7 @@ function transferPieValue(series, source, target, connector = " & ") {
2568
3252
  }
2569
3253
 
2570
3254
  // src/components/ChartValueIsland.tsx
2571
- var import_react19 = require("react");
3255
+ var import_react22 = require("react");
2572
3256
 
2573
3257
  // src/components/cartesianTransfer.ts
2574
3258
  function addValues(a, b) {
@@ -2634,13 +3318,13 @@ function findCompositeValueTarget(element, x, y) {
2634
3318
  // src/components/ChartValueIsland.tsx
2635
3319
  var import_jsx_runtime19 = require("react/jsx-runtime");
2636
3320
  function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolveTarget = findCompositeValueTarget }) {
2637
- const drag = (0, import_react19.useRef)(null);
2638
- const [offset, setOffset] = (0, import_react19.useState)([0, 0]);
3321
+ const drag = (0, import_react22.useRef)(null);
3322
+ const [offset, setOffset] = (0, import_react22.useState)([0, 0]);
2639
3323
  const cancel = () => {
2640
3324
  drag.current = null;
2641
3325
  setOffset([0, 0]);
2642
3326
  };
2643
- (0, import_react19.useEffect)(cancel, [x, y]);
3327
+ (0, import_react22.useEffect)(cancel, [x, y]);
2644
3328
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2645
3329
  ChartMark,
2646
3330
  {
@@ -2693,12 +3377,12 @@ function ChartValueIsland({ name, value, x, y, color = "#2ec7c9", onDrop, resolv
2693
3377
  }
2694
3378
 
2695
3379
  // src/components/ChartPulseRing.tsx
2696
- var import_react20 = require("react");
3380
+ var import_react23 = require("react");
2697
3381
  var import_jsx_runtime20 = require("react/jsx-runtime");
2698
3382
  function ChartPulseRing({ center, radius, scaleSize = 2, color = "gold", shadowBlur = 10, period = 15, progress, enabled = true }) {
2699
- const id = (0, import_react20.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react20.useState)(0);
2700
- const [reduced, setReduced] = (0, import_react20.useState)(false);
2701
- (0, import_react20.useEffect)(() => {
3383
+ const id = (0, import_react23.useId)().replace(/:/g, ""), [phase, setPhase] = (0, import_react23.useState)(0);
3384
+ const [reduced, setReduced] = (0, import_react23.useState)(false);
3385
+ (0, import_react23.useEffect)(() => {
2702
3386
  const preference = window.matchMedia("(prefers-reduced-motion: reduce)");
2703
3387
  setReduced(preference.matches);
2704
3388
  let frame = 0;
@@ -2842,7 +3526,7 @@ function chartMarkerPath(kind, x, y, size) {
2842
3526
  }
2843
3527
 
2844
3528
  // src/components/ChartLargeMapPointCanvas.tsx
2845
- var import_react21 = require("react");
3529
+ var import_react24 = require("react");
2846
3530
 
2847
3531
  // src/components/largeMapPointPulse.ts
2848
3532
  function largeMapPointPulse(elapsed, period, initial3, delay) {
@@ -2858,8 +3542,8 @@ function largeMapPointSize(size, pulse) {
2858
3542
  // src/components/ChartLargeMapPointCanvas.tsx
2859
3543
  var import_jsx_runtime21 = require("react/jsx-runtime");
2860
3544
  function ChartLargeMapPointCanvas({ groups, width, height }) {
2861
- const canvas = (0, import_react21.useRef)(null), key = JSON.stringify(groups);
2862
- (0, import_react21.useEffect)(() => {
3545
+ const canvas = (0, import_react24.useRef)(null), key = JSON.stringify(groups);
3546
+ (0, import_react24.useEffect)(() => {
2863
3547
  const element = canvas.current, context = element?.getContext("2d");
2864
3548
  if (!element || !context) return;
2865
3549
  const ratio = window.devicePixelRatio || 1;
@@ -2918,12 +3602,12 @@ function ChartLargeMapPointCanvas({ groups, width, height }) {
2918
3602
  }
2919
3603
 
2920
3604
  // src/components/ChartCrosshair.tsx
2921
- var import_react22 = require("react");
3605
+ var import_react25 = require("react");
2922
3606
  var import_jsx_runtime22 = require("react/jsx-runtime");
2923
3607
  function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY = decimal }) {
2924
- const ref = (0, import_react22.useRef)(null);
2925
- const [point, setPoint] = (0, import_react22.useState)(null);
2926
- (0, import_react22.useEffect)(() => {
3608
+ const ref = (0, import_react25.useRef)(null);
3609
+ const [point, setPoint] = (0, import_react25.useState)(null);
3610
+ (0, import_react25.useEffect)(() => {
2927
3611
  const svg = ref.current?.ownerSVGElement;
2928
3612
  if (!svg) return;
2929
3613
  const clear = () => setPoint(null);
@@ -2943,7 +3627,7 @@ function ChartCrosshair({ bounds, xDomain, yDomain, formatX = decimal, formatY =
2943
3627
  svg.removeEventListener("pointercancel", clear);
2944
3628
  };
2945
3629
  }, [bounds.x, bounds.y, bounds.width, bounds.height]);
2946
- (0, import_react22.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
3630
+ (0, import_react25.useEffect)(() => setPoint(null), [xDomain[0], xDomain[1], yDomain[0], yDomain[1]]);
2947
3631
  const x = point ? xDomain[0] + (point.x - bounds.x) / bounds.width * (xDomain[1] - xDomain[0]) : 0;
2948
3632
  const y = point ? yDomain[1] - (point.y - bounds.y) / bounds.height * (yDomain[1] - yDomain[0]) : 0;
2949
3633
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("g", { ref, className: "sia-chart__crosshair", "aria-hidden": "true", children: [
@@ -2960,7 +3644,7 @@ function decimal(value) {
2960
3644
  }
2961
3645
 
2962
3646
  // src/components/HeatmapRasterLayer.tsx
2963
- var import_react23 = require("react");
3647
+ var import_react26 = require("react");
2964
3648
 
2965
3649
  // src/components/heatmapRaster.ts
2966
3650
  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] }];
@@ -3007,9 +3691,9 @@ function rasterizeHeatmap(width, height, points, options = {}) {
3007
3691
  // src/components/HeatmapRasterLayer.tsx
3008
3692
  var import_jsx_runtime23 = require("react/jsx-runtime");
3009
3693
  function HeatmapRaster({ width, height, points, options }) {
3010
- const [url, setUrl] = (0, import_react23.useState)();
3694
+ const [url, setUrl] = (0, import_react26.useState)();
3011
3695
  const optionsKey = JSON.stringify(options);
3012
- (0, import_react23.useEffect)(() => {
3696
+ (0, import_react26.useEffect)(() => {
3013
3697
  const canvas = document.createElement("canvas");
3014
3698
  canvas.width = width;
3015
3699
  canvas.height = height;
@@ -3089,9 +3773,9 @@ function chordMatrixLayout(matrix, options = {}) {
3089
3773
  let angle = options.startAngle ?? -Math.PI / 2;
3090
3774
  const subSort = options.legacySubSort ? options.sortSub === "ascending" ? "ascending" : options.sort === "descending" ? "descending" : "none" : options.sortSub;
3091
3775
  const groups = order.map((index) => {
3092
- const start = angle, targets = Array.from({ length: n }, (_, i) => i);
3093
- if (subSort && subSort !== "none") targets.sort((a, b) => (values[index][a] - values[index][b]) * (subSort === "ascending" ? 1 : -1) || a - b);
3094
- for (const target of targets) {
3776
+ const start = angle, targets2 = Array.from({ length: n }, (_, i) => i);
3777
+ if (subSort && subSort !== "none") targets2.sort((a, b) => (values[index][a] - values[index][b]) * (subSort === "ascending" ? 1 : -1) || a - b);
3778
+ for (const target of targets2) {
3095
3779
  const value = values[index][target], end = angle + direction * value * factor;
3096
3780
  segments[index][target] = { index, target, start: angle, end, value };
3097
3781
  angle = end;
@@ -3109,10 +3793,10 @@ function chordMatrixLayout(matrix, options = {}) {
3109
3793
  }
3110
3794
 
3111
3795
  // src/components/MatrixChordPlot.tsx
3112
- var import_react24 = require("react");
3796
+ var import_react27 = require("react");
3113
3797
  var import_jsx_runtime24 = require("react/jsx-runtime");
3114
3798
  function MatrixChordPlot({ names, matrix, series, appearance, showNodeLabels = false, rotateNodeLabels = false, linkLabel, sort, sortSub, padAngle, clockwise, palette, geometry, legacySubSort = false, showScale = false }) {
3115
- const [hoveredLink, setHoveredLink] = (0, import_react24.useState)(null);
3799
+ const [hoveredLink, setHoveredLink] = (0, import_react27.useState)(null);
3116
3800
  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;
3117
3801
  const point = (angle) => [cx + Math.cos(angle) * r, cy + Math.sin(angle) * r];
3118
3802
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("g", { className: "sia-chart__matrix-chord", children: [
@@ -3459,13 +4143,13 @@ function transferRadarSeries(panels, source, target, connector = " & ") {
3459
4143
  }
3460
4144
 
3461
4145
  // src/components/ChartRoamGroup.tsx
3462
- var import_react25 = require("react");
4146
+ var import_react28 = require("react");
3463
4147
  var import_jsx_runtime26 = require("react/jsx-runtime");
3464
4148
  var initial2 = { x: 0, y: 0, scale: 1 };
3465
4149
  function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true, ariaLabel, resetSignal = 0 }) {
3466
- const group = (0, import_react25.useRef)(null), drag = (0, import_react25.useRef)();
3467
- const [view, setView] = (0, import_react25.useState)(initial2);
3468
- (0, import_react25.useEffect)(() => {
4150
+ const group = (0, import_react28.useRef)(null), drag = (0, import_react28.useRef)();
4151
+ const [view, setView] = (0, import_react28.useState)(initial2);
4152
+ (0, import_react28.useEffect)(() => {
3469
4153
  setView(initial2);
3470
4154
  drag.current = void 0;
3471
4155
  }, [resetSignal]);
@@ -3475,7 +4159,7 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
3475
4159
  const local = new DOMPoint(clientX, clientY).matrixTransform(matrix.inverse());
3476
4160
  return [local.x, local.y];
3477
4161
  };
3478
- (0, import_react25.useEffect)(() => {
4162
+ (0, import_react28.useEffect)(() => {
3479
4163
  const target = group.current;
3480
4164
  if (!target || !enabled || !zoomEnabled) return;
3481
4165
  const wheel = (event) => {
@@ -3536,11 +4220,11 @@ function ChartRoamGroup({ children, enabled, width, height, zoomEnabled = true,
3536
4220
  }
3537
4221
 
3538
4222
  // src/components/TreeNodeGlyph.tsx
3539
- var import_react26 = require("react");
4223
+ var import_react29 = require("react");
3540
4224
  var import_jsx_runtime27 = require("react/jsx-runtime");
3541
4225
  function TreeNodeGlyph({ symbol = "circle", x, y, width, height, color, itemStyle }) {
3542
- const [failed, setFailed] = (0, import_react26.useState)(false);
3543
- (0, import_react26.useEffect)(() => setFailed(false), [symbol]);
4226
+ const [failed, setFailed] = (0, import_react29.useState)(false);
4227
+ (0, import_react29.useEffect)(() => setFailed(false), [symbol]);
3544
4228
  const style = { fill: itemStyle.brushType === "stroke" ? "none" : color, stroke: itemStyle.borderColor, strokeWidth: itemStyle.borderWidth };
3545
4229
  if (symbol.startsWith("image://")) return failed ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("g", { role: "img", "aria-label": "\u539F\u59CB\u8282\u70B9\u56FE\u7247\u52A0\u8F7D\u5931\u8D25", children: [
3546
4230
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("rect", { x: x - width / 2, y: y - height / 2, width, height, fill: "none", stroke: "#999", strokeDasharray: "3 3" }),
@@ -3829,7 +4513,7 @@ function resolveMapRegionAppearance(base, datum, emphasized) {
3829
4513
  }
3830
4514
 
3831
4515
  // src/components/ChartBundledMapCanvas.tsx
3832
- var import_react27 = require("react");
4516
+ var import_react30 = require("react");
3833
4517
 
3834
4518
  // src/components/edgeBundling.ts
3835
4519
  var distance = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1]);
@@ -3973,9 +4657,9 @@ function sampleBundledPath(curves, progress) {
3973
4657
  var import_jsx_runtime28 = require("react/jsx-runtime");
3974
4658
  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 }) {
3975
4659
  const signature = JSON.stringify(edges), pointKey = JSON.stringify(points), effectKey = JSON.stringify(effect);
3976
- const paths = (0, import_react27.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
3977
- const base = (0, import_react27.useRef)(null), moving = (0, import_react27.useRef)(null);
3978
- (0, import_react27.useEffect)(() => {
4660
+ const paths = (0, import_react30.useMemo)(() => bundleEdges(JSON.parse(signature)).map((row) => ({ index: row.index, curves: smoothBundledPath(row.points, smoothness) })), [signature, smoothness]);
4661
+ const base = (0, import_react30.useRef)(null), moving = (0, import_react30.useRef)(null);
4662
+ (0, import_react30.useEffect)(() => {
3979
4663
  const node = base.current, ctx = node?.getContext("2d");
3980
4664
  if (!node || !ctx) return;
3981
4665
  const ratio = window.devicePixelRatio || 1;
@@ -4001,7 +4685,7 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
4001
4685
  ctx.fill();
4002
4686
  }
4003
4687
  }, [paths, pointKey, width, height, color, opacity, lineWidth, pointColor, pointRadius]);
4004
- (0, import_react27.useEffect)(() => {
4688
+ (0, import_react30.useEffect)(() => {
4005
4689
  const node = moving.current, ctx = node?.getContext("2d");
4006
4690
  if (!node || !ctx) return;
4007
4691
  const ratio = window.devicePixelRatio || 1;
@@ -4063,11 +4747,11 @@ function ChartBundledMapCanvas({ edges, points = [], smoothness = 0.1, color = "
4063
4747
  }
4064
4748
 
4065
4749
  // src/components/ChartMapEffectCanvas.tsx
4066
- var import_react28 = require("react");
4750
+ var import_react31 = require("react");
4067
4751
  var import_jsx_runtime29 = require("react/jsx-runtime");
4068
4752
  function ChartMapEffectCanvas({ effects, width, height, alpha = 0.95 }) {
4069
- const canvas = (0, import_react28.useRef)(null), key = JSON.stringify(effects);
4070
- (0, import_react28.useEffect)(() => {
4753
+ const canvas = (0, import_react31.useRef)(null), key = JSON.stringify(effects);
4754
+ (0, import_react31.useEffect)(() => {
4071
4755
  const element = canvas.current;
4072
4756
  if (!element) return;
4073
4757
  const context = element.getContext("2d");
@@ -4213,25 +4897,25 @@ function layoutTreeNodes(root, options = {}) {
4213
4897
  }
4214
4898
 
4215
4899
  // src/components/ChartDataEditor.tsx
4216
- var import_react32 = require("react");
4900
+ var import_react35 = require("react");
4217
4901
 
4218
4902
  // src/components/shared.ts
4219
- var import_react29 = require("react");
4220
- var ControlSizeContext = (0, import_react29.createContext)("medium");
4903
+ var import_react32 = require("react");
4904
+ var ControlSizeContext = (0, import_react32.createContext)("medium");
4221
4905
  function useControlSize(size) {
4222
- const inherited = (0, import_react29.useContext)(ControlSizeContext);
4906
+ const inherited = (0, import_react32.useContext)(ControlSizeContext);
4223
4907
  return size ?? inherited;
4224
4908
  }
4225
- var PlaceholderModeContext = (0, import_react29.createContext)("default");
4909
+ var PlaceholderModeContext = (0, import_react32.createContext)("default");
4226
4910
  function usePlaceholderMode(mode) {
4227
- const inherited = (0, import_react29.useContext)(PlaceholderModeContext);
4911
+ const inherited = (0, import_react32.useContext)(PlaceholderModeContext);
4228
4912
  return mode ?? inherited;
4229
4913
  }
4230
4914
 
4231
4915
  // src/components/Button.tsx
4232
- var import_react30 = require("react");
4916
+ var import_react33 = require("react");
4233
4917
  var import_jsx_runtime30 = require("react/jsx-runtime");
4234
- var Button = (0, import_react30.forwardRef)(function Button2({
4918
+ var Button = (0, import_react33.forwardRef)(function Button2({
4235
4919
  variant = "default",
4236
4920
  size: sizeProp,
4237
4921
  loading = false,
@@ -4247,7 +4931,33 @@ var Button = (0, import_react30.forwardRef)(function Button2({
4247
4931
  ...props
4248
4932
  }, forwardedRef) {
4249
4933
  const size = useControlSize(sizeProp);
4250
- const localRef = (0, import_react30.useRef)(null);
4934
+ const localRef = (0, import_react33.useRef)(null);
4935
+ const bounceRef = (0, import_react33.useRef)(null);
4936
+ const waveTimerRef = (0, import_react33.useRef)();
4937
+ (0, import_react33.useEffect)(() => () => {
4938
+ bounceRef.current?.cancel();
4939
+ window.clearTimeout(waveTimerRef.current);
4940
+ }, []);
4941
+ function playBounce(button) {
4942
+ if (!button.animate || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
4943
+ const current = getComputedStyle(button).scale;
4944
+ bounceRef.current?.cancel();
4945
+ const base = getComputedStyle(button).scale;
4946
+ const [x = 1, y = x] = base === "none" ? [] : base.split(/\s+/).map(Number);
4947
+ const scaled = (factor) => `${x * factor} ${y * factor}`;
4948
+ const animation = button.animate([
4949
+ { scale: current === "none" ? "1" : current, offset: 0 },
4950
+ // 宽按钮保持等比缩放,以更明显的过冲表现弹性但不改变布局占位。
4951
+ { scale: scaled(0.9), offset: 0.2 },
4952
+ { scale: scaled(1.09), offset: 0.52 },
4953
+ { scale: scaled(0.96), offset: 0.78 },
4954
+ { scale: scaled(1), offset: 1 }
4955
+ ], { duration: 320, easing: "cubic-bezier(.3, 0, .25, 1)" });
4956
+ bounceRef.current = animation;
4957
+ animation.onfinish = () => {
4958
+ if (bounceRef.current === animation) bounceRef.current = null;
4959
+ };
4960
+ }
4251
4961
  function setRef(node) {
4252
4962
  localRef.current = node;
4253
4963
  if (typeof forwardedRef === "function") forwardedRef(node);
@@ -4255,12 +4965,15 @@ var Button = (0, import_react30.forwardRef)(function Button2({
4255
4965
  }
4256
4966
  function handleClick(event) {
4257
4967
  const button = localRef.current;
4968
+ if (disabled || loading) return;
4969
+ if (button) playBounce(button);
4258
4970
  if (button && variant === "primary") {
4259
4971
  const rect = button.getBoundingClientRect();
4260
- button.style.setProperty("--sia-wave-x", `${event.clientX - rect.left}px`);
4261
- button.style.setProperty("--sia-wave-y", `${event.clientY - rect.top}px`);
4972
+ button.style.setProperty("--sia-wave-x", `${event.detail === 0 ? button.offsetWidth / 2 : (event.clientX - rect.left) * button.offsetWidth / rect.width}px`);
4973
+ button.style.setProperty("--sia-wave-y", `${event.detail === 0 ? button.offsetHeight / 2 : (event.clientY - rect.top) * button.offsetHeight / rect.height}px`);
4262
4974
  button.dataset.wave = "active";
4263
- window.setTimeout(() => delete button.dataset.wave, 360);
4975
+ window.clearTimeout(waveTimerRef.current);
4976
+ waveTimerRef.current = window.setTimeout(() => delete button.dataset.wave, 360);
4264
4977
  }
4265
4978
  onClick?.(event);
4266
4979
  }
@@ -4297,9 +5010,9 @@ function useFloatingPlaceholder({ mode, placeholder, filled, active = false }) {
4297
5010
  }
4298
5011
 
4299
5012
  // src/components/TextArea.tsx
4300
- var import_react31 = require("react");
5013
+ var import_react34 = require("react");
4301
5014
  var import_jsx_runtime32 = require("react/jsx-runtime");
4302
- var TextArea = (0, import_react31.forwardRef)(function TextArea2({
5015
+ var TextArea = (0, import_react34.forwardRef)(function TextArea2({
4303
5016
  label,
4304
5017
  hint,
4305
5018
  status = "default",
@@ -4317,9 +5030,9 @@ var TextArea = (0, import_react31.forwardRef)(function TextArea2({
4317
5030
  ...props
4318
5031
  }, ref) {
4319
5032
  const size = useControlSize(sizeProp);
4320
- const fallbackId = (0, import_react31.useId)();
5033
+ const fallbackId = (0, import_react34.useId)();
4321
5034
  const textAreaId = id ?? fallbackId;
4322
- const [uncontrolledValue, setUncontrolledValue] = (0, import_react31.useState)(() => defaultValue === void 0 ? "" : String(defaultValue));
5035
+ const [uncontrolledValue, setUncontrolledValue] = (0, import_react34.useState)(() => defaultValue === void 0 ? "" : String(defaultValue));
4323
5036
  const currentText = value !== void 0 ? String(value) : uncontrolledValue;
4324
5037
  const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: currentText.length > 0 });
4325
5038
  const hintId = `${textAreaId}-hint`;
@@ -4363,9 +5076,9 @@ var TextArea = (0, import_react31.forwardRef)(function TextArea2({
4363
5076
  // src/components/ChartDataEditor.tsx
4364
5077
  var import_jsx_runtime33 = require("react/jsx-runtime");
4365
5078
  function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false }) {
4366
- const [draft, setDraft] = (0, import_react32.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
4367
- const [error, setError] = (0, import_react32.useState)("");
4368
- const [applied, setApplied] = (0, import_react32.useState)(false);
5079
+ const [draft, setDraft] = (0, import_react35.useState)(() => JSON.stringify(series.map((item) => item.data), null, 2));
5080
+ const [error, setError] = (0, import_react35.useState)("");
5081
+ const [applied, setApplied] = (0, import_react35.useState)(false);
4369
5082
  function apply() {
4370
5083
  try {
4371
5084
  const values = JSON.parse(draft);
@@ -4396,11 +5109,11 @@ function ChartDataEditor({ series, onApply, readOnly = false, allowNull = false
4396
5109
  }
4397
5110
 
4398
5111
  // src/components/ChartBarStatistics.tsx
4399
- var import_react33 = require("react");
5112
+ var import_react36 = require("react");
4400
5113
  var import_jsx_runtime34 = require("react/jsx-runtime");
4401
5114
  function ChartBarStatistics({ values, kinds, project, plot, horizontal, color, gradient, seriesName }) {
4402
- const id = (0, import_react33.useId)().replaceAll(":", "");
4403
- const [active, setActive] = (0, import_react33.useState)();
5115
+ const id = (0, import_react36.useId)().replaceAll(":", "");
5116
+ const [active, setActive] = (0, import_react36.useState)();
4404
5117
  const paint = gradient ? `url(#${id})` : color;
4405
5118
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("g", { children: [
4406
5119
  gradient ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime34.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_runtime34.jsx)("stop", { offset: stop.offset, stopColor: stop.color }, i)) }) }) : null,
@@ -4455,7 +5168,7 @@ function lineSegments(points) {
4455
5168
  }
4456
5169
 
4457
5170
  // src/components/useBarMagicState.ts
4458
- var import_react34 = require("react");
5171
+ var import_react37 = require("react");
4459
5172
 
4460
5173
  // src/components/cartesianMagicState.ts
4461
5174
  function changeCartesianMagic(state, action) {
@@ -4470,8 +5183,8 @@ function changeCartesianMagic(state, action) {
4470
5183
  function useBarMagicState(toolbox, shape = "bar") {
4471
5184
  const initial3 = { shape, layout: "original" };
4472
5185
  const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
4473
- const [state, setState] = (0, import_react34.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
4474
- (0, import_react34.useEffect)(() => {
5186
+ const [state, setState] = (0, import_react37.useState)(() => changeCartesianMagic(initial3, options?.activeMagicType ?? shape));
5187
+ (0, import_react37.useEffect)(() => {
4475
5188
  if (options?.activeMagicType) setState((s) => changeCartesianMagic(s, options.activeMagicType));
4476
5189
  }, [options?.activeMagicType]);
4477
5190
  const resolved = options ? { ...options, activeMagicType: state.shape, activeMagicTypes: options.activeMagicTypes ?? (state.layout === "original" ? [state.shape] : [state.shape, state.layout]), onMagicTypeChange: (action) => {
@@ -4485,7 +5198,7 @@ function useBarMagicState(toolbox, shape = "bar") {
4485
5198
  }
4486
5199
 
4487
5200
  // src/components/useBarValueTransfer.ts
4488
- var import_react35 = require("react");
5201
+ var import_react38 = require("react");
4489
5202
 
4490
5203
  // src/components/barTransfer.ts
4491
5204
  function transferBarValue(series, source, target, categories) {
@@ -4502,10 +5215,10 @@ function transferBarValue(series, source, target, categories) {
4502
5215
 
4503
5216
  // src/components/useBarValueTransfer.ts
4504
5217
  function useBarValueTransfer(series, initial3, categories, enabled, publish, onError) {
4505
- const [islands, setIslands] = (0, import_react35.useState)([]);
4506
- const drag = (0, import_react35.useRef)();
4507
- const [offset, setOffset] = (0, import_react35.useState)();
4508
- (0, import_react35.useEffect)(() => {
5218
+ const [islands, setIslands] = (0, import_react38.useState)([]);
5219
+ const drag = (0, import_react38.useRef)();
5220
+ const [offset, setOffset] = (0, import_react38.useState)();
5221
+ (0, import_react38.useEffect)(() => {
4509
5222
  setIslands([]);
4510
5223
  drag.current = void 0;
4511
5224
  setOffset(void 0);
@@ -4606,12 +5319,12 @@ function logarithmicValueAt(progress, domain) {
4606
5319
 
4607
5320
  // src/components/Charts.tsx
4608
5321
  var import_jsx_runtime35 = require("react/jsx-runtime");
4609
- var import_react37 = require("react");
5322
+ var import_react40 = require("react");
4610
5323
  var PLOT = { x: 62, y: 48, width: 628, height: 250 };
4611
5324
  var PLOT_BOTTOM = PLOT.y + PLOT.height;
4612
5325
  function useLegendSelection(names, controlled, onChange) {
4613
- const [internal, setInternal] = (0, import_react36.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
4614
- (0, import_react36.useEffect)(() => {
5326
+ const [internal, setInternal] = (0, import_react39.useState)(() => Object.fromEntries(names.map((name) => [name, true])));
5327
+ (0, import_react39.useEffect)(() => {
4615
5328
  setInternal((current) => {
4616
5329
  const next = { ...current };
4617
5330
  names.forEach((name) => {
@@ -4711,7 +5424,7 @@ function lineSymbol(type, x, y, size, color, image, strokeWidth = 2) {
4711
5424
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("circle", { cx: x, cy: y, r: size / 2, fill: color, stroke: "var(--sia-color-surface)", strokeWidth: 2 });
4712
5425
  }
4713
5426
  function useZoom(value, defaultValue, onChange) {
4714
- const [internal, setInternal] = (0, import_react36.useState)([...defaultValue ?? [0, 100]]);
5427
+ const [internal, setInternal] = (0, import_react39.useState)([...defaultValue ?? [0, 100]]);
4715
5428
  const current = value ?? internal;
4716
5429
  const update = (next) => {
4717
5430
  if (!value) setInternal(next);
@@ -4721,8 +5434,8 @@ function useZoom(value, defaultValue, onChange) {
4721
5434
  }
4722
5435
  function useToolboxMagicType(toolbox, fallback) {
4723
5436
  const options = toolbox === true ? {} : typeof toolbox === "object" ? toolbox : void 0;
4724
- const [internal, setInternal] = (0, import_react36.useState)(options?.activeMagicType ?? fallback);
4725
- (0, import_react36.useEffect)(() => {
5437
+ const [internal, setInternal] = (0, import_react39.useState)(options?.activeMagicType ?? fallback);
5438
+ (0, import_react39.useEffect)(() => {
4726
5439
  if (options?.activeMagicType) setInternal(options.activeMagicType);
4727
5440
  }, [options?.activeMagicType]);
4728
5441
  const active = options?.activeMagicType ?? internal;
@@ -4740,15 +5453,15 @@ function useToolboxMagicType(toolbox, fallback) {
4740
5453
  } : toolbox;
4741
5454
  return [active, resolved];
4742
5455
  }
4743
- var LineChart = (0, import_react36.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) {
4744
- const [hoverIndex, setHoverIndex] = (0, import_react36.useState)(null);
4745
- const [editableSeries, setEditableSeries] = (0, import_react36.useState)(sourceSeries);
4746
- const [dragPoint, setDragPoint] = (0, import_react36.useState)(null);
4747
- const linePaintId = (0, import_react36.useId)().replaceAll(":", "");
4748
- const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react36.useState)();
4749
- (0, import_react36.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
5456
+ var LineChart = (0, import_react39.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) {
5457
+ const [hoverIndex, setHoverIndex] = (0, import_react39.useState)(null);
5458
+ const [editableSeries, setEditableSeries] = (0, import_react39.useState)(sourceSeries);
5459
+ const [dragPoint, setDragPoint] = (0, import_react39.useState)(null);
5460
+ const linePaintId = (0, import_react39.useId)().replaceAll(":", "");
5461
+ const [hoveredLinePoint, setHoveredLinePoint] = (0, import_react39.useState)();
5462
+ (0, import_react39.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
4750
5463
  const series = externalValueTransfer ? sourceSeries : editableSeries;
4751
- const initialTransferSeries = (0, import_react36.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
5464
+ const initialTransferSeries = (0, import_react39.useMemo)(() => sourceSeries.map((item) => ({ ...item, data: item.data.map(lineValue) })), [sourceSeries]);
4752
5465
  const localTransfer = useBarValueTransfer(series.map((item) => ({ ...item, data: item.data.map(lineValue) })), initialTransferSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (nextBars) => {
4753
5466
  const next = series.map((item, row) => ({ ...item, data: item.data.map((datum, index) => {
4754
5467
  const value = barDatum(nextBars[row].data[index]).value;
@@ -4765,8 +5478,8 @@ var LineChart = (0, import_react36.forwardRef)(function LineChart2({ calculableM
4765
5478
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
4766
5479
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
4767
5480
  const inlineZoom = dataZoom && zoomControlBounds ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("foreignObject", { className: "sia-chart__inline-zoom sia-chart__inline-zoom--compact", ...withTitleTooltip(zoomControlBounds), children: /* @__PURE__ */ (0, import_jsx_runtime35.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;
4768
- const [zoomBrushActive, setZoomBrushActive] = (0, import_react36.useState)(false);
4769
- const [zoomHistory, setZoomHistory] = (0, import_react36.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
5481
+ const [zoomBrushActive, setZoomBrushActive] = (0, import_react39.useState)(false);
5482
+ const [zoomHistory, setZoomHistory] = (0, import_react39.useState)(() => dataZoom ? [defaultZoom ?? zoom ?? [0, 100]] : []);
4770
5483
  const zoomBrush = dataZoom && zoomBrushActive ? { minSelectionSize: zoomMinSelectionSize, selectionStyle: zoomSelectionStyle, selectionShape: zoomSelectionShape, bounds: PLOT2, onCancel: () => setZoomBrushActive(false), onSelect: (range) => {
4771
5484
  const start = Math.min(...zoomValue), span = Math.max(...zoomValue) - start;
4772
5485
  const next = [start + range[0] * span, start + range[1] * span];
@@ -5153,17 +5866,17 @@ function ChartPin({ point, color, label }) {
5153
5866
  function barDatum(datum) {
5154
5867
  return typeof datum === "number" ? { value: datum } : datum;
5155
5868
  }
5156
- var BarChart = (0, import_react36.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) {
5157
- const [editableSeries, setEditableSeries] = (0, import_react36.useState)(sourceSeries);
5158
- const [dragBar, setDragBar] = (0, import_react36.useState)(null);
5159
- const [hoveredBar, setHoveredBar] = (0, import_react36.useState)();
5160
- const barPaintId = (0, import_react36.useId)().replaceAll(":", "");
5869
+ var BarChart = (0, import_react39.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) {
5870
+ const [editableSeries, setEditableSeries] = (0, import_react39.useState)(sourceSeries);
5871
+ const [dragBar, setDragBar] = (0, import_react39.useState)(null);
5872
+ const [hoveredBar, setHoveredBar] = (0, import_react39.useState)();
5873
+ const barPaintId = (0, import_react39.useId)().replaceAll(":", "");
5161
5874
  const localTransfer = useBarValueTransfer(editableSeries, sourceSeries, categories, calculable && calculableMode === "transfer" && !externalValueTransfer, (next) => {
5162
5875
  setEditableSeries(next);
5163
5876
  onDataChange?.(next);
5164
5877
  }, onTransferError);
5165
5878
  const transfer = externalValueTransfer ?? localTransfer;
5166
- (0, import_react36.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
5879
+ (0, import_react39.useEffect)(() => setEditableSeries(sourceSeries), [sourceSeries]);
5167
5880
  const series = externalValueTransfer ? sourceSeries : editableSeries;
5168
5881
  const legacy = appearance === "macarons";
5169
5882
  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 };
@@ -5410,17 +6123,17 @@ var BarChart = (0, import_react36.forwardRef)(function BarChart2({ valueTransfer
5410
6123
  ] }, `bar-island-${index}`)) : null
5411
6124
  ] });
5412
6125
  });
5413
- var ScatterChart = (0, import_react36.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) {
5414
- const [data, setData] = (0, import_react36.useState)(initialData);
5415
- const [emphasizedPoint, setEmphasizedPoint] = (0, import_react36.useState)(null);
5416
- const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react36.useState)();
5417
- (0, import_react36.useEffect)(() => setData(initialData), [initialData]);
6126
+ var ScatterChart = (0, import_react39.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) {
6127
+ const [data, setData] = (0, import_react39.useState)(initialData);
6128
+ const [emphasizedPoint, setEmphasizedPoint] = (0, import_react39.useState)(null);
6129
+ const [emphasizedAnnotation, setEmphasizedAnnotation] = (0, import_react39.useState)();
6130
+ (0, import_react39.useEffect)(() => setData(initialData), [initialData]);
5418
6131
  const plot = plotBounds ?? PLOT, bottom = plot.y + plot.height;
5419
6132
  const [zoomValue, setZoomValue] = useZoom(zoom, defaultZoom, onZoomChange);
5420
6133
  const allCategories = [...new Set(data.map((item) => item.category).filter((value) => Boolean(value)))];
5421
6134
  const legend = useLegendSelection(allCategories, legendSelected, onLegendSelectionChange);
5422
6135
  const activeData = data.filter((item) => !item.category || legend.isSelected(item.category));
5423
- const sorted = (0, import_react36.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
6136
+ const sorted = (0, import_react39.useMemo)(() => [...activeData].sort((left, right) => left.x - right.x), [activeData]);
5424
6137
  const startIndex = dataZoom ? Math.floor(Math.min(...zoomValue) / 100 * Math.max(0, sorted.length - 1)) : 0;
5425
6138
  const endIndex = dataZoom ? Math.max(startIndex + 1, Math.ceil(Math.max(...zoomValue) / 100 * sorted.length)) : sorted.length;
5426
6139
  const categoryWindow = xCategories ? scatterCategoryWindow(xCategories, dataZoom ? zoomValue : [0, 100]) : void 0;
@@ -5435,10 +6148,10 @@ var ScatterChart = (0, import_react36.forwardRef)(function ScatterChart2({ symbo
5435
6148
  const visualMinimum = visualMap?.min ?? (visualValues.length ? Math.min(...visualValues) : 0);
5436
6149
  const visualMaximum = visualMap?.max ?? (visualValues.length ? Math.max(...visualValues) : 1);
5437
6150
  const visualColors = visualMap?.colors ?? ["#e6f4ff", "#1677ff"];
5438
- const [selectedPieces, setSelectedPieces] = (0, import_react36.useState)([]);
5439
- const [visualRange, setVisualRange] = (0, import_react36.useState)();
6151
+ const [selectedPieces, setSelectedPieces] = (0, import_react39.useState)([]);
6152
+ const [visualRange, setVisualRange] = (0, import_react39.useState)();
5440
6153
  const piecesKey = JSON.stringify(visualMap?.pieces ?? []);
5441
- (0, import_react36.useEffect)(() => setSelectedPieces([]), [piecesKey]);
6154
+ (0, import_react39.useEffect)(() => setSelectedPieces([]), [piecesKey]);
5442
6155
  const statistics = scatterStatistics(visibleData, markByCategory);
5443
6156
  const plotted = visibleData.map((item, index) => {
5444
6157
  const x = linearScale(categoryWindow ? categoryWindow.indexOf(item.x) : item.x, [xDomain[0], xDomain[1]], [plot.x, plot.x + plot.width]);
@@ -5596,8 +6309,8 @@ var ScatterChart = (0, import_react36.forwardRef)(function ScatterChart2({ symbo
5596
6309
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChartDataZoom, { value: zoomValue, onChange: setZoomValue })
5597
6310
  ] }) : content;
5598
6311
  });
5599
- var CandlestickChart = (0, import_react36.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) {
5600
- const [data, setData] = (0, import_react36.useState)(initialData), [internalActive, setInternalActive] = (0, import_react36.useState)(null), [internalVisible, setInternalVisible] = (0, import_react36.useState)(true);
6312
+ var CandlestickChart = (0, import_react39.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) {
6313
+ const [data, setData] = (0, import_react39.useState)(initialData), [internalActive, setInternalActive] = (0, import_react39.useState)(null), [internalVisible, setInternalVisible] = (0, import_react39.useState)(true);
5601
6314
  const active = activeIndex === void 0 ? internalActive : activeIndex;
5602
6315
  const seriesVisible = controlledVisible ?? internalVisible;
5603
6316
  const setActive = (index) => {
@@ -5608,7 +6321,7 @@ var CandlestickChart = (0, import_react36.forwardRef)(function CandlestickChart2
5608
6321
  if (controlledVisible === void 0) setInternalVisible(visible);
5609
6322
  onSeriesVisibilityChange?.(visible);
5610
6323
  };
5611
- (0, import_react36.useEffect)(() => {
6324
+ (0, import_react39.useEffect)(() => {
5612
6325
  setData(initialData);
5613
6326
  }, [initialData]);
5614
6327
  const legacy = appearance === "macarons";
@@ -5699,20 +6412,20 @@ var CandlestickChart = (0, import_react36.forwardRef)(function CandlestickChart2
5699
6412
  ] }) : content;
5700
6413
  });
5701
6414
  var EMPTY_PIE_DATA = [];
5702
- var PieChart = (0, import_react36.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) {
5703
- const pieGradientId = (0, import_react36.useId)().replace(/:/g, "");
5704
- const [pieIslands, setPieIslands] = (0, import_react36.useState)([]);
5705
- const sourceRings = (0, import_react36.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
5706
- const [editableRings, setEditableRings] = (0, import_react36.useState)(sourceRings);
5707
- const valueDrag = (0, import_react36.useRef)(null);
5708
- const [valueOffset, setValueOffset] = (0, import_react36.useState)();
5709
- (0, import_react36.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
6415
+ var PieChart = (0, import_react39.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) {
6416
+ const pieGradientId = (0, import_react39.useId)().replace(/:/g, "");
6417
+ const [pieIslands, setPieIslands] = (0, import_react39.useState)([]);
6418
+ const sourceRings = (0, import_react39.useMemo)(() => series?.length ? series : [{ data, innerRadius, outerRadius, rose, showLabels }], [series, data, innerRadius, outerRadius, rose, showLabels]);
6419
+ const [editableRings, setEditableRings] = (0, import_react39.useState)(sourceRings);
6420
+ const valueDrag = (0, import_react39.useRef)(null);
6421
+ const [valueOffset, setValueOffset] = (0, import_react39.useState)();
6422
+ (0, import_react39.useEffect)(() => setEditableRings(sourceRings), [sourceRings]);
5710
6423
  const allData = editableRings.flatMap((ring) => ring.data).filter((item) => !item.missing);
5711
6424
  const names = [...new Set(allData.map((item) => item.name))];
5712
6425
  const legend = useLegendSelection(names, legendSelected, onLegendSelectionChange);
5713
6426
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u997C\u56FE");
5714
- const [hovered, setHovered] = (0, import_react36.useState)();
5715
- const [internalSelected, setInternalSelected] = (0, import_react36.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
6427
+ const [hovered, setHovered] = (0, import_react39.useState)();
6428
+ const [internalSelected, setInternalSelected] = (0, import_react39.useState)(() => [...defaultSelected ?? allData.filter((item) => item.selected).map((item) => item.name)]);
5716
6429
  const selectedNames = selected ?? internalSelected;
5717
6430
  const legacy = appearance === "macarons";
5718
6431
  const colorNames = [...new Set(allData.filter((item) => item.showInLegend !== false).map((item) => item.name))];
@@ -5932,15 +6645,15 @@ var PieChart = (0, import_react36.forwardRef)(function PieChart2({ pulseRing, ca
5932
6645
  });
5933
6646
  var EMPTY_RADAR_INDICATORS = [];
5934
6647
  var EMPTY_RADAR_SERIES = [];
5935
- var RadarChart = (0, import_react36.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) {
6648
+ var RadarChart = (0, import_react39.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) {
5936
6649
  const legacy = appearance === "macarons";
5937
- const initialPanels = (0, import_react36.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
5938
- const [sourcePanels, setSourcePanels] = (0, import_react36.useState)(initialPanels);
5939
- const [hoveredRadar, setHoveredRadar] = (0, import_react36.useState)(null);
5940
- const radarPaintId = `sia-radar-${(0, import_react36.useId)().replaceAll(":", "")}`;
5941
- const radarDrag = (0, import_react36.useRef)(null);
5942
- const [radarOffset, setRadarOffset] = (0, import_react36.useState)(null);
5943
- (0, import_react36.useEffect)(() => {
6650
+ const initialPanels = (0, import_react39.useMemo)(() => radars?.length ? radars : [{ indicators, series, levels }], [radars, indicators, series, levels]);
6651
+ const [sourcePanels, setSourcePanels] = (0, import_react39.useState)(initialPanels);
6652
+ const [hoveredRadar, setHoveredRadar] = (0, import_react39.useState)(null);
6653
+ const radarPaintId = `sia-radar-${(0, import_react39.useId)().replaceAll(":", "")}`;
6654
+ const radarDrag = (0, import_react39.useRef)(null);
6655
+ const [radarOffset, setRadarOffset] = (0, import_react39.useState)(null);
6656
+ (0, import_react39.useEffect)(() => {
5944
6657
  setSourcePanels(initialPanels);
5945
6658
  radarDrag.current = null;
5946
6659
  setRadarOffset(null);
@@ -6094,7 +6807,7 @@ var RadarChart = (0, import_react36.forwardRef)(function RadarChart2({ indicator
6094
6807
  })
6095
6808
  ] });
6096
6809
  });
6097
- var ChordChart = (0, import_react36.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) {
6810
+ var ChordChart = (0, import_react39.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) {
6098
6811
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, "\u548C\u5F26");
6099
6812
  if (/force|力导向|关系/i.test(magicType)) return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
6100
6813
  GraphChart,
@@ -6167,11 +6880,11 @@ var ChordChart = (0, import_react36.forwardRef)(function ChordChart2({ nodes, li
6167
6880
  })
6168
6881
  ] });
6169
6882
  });
6170
- var GraphChart = (0, import_react36.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) {
6883
+ var GraphChart = (0, import_react39.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) {
6171
6884
  const categories = [...new Set(nodes.map((node) => node.category).filter((value) => Boolean(value)))];
6172
6885
  const legend = useLegendSelection(categories, legendSelected, onLegendSelectionChange);
6173
6886
  const [magicType, resolvedToolbox] = useToolboxMagicType(toolbox, layout === "force" ? "\u529B\u5BFC\u5411" : "\u5173\u7CFB");
6174
- const [roamReset, setRoamReset] = (0, import_react36.useState)(0);
6887
+ const [roamReset, setRoamReset] = (0, import_react39.useState)(0);
6175
6888
  const chartToolbox = typeof resolvedToolbox === "object" ? {
6176
6889
  ...resolvedToolbox,
6177
6890
  onRestore: () => {
@@ -6180,23 +6893,23 @@ var GraphChart = (0, import_react36.forwardRef)(function GraphChart2({ nodes, li
6180
6893
  resolvedToolbox.onRestore?.();
6181
6894
  }
6182
6895
  } : resolvedToolbox;
6183
- const activeNodes = (0, import_react36.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
6184
- const activeLinks = (0, import_react36.useMemo)(() => {
6896
+ const activeNodes = (0, import_react39.useMemo)(() => nodes.filter((node) => !node.category || legend.selected[node.category] !== false), [legend.selected, nodes]);
6897
+ const activeLinks = (0, import_react39.useMemo)(() => {
6185
6898
  const activeIds = new Set(activeNodes.map((node) => node.id));
6186
6899
  return links.filter((link) => activeIds.has(link.source) && activeIds.has(link.target));
6187
6900
  }, [activeNodes, links]);
6188
6901
  const progressive = progressiveForce && layout === "force" && props.animation !== false && !/chord|和弦/i.test(magicType);
6189
- const calculatedPositions = (0, import_react36.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
6190
- const [positions, setPositions] = (0, import_react36.useState)(calculatedPositions);
6191
- const [dragging, setDragging] = (0, import_react36.useState)(null);
6192
- const heldNode = (0, import_react36.useRef)(null);
6193
- const [forceRestart, setForceRestart] = (0, import_react36.useState)(0);
6194
- (0, import_react36.useEffect)(() => {
6902
+ const calculatedPositions = (0, import_react39.useMemo)(() => graphLayout(activeNodes, activeLinks, layout === "force" && !progressive, forceOptions), [activeLinks, activeNodes, layout, forceOptions, progressive]);
6903
+ const [positions, setPositions] = (0, import_react39.useState)(calculatedPositions);
6904
+ const [dragging, setDragging] = (0, import_react39.useState)(null);
6905
+ const heldNode = (0, import_react39.useRef)(null);
6906
+ const [forceRestart, setForceRestart] = (0, import_react39.useState)(0);
6907
+ (0, import_react39.useEffect)(() => {
6195
6908
  setPositions(calculatedPositions);
6196
6909
  setDragging(null);
6197
6910
  heldNode.current = null;
6198
6911
  }, [calculatedPositions, roamReset]);
6199
- (0, import_react36.useEffect)(() => {
6912
+ (0, import_react39.useEffect)(() => {
6200
6913
  if (!progressive || activeNodes.length > (forceOptions?.maxNodes ?? 80)) return;
6201
6914
  let frame = 0, remaining = Math.max(0, forceOptions?.iterations ?? 140), previous, carry = 0;
6202
6915
  const tick = (time) => {
@@ -6314,7 +7027,7 @@ var GraphChart = (0, import_react36.forwardRef)(function GraphChart2({ nodes, li
6314
7027
  ] })
6315
7028
  ] });
6316
7029
  });
6317
- var ForceGraphChart = (0, import_react36.forwardRef)(function ForceGraphChart2(props, ref) {
7030
+ var ForceGraphChart = (0, import_react39.forwardRef)(function ForceGraphChart2(props, ref) {
6318
7031
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(GraphChart, { ...props, layout: "force", ref });
6319
7032
  });
6320
7033
  var ForceChart = ForceGraphChart;
@@ -6343,12 +7056,12 @@ function colorBetween(start, end, ratio) {
6343
7056
  const to = read(end);
6344
7057
  return `rgb(${from.map((value, index) => Math.round(value + ((to[index] ?? value) - value) * Math.max(0, Math.min(1, ratio)))).join(" ")})`;
6345
7058
  }
6346
- var MapChart = (0, import_react36.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) {
6347
- const [internalSelected, setInternalSelected] = (0, import_react36.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
7059
+ var MapChart = (0, import_react39.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) {
7060
+ const [internalSelected, setInternalSelected] = (0, import_react39.useState)(() => [...defaultSelected ?? data.filter((item) => item.selected).map((item) => item.name)]);
6348
7061
  const selectedNames = selected ?? internalSelected;
6349
- const [hoveredRegion, setHoveredRegion] = (0, import_react36.useState)();
6350
- const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react36.useState)();
6351
- const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react36.useState)();
7062
+ const [hoveredRegion, setHoveredRegion] = (0, import_react39.useState)();
7063
+ const [hoveredMarkPoint, setHoveredMarkPoint] = (0, import_react39.useState)();
7064
+ const [internalHoveredValueRange, setHoveredValueRange] = (0, import_react39.useState)();
6352
7065
  const hoveredValueRange = emphasisValueRange ?? internalHoveredValueRange;
6353
7066
  const roamControl = useMapRoam(roam, scaleLimit, wheelZoomFactors);
6354
7067
  const { view } = roamControl;
@@ -6363,8 +7076,8 @@ var MapChart = (0, import_react36.forwardRef)(function MapChart2({ overlayProjec
6363
7076
  const values = data.map((item) => item.value);
6364
7077
  const minimum = valueDomain?.[0] ?? (values.length ? Math.min(...values) : 0);
6365
7078
  const maximum = valueDomain?.[1] ?? (values.length ? Math.max(...values) : 1);
6366
- const [internalVisualRange, setInternalVisualRange] = (0, import_react36.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
6367
- (0, import_react36.useEffect)(() => {
7079
+ const [internalVisualRange, setInternalVisualRange] = (0, import_react39.useState)(() => [...defaultVisualRange ?? [minimum, maximum]]);
7080
+ (0, import_react39.useEffect)(() => {
6368
7081
  if (!visualRange && !defaultVisualRange) setInternalVisualRange([minimum, maximum]);
6369
7082
  }, [defaultVisualRange, maximum, minimum, visualRange]);
6370
7083
  const currentVisualRange = visualRange ?? internalVisualRange;
@@ -6540,7 +7253,7 @@ var MapChart = (0, import_react36.forwardRef)(function MapChart2({ overlayProjec
6540
7253
  roamController ? /* @__PURE__ */ (0, import_jsx_runtime35.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
6541
7254
  ] });
6542
7255
  });
6543
- var GaugeChart = (0, import_react36.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) {
7256
+ var GaugeChart = (0, import_react39.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) {
6544
7257
  const count = Math.max(1, data.length);
6545
7258
  const legacy = appearance === "macarons";
6546
7259
  return /* @__PURE__ */ (0, import_jsx_runtime35.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) => {
@@ -6623,12 +7336,12 @@ var GaugeChart = (0, import_react36.forwardRef)(function GaugeChart2({ tooltipFo
6623
7336
  ] }, `${item.name}-${index}`);
6624
7337
  }) });
6625
7338
  });
6626
- var FunnelChart = (0, import_react36.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) {
7339
+ var FunnelChart = (0, import_react39.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) {
6627
7340
  const legacy = appearance === "macarons";
6628
- const [activeFunnel, setActiveFunnel] = (0, import_react36.useState)(null);
6629
- const initialFunnels = (0, import_react36.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
6630
- const [sourceFunnels, setSourceFunnels] = (0, import_react36.useState)(initialFunnels);
6631
- (0, import_react36.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
7341
+ const [activeFunnel, setActiveFunnel] = (0, import_react39.useState)(null);
7342
+ const initialFunnels = (0, import_react39.useMemo)(() => series?.length ? series : [{ data, sort, gap, align, orientation }], [series, data, sort, gap, align, orientation]);
7343
+ const [sourceFunnels, setSourceFunnels] = (0, import_react39.useState)(initialFunnels);
7344
+ (0, import_react39.useEffect)(() => setSourceFunnels(initialFunnels), [initialFunnels]);
6632
7345
  const allData = sourceFunnels.flatMap((funnel) => funnel.data);
6633
7346
  const legendData = [...new Map(allData.map((item) => [item.name, item])).values()];
6634
7347
  const legend = useLegendSelection(legendData.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -6719,7 +7432,7 @@ var FunnelChart = (0, import_react36.forwardRef)(function FunnelChart2({ data =
6719
7432
  })
6720
7433
  ] });
6721
7434
  });
6722
- var HeatmapChart = (0, import_react36.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) {
7435
+ var HeatmapChart = (0, import_react39.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) {
6723
7436
  const pointMode = points.length > 0;
6724
7437
  const values = pointMode ? points.map((point) => point.value) : data.flatMap((row) => [...row]);
6725
7438
  const minimum = values.length ? Math.min(...values) : 0;
@@ -6728,7 +7441,7 @@ var HeatmapChart = (0, import_react36.forwardRef)(function HeatmapChart2({ raste
6728
7441
  const cellHeight = PLOT.height / Math.max(1, yLabels.length);
6729
7442
  const pointXDomain = niceChartDomain(points.map((point) => point.x), false);
6730
7443
  const pointYDomain = niceChartDomain(points.map((point) => point.y), false);
6731
- const filterId = `sia-heat-${(0, import_react36.useId)().replaceAll(":", "")}`;
7444
+ const filterId = `sia-heat-${(0, import_react39.useId)().replaceAll(":", "")}`;
6732
7445
  if (raster) return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(SiaChart, { ...props, ref, empty: !points.length, ariaLabel: props.ariaLabel ?? "\u50CF\u7D20\u70ED\u529B\u56FE", children: [
6733
7446
  raster.backgroundImage ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("image", { href: raster.backgroundImage, x: 0, y: 0, width: raster.width, height: raster.height, preserveAspectRatio: "none", pointerEvents: "none" }) : null,
6734
7447
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(HeatmapRaster, { width: raster.width, height: raster.height, points, options: raster })
@@ -6764,7 +7477,7 @@ var HeatmapChart = (0, import_react36.forwardRef)(function HeatmapChart2({ raste
6764
7477
  ] })
6765
7478
  ] });
6766
7479
  });
6767
- var ThemeRiverChart = (0, import_react36.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
7480
+ var ThemeRiverChart = (0, import_react39.forwardRef)(function ThemeRiverChart2({ categories, series, legendInteractive = true, legendSelected, onLegendSelectionChange, onDataClick, palette, ...props }, ref) {
6768
7481
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
6769
7482
  const activeSeries = series.filter((item) => legend.isSelected(item.name));
6770
7483
  const totals = categories.map((_, index) => activeSeries.reduce((sum, item) => sum + Math.max(0, item.data[index] ?? 0), 0));
@@ -6802,8 +7515,8 @@ function eventTime(value) {
6802
7515
  if (typeof value === "number") return value;
6803
7516
  return Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(value) ? value.replace(/-/g, "/") : value);
6804
7517
  }
6805
- var EventRiverChart = (0, import_react36.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) {
6806
- const [restoreVersion, setRestoreVersion] = (0, import_react36.useState)(0);
7518
+ var EventRiverChart = (0, import_react39.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) {
7519
+ const [restoreVersion, setRestoreVersion] = (0, import_react39.useState)(0);
6807
7520
  const area = plot;
6808
7521
  palette = palette ?? (appearance === "macarons" ? ["#2ec7c9", "#b6a2de"] : void 0);
6809
7522
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -6876,9 +7589,9 @@ function vennDistance(radiusA, radiusB, overlap) {
6876
7589
  }
6877
7590
  return (low + high) / 2;
6878
7591
  }
6879
- var VennChart = (0, import_react36.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
6880
- const [sets, setSets] = (0, import_react36.useState)(initialSets), [intersection, setIntersection] = (0, import_react36.useState)(initialIntersection), [active, setActive] = (0, import_react36.useState)();
6881
- (0, import_react36.useEffect)(() => {
7592
+ var VennChart = (0, import_react39.forwardRef)(function VennChart2({ sets: initialSets, intersection: initialIntersection, appearance = "sia", emphasisColor, emphasisBorderColor, emphasisBorderWidth, onDataClick, palette, toolbox, ...props }, ref) {
7593
+ const [sets, setSets] = (0, import_react39.useState)(initialSets), [intersection, setIntersection] = (0, import_react39.useState)(initialIntersection), [active, setActive] = (0, import_react39.useState)();
7594
+ (0, import_react39.useEffect)(() => {
6882
7595
  setSets(initialSets);
6883
7596
  setIntersection(initialIntersection);
6884
7597
  }, [initialSets, initialIntersection]);
@@ -6941,17 +7654,17 @@ function layoutTreemap(nodes, x, y, width, height, gap, maxDepth, depth = 0, see
6941
7654
  });
6942
7655
  return result;
6943
7656
  }
6944
- var TreemapChart = (0, import_react36.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) {
6945
- const [path, setPath] = (0, import_react36.useState)([]);
6946
- const [sourceData, setSourceData] = (0, import_react36.useState)(data);
6947
- const [active, setActive] = (0, import_react36.useState)();
6948
- (0, import_react36.useEffect)(() => {
7657
+ var TreemapChart = (0, import_react39.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) {
7658
+ const [path, setPath] = (0, import_react39.useState)([]);
7659
+ const [sourceData, setSourceData] = (0, import_react39.useState)(data);
7660
+ const [active, setActive] = (0, import_react39.useState)();
7661
+ (0, import_react39.useEffect)(() => {
6949
7662
  setSourceData(data);
6950
7663
  setPath([]);
6951
7664
  }, [data]);
6952
7665
  const currentData = path.reduce((nodes, name) => nodes.find((node) => node.name === name)?.children ?? nodes, sourceData);
6953
7666
  const top = drilldown && showBreadcrumb ? 52 : 28;
6954
- const rectangles = (0, import_react36.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
7667
+ const rectangles = (0, import_react39.useMemo)(() => layoutTreemap(currentData, bounds?.x ?? 24, bounds?.y ?? top, bounds?.width ?? 672, bounds?.height ?? 336 - top, gap, maxDepth), [currentData, gap, maxDepth, top, bounds]);
6955
7668
  const chartToolbox = typeof toolbox === "object" ? { ...toolbox, dataView: toolbox.dataView ?? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChartDataEditor, { readOnly: toolbox.dataViewReadOnly, series: currentData.map((node) => ({ name: node.name, data: [treemapValue(node)] })), onApply: (values) => {
6956
7669
  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);
6957
7670
  setSourceData(update(sourceData, 0));
@@ -7019,15 +7732,15 @@ function flattenTree(root, collapsed) {
7019
7732
  visit(root, 0);
7020
7733
  return { nodes, leafCount: Math.max(1, leafOrder), maxDepth: Math.max(0, ...nodes.map((item) => item.depth)) };
7021
7734
  }
7022
- var TreeChart = (0, import_react36.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) {
7023
- const [sourceData, setSourceData] = (0, import_react36.useState)(data);
7024
- const [roamReset, setRoamReset] = (0, import_react36.useState)(0);
7025
- const [active, setActive] = (0, import_react36.useState)();
7026
- (0, import_react36.useEffect)(() => {
7735
+ var TreeChart = (0, import_react39.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) {
7736
+ const [sourceData, setSourceData] = (0, import_react39.useState)(data);
7737
+ const [roamReset, setRoamReset] = (0, import_react39.useState)(0);
7738
+ const [active, setActive] = (0, import_react39.useState)();
7739
+ (0, import_react39.useEffect)(() => {
7027
7740
  setSourceData(data);
7028
7741
  setActive(void 0);
7029
7742
  }, [data]);
7030
- const [collapsed, setCollapsed] = (0, import_react36.useState)(() => {
7743
+ const [collapsed, setCollapsed] = (0, import_react39.useState)(() => {
7031
7744
  const result = /* @__PURE__ */ new Set();
7032
7745
  const visit = (node) => {
7033
7746
  if (node.collapsed) result.add(node.name);
@@ -7036,8 +7749,8 @@ var TreeChart = (0, import_react36.forwardRef)(function TreeChart2({ data, itemS
7036
7749
  visit(data);
7037
7750
  return result;
7038
7751
  });
7039
- const layout = (0, import_react36.useMemo)(() => flattenTree(sourceData, collapsed), [collapsed, sourceData]);
7040
- const fixedLayout = (0, import_react36.useMemo)(() => {
7752
+ const layout = (0, import_react39.useMemo)(() => flattenTree(sourceData, collapsed), [collapsed, sourceData]);
7753
+ const fixedLayout = (0, import_react39.useMemo)(() => {
7041
7754
  const visible = (node) => ({ ...node, children: collapsed.has(node.name) ? [] : node.children?.map(visible) });
7042
7755
  return rootPosition ? layoutTreeNodes(visible(sourceData), { nodeSize, nodePadding, layerPadding, rootPosition, orientation }) : void 0;
7043
7756
  }, [sourceData, collapsed, rootPosition, nodeSize, nodePadding, layerPadding, orientation]);
@@ -7107,15 +7820,15 @@ var TreeChart = (0, import_react36.forwardRef)(function TreeChart2({ data, itemS
7107
7820
  })
7108
7821
  ] }) });
7109
7822
  });
7110
- var WordCloudChart = (0, import_react36.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) {
7111
- const placements = (0, import_react36.useMemo)(() => {
7823
+ var WordCloudChart = (0, import_react39.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) {
7824
+ const placements = (0, import_react39.useMemo)(() => {
7112
7825
  const context = typeof document === "undefined" ? null : document.createElement("canvas").getContext("2d");
7113
7826
  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) => {
7114
7827
  context.font = `${word.fontWeight ?? fontWeight} ${size}px ${word.fontFamily ?? fontFamily ?? "Arial"}`;
7115
7828
  return context.measureText(word.name).width;
7116
7829
  } : void 0 });
7117
7830
  }, [data, bounds, autoFit, areaSizing, maxFontSize, minFontSize, padding, rotations, shape, spiralStep, fontFamily, fontWeight]);
7118
- (0, import_react36.useEffect)(() => {
7831
+ (0, import_react39.useEffect)(() => {
7119
7832
  const present = new Set(placements.map((p) => p.index));
7120
7833
  onLayout?.({ placed: placements.length, unplaced: data.filter((_, i) => !present.has(i)).map((item) => item.name) });
7121
7834
  }, [placements, data, onLayout]);
@@ -7124,30 +7837,30 @@ var WordCloudChart = (0, import_react36.forwardRef)(function WordCloudChart2({ d
7124
7837
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChartMark, { label: `${placement.item.name}\uFF0C${placement.item.value}`, tooltip: /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.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}`);
7125
7838
  }) });
7126
7839
  });
7127
- var MixedChart = (0, import_react36.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) {
7128
- const plotClipId = `sia-mixed-plot-${(0, import_react36.useId)().replaceAll(":", "")}`;
7129
- const [editableSeries, setEditableSeries] = (0, import_react36.useState)(sourceSeries);
7130
- const [geometry, setGeometry] = (0, import_react36.useState)();
7131
- const [pointerIndex, setPointerIndex] = (0, import_react36.useState)(null);
7132
- const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react36.useState)(0);
7133
- const [motionRevision, setMotionRevision] = (0, import_react36.useState)(0);
7134
- const [stackMode, setStackMode] = (0, import_react36.useState)();
7135
- const lastPublished = (0, import_react36.useRef)(null);
7840
+ var MixedChart = (0, import_react39.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) {
7841
+ const plotClipId = `sia-mixed-plot-${(0, import_react39.useId)().replaceAll(":", "")}`;
7842
+ const [editableSeries, setEditableSeries] = (0, import_react39.useState)(sourceSeries);
7843
+ const [geometry, setGeometry] = (0, import_react39.useState)();
7844
+ const [pointerIndex, setPointerIndex] = (0, import_react39.useState)(null);
7845
+ const [pointerAxisIndex, setPointerAxisIndex] = (0, import_react39.useState)(0);
7846
+ const [motionRevision, setMotionRevision] = (0, import_react39.useState)(0);
7847
+ const [stackMode, setStackMode] = (0, import_react39.useState)();
7848
+ const lastPublished = (0, import_react39.useRef)(null);
7136
7849
  const publishData = (next) => {
7137
7850
  lastPublished.current = next;
7138
7851
  onDataChange?.(next);
7139
7852
  };
7140
- const [islands, setIslands] = (0, import_react36.useState)([]);
7141
- const drag = (0, import_react36.useRef)(null);
7142
- const [dragOffset, setDragOffset] = (0, import_react36.useState)();
7143
- (0, import_react36.useEffect)(() => {
7853
+ const [islands, setIslands] = (0, import_react39.useState)([]);
7854
+ const drag = (0, import_react39.useRef)(null);
7855
+ const [dragOffset, setDragOffset] = (0, import_react39.useState)();
7856
+ (0, import_react39.useEffect)(() => {
7144
7857
  if (sourceSeries === lastPublished.current) return;
7145
7858
  setEditableSeries(sourceSeries);
7146
7859
  setIslands([]);
7147
7860
  drag.current = null;
7148
7861
  setDragOffset(void 0);
7149
7862
  }, [sourceSeries]);
7150
- const series = (0, import_react36.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
7863
+ const series = (0, import_react39.useMemo)(() => editableSeries.map((item) => geometry ? { ...item, type: geometry } : item), [editableSeries, geometry]);
7151
7864
  const stacked = stackMode ?? sourceStacked;
7152
7865
  const PLOT2 = plotBounds ?? { x: 62, y: 48, width: 628, height: 250 }, PLOT_BOTTOM2 = PLOT2.y + PLOT2.height;
7153
7866
  const legend = useLegendSelection(series.map((item) => item.name), legendSelected, onLegendSelectionChange);
@@ -7311,7 +8024,7 @@ var MixedChart = (0, import_react36.forwardRef)(function MixedChart2({ axisPoint
7311
8024
  })
7312
8025
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CartesianAxes, { categories, domain, band: categoryGap }),
7313
8026
  activeIndex != null && activeIndex >= 0 && activeIndex < categories.length ? /* @__PURE__ */ (0, import_jsx_runtime35.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,
7314
- tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react37.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_runtime35.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,
8027
+ tooltipTrigger === "axis" ? categories.map((name, index) => /* @__PURE__ */ (0, import_react40.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_runtime35.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,
7315
8028
  calculable ? activeSeries.flatMap((item) => item.data.map((value, index) => value === null ? /* @__PURE__ */ (0, import_jsx_runtime35.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_runtime35.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,
7316
8029
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("clipPath", { id: plotClipId, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("rect", { x: PLOT2.x, y: PLOT2.y, width: PLOT2.width, height: PLOT2.height }) }) }),
7317
8030
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("g", { "data-mixed-plot": "", clipPath: clipPlot ? `url(#${plotClipId})` : void 0, children: renderSeries.map((item) => {
@@ -7350,7 +8063,7 @@ var MixedChart = (0, import_react36.forwardRef)(function MixedChart2({ axisPoint
7350
8063
  const zero = linearScale(placement.start, [valueDomain[0], valueDomain[1]], [PLOT_BOTTOM2, PLOT2.y]);
7351
8064
  const rectY = barSpacing?.pixelAlign ? Math.floor(Math.min(y, zero)) : Math.min(y, zero);
7352
8065
  const rectHeight = barSpacing?.pixelAlign ? Math.ceil(Math.abs(zero - y)) : Math.abs(zero - y);
7353
- return /* @__PURE__ */ (0, import_jsx_runtime35.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_react37.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_runtime35.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
8066
+ return /* @__PURE__ */ (0, import_jsx_runtime35.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_react40.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_runtime35.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: [props.tooltipProps?.placement === "axis" ? Math.round(categoryAt(index)) : x + width / 2, y], onPointerUp: (event) => {
7354
8067
  if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
7355
8068
  } }, /* @__PURE__ */ (0, import_jsx_runtime35.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}`);
7356
8069
  })
@@ -7379,7 +8092,7 @@ var MixedChart = (0, import_react36.forwardRef)(function MixedChart2({ axisPoint
7379
8092
  if (!placements[index]) return null;
7380
8093
  const name = categoryName(index, item.categoryAxisIndex);
7381
8094
  const value = item.data[index] ?? 0;
7382
- return /* @__PURE__ */ (0, import_react37.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_runtime35.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
8095
+ return /* @__PURE__ */ (0, import_react40.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_runtime35.jsx)(TooltipValue, { name, series: item.name, value, formatter: valueFormatter }), tooltipPoint: props.tooltipProps?.placement === "axis" ? [Math.round(point[0]), point[1]] : point, onPointerUp: (event) => {
7383
8096
  if (!finishDrag(event)) onDataClick?.({ name, value, seriesName: item.name, data: value, nativeEvent: event });
7384
8097
  } }, /* @__PURE__ */ (0, import_jsx_runtime35.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 }));
7385
8098
  })
@@ -7420,9 +8133,9 @@ var KLineChart = CandlestickChart;
7420
8133
 
7421
8134
  // src/components/LineShareChart.tsx
7422
8135
  var import_jsx_runtime36 = require("react/jsx-runtime");
7423
- var LineShareChart = (0, import_react38.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
7424
- const [selected, setSelected] = (0, import_react38.useState)(null);
7425
- const [maskHovered, setMaskHovered] = (0, import_react38.useState)(false);
8136
+ var LineShareChart = (0, import_react41.forwardRef)(function LineShareChart2({ data, lineColor = "#2ec7c9", shareColor = "#b6a2de", ...props }, ref) {
8137
+ const [selected, setSelected] = (0, import_react41.useState)(null);
8138
+ const [maskHovered, setMaskHovered] = (0, import_react41.useState)(false);
7426
8139
  const width = props.viewBoxSize?.[0] ?? 900, height = props.viewBoxSize?.[1] ?? 450;
7427
8140
  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;
7428
8141
  const maximum = data.reduce((best, item2, i) => item2.value >= data[best].value ? i : best, 0);
@@ -7500,16 +8213,16 @@ function paddedValueExtent(values, padding = 0.05) {
7500
8213
  }
7501
8214
 
7502
8215
  // src/components/XYChart.tsx
7503
- var import_react39 = require("react");
8216
+ var import_react42 = require("react");
7504
8217
  var import_jsx_runtime37 = require("react/jsx-runtime");
7505
- var XYChart = (0, import_react39.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
7506
- const [series, setSeries] = (0, import_react39.useState)(source);
7507
- const [hidden, setHidden] = (0, import_react39.useState)([]);
7508
- const [crosshair, setCrosshair] = (0, import_react39.useState)();
7509
- const [drag, setDrag] = (0, import_react39.useState)();
7510
- const [geometry, setGeometry] = (0, import_react39.useState)();
7511
- const [zoom, setZoom] = (0, import_react39.useState)(defaultZoom);
7512
- (0, import_react39.useEffect)(() => setSeries(source), [source]);
8218
+ var XYChart = (0, import_react42.forwardRef)(function XYChart2({ series: source, xDomain, yDomain, animationProgress, calculable = false, onDataChange, xAxisType = "value", xFormatter, tooltipFormatter, dataZoom = false, defaultZoom = [0, 100], onZoomChange, toolbox, ...props }, ref) {
8219
+ const [series, setSeries] = (0, import_react42.useState)(source);
8220
+ const [hidden, setHidden] = (0, import_react42.useState)([]);
8221
+ const [crosshair, setCrosshair] = (0, import_react42.useState)();
8222
+ const [drag, setDrag] = (0, import_react42.useState)();
8223
+ const [geometry, setGeometry] = (0, import_react42.useState)();
8224
+ const [zoom, setZoom] = (0, import_react42.useState)(defaultZoom);
8225
+ (0, import_react42.useEffect)(() => setSeries(source), [source]);
7513
8226
  const window2 = dataZoom || xAxisType === "time" ? scatterValueWindow(series.flatMap((item) => item.data.map((point) => point[0])), dataZoom ? zoom : [0, 100]) : void 0;
7514
8227
  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 }));
7515
8228
  const width = props.viewBoxSize?.[0] ?? 663, height = props.viewBoxSize?.[1] ?? 379;
@@ -7638,7 +8351,7 @@ var XYChart = (0, import_react39.forwardRef)(function XYChart2({ series: source,
7638
8351
  });
7639
8352
 
7640
8353
  // src/components/ChartMapOverlay.tsx
7641
- var import_react40 = require("react");
8354
+ var import_react43 = require("react");
7642
8355
 
7643
8356
  // src/components/mapOverlayHost.ts
7644
8357
  function observeMapOverlayHost(host, onChange) {
@@ -7654,9 +8367,9 @@ function observeMapOverlayHost(host, onChange) {
7654
8367
  if (stopped) return;
7655
8368
  stopped = true;
7656
8369
  try {
7657
- for (const cleanup of cleanups.splice(0).reverse()) {
8370
+ for (const cleanup2 of cleanups.splice(0).reverse()) {
7658
8371
  try {
7659
- cleanup();
8372
+ cleanup2();
7660
8373
  } catch {
7661
8374
  }
7662
8375
  }
@@ -7677,11 +8390,11 @@ function observeMapOverlayHost(host, onChange) {
7677
8390
  // src/components/ChartMapOverlay.tsx
7678
8391
  var import_jsx_runtime38 = require("react/jsx-runtime");
7679
8392
  function ChartMapOverlay({ createHost, children, className, style, ariaLabel = "\u5730\u56FE\u53E0\u52A0\u56FE\u8868", onError }) {
7680
- const container = (0, import_react40.useRef)(null);
7681
- const errorHandler = (0, import_react40.useRef)(onError);
8393
+ const container = (0, import_react43.useRef)(null);
8394
+ const errorHandler = (0, import_react43.useRef)(onError);
7682
8395
  errorHandler.current = onError;
7683
- const [snapshot, setSnapshot] = (0, import_react40.useState)();
7684
- (0, import_react40.useEffect)(() => {
8396
+ const [snapshot, setSnapshot] = (0, import_react43.useState)();
8397
+ (0, import_react43.useEffect)(() => {
7685
8398
  setSnapshot(void 0);
7686
8399
  if (!container.current) return;
7687
8400
  try {
@@ -7756,6 +8469,9 @@ function createBaiduMapHost(element, sdk, options) {
7756
8469
  destroy
7757
8470
  };
7758
8471
  }
8472
+
8473
+ // src/chart.ts
8474
+ initializeDefaultScrollbars();
7759
8475
  // Annotate the CommonJS export names for ESM import in node:
7760
8476
  0 && (module.exports = {
7761
8477
  BarChart,