shadcn-glass-ui 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +0 -51
  2. package/README.md +11 -12
  3. package/context7.json +4 -15
  4. package/dist/cli/index.cjs +1 -1
  5. package/dist/components.cjs +4 -4
  6. package/dist/components.d.ts +89 -160
  7. package/dist/components.js +1 -1
  8. package/dist/hooks.cjs +2 -2
  9. package/dist/index.cjs +966 -2289
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.js +965 -2253
  12. package/dist/index.js.map +1 -1
  13. package/dist/r/alert-glass.json +1 -1
  14. package/dist/r/badge-glass.json +1 -1
  15. package/dist/r/button-glass.json +1 -1
  16. package/dist/r/card-glass.json +40 -0
  17. package/dist/r/input-glass.json +1 -1
  18. package/dist/r/modal-glass.json +5 -5
  19. package/dist/r/registry.json +7 -1
  20. package/dist/r/tooltip-glass.json +1 -1
  21. package/dist/shadcn-glass-ui.css +1 -1
  22. package/dist/{theme-context-D_cb9KzA.cjs → theme-context-BEA8K_rq.cjs} +2 -2
  23. package/dist/{theme-context-D_cb9KzA.cjs.map → theme-context-BEA8K_rq.cjs.map} +1 -1
  24. package/dist/themes.cjs +1 -1
  25. package/dist/{trust-score-card-glass-CTsEVRD3.cjs → trust-score-card-glass-DTS1RdIt.cjs} +189 -341
  26. package/dist/trust-score-card-glass-DTS1RdIt.cjs.map +1 -0
  27. package/dist/{trust-score-card-glass-CUStm4o_.js → trust-score-card-glass-Dg4_b_g_.js} +158 -238
  28. package/dist/trust-score-card-glass-Dg4_b_g_.js.map +1 -0
  29. package/dist/{use-focus--Hw2nevi.cjs → use-focus-CdoUzFQ8.cjs} +2 -2
  30. package/dist/{use-focus--Hw2nevi.cjs.map → use-focus-CdoUzFQ8.cjs.map} +1 -1
  31. package/dist/{use-wallpaper-tint-B4oMQsXQ.cjs → use-wallpaper-tint-Rq5UgY9L.cjs} +2 -2
  32. package/dist/{use-wallpaper-tint-B4oMQsXQ.cjs.map → use-wallpaper-tint-Rq5UgY9L.cjs.map} +1 -1
  33. package/dist/{utils-BqeJ4aco.cjs → utils-NLnOCttr.cjs} +2 -2
  34. package/dist/{utils-BqeJ4aco.cjs.map → utils-NLnOCttr.cjs.map} +1 -1
  35. package/dist/utils.cjs +1 -1
  36. package/docs/ADVANCED_PATTERNS.md +7 -5
  37. package/docs/AI_USAGE.md +0 -1
  38. package/docs/BEST_PRACTICES.md +0 -2
  39. package/docs/BREAKING_CHANGES.md +0 -1
  40. package/docs/COMPONENTS_CATALOG.md +1 -4
  41. package/docs/COMPONENT_PATTERNS.md +325 -0
  42. package/docs/GETTING_STARTED.md +52 -28
  43. package/docs/api/README.md +0 -2
  44. package/docs/api/variables/ModalGlass.md +5 -4
  45. package/package.json +2 -4
  46. package/dist/trust-score-card-glass-CTsEVRD3.cjs.map +0 -1
  47. package/dist/trust-score-card-glass-CUStm4o_.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- const require_trust_score_card_glass = require("./trust-score-card-glass-CTsEVRD3.cjs");
2
- const require_utils = require("./utils-BqeJ4aco.cjs");
3
- const require_use_focus = require("./use-focus--Hw2nevi.cjs");
4
- const require_theme_context = require("./theme-context-D_cb9KzA.cjs");
5
- const require_use_wallpaper_tint = require("./use-wallpaper-tint-B4oMQsXQ.cjs");
1
+ const require_trust_score_card_glass = require("./trust-score-card-glass-DTS1RdIt.cjs");
2
+ const require_utils = require("./utils-NLnOCttr.cjs");
3
+ const require_use_focus = require("./use-focus-CdoUzFQ8.cjs");
4
+ const require_theme_context = require("./theme-context-BEA8K_rq.cjs");
5
+ const require_use_wallpaper_tint = require("./use-wallpaper-tint-Rq5UgY9L.cjs");
6
6
  let react = require("react");
7
7
  react = require_trust_score_card_glass.__toESM(react);
8
8
  let lucide_react = require("lucide-react");
@@ -12,9 +12,6 @@ let react_jsx_runtime = require("react/jsx-runtime");
12
12
  let __radix_ui_react_slot = require("@radix-ui/react-slot");
13
13
  let react_dom = require("react-dom");
14
14
  react_dom = require_trust_score_card_glass.__toESM(react_dom);
15
- let __radix_ui_react_dialog = require("@radix-ui/react-dialog");
16
- __radix_ui_react_dialog = require_trust_score_card_glass.__toESM(__radix_ui_react_dialog);
17
- let __radix_ui_react_toggle = require("@radix-ui/react-toggle");
18
15
  const stepperRootVariants = (0, class_variance_authority.cva)("flex w-full", {
19
16
  variants: { orientation: {
20
17
  horizontal: "flex-col",
@@ -375,641 +372,38 @@ const StepperGlass = {
375
372
  Step: StepperStep,
376
373
  Content: StepperContent
377
374
  };
378
- function createContextScope$3(scopeName, createContextScopeDeps = []) {
379
- let defaultContexts = [];
380
- function createContext3(rootComponentName, defaultContext) {
381
- const BaseContext = react.createContext(defaultContext);
382
- const index = defaultContexts.length;
383
- defaultContexts = [...defaultContexts, defaultContext];
384
- const Provider = (props) => {
385
- const { scope, children, ...context } = props;
386
- const Context = scope?.[scopeName]?.[index] || BaseContext;
387
- const value = react.useMemo(() => context, Object.values(context));
388
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
389
- value,
390
- children
391
- });
392
- };
393
- Provider.displayName = rootComponentName + "Provider";
394
- function useContext2(consumerName, scope) {
395
- const Context = scope?.[scopeName]?.[index] || BaseContext;
396
- const context = react.useContext(Context);
397
- if (context) return context;
398
- if (defaultContext !== void 0) return defaultContext;
399
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
400
- }
401
- return [Provider, useContext2];
402
- }
403
- const createScope = () => {
404
- const scopeContexts = defaultContexts.map((defaultContext) => {
405
- return react.createContext(defaultContext);
406
- });
407
- return function useScope(scope) {
408
- const contexts = scope?.[scopeName] || scopeContexts;
409
- return react.useMemo(() => ({ [`__scope${scopeName}`]: {
410
- ...scope,
411
- [scopeName]: contexts
412
- } }), [scope, contexts]);
413
- };
414
- };
415
- createScope.scopeName = scopeName;
416
- return [createContext3, composeContextScopes$4(createScope, ...createContextScopeDeps)];
417
- }
418
- function composeContextScopes$4(...scopes) {
419
- const baseScope = scopes[0];
420
- if (scopes.length === 1) return baseScope;
421
- const createScope = () => {
422
- const scopeHooks = scopes.map((createScope2) => ({
423
- useScope: createScope2(),
424
- scopeName: createScope2.scopeName
425
- }));
426
- return function useComposedScopes(overrideScopes) {
427
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
428
- const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
429
- return {
430
- ...nextScopes2,
431
- ...currentScope
432
- };
433
- }, {});
434
- return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
435
- };
436
- };
437
- createScope.scopeName = baseScope.scopeName;
438
- return createScope;
439
- }
440
- var Primitive$4 = [
441
- "a",
442
- "button",
443
- "div",
444
- "form",
445
- "h2",
446
- "h3",
447
- "img",
448
- "input",
449
- "label",
450
- "li",
451
- "nav",
452
- "ol",
453
- "p",
454
- "select",
455
- "span",
456
- "svg",
457
- "ul"
458
- ].reduce((primitive, node) => {
459
- const Slot$3 = (0, __radix_ui_react_slot.createSlot)(`Primitive.${node}`);
460
- const Node = react.forwardRef((props, forwardedRef) => {
461
- const { asChild, ...primitiveProps } = props;
462
- const Comp = asChild ? Slot$3 : node;
463
- if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
464
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
465
- ...primitiveProps,
466
- ref: forwardedRef
467
- });
468
- });
469
- Node.displayName = `Primitive.${node}`;
470
- return {
471
- ...primitive,
472
- [node]: Node
473
- };
474
- }, {});
475
- function createContextScope$4(scopeName, createContextScopeDeps = []) {
476
- let defaultContexts = [];
477
- function createContext3(rootComponentName, defaultContext) {
478
- const BaseContext = react.createContext(defaultContext);
479
- const index = defaultContexts.length;
480
- defaultContexts = [...defaultContexts, defaultContext];
481
- const Provider = (props) => {
482
- const { scope, children, ...context } = props;
483
- const Context = scope?.[scopeName]?.[index] || BaseContext;
484
- const value = react.useMemo(() => context, Object.values(context));
485
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
486
- value,
487
- children
488
- });
489
- };
490
- Provider.displayName = rootComponentName + "Provider";
491
- function useContext2(consumerName, scope) {
492
- const Context = scope?.[scopeName]?.[index] || BaseContext;
493
- const context = react.useContext(Context);
494
- if (context) return context;
495
- if (defaultContext !== void 0) return defaultContext;
496
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
497
- }
498
- return [Provider, useContext2];
499
- }
500
- const createScope = () => {
501
- const scopeContexts = defaultContexts.map((defaultContext) => {
502
- return react.createContext(defaultContext);
503
- });
504
- return function useScope(scope) {
505
- const contexts = scope?.[scopeName] || scopeContexts;
506
- return react.useMemo(() => ({ [`__scope${scopeName}`]: {
507
- ...scope,
508
- [scopeName]: contexts
509
- } }), [scope, contexts]);
510
- };
511
- };
512
- createScope.scopeName = scopeName;
513
- return [createContext3, composeContextScopes$3(createScope, ...createContextScopeDeps)];
514
- }
515
- function composeContextScopes$3(...scopes) {
516
- const baseScope = scopes[0];
517
- if (scopes.length === 1) return baseScope;
518
- const createScope = () => {
519
- const scopeHooks = scopes.map((createScope2) => ({
520
- useScope: createScope2(),
521
- scopeName: createScope2.scopeName
522
- }));
523
- return function useComposedScopes(overrideScopes) {
524
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
525
- const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
526
- return {
527
- ...nextScopes2,
528
- ...currentScope
529
- };
530
- }, {});
531
- return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
532
- };
533
- };
534
- createScope.scopeName = baseScope.scopeName;
535
- return createScope;
375
+ var MOBILE_BREAKPOINT = 768;
376
+ var SIDEBAR_COOKIE_NAME = "sidebar:state";
377
+ var SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
378
+ var SidebarContext = (0, react.createContext)(null);
379
+ function useSidebar() {
380
+ const context = (0, react.useContext)(SidebarContext);
381
+ if (!context) throw new Error("useSidebar must be used within SidebarGlass.Provider. Wrap your component tree with <SidebarGlass.Provider>.");
382
+ return context;
536
383
  }
537
- var Primitive$5 = [
538
- "a",
539
- "button",
540
- "div",
541
- "form",
542
- "h2",
543
- "h3",
544
- "img",
545
- "input",
546
- "label",
547
- "li",
548
- "nav",
549
- "ol",
550
- "p",
551
- "select",
552
- "span",
553
- "svg",
554
- "ul"
555
- ].reduce((primitive, node) => {
556
- const Slot$3 = (0, __radix_ui_react_slot.createSlot)(`Primitive.${node}`);
557
- const Node = react.forwardRef((props, forwardedRef) => {
558
- const { asChild, ...primitiveProps } = props;
559
- const Comp = asChild ? Slot$3 : node;
560
- if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
561
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
562
- ...primitiveProps,
563
- ref: forwardedRef
564
- });
565
- });
566
- Node.displayName = `Primitive.${node}`;
567
- return {
568
- ...primitive,
569
- [node]: Node
570
- };
571
- }, {});
572
- var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
573
- var EVENT_OPTIONS = {
574
- bubbles: false,
575
- cancelable: true
576
- };
577
- var GROUP_NAME = "RovingFocusGroup";
578
- var [Collection, useCollection, createCollectionScope] = require_trust_score_card_glass.createCollection(GROUP_NAME);
579
- var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope$4(GROUP_NAME, [createCollectionScope]);
580
- var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
581
- var RovingFocusGroup = react.forwardRef((props, forwardedRef) => {
582
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collection.Provider, {
583
- scope: props.__scopeRovingFocusGroup,
584
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collection.Slot, {
585
- scope: props.__scopeRovingFocusGroup,
586
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RovingFocusGroupImpl, {
587
- ...props,
588
- ref: forwardedRef
589
- })
590
- })
591
- });
592
- });
593
- RovingFocusGroup.displayName = GROUP_NAME;
594
- var RovingFocusGroupImpl = react.forwardRef((props, forwardedRef) => {
595
- const { __scopeRovingFocusGroup, orientation, loop = false, dir, currentTabStopId: currentTabStopIdProp, defaultCurrentTabStopId, onCurrentTabStopIdChange, onEntryFocus, preventScrollOnEntryFocus = false, ...groupProps } = props;
596
- const ref = react.useRef(null);
597
- const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref);
598
- const direction = require_trust_score_card_glass.useDirection(dir);
599
- const [currentTabStopId, setCurrentTabStopId] = require_trust_score_card_glass.useControllableState({
600
- prop: currentTabStopIdProp,
601
- defaultProp: defaultCurrentTabStopId ?? null,
602
- onChange: onCurrentTabStopIdChange,
603
- caller: GROUP_NAME
604
- });
605
- const [isTabbingBackOut, setIsTabbingBackOut] = react.useState(false);
606
- const handleEntryFocus = require_trust_score_card_glass.useCallbackRef(onEntryFocus);
607
- const getItems = useCollection(__scopeRovingFocusGroup);
608
- const isClickFocusRef = react.useRef(false);
609
- const [focusableItemsCount, setFocusableItemsCount] = react.useState(0);
610
- react.useEffect(() => {
611
- const node = ref.current;
612
- if (node) {
613
- node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
614
- return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
384
+ const SidebarProvider = ({ children, open: controlledOpen, onOpenChange, defaultOpen = true, side = "left", variant = "sidebar", collapsible = "offcanvas", cookieName = SIDEBAR_COOKIE_NAME, keyboardShortcut = "b" }) => {
385
+ const [internalOpen, setInternalOpen] = (0, react.useState)(() => {
386
+ if (typeof document !== "undefined") {
387
+ const sidebarCookie = document.cookie.split(";").find((c) => c.trim().startsWith(`${cookieName}=`));
388
+ if (sidebarCookie) return sidebarCookie.split("=")[1] === "true";
615
389
  }
616
- }, [handleEntryFocus]);
617
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RovingFocusProvider, {
618
- scope: __scopeRovingFocusGroup,
619
- orientation,
620
- dir: direction,
621
- loop,
622
- currentTabStopId,
623
- onItemFocus: react.useCallback((tabStopId) => setCurrentTabStopId(tabStopId), [setCurrentTabStopId]),
624
- onItemShiftTab: react.useCallback(() => setIsTabbingBackOut(true), []),
625
- onFocusableItemAdd: react.useCallback(() => setFocusableItemsCount((prevCount) => prevCount + 1), []),
626
- onFocusableItemRemove: react.useCallback(() => setFocusableItemsCount((prevCount) => prevCount - 1), []),
627
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$5.div, {
628
- tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
629
- "data-orientation": orientation,
630
- ...groupProps,
631
- ref: composedRefs,
632
- style: {
633
- outline: "none",
634
- ...props.style
635
- },
636
- onMouseDown: require_trust_score_card_glass.composeEventHandlers(props.onMouseDown, () => {
637
- isClickFocusRef.current = true;
638
- }),
639
- onFocus: require_trust_score_card_glass.composeEventHandlers(props.onFocus, (event) => {
640
- const isKeyboardFocus = !isClickFocusRef.current;
641
- if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
642
- const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
643
- event.currentTarget.dispatchEvent(entryFocusEvent);
644
- if (!entryFocusEvent.defaultPrevented) {
645
- const items = getItems().filter((item) => item.focusable);
646
- focusFirst([
647
- items.find((item) => item.active),
648
- items.find((item) => item.id === currentTabStopId),
649
- ...items
650
- ].filter(Boolean).map((item) => item.ref.current), preventScrollOnEntryFocus);
651
- }
652
- }
653
- isClickFocusRef.current = false;
654
- }),
655
- onBlur: require_trust_score_card_glass.composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
656
- })
390
+ return defaultOpen;
657
391
  });
658
- });
659
- var ITEM_NAME$2 = "RovingFocusGroupItem";
660
- var RovingFocusGroupItem = react.forwardRef((props, forwardedRef) => {
661
- const { __scopeRovingFocusGroup, focusable = true, active = false, tabStopId, children, ...itemProps } = props;
662
- const autoId = require_trust_score_card_glass.useId();
663
- const id = tabStopId || autoId;
664
- const context = useRovingFocusContext(ITEM_NAME$2, __scopeRovingFocusGroup);
665
- const isCurrentTabStop = context.currentTabStopId === id;
666
- const getItems = useCollection(__scopeRovingFocusGroup);
667
- const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
668
- react.useEffect(() => {
669
- if (focusable) {
670
- onFocusableItemAdd();
671
- return () => onFocusableItemRemove();
672
- }
392
+ const isControlled = controlledOpen !== void 0;
393
+ const open = isControlled ? controlledOpen : internalOpen;
394
+ const setOpen = (0, react.useCallback)((value$1) => {
395
+ if (!isControlled) setInternalOpen(value$1);
396
+ onOpenChange?.(value$1);
397
+ if (typeof document !== "undefined") document.cookie = `${cookieName}=${value$1}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
673
398
  }, [
674
- focusable,
675
- onFocusableItemAdd,
676
- onFocusableItemRemove
399
+ isControlled,
400
+ onOpenChange,
401
+ cookieName
677
402
  ]);
678
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Collection.ItemSlot, {
679
- scope: __scopeRovingFocusGroup,
680
- id,
681
- focusable,
682
- active,
683
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$5.span, {
684
- tabIndex: isCurrentTabStop ? 0 : -1,
685
- "data-orientation": context.orientation,
686
- ...itemProps,
687
- ref: forwardedRef,
688
- onMouseDown: require_trust_score_card_glass.composeEventHandlers(props.onMouseDown, (event) => {
689
- if (!focusable) event.preventDefault();
690
- else context.onItemFocus(id);
691
- }),
692
- onFocus: require_trust_score_card_glass.composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
693
- onKeyDown: require_trust_score_card_glass.composeEventHandlers(props.onKeyDown, (event) => {
694
- if (event.key === "Tab" && event.shiftKey) {
695
- context.onItemShiftTab();
696
- return;
697
- }
698
- if (event.target !== event.currentTarget) return;
699
- const focusIntent = getFocusIntent(event, context.orientation, context.dir);
700
- if (focusIntent !== void 0) {
701
- if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
702
- event.preventDefault();
703
- let candidateNodes = getItems().filter((item) => item.focusable).map((item) => item.ref.current);
704
- if (focusIntent === "last") candidateNodes.reverse();
705
- else if (focusIntent === "prev" || focusIntent === "next") {
706
- if (focusIntent === "prev") candidateNodes.reverse();
707
- const currentIndex = candidateNodes.indexOf(event.currentTarget);
708
- candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
709
- }
710
- setTimeout(() => focusFirst(candidateNodes));
711
- }
712
- }),
713
- children: typeof children === "function" ? children({
714
- isCurrentTabStop,
715
- hasTabStop: currentTabStopId != null
716
- }) : children
717
- })
718
- });
719
- });
720
- RovingFocusGroupItem.displayName = ITEM_NAME$2;
721
- var MAP_KEY_TO_FOCUS_INTENT = {
722
- ArrowLeft: "prev",
723
- ArrowUp: "prev",
724
- ArrowRight: "next",
725
- ArrowDown: "next",
726
- PageUp: "first",
727
- Home: "first",
728
- PageDown: "last",
729
- End: "last"
730
- };
731
- function getDirectionAwareKey(key, dir) {
732
- if (dir !== "rtl") return key;
733
- return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
734
- }
735
- function getFocusIntent(event, orientation, dir) {
736
- const key = getDirectionAwareKey(event.key, dir);
737
- if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
738
- if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
739
- return MAP_KEY_TO_FOCUS_INTENT[key];
740
- }
741
- function focusFirst(candidates, preventScroll = false) {
742
- const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
743
- for (const candidate of candidates) {
744
- if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
745
- candidate.focus({ preventScroll });
746
- if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
747
- }
748
- }
749
- function wrapArray(array, startIndex) {
750
- return array.map((_, index) => array[(startIndex + index) % array.length]);
751
- }
752
- var Root$3 = RovingFocusGroup;
753
- var Item = RovingFocusGroupItem;
754
- var TOGGLE_GROUP_NAME = "ToggleGroup";
755
- var [createToggleGroupContext, createToggleGroupScope] = createContextScope$3(TOGGLE_GROUP_NAME, [createRovingFocusGroupScope]);
756
- var useRovingFocusGroupScope$1 = createRovingFocusGroupScope();
757
- var ToggleGroup = react.default.forwardRef((props, forwardedRef) => {
758
- const { type, ...toggleGroupProps } = props;
759
- if (type === "single") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupImplSingle, {
760
- ...toggleGroupProps,
761
- ref: forwardedRef
762
- });
763
- if (type === "multiple") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupImplMultiple, {
764
- ...toggleGroupProps,
765
- ref: forwardedRef
766
- });
767
- throw new Error(`Missing prop \`type\` expected on \`${TOGGLE_GROUP_NAME}\``);
768
- });
769
- ToggleGroup.displayName = TOGGLE_GROUP_NAME;
770
- var [ToggleGroupValueProvider, useToggleGroupValueContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
771
- var ToggleGroupImplSingle = react.default.forwardRef((props, forwardedRef) => {
772
- const { value: valueProp, defaultValue, onValueChange = () => {}, ...toggleGroupSingleProps } = props;
773
- const [value, setValue] = require_trust_score_card_glass.useControllableState({
774
- prop: valueProp,
775
- defaultProp: defaultValue ?? "",
776
- onChange: onValueChange,
777
- caller: TOGGLE_GROUP_NAME
778
- });
779
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupValueProvider, {
780
- scope: props.__scopeToggleGroup,
781
- type: "single",
782
- value: react.default.useMemo(() => value ? [value] : [], [value]),
783
- onItemActivate: setValue,
784
- onItemDeactivate: react.default.useCallback(() => setValue(""), [setValue]),
785
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupImpl, {
786
- ...toggleGroupSingleProps,
787
- ref: forwardedRef
788
- })
789
- });
790
- });
791
- var ToggleGroupImplMultiple = react.default.forwardRef((props, forwardedRef) => {
792
- const { value: valueProp, defaultValue, onValueChange = () => {}, ...toggleGroupMultipleProps } = props;
793
- const [value, setValue] = require_trust_score_card_glass.useControllableState({
794
- prop: valueProp,
795
- defaultProp: defaultValue ?? [],
796
- onChange: onValueChange,
797
- caller: TOGGLE_GROUP_NAME
798
- });
799
- const handleButtonActivate = react.default.useCallback((itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]), [setValue]);
800
- const handleButtonDeactivate = react.default.useCallback((itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)), [setValue]);
801
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupValueProvider, {
802
- scope: props.__scopeToggleGroup,
803
- type: "multiple",
804
- value,
805
- onItemActivate: handleButtonActivate,
806
- onItemDeactivate: handleButtonDeactivate,
807
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupImpl, {
808
- ...toggleGroupMultipleProps,
809
- ref: forwardedRef
810
- })
811
- });
812
- });
813
- ToggleGroup.displayName = TOGGLE_GROUP_NAME;
814
- var [ToggleGroupContext$1, useToggleGroupContext] = createToggleGroupContext(TOGGLE_GROUP_NAME);
815
- var ToggleGroupImpl = react.default.forwardRef((props, forwardedRef) => {
816
- const { __scopeToggleGroup, disabled = false, rovingFocus = true, orientation, dir, loop = true, ...toggleGroupProps } = props;
817
- const rovingFocusGroupScope = useRovingFocusGroupScope$1(__scopeToggleGroup);
818
- const direction = require_trust_score_card_glass.useDirection(dir);
819
- const commonProps = {
820
- role: "group",
821
- dir: direction,
822
- ...toggleGroupProps
823
- };
824
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupContext$1, {
825
- scope: __scopeToggleGroup,
826
- rovingFocus,
827
- disabled,
828
- children: rovingFocus ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$3, {
829
- asChild: true,
830
- ...rovingFocusGroupScope,
831
- orientation,
832
- dir: direction,
833
- loop,
834
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$4.div, {
835
- ...commonProps,
836
- ref: forwardedRef
837
- })
838
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$4.div, {
839
- ...commonProps,
840
- ref: forwardedRef
841
- })
842
- });
843
- });
844
- var ITEM_NAME$1 = "ToggleGroupItem";
845
- var ToggleGroupItem = react.default.forwardRef((props, forwardedRef) => {
846
- const valueContext = useToggleGroupValueContext(ITEM_NAME$1, props.__scopeToggleGroup);
847
- const context = useToggleGroupContext(ITEM_NAME$1, props.__scopeToggleGroup);
848
- const rovingFocusGroupScope = useRovingFocusGroupScope$1(props.__scopeToggleGroup);
849
- const pressed = valueContext.value.includes(props.value);
850
- const disabled = context.disabled || props.disabled;
851
- const commonProps = {
852
- ...props,
853
- pressed,
854
- disabled
855
- };
856
- const ref = react.default.useRef(null);
857
- return context.rovingFocus ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
858
- asChild: true,
859
- ...rovingFocusGroupScope,
860
- focusable: !disabled,
861
- active: pressed,
862
- ref,
863
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupItemImpl, {
864
- ...commonProps,
865
- ref: forwardedRef
866
- })
867
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupItemImpl, {
868
- ...commonProps,
869
- ref: forwardedRef
870
- });
871
- });
872
- ToggleGroupItem.displayName = ITEM_NAME$1;
873
- var ToggleGroupItemImpl = react.default.forwardRef((props, forwardedRef) => {
874
- const { __scopeToggleGroup, value, ...itemProps } = props;
875
- const valueContext = useToggleGroupValueContext(ITEM_NAME$1, __scopeToggleGroup);
876
- const singleProps = {
877
- role: "radio",
878
- "aria-checked": props.pressed,
879
- "aria-pressed": void 0
880
- };
881
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_toggle.Toggle, {
882
- ...valueContext.type === "single" ? singleProps : void 0,
883
- ...itemProps,
884
- ref: forwardedRef,
885
- onPressedChange: (pressed) => {
886
- if (pressed) valueContext.onItemActivate(value);
887
- else valueContext.onItemDeactivate(value);
888
- }
889
- });
890
- });
891
- var Root2$1 = ToggleGroup;
892
- var Item2$1 = ToggleGroupItem;
893
- var ToggleGroupContext = react.createContext({
894
- size: "default",
895
- variant: "default"
896
- });
897
- var toggleGroupItemVariants = (0, class_variance_authority.cva)([
898
- "inline-flex items-center justify-center rounded-md text-sm font-medium",
899
- "transition-all duration-200",
900
- "focus:outline-none focus-visible:ring-2",
901
- "focus-visible:ring-[var(--focus-ring)] focus-visible:ring-offset-2",
902
- "disabled:pointer-events-none disabled:opacity-50"
903
- ], {
904
- variants: {
905
- variant: {
906
- default: [
907
- "bg-[var(--toggle-group-item-bg,transparent)]",
908
- "hover:bg-[var(--toggle-group-item-hover-bg,var(--glass-bg-subtle))]",
909
- "data-[state=on]:bg-[var(--toggle-group-item-active-bg,var(--semantic-primary-subtle))]",
910
- "data-[state=on]:text-[var(--toggle-group-item-active-text,var(--semantic-primary))]"
911
- ],
912
- outline: [
913
- "border border-[var(--toggle-group-item-border,var(--glass-border))]",
914
- "bg-transparent",
915
- "hover:bg-[var(--toggle-group-item-hover-bg,var(--glass-bg-subtle))]",
916
- "data-[state=on]:border-[var(--semantic-primary)]",
917
- "data-[state=on]:bg-[var(--toggle-group-item-active-bg,var(--semantic-primary-subtle))]",
918
- "data-[state=on]:text-[var(--toggle-group-item-active-text,var(--semantic-primary))]"
919
- ]
920
- },
921
- size: {
922
- default: "h-10 px-3",
923
- sm: "h-8 px-2",
924
- lg: "h-11 px-4"
925
- }
926
- },
927
- defaultVariants: {
928
- variant: "default",
929
- size: "default"
930
- }
931
- });
932
- function ToggleGroupGlassRootImpl(props, ref) {
933
- const { className, variant = "default", size = "default", children, ...rest } = props;
934
- const containerClasses = require_utils.cn("inline-flex items-center justify-center gap-1", "rounded-lg p-1", "bg-[var(--toggle-group-bg,var(--glass-bg-subtle))]", "border border-[var(--toggle-group-border,var(--glass-border))]", className);
935
- const contextValue = {
936
- size: size ?? "default",
937
- variant: variant ?? "default"
938
- };
939
- if (props.type === "multiple") {
940
- const multipleRest = rest;
941
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root2$1, {
942
- ref,
943
- className: containerClasses,
944
- ...multipleRest,
945
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupContext.Provider, {
946
- value: contextValue,
947
- children
948
- })
949
- });
950
- }
951
- const singleRest = rest;
952
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root2$1, {
953
- ref,
954
- className: containerClasses,
955
- ...singleRest,
956
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleGroupContext.Provider, {
957
- value: contextValue,
958
- children
959
- })
960
- });
961
- }
962
- var ToggleGroupGlassRoot = react.forwardRef(ToggleGroupGlassRootImpl);
963
- ToggleGroupGlassRoot.displayName = "ToggleGroupGlassRoot";
964
- var ToggleGroupGlassItem = react.forwardRef(({ className, children, variant, size, ...props }, ref) => {
965
- const context = react.useContext(ToggleGroupContext);
966
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item2$1, {
967
- ref,
968
- className: require_utils.cn(toggleGroupItemVariants({
969
- variant: variant ?? context.variant,
970
- size: size ?? context.size
971
- }), className),
972
- ...props,
973
- children
974
- });
975
- });
976
- ToggleGroupGlassItem.displayName = "ToggleGroupGlassItem";
977
- const ToggleGroupGlass = {
978
- Root: ToggleGroupGlassRoot,
979
- Item: ToggleGroupGlassItem
980
- };
981
- var MOBILE_BREAKPOINT = 768;
982
- var SIDEBAR_COOKIE_NAME = "sidebar:state";
983
- var SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7;
984
- var SidebarContext = (0, react.createContext)(null);
985
- function useSidebar() {
986
- const context = (0, react.useContext)(SidebarContext);
987
- if (!context) throw new Error("useSidebar must be used within SidebarGlass.Provider. Wrap your component tree with <SidebarGlass.Provider>.");
988
- return context;
989
- }
990
- const SidebarProvider = ({ children, open: controlledOpen, onOpenChange, defaultOpen = true, side = "left", variant = "sidebar", collapsible = "offcanvas", cookieName = SIDEBAR_COOKIE_NAME, keyboardShortcut = "b" }) => {
991
- const [internalOpen, setInternalOpen] = (0, react.useState)(() => {
992
- if (typeof document !== "undefined") {
993
- const sidebarCookie = document.cookie.split(";").find((c) => c.trim().startsWith(`${cookieName}=`));
994
- if (sidebarCookie) return sidebarCookie.split("=")[1] === "true";
995
- }
996
- return defaultOpen;
997
- });
998
- const isControlled = controlledOpen !== void 0;
999
- const open = isControlled ? controlledOpen : internalOpen;
1000
- const setOpen = (0, react.useCallback)((value$1) => {
1001
- if (!isControlled) setInternalOpen(value$1);
1002
- onOpenChange?.(value$1);
1003
- if (typeof document !== "undefined") document.cookie = `${cookieName}=${value$1}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
1004
- }, [
1005
- isControlled,
1006
- onOpenChange,
1007
- cookieName
1008
- ]);
1009
- const [openMobile, setOpenMobile] = (0, react.useState)(false);
1010
- const [isMobile, setIsMobile] = (0, react.useState)(() => {
1011
- if (typeof window === "undefined") return false;
1012
- return window.innerWidth < MOBILE_BREAKPOINT;
403
+ const [openMobile, setOpenMobile] = (0, react.useState)(false);
404
+ const [isMobile, setIsMobile] = (0, react.useState)(() => {
405
+ if (typeof window === "undefined") return false;
406
+ return window.innerWidth < MOBILE_BREAKPOINT;
1013
407
  });
1014
408
  (0, react.useEffect)(() => {
1015
409
  if (typeof window === "undefined") return;
@@ -1385,875 +779,342 @@ const SidebarGlass = {
1385
779
  MenuSubItem: SidebarMenuSubItem,
1386
780
  MenuSubButton: SidebarMenuSubButton
1387
781
  };
1388
- var NAME = "Separator";
1389
- var DEFAULT_ORIENTATION = "horizontal";
1390
- var ORIENTATIONS = ["horizontal", "vertical"];
1391
- var Separator = react.forwardRef((props, forwardedRef) => {
1392
- const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
1393
- const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
1394
- const ariaOrientation = orientation === "vertical" ? orientation : void 0;
1395
- const semanticProps = decorative ? { role: "none" } : {
1396
- "aria-orientation": ariaOrientation,
1397
- role: "separator"
1398
- };
1399
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Primitive.div, {
1400
- "data-orientation": orientation,
1401
- ...semanticProps,
1402
- ...domProps,
1403
- ref: forwardedRef
1404
- });
1405
- });
1406
- Separator.displayName = NAME;
1407
- function isValidOrientation(orientation) {
1408
- return ORIENTATIONS.includes(orientation);
1409
- }
1410
- var Root$2 = Separator;
1411
- var SeparatorGlass = react.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$2, {
1412
- ref,
1413
- decorative,
1414
- orientation,
1415
- className: require_utils.cn("shrink-0", "bg-[var(--separator-bg,var(--glass-border))]", orientation === "horizontal" ? "h-px w-full" : "h-full w-px", className),
1416
- ...props
1417
- }));
1418
- SeparatorGlass.displayName = "SeparatorGlass";
1419
- var Primitive$2 = [
1420
- "a",
1421
- "button",
1422
- "div",
1423
- "form",
1424
- "h2",
1425
- "h3",
1426
- "img",
1427
- "input",
1428
- "label",
1429
- "li",
1430
- "nav",
1431
- "ol",
1432
- "p",
1433
- "select",
1434
- "span",
1435
- "svg",
1436
- "ul"
1437
- ].reduce((primitive, node) => {
1438
- const Slot$3 = (0, __radix_ui_react_slot.createSlot)(`Primitive.${node}`);
1439
- const Node = react.forwardRef((props, forwardedRef) => {
1440
- const { asChild, ...primitiveProps } = props;
1441
- const Comp = asChild ? Slot$3 : node;
1442
- if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
1443
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
1444
- ...primitiveProps,
1445
- ref: forwardedRef
1446
- });
1447
- });
1448
- Node.displayName = `Primitive.${node}`;
1449
- return {
1450
- ...primitive,
1451
- [node]: Node
1452
- };
1453
- }, {});
1454
- function createContextScope$2(scopeName, createContextScopeDeps = []) {
1455
- let defaultContexts = [];
1456
- function createContext3(rootComponentName, defaultContext) {
1457
- const BaseContext = react.createContext(defaultContext);
1458
- const index = defaultContexts.length;
1459
- defaultContexts = [...defaultContexts, defaultContext];
1460
- const Provider = (props) => {
1461
- const { scope, children, ...context } = props;
1462
- const Context = scope?.[scopeName]?.[index] || BaseContext;
1463
- const value = react.useMemo(() => context, Object.values(context));
1464
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
1465
- value,
1466
- children
1467
- });
1468
- };
1469
- Provider.displayName = rootComponentName + "Provider";
1470
- function useContext2(consumerName, scope) {
1471
- const Context = scope?.[scopeName]?.[index] || BaseContext;
1472
- const context = react.useContext(Context);
1473
- if (context) return context;
1474
- if (defaultContext !== void 0) return defaultContext;
1475
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
782
+ function _extends$1() {
783
+ return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
784
+ for (var e = 1; e < arguments.length; e++) {
785
+ var t = arguments[e];
786
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1476
787
  }
1477
- return [Provider, useContext2];
788
+ return n;
789
+ }, _extends$1.apply(null, arguments);
790
+ }
791
+ function ownKeys$1(e, r) {
792
+ var t = Object.keys(e);
793
+ if (Object.getOwnPropertySymbols) {
794
+ var o = Object.getOwnPropertySymbols(e);
795
+ r && (o = o.filter(function(r$1) {
796
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
797
+ })), t.push.apply(t, o);
1478
798
  }
1479
- const createScope = () => {
1480
- const scopeContexts = defaultContexts.map((defaultContext) => {
1481
- return react.createContext(defaultContext);
799
+ return t;
800
+ }
801
+ function _objectSpread$1(e) {
802
+ for (var r = 1; r < arguments.length; r++) {
803
+ var t = null != arguments[r] ? arguments[r] : {};
804
+ r % 2 ? ownKeys$1(Object(t), !0).forEach(function(r$1) {
805
+ _defineProperty$1(e, r$1, t[r$1]);
806
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r$1) {
807
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
1482
808
  });
1483
- return function useScope(scope) {
1484
- const contexts = scope?.[scopeName] || scopeContexts;
1485
- return react.useMemo(() => ({ [`__scope${scopeName}`]: {
1486
- ...scope,
1487
- [scopeName]: contexts
1488
- } }), [scope, contexts]);
1489
- };
1490
- };
1491
- createScope.scopeName = scopeName;
1492
- return [createContext3, composeContextScopes$2(createScope, ...createContextScopeDeps)];
809
+ }
810
+ return e;
1493
811
  }
1494
- function composeContextScopes$2(...scopes) {
1495
- const baseScope = scopes[0];
1496
- if (scopes.length === 1) return baseScope;
1497
- const createScope = () => {
1498
- const scopeHooks = scopes.map((createScope2) => ({
1499
- useScope: createScope2(),
1500
- scopeName: createScope2.scopeName
1501
- }));
1502
- return function useComposedScopes(overrideScopes) {
1503
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
1504
- const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
1505
- return {
1506
- ...nextScopes2,
1507
- ...currentScope
1508
- };
1509
- }, {});
1510
- return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
1511
- };
1512
- };
1513
- createScope.scopeName = baseScope.scopeName;
1514
- return createScope;
812
+ function _defineProperty$1(e, r, t) {
813
+ return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
814
+ value: t,
815
+ enumerable: !0,
816
+ configurable: !0,
817
+ writable: !0
818
+ }) : e[r] = t, e;
1515
819
  }
1516
- function useStateMachine(initialState, machine) {
1517
- return react.useReducer((state, event) => {
1518
- return machine[state][event] ?? state;
1519
- }, initialState);
820
+ function _toPropertyKey$1(t) {
821
+ var i = _toPrimitive$1(t, "string");
822
+ return "symbol" == typeof i ? i : i + "";
1520
823
  }
1521
- var SCROLL_AREA_NAME = "ScrollArea";
1522
- var [createScrollAreaContext, createScrollAreaScope] = createContextScope$2(SCROLL_AREA_NAME);
1523
- var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
1524
- var ScrollArea$1 = react.forwardRef((props, forwardedRef) => {
1525
- const { __scopeScrollArea, type = "hover", dir, scrollHideDelay = 600, ...scrollAreaProps } = props;
1526
- const [scrollArea, setScrollArea] = react.useState(null);
1527
- const [viewport, setViewport] = react.useState(null);
1528
- const [content, setContent] = react.useState(null);
1529
- const [scrollbarX, setScrollbarX] = react.useState(null);
1530
- const [scrollbarY, setScrollbarY] = react.useState(null);
1531
- const [cornerWidth, setCornerWidth] = react.useState(0);
1532
- const [cornerHeight, setCornerHeight] = react.useState(0);
1533
- const [scrollbarXEnabled, setScrollbarXEnabled] = react.useState(false);
1534
- const [scrollbarYEnabled, setScrollbarYEnabled] = react.useState(false);
1535
- const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => setScrollArea(node));
1536
- const direction = require_trust_score_card_glass.useDirection(dir);
1537
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaProvider, {
1538
- scope: __scopeScrollArea,
1539
- type,
1540
- dir: direction,
1541
- scrollHideDelay,
1542
- scrollArea,
1543
- viewport,
1544
- onViewportChange: setViewport,
1545
- content,
1546
- onContentChange: setContent,
1547
- scrollbarX,
1548
- onScrollbarXChange: setScrollbarX,
1549
- scrollbarXEnabled,
1550
- onScrollbarXEnabledChange: setScrollbarXEnabled,
1551
- scrollbarY,
1552
- onScrollbarYChange: setScrollbarY,
1553
- scrollbarYEnabled,
1554
- onScrollbarYEnabledChange: setScrollbarYEnabled,
1555
- onCornerWidthChange: setCornerWidth,
1556
- onCornerHeightChange: setCornerHeight,
1557
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
1558
- dir: direction,
1559
- ...scrollAreaProps,
1560
- ref: composedRefs,
1561
- style: {
1562
- position: "relative",
1563
- ["--radix-scroll-area-corner-width"]: cornerWidth + "px",
1564
- ["--radix-scroll-area-corner-height"]: cornerHeight + "px",
1565
- ...props.style
1566
- }
1567
- })
1568
- });
1569
- });
1570
- ScrollArea$1.displayName = SCROLL_AREA_NAME;
1571
- var VIEWPORT_NAME = "ScrollAreaViewport";
1572
- var ScrollAreaViewport = react.forwardRef((props, forwardedRef) => {
1573
- const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
1574
- const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
1575
- const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, react.useRef(null), context.onViewportChange);
1576
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
1577
- dangerouslySetInnerHTML: { __html: `[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}` },
1578
- nonce
1579
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
1580
- "data-radix-scroll-area-viewport": "",
1581
- ...viewportProps,
1582
- ref: composedRefs,
1583
- style: {
1584
- overflowX: context.scrollbarXEnabled ? "scroll" : "hidden",
1585
- overflowY: context.scrollbarYEnabled ? "scroll" : "hidden",
1586
- ...props.style
1587
- },
1588
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1589
- ref: context.onContentChange,
1590
- style: {
1591
- minWidth: "100%",
1592
- display: "table"
1593
- },
1594
- children
1595
- })
1596
- })] });
1597
- });
1598
- ScrollAreaViewport.displayName = VIEWPORT_NAME;
1599
- var SCROLLBAR_NAME = "ScrollAreaScrollbar";
1600
- var ScrollAreaScrollbar = react.forwardRef((props, forwardedRef) => {
1601
- const { forceMount, ...scrollbarProps } = props;
1602
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1603
- const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context;
1604
- const isHorizontal = props.orientation === "horizontal";
1605
- react.useEffect(() => {
1606
- isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
1607
- return () => {
1608
- isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
1609
- };
1610
- }, [
1611
- isHorizontal,
1612
- onScrollbarXEnabledChange,
1613
- onScrollbarYEnabledChange
1614
- ]);
1615
- return context.type === "hover" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarHover, {
1616
- ...scrollbarProps,
1617
- ref: forwardedRef,
1618
- forceMount
1619
- }) : context.type === "scroll" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarScroll, {
1620
- ...scrollbarProps,
1621
- ref: forwardedRef,
1622
- forceMount
1623
- }) : context.type === "auto" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarAuto, {
1624
- ...scrollbarProps,
1625
- ref: forwardedRef,
1626
- forceMount
1627
- }) : context.type === "always" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
1628
- ...scrollbarProps,
1629
- ref: forwardedRef
1630
- }) : null;
1631
- });
1632
- ScrollAreaScrollbar.displayName = SCROLLBAR_NAME;
1633
- var ScrollAreaScrollbarHover = react.forwardRef((props, forwardedRef) => {
1634
- const { forceMount, ...scrollbarProps } = props;
1635
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1636
- const [visible, setVisible] = react.useState(false);
1637
- react.useEffect(() => {
1638
- const scrollArea = context.scrollArea;
1639
- let hideTimer = 0;
1640
- if (scrollArea) {
1641
- const handlePointerEnter = () => {
1642
- window.clearTimeout(hideTimer);
1643
- setVisible(true);
1644
- };
1645
- const handlePointerLeave = () => {
1646
- hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay);
1647
- };
1648
- scrollArea.addEventListener("pointerenter", handlePointerEnter);
1649
- scrollArea.addEventListener("pointerleave", handlePointerLeave);
1650
- return () => {
1651
- window.clearTimeout(hideTimer);
1652
- scrollArea.removeEventListener("pointerenter", handlePointerEnter);
1653
- scrollArea.removeEventListener("pointerleave", handlePointerLeave);
1654
- };
1655
- }
1656
- }, [context.scrollArea, context.scrollHideDelay]);
1657
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
1658
- present: forceMount || visible,
1659
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarAuto, {
1660
- "data-state": visible ? "visible" : "hidden",
1661
- ...scrollbarProps,
1662
- ref: forwardedRef
1663
- })
1664
- });
1665
- });
1666
- var ScrollAreaScrollbarScroll = react.forwardRef((props, forwardedRef) => {
1667
- const { forceMount, ...scrollbarProps } = props;
1668
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1669
- const isHorizontal = props.orientation === "horizontal";
1670
- const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
1671
- const [state, send] = useStateMachine("hidden", {
1672
- hidden: { SCROLL: "scrolling" },
1673
- scrolling: {
1674
- SCROLL_END: "idle",
1675
- POINTER_ENTER: "interacting"
1676
- },
1677
- interacting: {
1678
- SCROLL: "interacting",
1679
- POINTER_LEAVE: "idle"
1680
- },
1681
- idle: {
1682
- HIDE: "hidden",
1683
- SCROLL: "scrolling",
1684
- POINTER_ENTER: "interacting"
1685
- }
1686
- });
1687
- react.useEffect(() => {
1688
- if (state === "idle") {
1689
- const hideTimer = window.setTimeout(() => send("HIDE"), context.scrollHideDelay);
1690
- return () => window.clearTimeout(hideTimer);
1691
- }
1692
- }, [
1693
- state,
1694
- context.scrollHideDelay,
1695
- send
1696
- ]);
1697
- react.useEffect(() => {
1698
- const viewport = context.viewport;
1699
- const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
1700
- if (viewport) {
1701
- let prevScrollPos = viewport[scrollDirection];
1702
- const handleScroll = () => {
1703
- const scrollPos = viewport[scrollDirection];
1704
- if (prevScrollPos !== scrollPos) {
1705
- send("SCROLL");
1706
- debounceScrollEnd();
1707
- }
1708
- prevScrollPos = scrollPos;
1709
- };
1710
- viewport.addEventListener("scroll", handleScroll);
1711
- return () => viewport.removeEventListener("scroll", handleScroll);
1712
- }
1713
- }, [
1714
- context.viewport,
1715
- isHorizontal,
1716
- send,
1717
- debounceScrollEnd
1718
- ]);
1719
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
1720
- present: forceMount || state !== "hidden",
1721
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
1722
- "data-state": state === "hidden" ? "hidden" : "visible",
1723
- ...scrollbarProps,
1724
- ref: forwardedRef,
1725
- onPointerEnter: require_trust_score_card_glass.composeEventHandlers(props.onPointerEnter, () => send("POINTER_ENTER")),
1726
- onPointerLeave: require_trust_score_card_glass.composeEventHandlers(props.onPointerLeave, () => send("POINTER_LEAVE"))
1727
- })
1728
- });
1729
- });
1730
- var ScrollAreaScrollbarAuto = react.forwardRef((props, forwardedRef) => {
1731
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1732
- const { forceMount, ...scrollbarProps } = props;
1733
- const [visible, setVisible] = react.useState(false);
1734
- const isHorizontal = props.orientation === "horizontal";
1735
- const handleResize = useDebounceCallback(() => {
1736
- if (context.viewport) {
1737
- const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;
1738
- const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;
1739
- setVisible(isHorizontal ? isOverflowX : isOverflowY);
1740
- }
1741
- }, 10);
1742
- useResizeObserver(context.viewport, handleResize);
1743
- useResizeObserver(context.content, handleResize);
1744
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
1745
- present: forceMount || visible,
1746
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
1747
- "data-state": visible ? "visible" : "hidden",
1748
- ...scrollbarProps,
1749
- ref: forwardedRef
1750
- })
1751
- });
1752
- });
1753
- var ScrollAreaScrollbarVisible = react.forwardRef((props, forwardedRef) => {
1754
- const { orientation = "vertical", ...scrollbarProps } = props;
1755
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1756
- const thumbRef = react.useRef(null);
1757
- const pointerOffsetRef = react.useRef(0);
1758
- const [sizes, setSizes] = react.useState({
1759
- content: 0,
1760
- viewport: 0,
1761
- scrollbar: {
1762
- size: 0,
1763
- paddingStart: 0,
1764
- paddingEnd: 0
1765
- }
1766
- });
1767
- const thumbRatio = getThumbRatio(sizes.viewport, sizes.content);
1768
- const commonProps = {
1769
- ...scrollbarProps,
1770
- sizes,
1771
- onSizesChange: setSizes,
1772
- hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
1773
- onThumbChange: (thumb) => thumbRef.current = thumb,
1774
- onThumbPointerUp: () => pointerOffsetRef.current = 0,
1775
- onThumbPointerDown: (pointerPos) => pointerOffsetRef.current = pointerPos
1776
- };
1777
- function getScrollPosition(pointerPos, dir) {
1778
- return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);
1779
- }
1780
- if (orientation === "horizontal") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarX, {
1781
- ...commonProps,
1782
- ref: forwardedRef,
1783
- onThumbPositionChange: () => {
1784
- if (context.viewport && thumbRef.current) {
1785
- const scrollPos = context.viewport.scrollLeft;
1786
- const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir);
1787
- thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`;
1788
- }
1789
- },
1790
- onWheelScroll: (scrollPos) => {
1791
- if (context.viewport) context.viewport.scrollLeft = scrollPos;
1792
- },
1793
- onDragScroll: (pointerPos) => {
1794
- if (context.viewport) context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);
1795
- }
1796
- });
1797
- if (orientation === "vertical") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarY, {
1798
- ...commonProps,
1799
- ref: forwardedRef,
1800
- onThumbPositionChange: () => {
1801
- if (context.viewport && thumbRef.current) {
1802
- const scrollPos = context.viewport.scrollTop;
1803
- const offset = getThumbOffsetFromScroll(scrollPos, sizes);
1804
- thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;
1805
- }
1806
- },
1807
- onWheelScroll: (scrollPos) => {
1808
- if (context.viewport) context.viewport.scrollTop = scrollPos;
1809
- },
1810
- onDragScroll: (pointerPos) => {
1811
- if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
1812
- }
1813
- });
1814
- return null;
1815
- });
1816
- var ScrollAreaScrollbarX = react.forwardRef((props, forwardedRef) => {
1817
- const { sizes, onSizesChange, ...scrollbarProps } = props;
1818
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1819
- const [computedStyle, setComputedStyle] = react.useState();
1820
- const ref = react.useRef(null);
1821
- const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);
1822
- react.useEffect(() => {
1823
- if (ref.current) setComputedStyle(getComputedStyle(ref.current));
1824
- }, [ref]);
1825
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarImpl, {
1826
- "data-orientation": "horizontal",
1827
- ...scrollbarProps,
1828
- ref: composeRefs,
1829
- sizes,
1830
- style: {
1831
- bottom: 0,
1832
- left: context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
1833
- right: context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
1834
- ["--radix-scroll-area-thumb-width"]: getThumbSize(sizes) + "px",
1835
- ...props.style
1836
- },
1837
- onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.x),
1838
- onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.x),
1839
- onWheelScroll: (event, maxScrollPos) => {
1840
- if (context.viewport) {
1841
- const scrollPos = context.viewport.scrollLeft + event.deltaX;
1842
- props.onWheelScroll(scrollPos);
1843
- if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
1844
- }
1845
- },
1846
- onResize: () => {
1847
- if (ref.current && context.viewport && computedStyle) onSizesChange({
1848
- content: context.viewport.scrollWidth,
1849
- viewport: context.viewport.offsetWidth,
1850
- scrollbar: {
1851
- size: ref.current.clientWidth,
1852
- paddingStart: toInt(computedStyle.paddingLeft),
1853
- paddingEnd: toInt(computedStyle.paddingRight)
1854
- }
1855
- });
1856
- }
1857
- });
1858
- });
1859
- var ScrollAreaScrollbarY = react.forwardRef((props, forwardedRef) => {
1860
- const { sizes, onSizesChange, ...scrollbarProps } = props;
1861
- const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1862
- const [computedStyle, setComputedStyle] = react.useState();
1863
- const ref = react.useRef(null);
1864
- const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);
1865
- react.useEffect(() => {
1866
- if (ref.current) setComputedStyle(getComputedStyle(ref.current));
1867
- }, [ref]);
1868
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarImpl, {
1869
- "data-orientation": "vertical",
1870
- ...scrollbarProps,
1871
- ref: composeRefs,
1872
- sizes,
1873
- style: {
1874
- top: 0,
1875
- right: context.dir === "ltr" ? 0 : void 0,
1876
- left: context.dir === "rtl" ? 0 : void 0,
1877
- bottom: "var(--radix-scroll-area-corner-height)",
1878
- ["--radix-scroll-area-thumb-height"]: getThumbSize(sizes) + "px",
1879
- ...props.style
1880
- },
1881
- onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.y),
1882
- onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.y),
1883
- onWheelScroll: (event, maxScrollPos) => {
1884
- if (context.viewport) {
1885
- const scrollPos = context.viewport.scrollTop + event.deltaY;
1886
- props.onWheelScroll(scrollPos);
1887
- if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
1888
- }
1889
- },
1890
- onResize: () => {
1891
- if (ref.current && context.viewport && computedStyle) onSizesChange({
1892
- content: context.viewport.scrollHeight,
1893
- viewport: context.viewport.offsetHeight,
1894
- scrollbar: {
1895
- size: ref.current.clientHeight,
1896
- paddingStart: toInt(computedStyle.paddingTop),
1897
- paddingEnd: toInt(computedStyle.paddingBottom)
1898
- }
1899
- });
1900
- }
1901
- });
1902
- });
1903
- var [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME);
1904
- var ScrollAreaScrollbarImpl = react.forwardRef((props, forwardedRef) => {
1905
- const { __scopeScrollArea, sizes, hasThumb, onThumbChange, onThumbPointerUp, onThumbPointerDown, onThumbPositionChange, onDragScroll, onWheelScroll, onResize, ...scrollbarProps } = props;
1906
- const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
1907
- const [scrollbar, setScrollbar] = react.useState(null);
1908
- const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => setScrollbar(node));
1909
- const rectRef = react.useRef(null);
1910
- const prevWebkitUserSelectRef = react.useRef("");
1911
- const viewport = context.viewport;
1912
- const maxScrollPos = sizes.content - sizes.viewport;
1913
- const handleWheelScroll = require_trust_score_card_glass.useCallbackRef(onWheelScroll);
1914
- const handleThumbPositionChange = require_trust_score_card_glass.useCallbackRef(onThumbPositionChange);
1915
- const handleResize = useDebounceCallback(onResize, 10);
1916
- function handleDragScroll(event) {
1917
- if (rectRef.current) onDragScroll({
1918
- x: event.clientX - rectRef.current.left,
1919
- y: event.clientY - rectRef.current.top
1920
- });
824
+ function _toPrimitive$1(t, r) {
825
+ if ("object" != typeof t || !t) return t;
826
+ var e = t[Symbol.toPrimitive];
827
+ if (void 0 !== e) {
828
+ var i = e.call(t, r || "default");
829
+ if ("object" != typeof i) return i;
830
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1921
831
  }
1922
- react.useEffect(() => {
1923
- const handleWheel = (event) => {
1924
- const element = event.target;
1925
- if (scrollbar?.contains(element)) handleWheelScroll(event, maxScrollPos);
1926
- };
1927
- document.addEventListener("wheel", handleWheel, { passive: false });
1928
- return () => document.removeEventListener("wheel", handleWheel, { passive: false });
1929
- }, [
1930
- viewport,
1931
- scrollbar,
1932
- maxScrollPos,
1933
- handleWheelScroll
1934
- ]);
1935
- react.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]);
1936
- useResizeObserver(scrollbar, handleResize);
1937
- useResizeObserver(context.content, handleResize);
1938
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollbarProvider, {
1939
- scope: __scopeScrollArea,
1940
- scrollbar,
1941
- hasThumb,
1942
- onThumbChange: require_trust_score_card_glass.useCallbackRef(onThumbChange),
1943
- onThumbPointerUp: require_trust_score_card_glass.useCallbackRef(onThumbPointerUp),
1944
- onThumbPositionChange: handleThumbPositionChange,
1945
- onThumbPointerDown: require_trust_score_card_glass.useCallbackRef(onThumbPointerDown),
1946
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
1947
- ...scrollbarProps,
1948
- ref: composeRefs,
1949
- style: {
1950
- position: "absolute",
1951
- ...scrollbarProps.style
1952
- },
1953
- onPointerDown: require_trust_score_card_glass.composeEventHandlers(props.onPointerDown, (event) => {
1954
- if (event.button === 0) {
1955
- event.target.setPointerCapture(event.pointerId);
1956
- rectRef.current = scrollbar.getBoundingClientRect();
1957
- prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
1958
- document.body.style.webkitUserSelect = "none";
1959
- if (context.viewport) context.viewport.style.scrollBehavior = "auto";
1960
- handleDragScroll(event);
1961
- }
1962
- }),
1963
- onPointerMove: require_trust_score_card_glass.composeEventHandlers(props.onPointerMove, handleDragScroll),
1964
- onPointerUp: require_trust_score_card_glass.composeEventHandlers(props.onPointerUp, (event) => {
1965
- const element = event.target;
1966
- if (element.hasPointerCapture(event.pointerId)) element.releasePointerCapture(event.pointerId);
1967
- document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
1968
- if (context.viewport) context.viewport.style.scrollBehavior = "";
1969
- rectRef.current = null;
1970
- })
1971
- })
1972
- });
1973
- });
1974
- var THUMB_NAME = "ScrollAreaThumb";
1975
- var ScrollAreaThumb = react.forwardRef((props, forwardedRef) => {
1976
- const { forceMount, ...thumbProps } = props;
1977
- const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
1978
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
1979
- present: forceMount || scrollbarContext.hasThumb,
1980
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaThumbImpl, {
1981
- ref: forwardedRef,
1982
- ...thumbProps
1983
- })
832
+ return ("string" === r ? String : Number)(t);
833
+ }
834
+ var SIZE = 32;
835
+ var defaultLegendContentDefaultProps = {
836
+ align: "center",
837
+ iconSize: 14,
838
+ inactiveColor: "#ccc",
839
+ layout: "horizontal",
840
+ verticalAlign: "middle"
841
+ };
842
+ function Icon(_ref) {
843
+ var { data, iconType, inactiveColor } = _ref;
844
+ var halfSize = SIZE / 2;
845
+ var sixthSize = SIZE / 6;
846
+ var thirdSize = SIZE / 3;
847
+ var color = data.inactive ? inactiveColor : data.color;
848
+ var preferredIcon = iconType !== null && iconType !== void 0 ? iconType : data.type;
849
+ if (preferredIcon === "none") return null;
850
+ if (preferredIcon === "plainline") {
851
+ var _data$payload;
852
+ return /* @__PURE__ */ react.createElement("line", {
853
+ strokeWidth: 4,
854
+ fill: "none",
855
+ stroke: color,
856
+ strokeDasharray: (_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.strokeDasharray,
857
+ x1: 0,
858
+ y1: halfSize,
859
+ x2: SIZE,
860
+ y2: halfSize,
861
+ className: "recharts-legend-icon"
862
+ });
863
+ }
864
+ if (preferredIcon === "line") return /* @__PURE__ */ react.createElement("path", {
865
+ strokeWidth: 4,
866
+ fill: "none",
867
+ stroke: color,
868
+ d: "M0,".concat(halfSize, "h").concat(thirdSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(2 * thirdSize, ",").concat(halfSize, "\n H").concat(SIZE, "M").concat(2 * thirdSize, ",").concat(halfSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(thirdSize, ",").concat(halfSize),
869
+ className: "recharts-legend-icon"
1984
870
  });
1985
- });
1986
- var ScrollAreaThumbImpl = react.forwardRef((props, forwardedRef) => {
1987
- const { __scopeScrollArea, style, ...thumbProps } = props;
1988
- const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
1989
- const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
1990
- const { onThumbPositionChange } = scrollbarContext;
1991
- const composedRef = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => scrollbarContext.onThumbChange(node));
1992
- const removeUnlinkedScrollListenerRef = react.useRef(void 0);
1993
- const debounceScrollEnd = useDebounceCallback(() => {
1994
- if (removeUnlinkedScrollListenerRef.current) {
1995
- removeUnlinkedScrollListenerRef.current();
1996
- removeUnlinkedScrollListenerRef.current = void 0;
1997
- }
1998
- }, 100);
1999
- react.useEffect(() => {
2000
- const viewport = scrollAreaContext.viewport;
2001
- if (viewport) {
2002
- const handleScroll = () => {
2003
- debounceScrollEnd();
2004
- if (!removeUnlinkedScrollListenerRef.current) {
2005
- removeUnlinkedScrollListenerRef.current = addUnlinkedScrollListener(viewport, onThumbPositionChange);
2006
- onThumbPositionChange();
2007
- }
2008
- };
2009
- onThumbPositionChange();
2010
- viewport.addEventListener("scroll", handleScroll);
2011
- return () => viewport.removeEventListener("scroll", handleScroll);
2012
- }
2013
- }, [
2014
- scrollAreaContext.viewport,
2015
- debounceScrollEnd,
2016
- onThumbPositionChange
2017
- ]);
2018
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
2019
- "data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
2020
- ...thumbProps,
2021
- ref: composedRef,
2022
- style: {
2023
- width: "var(--radix-scroll-area-thumb-width)",
2024
- height: "var(--radix-scroll-area-thumb-height)",
2025
- ...style
2026
- },
2027
- onPointerDownCapture: require_trust_score_card_glass.composeEventHandlers(props.onPointerDownCapture, (event) => {
2028
- const thumbRect = event.target.getBoundingClientRect();
2029
- const x = event.clientX - thumbRect.left;
2030
- const y = event.clientY - thumbRect.top;
2031
- scrollbarContext.onThumbPointerDown({
2032
- x,
2033
- y
2034
- });
2035
- }),
2036
- onPointerUp: require_trust_score_card_glass.composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)
871
+ if (preferredIcon === "rect") return /* @__PURE__ */ react.createElement("path", {
872
+ stroke: "none",
873
+ fill: color,
874
+ d: "M0,".concat(SIZE / 8, "h").concat(SIZE, "v").concat(SIZE * 3 / 4, "h").concat(-SIZE, "z"),
875
+ className: "recharts-legend-icon"
2037
876
  });
2038
- });
2039
- ScrollAreaThumb.displayName = THUMB_NAME;
2040
- var CORNER_NAME = "ScrollAreaCorner";
2041
- var ScrollAreaCorner = react.forwardRef((props, forwardedRef) => {
2042
- const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea);
2043
- const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
2044
- return context.type !== "scroll" && hasBothScrollbarsVisible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaCornerImpl, {
2045
- ...props,
2046
- ref: forwardedRef
2047
- }) : null;
2048
- });
2049
- ScrollAreaCorner.displayName = CORNER_NAME;
2050
- var ScrollAreaCornerImpl = react.forwardRef((props, forwardedRef) => {
2051
- const { __scopeScrollArea, ...cornerProps } = props;
2052
- const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea);
2053
- const [width, setWidth] = react.useState(0);
2054
- const [height, setHeight] = react.useState(0);
2055
- const hasSize = Boolean(width && height);
2056
- useResizeObserver(context.scrollbarX, () => {
2057
- const height2 = context.scrollbarX?.offsetHeight || 0;
2058
- context.onCornerHeightChange(height2);
2059
- setHeight(height2);
877
+ if (/* @__PURE__ */ react.isValidElement(data.legendIcon)) {
878
+ var iconProps = _objectSpread$1({}, data);
879
+ delete iconProps.legendIcon;
880
+ return /* @__PURE__ */ react.cloneElement(data.legendIcon, iconProps);
881
+ }
882
+ return /* @__PURE__ */ react.createElement(require_trust_score_card_glass.Symbols, {
883
+ fill: color,
884
+ cx: halfSize,
885
+ cy: halfSize,
886
+ size: SIZE,
887
+ sizeType: "diameter",
888
+ type: preferredIcon
2060
889
  });
2061
- useResizeObserver(context.scrollbarY, () => {
2062
- const width2 = context.scrollbarY?.offsetWidth || 0;
2063
- context.onCornerWidthChange(width2);
2064
- setWidth(width2);
890
+ }
891
+ function Items(props) {
892
+ var { payload, iconSize, layout, formatter, inactiveColor, iconType } = props;
893
+ var viewBox = {
894
+ x: 0,
895
+ y: 0,
896
+ width: SIZE,
897
+ height: SIZE
898
+ };
899
+ var itemStyle = {
900
+ display: layout === "horizontal" ? "inline-block" : "block",
901
+ marginRight: 10
902
+ };
903
+ var svgStyle = {
904
+ display: "inline-block",
905
+ verticalAlign: "middle",
906
+ marginRight: 4
907
+ };
908
+ return payload.map((entry, i) => {
909
+ var finalFormatter = entry.formatter || formatter;
910
+ var className = (0, clsx.clsx)({
911
+ "recharts-legend-item": true,
912
+ ["legend-item-".concat(i)]: true,
913
+ inactive: entry.inactive
914
+ });
915
+ if (entry.type === "none") return null;
916
+ var color = entry.inactive ? inactiveColor : entry.color;
917
+ var finalValue = finalFormatter ? finalFormatter(entry.value, entry, i) : entry.value;
918
+ return /* @__PURE__ */ react.createElement("li", _extends$1({
919
+ className,
920
+ style: itemStyle,
921
+ key: "legend-item-".concat(i)
922
+ }, require_trust_score_card_glass.adaptEventsOfChild(props, entry, i)), /* @__PURE__ */ react.createElement(require_trust_score_card_glass.Surface, {
923
+ width: iconSize,
924
+ height: iconSize,
925
+ viewBox,
926
+ style: svgStyle,
927
+ "aria-label": "".concat(finalValue, " legend icon")
928
+ }, /* @__PURE__ */ react.createElement(Icon, {
929
+ data: entry,
930
+ iconType,
931
+ inactiveColor
932
+ })), /* @__PURE__ */ react.createElement("span", {
933
+ className: "recharts-legend-item-text",
934
+ style: { color }
935
+ }, finalValue));
2065
936
  });
2066
- return hasSize ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$2.div, {
2067
- ...cornerProps,
2068
- ref: forwardedRef,
2069
- style: {
2070
- width,
2071
- height,
2072
- position: "absolute",
2073
- right: context.dir === "ltr" ? 0 : void 0,
2074
- left: context.dir === "rtl" ? 0 : void 0,
2075
- bottom: 0,
2076
- ...props.style
937
+ }
938
+ var DefaultLegendContent = (outsideProps) => {
939
+ var props = require_trust_score_card_glass.resolveDefaultProps(outsideProps, defaultLegendContentDefaultProps);
940
+ var { payload, layout, align } = props;
941
+ if (!payload || !payload.length) return null;
942
+ var finalStyle = {
943
+ padding: 0,
944
+ margin: 0,
945
+ textAlign: layout === "horizontal" ? align : "left"
946
+ };
947
+ return /* @__PURE__ */ react.createElement("ul", {
948
+ className: "recharts-default-legend",
949
+ style: finalStyle
950
+ }, /* @__PURE__ */ react.createElement(Items, _extends$1({}, props, { payload })));
951
+ };
952
+ function useLegendPayload() {
953
+ return require_trust_score_card_glass.useAppSelector(require_trust_score_card_glass.selectLegendPayload);
954
+ }
955
+ var _excluded = ["contextPayload"];
956
+ function _extends() {
957
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
958
+ for (var e = 1; e < arguments.length; e++) {
959
+ var t = arguments[e];
960
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
2077
961
  }
2078
- }) : null;
2079
- });
2080
- function toInt(value) {
2081
- return value ? parseInt(value, 10) : 0;
962
+ return n;
963
+ }, _extends.apply(null, arguments);
2082
964
  }
2083
- function getThumbRatio(viewportSize, contentSize) {
2084
- const ratio = viewportSize / contentSize;
2085
- return isNaN(ratio) ? 0 : ratio;
965
+ function ownKeys(e, r) {
966
+ var t = Object.keys(e);
967
+ if (Object.getOwnPropertySymbols) {
968
+ var o = Object.getOwnPropertySymbols(e);
969
+ r && (o = o.filter(function(r$1) {
970
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
971
+ })), t.push.apply(t, o);
972
+ }
973
+ return t;
2086
974
  }
2087
- function getThumbSize(sizes) {
2088
- const ratio = getThumbRatio(sizes.viewport, sizes.content);
2089
- const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
2090
- const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;
2091
- return Math.max(thumbSize, 18);
975
+ function _objectSpread(e) {
976
+ for (var r = 1; r < arguments.length; r++) {
977
+ var t = null != arguments[r] ? arguments[r] : {};
978
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
979
+ _defineProperty(e, r$1, t[r$1]);
980
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
981
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
982
+ });
983
+ }
984
+ return e;
2092
985
  }
2093
- function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = "ltr") {
2094
- const thumbSizePx = getThumbSize(sizes);
2095
- const thumbCenter = thumbSizePx / 2;
2096
- const offset = pointerOffset || thumbCenter;
2097
- const thumbOffsetFromEnd = thumbSizePx - offset;
2098
- const minPointerPos = sizes.scrollbar.paddingStart + offset;
2099
- const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;
2100
- const maxScrollPos = sizes.content - sizes.viewport;
2101
- const scrollRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
2102
- return linearScale([minPointerPos, maxPointerPos], scrollRange)(pointerPos);
986
+ function _defineProperty(e, r, t) {
987
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
988
+ value: t,
989
+ enumerable: !0,
990
+ configurable: !0,
991
+ writable: !0
992
+ }) : e[r] = t, e;
2103
993
  }
2104
- function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
2105
- const thumbSizePx = getThumbSize(sizes);
2106
- const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
2107
- const scrollbar = sizes.scrollbar.size - scrollbarPadding;
2108
- const maxScrollPos = sizes.content - sizes.viewport;
2109
- const maxThumbPos = scrollbar - thumbSizePx;
2110
- const scrollWithoutMomentum = require_trust_score_card_glass.clamp(scrollPos, dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0]);
2111
- return linearScale([0, maxScrollPos], [0, maxThumbPos])(scrollWithoutMomentum);
994
+ function _toPropertyKey(t) {
995
+ var i = _toPrimitive(t, "string");
996
+ return "symbol" == typeof i ? i : i + "";
997
+ }
998
+ function _toPrimitive(t, r) {
999
+ if ("object" != typeof t || !t) return t;
1000
+ var e = t[Symbol.toPrimitive];
1001
+ if (void 0 !== e) {
1002
+ var i = e.call(t, r || "default");
1003
+ if ("object" != typeof i) return i;
1004
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1005
+ }
1006
+ return ("string" === r ? String : Number)(t);
1007
+ }
1008
+ function _objectWithoutProperties(e, t) {
1009
+ if (null == e) return {};
1010
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
1011
+ if (Object.getOwnPropertySymbols) {
1012
+ var n = Object.getOwnPropertySymbols(e);
1013
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
1014
+ }
1015
+ return i;
2112
1016
  }
2113
- function linearScale(input, output) {
2114
- return (value) => {
2115
- if (input[0] === input[1] || output[0] === output[1]) return output[0];
2116
- const ratio = (output[1] - output[0]) / (input[1] - input[0]);
2117
- return output[0] + ratio * (value - input[0]);
2118
- };
1017
+ function _objectWithoutPropertiesLoose(r, e) {
1018
+ if (null == r) return {};
1019
+ var t = {};
1020
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1021
+ if (-1 !== e.indexOf(n)) continue;
1022
+ t[n] = r[n];
1023
+ }
1024
+ return t;
2119
1025
  }
2120
- function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
2121
- return scrollPos > 0 && scrollPos < maxScrollPos;
1026
+ function defaultUniqBy(entry) {
1027
+ return entry.value;
2122
1028
  }
2123
- var addUnlinkedScrollListener = (node, handler = () => {}) => {
2124
- let prevPosition = {
2125
- left: node.scrollLeft,
2126
- top: node.scrollTop
2127
- };
2128
- let rAF = 0;
2129
- (function loop() {
2130
- const position = {
2131
- left: node.scrollLeft,
2132
- top: node.scrollTop
2133
- };
2134
- const isHorizontalScroll = prevPosition.left !== position.left;
2135
- const isVerticalScroll = prevPosition.top !== position.top;
2136
- if (isHorizontalScroll || isVerticalScroll) handler();
2137
- prevPosition = position;
2138
- rAF = window.requestAnimationFrame(loop);
2139
- })();
2140
- return () => window.cancelAnimationFrame(rAF);
2141
- };
2142
- function useDebounceCallback(callback, delay) {
2143
- const handleCallback = require_trust_score_card_glass.useCallbackRef(callback);
2144
- const debounceTimerRef = react.useRef(0);
2145
- react.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
2146
- return react.useCallback(() => {
2147
- window.clearTimeout(debounceTimerRef.current);
2148
- debounceTimerRef.current = window.setTimeout(handleCallback, delay);
2149
- }, [handleCallback, delay]);
1029
+ function LegendContent(props) {
1030
+ var { contextPayload } = props, otherProps = _objectWithoutProperties(props, _excluded);
1031
+ var finalPayload = require_trust_score_card_glass.getUniqPayload(contextPayload, props.payloadUniqBy, defaultUniqBy);
1032
+ var contentProps = _objectSpread(_objectSpread({}, otherProps), {}, { payload: finalPayload });
1033
+ if (/* @__PURE__ */ react.isValidElement(props.content)) return /* @__PURE__ */ react.cloneElement(props.content, contentProps);
1034
+ if (typeof props.content === "function") return /* @__PURE__ */ react.createElement(props.content, contentProps);
1035
+ return /* @__PURE__ */ react.createElement(DefaultLegendContent, contentProps);
2150
1036
  }
2151
- function useResizeObserver(element, onResize) {
2152
- const handleResize = require_trust_score_card_glass.useCallbackRef(onResize);
2153
- require_trust_score_card_glass.useLayoutEffect2(() => {
2154
- let rAF = 0;
2155
- if (element) {
2156
- const resizeObserver = new ResizeObserver(() => {
2157
- cancelAnimationFrame(rAF);
2158
- rAF = window.requestAnimationFrame(handleResize);
2159
- });
2160
- resizeObserver.observe(element);
2161
- return () => {
2162
- window.cancelAnimationFrame(rAF);
2163
- resizeObserver.unobserve(element);
2164
- };
2165
- }
2166
- }, [element, handleResize]);
1037
+ function getDefaultPosition(style, props, margin, chartWidth, chartHeight, box) {
1038
+ var { layout, align, verticalAlign } = props;
1039
+ var hPos, vPos;
1040
+ if (!style || (style.left === void 0 || style.left === null) && (style.right === void 0 || style.right === null)) if (align === "center" && layout === "vertical") hPos = { left: ((chartWidth || 0) - box.width) / 2 };
1041
+ else hPos = align === "right" ? { right: margin && margin.right || 0 } : { left: margin && margin.left || 0 };
1042
+ if (!style || (style.top === void 0 || style.top === null) && (style.bottom === void 0 || style.bottom === null)) if (verticalAlign === "middle") vPos = { top: ((chartHeight || 0) - box.height) / 2 };
1043
+ else vPos = verticalAlign === "bottom" ? { bottom: margin && margin.bottom || 0 } : { top: margin && margin.top || 0 };
1044
+ return _objectSpread(_objectSpread({}, hPos), vPos);
2167
1045
  }
2168
- var Root$1 = ScrollArea$1;
2169
- var Viewport = ScrollAreaViewport;
2170
- var Corner = ScrollAreaCorner;
2171
- var ScrollBarGlass = react.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbar, {
2172
- ref,
2173
- orientation,
2174
- className: require_utils.cn("flex touch-none select-none transition-colors", "bg-[var(--scrollbar-track,transparent)]", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]", orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]", className),
2175
- ...props,
2176
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaThumb, { className: require_utils.cn("relative flex-1 rounded-full", "bg-[var(--scrollbar-thumb,var(--glass-border))]", "hover:bg-[var(--scrollbar-thumb-hover,var(--glass-border-hover))]", "transition-colors") })
2177
- }));
2178
- ScrollBarGlass.displayName = "ScrollBarGlass";
2179
- var ScrollAreaGlass = react.forwardRef(({ className, children, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root$1, {
2180
- ref,
2181
- className: require_utils.cn("relative overflow-hidden", className),
2182
- ...props,
2183
- children: [
2184
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Viewport, {
2185
- className: "h-full w-full rounded-[inherit]",
2186
- children
2187
- }),
2188
- (orientation === "vertical" || orientation === "both") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollBarGlass, { orientation: "vertical" }),
2189
- (orientation === "horizontal" || orientation === "both") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollBarGlass, { orientation: "horizontal" }),
2190
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Corner, {})
2191
- ]
2192
- }));
2193
- ScrollAreaGlass.displayName = "ScrollAreaGlass";
2194
- function createContextScope$1(scopeName, createContextScopeDeps = []) {
2195
- let defaultContexts = [];
2196
- function createContext3(rootComponentName, defaultContext) {
2197
- const BaseContext = react.createContext(defaultContext);
2198
- const index = defaultContexts.length;
2199
- defaultContexts = [...defaultContexts, defaultContext];
2200
- const Provider = (props) => {
2201
- const { scope, children, ...context } = props;
2202
- const Context = scope?.[scopeName]?.[index] || BaseContext;
2203
- const value = react.useMemo(() => context, Object.values(context));
2204
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Context.Provider, {
2205
- value,
2206
- children
2207
- });
2208
- };
2209
- Provider.displayName = rootComponentName + "Provider";
2210
- function useContext2(consumerName, scope) {
2211
- const Context = scope?.[scopeName]?.[index] || BaseContext;
2212
- const context = react.useContext(Context);
2213
- if (context) return context;
2214
- if (defaultContext !== void 0) return defaultContext;
2215
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
2216
- }
2217
- return [Provider, useContext2];
2218
- }
2219
- const createScope = () => {
2220
- const scopeContexts = defaultContexts.map((defaultContext) => {
2221
- return react.createContext(defaultContext);
2222
- });
2223
- return function useScope(scope) {
2224
- const contexts = scope?.[scopeName] || scopeContexts;
2225
- return react.useMemo(() => ({ [`__scope${scopeName}`]: {
2226
- ...scope,
2227
- [scopeName]: contexts
2228
- } }), [scope, contexts]);
2229
- };
2230
- };
2231
- createScope.scopeName = scopeName;
2232
- return [createContext3, composeContextScopes$1(createScope, ...createContextScopeDeps)];
1046
+ function LegendSettingsDispatcher(props) {
1047
+ var dispatch = require_trust_score_card_glass.useAppDispatch();
1048
+ (0, react.useEffect)(() => {
1049
+ dispatch(require_trust_score_card_glass.setLegendSettings(props));
1050
+ }, [dispatch, props]);
1051
+ return null;
2233
1052
  }
2234
- function composeContextScopes$1(...scopes) {
2235
- const baseScope = scopes[0];
2236
- if (scopes.length === 1) return baseScope;
2237
- const createScope = () => {
2238
- const scopeHooks = scopes.map((createScope2) => ({
2239
- useScope: createScope2(),
2240
- scopeName: createScope2.scopeName
2241
- }));
2242
- return function useComposedScopes(overrideScopes) {
2243
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
2244
- const currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
2245
- return {
2246
- ...nextScopes2,
2247
- ...currentScope
2248
- };
2249
- }, {});
2250
- return react.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
1053
+ function LegendSizeDispatcher(props) {
1054
+ var dispatch = require_trust_score_card_glass.useAppDispatch();
1055
+ (0, react.useEffect)(() => {
1056
+ dispatch(require_trust_score_card_glass.setLegendSize(props));
1057
+ return () => {
1058
+ dispatch(require_trust_score_card_glass.setLegendSize({
1059
+ width: 0,
1060
+ height: 0
1061
+ }));
2251
1062
  };
2252
- };
2253
- createScope.scopeName = baseScope.scopeName;
2254
- return createScope;
1063
+ }, [dispatch, props]);
1064
+ return null;
1065
+ }
1066
+ function getWidthOrHeight(layout, height, width, maxWidth) {
1067
+ if (layout === "vertical" && require_trust_score_card_glass.isNumber(height)) return { height };
1068
+ if (layout === "horizontal") return { width: width || maxWidth };
1069
+ return null;
1070
+ }
1071
+ var legendDefaultProps = {
1072
+ align: "center",
1073
+ iconSize: 14,
1074
+ itemSorter: "value",
1075
+ layout: "horizontal",
1076
+ verticalAlign: "bottom"
1077
+ };
1078
+ function Legend(outsideProps) {
1079
+ var props = require_trust_score_card_glass.resolveDefaultProps(outsideProps, legendDefaultProps);
1080
+ var contextPayload = useLegendPayload();
1081
+ var legendPortalFromContext = require_trust_score_card_glass.useLegendPortal();
1082
+ var margin = require_trust_score_card_glass.useMargin();
1083
+ var { width: widthFromProps, height: heightFromProps, wrapperStyle, portal: portalFromProps } = props;
1084
+ var [lastBoundingBox, updateBoundingBox] = require_trust_score_card_glass.useElementOffset([contextPayload]);
1085
+ var chartWidth = require_trust_score_card_glass.useChartWidth();
1086
+ var chartHeight = require_trust_score_card_glass.useChartHeight();
1087
+ if (chartWidth == null || chartHeight == null) return null;
1088
+ var maxWidth = chartWidth - ((margin === null || margin === void 0 ? void 0 : margin.left) || 0) - ((margin === null || margin === void 0 ? void 0 : margin.right) || 0);
1089
+ var widthOrHeight = getWidthOrHeight(props.layout, heightFromProps, widthFromProps, maxWidth);
1090
+ var outerStyle = portalFromProps ? wrapperStyle : _objectSpread(_objectSpread({
1091
+ position: "absolute",
1092
+ width: (widthOrHeight === null || widthOrHeight === void 0 ? void 0 : widthOrHeight.width) || widthFromProps || "auto",
1093
+ height: (widthOrHeight === null || widthOrHeight === void 0 ? void 0 : widthOrHeight.height) || heightFromProps || "auto"
1094
+ }, getDefaultPosition(wrapperStyle, props, margin, chartWidth, chartHeight, lastBoundingBox)), wrapperStyle);
1095
+ var legendPortal = portalFromProps !== null && portalFromProps !== void 0 ? portalFromProps : legendPortalFromContext;
1096
+ if (legendPortal == null || contextPayload == null) return null;
1097
+ return /* @__PURE__ */ (0, react_dom.createPortal)(/* @__PURE__ */ react.createElement("div", {
1098
+ className: "recharts-legend-wrapper",
1099
+ style: outerStyle,
1100
+ ref: updateBoundingBox
1101
+ }, /* @__PURE__ */ react.createElement(LegendSettingsDispatcher, {
1102
+ layout: props.layout,
1103
+ align: props.align,
1104
+ verticalAlign: props.verticalAlign,
1105
+ itemSorter: props.itemSorter
1106
+ }), !portalFromProps && /* @__PURE__ */ react.createElement(LegendSizeDispatcher, {
1107
+ width: lastBoundingBox.width,
1108
+ height: lastBoundingBox.height
1109
+ }), /* @__PURE__ */ react.createElement(LegendContent, _extends({}, props, widthOrHeight, {
1110
+ margin,
1111
+ chartWidth,
1112
+ chartHeight,
1113
+ contextPayload
1114
+ }))), legendPortal);
2255
1115
  }
2256
- var Primitive$1 = [
1116
+ Legend.displayName = "Legend";
1117
+ var Primitive = [
2257
1118
  "a",
2258
1119
  "button",
2259
1120
  "div",
@@ -2287,145 +1148,7 @@ var Primitive$1 = [
2287
1148
  ...primitive,
2288
1149
  [node]: Node
2289
1150
  };
2290
- }, {});
2291
- var COLLAPSIBLE_NAME = "Collapsible";
2292
- var [createCollapsibleContext, createCollapsibleScope] = createContextScope$1(COLLAPSIBLE_NAME);
2293
- var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
2294
- var Collapsible = react.forwardRef((props, forwardedRef) => {
2295
- const { __scopeCollapsible, open: openProp, defaultOpen, disabled, onOpenChange, ...collapsibleProps } = props;
2296
- const [open, setOpen] = require_trust_score_card_glass.useControllableState({
2297
- prop: openProp,
2298
- defaultProp: defaultOpen ?? false,
2299
- onChange: onOpenChange,
2300
- caller: COLLAPSIBLE_NAME
2301
- });
2302
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollapsibleProvider, {
2303
- scope: __scopeCollapsible,
2304
- disabled,
2305
- contentId: require_trust_score_card_glass.useId(),
2306
- open,
2307
- onOpenToggle: react.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
2308
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$1.div, {
2309
- "data-state": getState$1(open),
2310
- "data-disabled": disabled ? "" : void 0,
2311
- ...collapsibleProps,
2312
- ref: forwardedRef
2313
- })
2314
- });
2315
- });
2316
- Collapsible.displayName = COLLAPSIBLE_NAME;
2317
- var TRIGGER_NAME = "CollapsibleTrigger";
2318
- var CollapsibleTrigger = react.forwardRef((props, forwardedRef) => {
2319
- const { __scopeCollapsible, ...triggerProps } = props;
2320
- const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible);
2321
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$1.button, {
2322
- type: "button",
2323
- "aria-controls": context.contentId,
2324
- "aria-expanded": context.open || false,
2325
- "data-state": getState$1(context.open),
2326
- "data-disabled": context.disabled ? "" : void 0,
2327
- disabled: context.disabled,
2328
- ...triggerProps,
2329
- ref: forwardedRef,
2330
- onClick: require_trust_score_card_glass.composeEventHandlers(props.onClick, context.onOpenToggle)
2331
- });
2332
- });
2333
- CollapsibleTrigger.displayName = TRIGGER_NAME;
2334
- var CONTENT_NAME = "CollapsibleContent";
2335
- var CollapsibleContent = react.forwardRef((props, forwardedRef) => {
2336
- const { forceMount, ...contentProps } = props;
2337
- const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible);
2338
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
2339
- present: forceMount || context.open,
2340
- children: ({ present }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollapsibleContentImpl, {
2341
- ...contentProps,
2342
- ref: forwardedRef,
2343
- present
2344
- })
2345
- });
2346
- });
2347
- CollapsibleContent.displayName = CONTENT_NAME;
2348
- var CollapsibleContentImpl = react.forwardRef((props, forwardedRef) => {
2349
- const { __scopeCollapsible, present, children, ...contentProps } = props;
2350
- const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible);
2351
- const [isPresent, setIsPresent] = react.useState(present);
2352
- const ref = react.useRef(null);
2353
- const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref);
2354
- const heightRef = react.useRef(0);
2355
- const height = heightRef.current;
2356
- const widthRef = react.useRef(0);
2357
- const width = widthRef.current;
2358
- const isOpen = context.open || isPresent;
2359
- const isMountAnimationPreventedRef = react.useRef(isOpen);
2360
- const originalStylesRef = react.useRef(void 0);
2361
- react.useEffect(() => {
2362
- const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
2363
- return () => cancelAnimationFrame(rAF);
2364
- }, []);
2365
- require_trust_score_card_glass.useLayoutEffect2(() => {
2366
- const node = ref.current;
2367
- if (node) {
2368
- originalStylesRef.current = originalStylesRef.current || {
2369
- transitionDuration: node.style.transitionDuration,
2370
- animationName: node.style.animationName
2371
- };
2372
- node.style.transitionDuration = "0s";
2373
- node.style.animationName = "none";
2374
- const rect = node.getBoundingClientRect();
2375
- heightRef.current = rect.height;
2376
- widthRef.current = rect.width;
2377
- if (!isMountAnimationPreventedRef.current) {
2378
- node.style.transitionDuration = originalStylesRef.current.transitionDuration;
2379
- node.style.animationName = originalStylesRef.current.animationName;
2380
- }
2381
- setIsPresent(present);
2382
- }
2383
- }, [context.open, present]);
2384
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive$1.div, {
2385
- "data-state": getState$1(context.open),
2386
- "data-disabled": context.disabled ? "" : void 0,
2387
- id: context.contentId,
2388
- hidden: !isOpen,
2389
- ...contentProps,
2390
- ref: composedRefs,
2391
- style: {
2392
- [`--radix-collapsible-content-height`]: height ? `${height}px` : void 0,
2393
- [`--radix-collapsible-content-width`]: width ? `${width}px` : void 0,
2394
- ...props.style
2395
- },
2396
- children: isOpen && children
2397
- });
2398
- });
2399
- function getState$1(open) {
2400
- return open ? "open" : "closed";
2401
- }
2402
- var Root = Collapsible;
2403
- var Trigger = CollapsibleTrigger;
2404
- var Content = CollapsibleContent;
2405
- var CollapsibleGlassRoot = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root, {
2406
- ref,
2407
- className: require_utils.cn("w-full", className),
2408
- ...props
2409
- }));
2410
- CollapsibleGlassRoot.displayName = "CollapsibleGlassRoot";
2411
- var CollapsibleGlassTrigger = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trigger, {
2412
- ref,
2413
- className: require_utils.cn("flex w-full items-center justify-between", "focus-visible:outline-none focus-visible:ring-2", "focus-visible:ring-[var(--focus-ring)] focus-visible:ring-offset-2", className),
2414
- ...props
2415
- }));
2416
- CollapsibleGlassTrigger.displayName = "CollapsibleGlassTrigger";
2417
- var CollapsibleGlassContent = react.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, {
2418
- ref,
2419
- className: require_utils.cn("overflow-hidden transition-all", "data-[state=closed]:animate-collapsible-up", "data-[state=open]:animate-collapsible-down", className),
2420
- ...props,
2421
- children
2422
- }));
2423
- CollapsibleGlassContent.displayName = "CollapsibleGlassContent";
2424
- const CollapsibleGlass = {
2425
- Root: CollapsibleGlassRoot,
2426
- Trigger: CollapsibleGlassTrigger,
2427
- Content: CollapsibleGlassContent
2428
- };
1151
+ }, {});
2429
1152
  function createContextScope(scopeName, createContextScopeDeps = []) {
2430
1153
  let defaultContexts = [];
2431
1154
  function createContext3(rootComponentName, defaultContext) {
@@ -2488,679 +1211,663 @@ function composeContextScopes(...scopes) {
2488
1211
  createScope.scopeName = baseScope.scopeName;
2489
1212
  return createScope;
2490
1213
  }
2491
- var Primitive = [
2492
- "a",
2493
- "button",
2494
- "div",
2495
- "form",
2496
- "h2",
2497
- "h3",
2498
- "img",
2499
- "input",
2500
- "label",
2501
- "li",
2502
- "nav",
2503
- "ol",
2504
- "p",
2505
- "select",
2506
- "span",
2507
- "svg",
2508
- "ul"
2509
- ].reduce((primitive, node) => {
2510
- const Slot$3 = (0, __radix_ui_react_slot.createSlot)(`Primitive.${node}`);
2511
- const Node = react.forwardRef((props, forwardedRef) => {
2512
- const { asChild, ...primitiveProps } = props;
2513
- const Comp = asChild ? Slot$3 : node;
2514
- if (typeof window !== "undefined") window[Symbol.for("radix-ui")] = true;
2515
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Comp, {
2516
- ...primitiveProps,
1214
+ function useStateMachine(initialState, machine) {
1215
+ return react.useReducer((state, event) => {
1216
+ return machine[state][event] ?? state;
1217
+ }, initialState);
1218
+ }
1219
+ var SCROLL_AREA_NAME = "ScrollArea";
1220
+ var [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME);
1221
+ var [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);
1222
+ var ScrollArea$1 = react.forwardRef((props, forwardedRef) => {
1223
+ const { __scopeScrollArea, type = "hover", dir, scrollHideDelay = 600, ...scrollAreaProps } = props;
1224
+ const [scrollArea, setScrollArea] = react.useState(null);
1225
+ const [viewport, setViewport] = react.useState(null);
1226
+ const [content, setContent] = react.useState(null);
1227
+ const [scrollbarX, setScrollbarX] = react.useState(null);
1228
+ const [scrollbarY, setScrollbarY] = react.useState(null);
1229
+ const [cornerWidth, setCornerWidth] = react.useState(0);
1230
+ const [cornerHeight, setCornerHeight] = react.useState(0);
1231
+ const [scrollbarXEnabled, setScrollbarXEnabled] = react.useState(false);
1232
+ const [scrollbarYEnabled, setScrollbarYEnabled] = react.useState(false);
1233
+ const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => setScrollArea(node));
1234
+ const direction = require_trust_score_card_glass.useDirection(dir);
1235
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaProvider, {
1236
+ scope: __scopeScrollArea,
1237
+ type,
1238
+ dir: direction,
1239
+ scrollHideDelay,
1240
+ scrollArea,
1241
+ viewport,
1242
+ onViewportChange: setViewport,
1243
+ content,
1244
+ onContentChange: setContent,
1245
+ scrollbarX,
1246
+ onScrollbarXChange: setScrollbarX,
1247
+ scrollbarXEnabled,
1248
+ onScrollbarXEnabledChange: setScrollbarXEnabled,
1249
+ scrollbarY,
1250
+ onScrollbarYChange: setScrollbarY,
1251
+ scrollbarYEnabled,
1252
+ onScrollbarYEnabledChange: setScrollbarYEnabled,
1253
+ onCornerWidthChange: setCornerWidth,
1254
+ onCornerHeightChange: setCornerHeight,
1255
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
1256
+ dir: direction,
1257
+ ...scrollAreaProps,
1258
+ ref: composedRefs,
1259
+ style: {
1260
+ position: "relative",
1261
+ ["--radix-scroll-area-corner-width"]: cornerWidth + "px",
1262
+ ["--radix-scroll-area-corner-height"]: cornerHeight + "px",
1263
+ ...props.style
1264
+ }
1265
+ })
1266
+ });
1267
+ });
1268
+ ScrollArea$1.displayName = SCROLL_AREA_NAME;
1269
+ var VIEWPORT_NAME = "ScrollAreaViewport";
1270
+ var ScrollAreaViewport = react.forwardRef((props, forwardedRef) => {
1271
+ const { __scopeScrollArea, children, nonce, ...viewportProps } = props;
1272
+ const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);
1273
+ const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, react.useRef(null), context.onViewportChange);
1274
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", {
1275
+ dangerouslySetInnerHTML: { __html: `[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}` },
1276
+ nonce
1277
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
1278
+ "data-radix-scroll-area-viewport": "",
1279
+ ...viewportProps,
1280
+ ref: composedRefs,
1281
+ style: {
1282
+ overflowX: context.scrollbarXEnabled ? "scroll" : "hidden",
1283
+ overflowY: context.scrollbarYEnabled ? "scroll" : "hidden",
1284
+ ...props.style
1285
+ },
1286
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1287
+ ref: context.onContentChange,
1288
+ style: {
1289
+ minWidth: "100%",
1290
+ display: "table"
1291
+ },
1292
+ children
1293
+ })
1294
+ })] });
1295
+ });
1296
+ ScrollAreaViewport.displayName = VIEWPORT_NAME;
1297
+ var SCROLLBAR_NAME = "ScrollAreaScrollbar";
1298
+ var ScrollAreaScrollbar = react.forwardRef((props, forwardedRef) => {
1299
+ const { forceMount, ...scrollbarProps } = props;
1300
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1301
+ const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context;
1302
+ const isHorizontal = props.orientation === "horizontal";
1303
+ react.useEffect(() => {
1304
+ isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
1305
+ return () => {
1306
+ isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
1307
+ };
1308
+ }, [
1309
+ isHorizontal,
1310
+ onScrollbarXEnabledChange,
1311
+ onScrollbarYEnabledChange
1312
+ ]);
1313
+ return context.type === "hover" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarHover, {
1314
+ ...scrollbarProps,
1315
+ ref: forwardedRef,
1316
+ forceMount
1317
+ }) : context.type === "scroll" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarScroll, {
1318
+ ...scrollbarProps,
1319
+ ref: forwardedRef,
1320
+ forceMount
1321
+ }) : context.type === "auto" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarAuto, {
1322
+ ...scrollbarProps,
1323
+ ref: forwardedRef,
1324
+ forceMount
1325
+ }) : context.type === "always" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
1326
+ ...scrollbarProps,
1327
+ ref: forwardedRef
1328
+ }) : null;
1329
+ });
1330
+ ScrollAreaScrollbar.displayName = SCROLLBAR_NAME;
1331
+ var ScrollAreaScrollbarHover = react.forwardRef((props, forwardedRef) => {
1332
+ const { forceMount, ...scrollbarProps } = props;
1333
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1334
+ const [visible, setVisible] = react.useState(false);
1335
+ react.useEffect(() => {
1336
+ const scrollArea = context.scrollArea;
1337
+ let hideTimer = 0;
1338
+ if (scrollArea) {
1339
+ const handlePointerEnter = () => {
1340
+ window.clearTimeout(hideTimer);
1341
+ setVisible(true);
1342
+ };
1343
+ const handlePointerLeave = () => {
1344
+ hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay);
1345
+ };
1346
+ scrollArea.addEventListener("pointerenter", handlePointerEnter);
1347
+ scrollArea.addEventListener("pointerleave", handlePointerLeave);
1348
+ return () => {
1349
+ window.clearTimeout(hideTimer);
1350
+ scrollArea.removeEventListener("pointerenter", handlePointerEnter);
1351
+ scrollArea.removeEventListener("pointerleave", handlePointerLeave);
1352
+ };
1353
+ }
1354
+ }, [context.scrollArea, context.scrollHideDelay]);
1355
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
1356
+ present: forceMount || visible,
1357
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarAuto, {
1358
+ "data-state": visible ? "visible" : "hidden",
1359
+ ...scrollbarProps,
2517
1360
  ref: forwardedRef
2518
- });
1361
+ })
2519
1362
  });
2520
- Node.displayName = `Primitive.${node}`;
2521
- return {
2522
- ...primitive,
2523
- [node]: Node
2524
- };
2525
- }, {});
2526
- var RADIO_NAME = "Radio";
2527
- var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
2528
- var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
2529
- var Radio = react.forwardRef((props, forwardedRef) => {
2530
- const { __scopeRadio, name, checked = false, required, disabled, value = "on", onCheck, form, ...radioProps } = props;
2531
- const [button, setButton] = react.useState(null);
2532
- const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => setButton(node));
2533
- const hasConsumerStoppedPropagationRef = react.useRef(false);
2534
- const isFormControl = button ? form || !!button.closest("form") : true;
2535
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RadioProvider, {
2536
- scope: __scopeRadio,
2537
- checked,
2538
- disabled,
2539
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.button, {
2540
- type: "button",
2541
- role: "radio",
2542
- "aria-checked": checked,
2543
- "data-state": getState(checked),
2544
- "data-disabled": disabled ? "" : void 0,
2545
- disabled,
2546
- value,
2547
- ...radioProps,
2548
- ref: composedRefs,
2549
- onClick: require_trust_score_card_glass.composeEventHandlers(props.onClick, (event) => {
2550
- if (!checked) onCheck?.();
2551
- if (isFormControl) {
2552
- hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
2553
- if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
1363
+ });
1364
+ var ScrollAreaScrollbarScroll = react.forwardRef((props, forwardedRef) => {
1365
+ const { forceMount, ...scrollbarProps } = props;
1366
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1367
+ const isHorizontal = props.orientation === "horizontal";
1368
+ const debounceScrollEnd = useDebounceCallback(() => send("SCROLL_END"), 100);
1369
+ const [state, send] = useStateMachine("hidden", {
1370
+ hidden: { SCROLL: "scrolling" },
1371
+ scrolling: {
1372
+ SCROLL_END: "idle",
1373
+ POINTER_ENTER: "interacting"
1374
+ },
1375
+ interacting: {
1376
+ SCROLL: "interacting",
1377
+ POINTER_LEAVE: "idle"
1378
+ },
1379
+ idle: {
1380
+ HIDE: "hidden",
1381
+ SCROLL: "scrolling",
1382
+ POINTER_ENTER: "interacting"
1383
+ }
1384
+ });
1385
+ react.useEffect(() => {
1386
+ if (state === "idle") {
1387
+ const hideTimer = window.setTimeout(() => send("HIDE"), context.scrollHideDelay);
1388
+ return () => window.clearTimeout(hideTimer);
1389
+ }
1390
+ }, [
1391
+ state,
1392
+ context.scrollHideDelay,
1393
+ send
1394
+ ]);
1395
+ react.useEffect(() => {
1396
+ const viewport = context.viewport;
1397
+ const scrollDirection = isHorizontal ? "scrollLeft" : "scrollTop";
1398
+ if (viewport) {
1399
+ let prevScrollPos = viewport[scrollDirection];
1400
+ const handleScroll = () => {
1401
+ const scrollPos = viewport[scrollDirection];
1402
+ if (prevScrollPos !== scrollPos) {
1403
+ send("SCROLL");
1404
+ debounceScrollEnd();
2554
1405
  }
2555
- })
2556
- }), isFormControl && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioBubbleInput, {
2557
- control: button,
2558
- bubbles: !hasConsumerStoppedPropagationRef.current,
2559
- name,
2560
- value,
2561
- checked,
2562
- required,
2563
- disabled,
2564
- form,
2565
- style: { transform: "translateX(-100%)" }
2566
- })]
1406
+ prevScrollPos = scrollPos;
1407
+ };
1408
+ viewport.addEventListener("scroll", handleScroll);
1409
+ return () => viewport.removeEventListener("scroll", handleScroll);
1410
+ }
1411
+ }, [
1412
+ context.viewport,
1413
+ isHorizontal,
1414
+ send,
1415
+ debounceScrollEnd
1416
+ ]);
1417
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
1418
+ present: forceMount || state !== "hidden",
1419
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
1420
+ "data-state": state === "hidden" ? "hidden" : "visible",
1421
+ ...scrollbarProps,
1422
+ ref: forwardedRef,
1423
+ onPointerEnter: require_trust_score_card_glass.composeEventHandlers(props.onPointerEnter, () => send("POINTER_ENTER")),
1424
+ onPointerLeave: require_trust_score_card_glass.composeEventHandlers(props.onPointerLeave, () => send("POINTER_LEAVE"))
1425
+ })
2567
1426
  });
2568
1427
  });
2569
- Radio.displayName = RADIO_NAME;
2570
- var INDICATOR_NAME = "RadioIndicator";
2571
- var RadioIndicator = react.forwardRef((props, forwardedRef) => {
2572
- const { __scopeRadio, forceMount, ...indicatorProps } = props;
2573
- const context = useRadioContext(INDICATOR_NAME, __scopeRadio);
1428
+ var ScrollAreaScrollbarAuto = react.forwardRef((props, forwardedRef) => {
1429
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1430
+ const { forceMount, ...scrollbarProps } = props;
1431
+ const [visible, setVisible] = react.useState(false);
1432
+ const isHorizontal = props.orientation === "horizontal";
1433
+ const handleResize = useDebounceCallback(() => {
1434
+ if (context.viewport) {
1435
+ const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;
1436
+ const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;
1437
+ setVisible(isHorizontal ? isOverflowX : isOverflowY);
1438
+ }
1439
+ }, 10);
1440
+ useResizeObserver(context.viewport, handleResize);
1441
+ useResizeObserver(context.content, handleResize);
2574
1442
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
2575
- present: forceMount || context.checked,
2576
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.span, {
2577
- "data-state": getState(context.checked),
2578
- "data-disabled": context.disabled ? "" : void 0,
2579
- ...indicatorProps,
1443
+ present: forceMount || visible,
1444
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarVisible, {
1445
+ "data-state": visible ? "visible" : "hidden",
1446
+ ...scrollbarProps,
2580
1447
  ref: forwardedRef
2581
1448
  })
2582
1449
  });
2583
1450
  });
2584
- RadioIndicator.displayName = INDICATOR_NAME;
2585
- var BUBBLE_INPUT_NAME = "RadioBubbleInput";
2586
- var RadioBubbleInput = react.forwardRef(({ __scopeRadio, control, checked, bubbles = true, ...props }, forwardedRef) => {
2587
- const ref = react.useRef(null);
2588
- const composedRefs = require_trust_score_card_glass.useComposedRefs(ref, forwardedRef);
2589
- const prevChecked = require_trust_score_card_glass.usePrevious(checked);
2590
- const controlSize = require_trust_score_card_glass.useSize(control);
2591
- react.useEffect(() => {
2592
- const input = ref.current;
2593
- if (!input) return;
2594
- const inputProto = window.HTMLInputElement.prototype;
2595
- const setChecked = Object.getOwnPropertyDescriptor(inputProto, "checked").set;
2596
- if (prevChecked !== checked && setChecked) {
2597
- const event = new Event("click", { bubbles });
2598
- setChecked.call(input, checked);
2599
- input.dispatchEvent(event);
1451
+ var ScrollAreaScrollbarVisible = react.forwardRef((props, forwardedRef) => {
1452
+ const { orientation = "vertical", ...scrollbarProps } = props;
1453
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1454
+ const thumbRef = react.useRef(null);
1455
+ const pointerOffsetRef = react.useRef(0);
1456
+ const [sizes, setSizes] = react.useState({
1457
+ content: 0,
1458
+ viewport: 0,
1459
+ scrollbar: {
1460
+ size: 0,
1461
+ paddingStart: 0,
1462
+ paddingEnd: 0
2600
1463
  }
2601
- }, [
2602
- prevChecked,
2603
- checked,
2604
- bubbles
2605
- ]);
2606
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.input, {
2607
- type: "radio",
2608
- "aria-hidden": true,
2609
- defaultChecked: checked,
2610
- ...props,
2611
- tabIndex: -1,
2612
- ref: composedRefs,
2613
- style: {
2614
- ...props.style,
2615
- ...controlSize,
2616
- position: "absolute",
2617
- pointerEvents: "none",
2618
- opacity: 0,
2619
- margin: 0
1464
+ });
1465
+ const thumbRatio = getThumbRatio(sizes.viewport, sizes.content);
1466
+ const commonProps = {
1467
+ ...scrollbarProps,
1468
+ sizes,
1469
+ onSizesChange: setSizes,
1470
+ hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),
1471
+ onThumbChange: (thumb) => thumbRef.current = thumb,
1472
+ onThumbPointerUp: () => pointerOffsetRef.current = 0,
1473
+ onThumbPointerDown: (pointerPos) => pointerOffsetRef.current = pointerPos
1474
+ };
1475
+ function getScrollPosition(pointerPos, dir) {
1476
+ return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);
1477
+ }
1478
+ if (orientation === "horizontal") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarX, {
1479
+ ...commonProps,
1480
+ ref: forwardedRef,
1481
+ onThumbPositionChange: () => {
1482
+ if (context.viewport && thumbRef.current) {
1483
+ const scrollPos = context.viewport.scrollLeft;
1484
+ const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir);
1485
+ thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`;
1486
+ }
1487
+ },
1488
+ onWheelScroll: (scrollPos) => {
1489
+ if (context.viewport) context.viewport.scrollLeft = scrollPos;
1490
+ },
1491
+ onDragScroll: (pointerPos) => {
1492
+ if (context.viewport) context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);
2620
1493
  }
2621
1494
  });
2622
- });
2623
- RadioBubbleInput.displayName = BUBBLE_INPUT_NAME;
2624
- function getState(checked) {
2625
- return checked ? "checked" : "unchecked";
2626
- }
2627
- var ARROW_KEYS = [
2628
- "ArrowUp",
2629
- "ArrowDown",
2630
- "ArrowLeft",
2631
- "ArrowRight"
2632
- ];
2633
- var RADIO_GROUP_NAME = "RadioGroup";
2634
- var [createRadioGroupContext, createRadioGroupScope] = createContextScope(RADIO_GROUP_NAME, [createRovingFocusGroupScope, createRadioScope]);
2635
- var useRovingFocusGroupScope = createRovingFocusGroupScope();
2636
- var useRadioScope = createRadioScope();
2637
- var [RadioGroupProvider, useRadioGroupContext] = createRadioGroupContext(RADIO_GROUP_NAME);
2638
- var RadioGroup = react.forwardRef((props, forwardedRef) => {
2639
- const { __scopeRadioGroup, name, defaultValue, value: valueProp, required = false, disabled = false, orientation, dir, loop = true, onValueChange, ...groupProps } = props;
2640
- const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
2641
- const direction = require_trust_score_card_glass.useDirection(dir);
2642
- const [value, setValue] = require_trust_score_card_glass.useControllableState({
2643
- prop: valueProp,
2644
- defaultProp: defaultValue ?? null,
2645
- onChange: onValueChange,
2646
- caller: RADIO_GROUP_NAME
2647
- });
2648
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioGroupProvider, {
2649
- scope: __scopeRadioGroup,
2650
- name,
2651
- required,
2652
- disabled,
2653
- value,
2654
- onValueChange: setValue,
2655
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root$3, {
2656
- asChild: true,
2657
- ...rovingFocusGroupScope,
2658
- orientation,
2659
- dir: direction,
2660
- loop,
2661
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
2662
- role: "radiogroup",
2663
- "aria-required": required,
2664
- "aria-orientation": orientation,
2665
- "data-disabled": disabled ? "" : void 0,
2666
- dir: direction,
2667
- ...groupProps,
2668
- ref: forwardedRef
2669
- })
2670
- })
1495
+ if (orientation === "vertical") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarY, {
1496
+ ...commonProps,
1497
+ ref: forwardedRef,
1498
+ onThumbPositionChange: () => {
1499
+ if (context.viewport && thumbRef.current) {
1500
+ const scrollPos = context.viewport.scrollTop;
1501
+ const offset = getThumbOffsetFromScroll(scrollPos, sizes);
1502
+ thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;
1503
+ }
1504
+ },
1505
+ onWheelScroll: (scrollPos) => {
1506
+ if (context.viewport) context.viewport.scrollTop = scrollPos;
1507
+ },
1508
+ onDragScroll: (pointerPos) => {
1509
+ if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);
1510
+ }
2671
1511
  });
1512
+ return null;
2672
1513
  });
2673
- RadioGroup.displayName = RADIO_GROUP_NAME;
2674
- var ITEM_NAME = "RadioGroupItem";
2675
- var RadioGroupItem = react.forwardRef((props, forwardedRef) => {
2676
- const { __scopeRadioGroup, disabled, ...itemProps } = props;
2677
- const context = useRadioGroupContext(ITEM_NAME, __scopeRadioGroup);
2678
- const isDisabled = context.disabled || disabled;
2679
- const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
2680
- const radioScope = useRadioScope(__scopeRadioGroup);
1514
+ var ScrollAreaScrollbarX = react.forwardRef((props, forwardedRef) => {
1515
+ const { sizes, onSizesChange, ...scrollbarProps } = props;
1516
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1517
+ const [computedStyle, setComputedStyle] = react.useState();
2681
1518
  const ref = react.useRef(null);
2682
- const composedRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref);
2683
- const checked = context.value === itemProps.value;
2684
- const isArrowKeyPressedRef = react.useRef(false);
1519
+ const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);
2685
1520
  react.useEffect(() => {
2686
- const handleKeyDown = (event) => {
2687
- if (ARROW_KEYS.includes(event.key)) isArrowKeyPressedRef.current = true;
2688
- };
2689
- const handleKeyUp = () => isArrowKeyPressedRef.current = false;
2690
- document.addEventListener("keydown", handleKeyDown);
2691
- document.addEventListener("keyup", handleKeyUp);
2692
- return () => {
2693
- document.removeEventListener("keydown", handleKeyDown);
2694
- document.removeEventListener("keyup", handleKeyUp);
2695
- };
2696
- }, []);
2697
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item, {
2698
- asChild: true,
2699
- ...rovingFocusGroupScope,
2700
- focusable: !isDisabled,
2701
- active: checked,
2702
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Radio, {
2703
- disabled: isDisabled,
2704
- required: context.required,
2705
- checked,
2706
- ...radioScope,
2707
- ...itemProps,
2708
- name: context.name,
2709
- ref: composedRefs,
2710
- onCheck: () => context.onValueChange(itemProps.value),
2711
- onKeyDown: require_trust_score_card_glass.composeEventHandlers((event) => {
2712
- if (event.key === "Enter") event.preventDefault();
2713
- }),
2714
- onFocus: require_trust_score_card_glass.composeEventHandlers(itemProps.onFocus, () => {
2715
- if (isArrowKeyPressedRef.current) ref.current?.click();
2716
- })
2717
- })
2718
- });
2719
- });
2720
- RadioGroupItem.displayName = ITEM_NAME;
2721
- var INDICATOR_NAME2 = "RadioGroupIndicator";
2722
- var RadioGroupIndicator = react.forwardRef((props, forwardedRef) => {
2723
- const { __scopeRadioGroup, ...indicatorProps } = props;
2724
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioIndicator, {
2725
- ...useRadioScope(__scopeRadioGroup),
2726
- ...indicatorProps,
2727
- ref: forwardedRef
1521
+ if (ref.current) setComputedStyle(getComputedStyle(ref.current));
1522
+ }, [ref]);
1523
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarImpl, {
1524
+ "data-orientation": "horizontal",
1525
+ ...scrollbarProps,
1526
+ ref: composeRefs,
1527
+ sizes,
1528
+ style: {
1529
+ bottom: 0,
1530
+ left: context.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
1531
+ right: context.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
1532
+ ["--radix-scroll-area-thumb-width"]: getThumbSize(sizes) + "px",
1533
+ ...props.style
1534
+ },
1535
+ onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.x),
1536
+ onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.x),
1537
+ onWheelScroll: (event, maxScrollPos) => {
1538
+ if (context.viewport) {
1539
+ const scrollPos = context.viewport.scrollLeft + event.deltaX;
1540
+ props.onWheelScroll(scrollPos);
1541
+ if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
1542
+ }
1543
+ },
1544
+ onResize: () => {
1545
+ if (ref.current && context.viewport && computedStyle) onSizesChange({
1546
+ content: context.viewport.scrollWidth,
1547
+ viewport: context.viewport.offsetWidth,
1548
+ scrollbar: {
1549
+ size: ref.current.clientWidth,
1550
+ paddingStart: toInt(computedStyle.paddingLeft),
1551
+ paddingEnd: toInt(computedStyle.paddingRight)
1552
+ }
1553
+ });
1554
+ }
2728
1555
  });
2729
1556
  });
2730
- RadioGroupIndicator.displayName = INDICATOR_NAME2;
2731
- var Root2 = RadioGroup;
2732
- var Item2 = RadioGroupItem;
2733
- var Indicator = RadioGroupIndicator;
2734
- var RadioGroupGlassRoot = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root2, {
2735
- ref,
2736
- className: require_utils.cn("grid gap-2", className),
2737
- ...props
2738
- }));
2739
- RadioGroupGlassRoot.displayName = "RadioGroupGlassRoot";
2740
- var RadioGroupGlassItem = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Item2, {
2741
- ref,
2742
- className: require_utils.cn("aspect-square h-4 w-4 rounded-full", "border border-[var(--radio-border,var(--glass-border))]", "bg-[var(--radio-bg,transparent)]", "text-[var(--radio-indicator,var(--semantic-primary))]", "ring-offset-background", "focus:outline-none focus-visible:ring-2", "focus-visible:ring-[var(--focus-ring)] focus-visible:ring-offset-2", "disabled:cursor-not-allowed disabled:opacity-50", "data-[state=checked]:border-[var(--radio-border-checked,var(--semantic-primary))]", "data-[state=checked]:bg-[var(--radio-bg-checked,var(--semantic-primary-subtle))]", "transition-all duration-200", className),
2743
- ...props,
2744
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Indicator, {
2745
- className: "flex items-center justify-center",
2746
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Circle, { className: require_utils.cn("h-2.5 w-2.5 fill-current text-current", "drop-shadow-[0_0_4px_var(--semantic-primary)]") })
2747
- })
2748
- }));
2749
- RadioGroupGlassItem.displayName = "RadioGroupGlassItem";
2750
- const RadioGroupGlass = {
2751
- Root: RadioGroupGlassRoot,
2752
- Item: RadioGroupGlassItem
2753
- };
2754
- var sheetVariants = (0, class_variance_authority.cva)([
2755
- "fixed z-50 gap-4 p-6",
2756
- "bg-[var(--sheet-bg,var(--modal-bg))]",
2757
- "border-[var(--sheet-border,var(--modal-border))]",
2758
- "backdrop-blur-lg",
2759
- "transition-all duration-300 ease-in-out",
2760
- "data-[state=open]:animate-in data-[state=closed]:animate-out"
2761
- ], {
2762
- variants: { side: {
2763
- top: ["inset-x-0 top-0 border-b", "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top"],
2764
- bottom: ["inset-x-0 bottom-0 border-t", "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"],
2765
- left: ["inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left"],
2766
- right: ["inset-y-0 right-0 h-full w-3/4 border-r sm:max-w-sm", "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right"]
2767
- } },
2768
- defaultVariants: { side: "right" }
2769
- });
2770
- var SheetGlassRoot = __radix_ui_react_dialog.Root;
2771
- var SheetGlassTrigger = __radix_ui_react_dialog.Trigger;
2772
- var SheetGlassClose = __radix_ui_react_dialog.Close;
2773
- var SheetGlassPortal = __radix_ui_react_dialog.Portal;
2774
- var SheetGlassOverlay = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_dialog.Overlay, {
2775
- ref,
2776
- className: require_utils.cn("fixed inset-0 z-50", "bg-[var(--sheet-overlay,var(--modal-overlay))]", "backdrop-blur-sm", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className),
2777
- ...props
2778
- }));
2779
- SheetGlassOverlay.displayName = "SheetGlassOverlay";
2780
- var SheetGlassContent = react.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(SheetGlassPortal, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetGlassOverlay, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__radix_ui_react_dialog.Content, {
2781
- ref,
2782
- className: require_utils.cn(sheetVariants({ side }), className),
2783
- ...props,
2784
- children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__radix_ui_react_dialog.Close, {
2785
- className: require_utils.cn("absolute right-4 top-4 rounded-sm", "opacity-70 ring-offset-background", "transition-opacity hover:opacity-100", "focus:outline-none focus:ring-2 focus:ring-[var(--focus-ring)] focus:ring-offset-2", "disabled:pointer-events-none", "data-[state=open]:bg-secondary"),
2786
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "h-4 w-4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2787
- className: "sr-only",
2788
- children: "Close"
2789
- })]
2790
- })]
2791
- })] }));
2792
- SheetGlassContent.displayName = "SheetGlassContent";
2793
- var SheetGlassHeader = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2794
- className: require_utils.cn("flex flex-col space-y-2 text-center sm:text-left", className),
2795
- ...props
2796
- });
2797
- SheetGlassHeader.displayName = "SheetGlassHeader";
2798
- var SheetGlassFooter = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2799
- className: require_utils.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
2800
- ...props
2801
- });
2802
- SheetGlassFooter.displayName = "SheetGlassFooter";
2803
- var SheetGlassTitle = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_dialog.Title, {
2804
- ref,
2805
- className: require_utils.cn("text-lg font-semibold", "text-[var(--sheet-title,var(--text-primary))]", className),
2806
- ...props
2807
- }));
2808
- SheetGlassTitle.displayName = "SheetGlassTitle";
2809
- var SheetGlassDescription = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__radix_ui_react_dialog.Description, {
2810
- ref,
2811
- className: require_utils.cn("text-sm", "text-[var(--sheet-description,var(--text-muted))]", className),
2812
- ...props
2813
- }));
2814
- SheetGlassDescription.displayName = "SheetGlassDescription";
2815
- const SheetGlass = {
2816
- Root: SheetGlassRoot,
2817
- Trigger: SheetGlassTrigger,
2818
- Close: SheetGlassClose,
2819
- Portal: SheetGlassPortal,
2820
- Overlay: SheetGlassOverlay,
2821
- Content: SheetGlassContent,
2822
- Header: SheetGlassHeader,
2823
- Footer: SheetGlassFooter,
2824
- Title: SheetGlassTitle,
2825
- Description: SheetGlassDescription
2826
- };
2827
- function _extends$1() {
2828
- return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
2829
- for (var e = 1; e < arguments.length; e++) {
2830
- var t = arguments[e];
2831
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
2832
- }
2833
- return n;
2834
- }, _extends$1.apply(null, arguments);
2835
- }
2836
- function ownKeys$1(e, r) {
2837
- var t = Object.keys(e);
2838
- if (Object.getOwnPropertySymbols) {
2839
- var o = Object.getOwnPropertySymbols(e);
2840
- r && (o = o.filter(function(r$1) {
2841
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
2842
- })), t.push.apply(t, o);
2843
- }
2844
- return t;
2845
- }
2846
- function _objectSpread$1(e) {
2847
- for (var r = 1; r < arguments.length; r++) {
2848
- var t = null != arguments[r] ? arguments[r] : {};
2849
- r % 2 ? ownKeys$1(Object(t), !0).forEach(function(r$1) {
2850
- _defineProperty$1(e, r$1, t[r$1]);
2851
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function(r$1) {
2852
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
2853
- });
2854
- }
2855
- return e;
2856
- }
2857
- function _defineProperty$1(e, r, t) {
2858
- return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
2859
- value: t,
2860
- enumerable: !0,
2861
- configurable: !0,
2862
- writable: !0
2863
- }) : e[r] = t, e;
2864
- }
2865
- function _toPropertyKey$1(t) {
2866
- var i = _toPrimitive$1(t, "string");
2867
- return "symbol" == typeof i ? i : i + "";
2868
- }
2869
- function _toPrimitive$1(t, r) {
2870
- if ("object" != typeof t || !t) return t;
2871
- var e = t[Symbol.toPrimitive];
2872
- if (void 0 !== e) {
2873
- var i = e.call(t, r || "default");
2874
- if ("object" != typeof i) return i;
2875
- throw new TypeError("@@toPrimitive must return a primitive value.");
2876
- }
2877
- return ("string" === r ? String : Number)(t);
2878
- }
2879
- var SIZE = 32;
2880
- var defaultLegendContentDefaultProps = {
2881
- align: "center",
2882
- iconSize: 14,
2883
- inactiveColor: "#ccc",
2884
- layout: "horizontal",
2885
- verticalAlign: "middle"
2886
- };
2887
- function Icon(_ref) {
2888
- var { data, iconType, inactiveColor } = _ref;
2889
- var halfSize = SIZE / 2;
2890
- var sixthSize = SIZE / 6;
2891
- var thirdSize = SIZE / 3;
2892
- var color = data.inactive ? inactiveColor : data.color;
2893
- var preferredIcon = iconType !== null && iconType !== void 0 ? iconType : data.type;
2894
- if (preferredIcon === "none") return null;
2895
- if (preferredIcon === "plainline") {
2896
- var _data$payload;
2897
- return /* @__PURE__ */ react.createElement("line", {
2898
- strokeWidth: 4,
2899
- fill: "none",
2900
- stroke: color,
2901
- strokeDasharray: (_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.strokeDasharray,
2902
- x1: 0,
2903
- y1: halfSize,
2904
- x2: SIZE,
2905
- y2: halfSize,
2906
- className: "recharts-legend-icon"
1557
+ var ScrollAreaScrollbarY = react.forwardRef((props, forwardedRef) => {
1558
+ const { sizes, onSizesChange, ...scrollbarProps } = props;
1559
+ const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);
1560
+ const [computedStyle, setComputedStyle] = react.useState();
1561
+ const ref = react.useRef(null);
1562
+ const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);
1563
+ react.useEffect(() => {
1564
+ if (ref.current) setComputedStyle(getComputedStyle(ref.current));
1565
+ }, [ref]);
1566
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaScrollbarImpl, {
1567
+ "data-orientation": "vertical",
1568
+ ...scrollbarProps,
1569
+ ref: composeRefs,
1570
+ sizes,
1571
+ style: {
1572
+ top: 0,
1573
+ right: context.dir === "ltr" ? 0 : void 0,
1574
+ left: context.dir === "rtl" ? 0 : void 0,
1575
+ bottom: "var(--radix-scroll-area-corner-height)",
1576
+ ["--radix-scroll-area-thumb-height"]: getThumbSize(sizes) + "px",
1577
+ ...props.style
1578
+ },
1579
+ onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.y),
1580
+ onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.y),
1581
+ onWheelScroll: (event, maxScrollPos) => {
1582
+ if (context.viewport) {
1583
+ const scrollPos = context.viewport.scrollTop + event.deltaY;
1584
+ props.onWheelScroll(scrollPos);
1585
+ if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) event.preventDefault();
1586
+ }
1587
+ },
1588
+ onResize: () => {
1589
+ if (ref.current && context.viewport && computedStyle) onSizesChange({
1590
+ content: context.viewport.scrollHeight,
1591
+ viewport: context.viewport.offsetHeight,
1592
+ scrollbar: {
1593
+ size: ref.current.clientHeight,
1594
+ paddingStart: toInt(computedStyle.paddingTop),
1595
+ paddingEnd: toInt(computedStyle.paddingBottom)
1596
+ }
1597
+ });
1598
+ }
1599
+ });
1600
+ });
1601
+ var [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME);
1602
+ var ScrollAreaScrollbarImpl = react.forwardRef((props, forwardedRef) => {
1603
+ const { __scopeScrollArea, sizes, hasThumb, onThumbChange, onThumbPointerUp, onThumbPointerDown, onThumbPositionChange, onDragScroll, onWheelScroll, onResize, ...scrollbarProps } = props;
1604
+ const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);
1605
+ const [scrollbar, setScrollbar] = react.useState(null);
1606
+ const composeRefs = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => setScrollbar(node));
1607
+ const rectRef = react.useRef(null);
1608
+ const prevWebkitUserSelectRef = react.useRef("");
1609
+ const viewport = context.viewport;
1610
+ const maxScrollPos = sizes.content - sizes.viewport;
1611
+ const handleWheelScroll = require_trust_score_card_glass.useCallbackRef(onWheelScroll);
1612
+ const handleThumbPositionChange = require_trust_score_card_glass.useCallbackRef(onThumbPositionChange);
1613
+ const handleResize = useDebounceCallback(onResize, 10);
1614
+ function handleDragScroll(event) {
1615
+ if (rectRef.current) onDragScroll({
1616
+ x: event.clientX - rectRef.current.left,
1617
+ y: event.clientY - rectRef.current.top
2907
1618
  });
2908
1619
  }
2909
- if (preferredIcon === "line") return /* @__PURE__ */ react.createElement("path", {
2910
- strokeWidth: 4,
2911
- fill: "none",
2912
- stroke: color,
2913
- d: "M0,".concat(halfSize, "h").concat(thirdSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(2 * thirdSize, ",").concat(halfSize, "\n H").concat(SIZE, "M").concat(2 * thirdSize, ",").concat(halfSize, "\n A").concat(sixthSize, ",").concat(sixthSize, ",0,1,1,").concat(thirdSize, ",").concat(halfSize),
2914
- className: "recharts-legend-icon"
2915
- });
2916
- if (preferredIcon === "rect") return /* @__PURE__ */ react.createElement("path", {
2917
- stroke: "none",
2918
- fill: color,
2919
- d: "M0,".concat(SIZE / 8, "h").concat(SIZE, "v").concat(SIZE * 3 / 4, "h").concat(-SIZE, "z"),
2920
- className: "recharts-legend-icon"
1620
+ react.useEffect(() => {
1621
+ const handleWheel = (event) => {
1622
+ const element = event.target;
1623
+ if (scrollbar?.contains(element)) handleWheelScroll(event, maxScrollPos);
1624
+ };
1625
+ document.addEventListener("wheel", handleWheel, { passive: false });
1626
+ return () => document.removeEventListener("wheel", handleWheel, { passive: false });
1627
+ }, [
1628
+ viewport,
1629
+ scrollbar,
1630
+ maxScrollPos,
1631
+ handleWheelScroll
1632
+ ]);
1633
+ react.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]);
1634
+ useResizeObserver(scrollbar, handleResize);
1635
+ useResizeObserver(context.content, handleResize);
1636
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollbarProvider, {
1637
+ scope: __scopeScrollArea,
1638
+ scrollbar,
1639
+ hasThumb,
1640
+ onThumbChange: require_trust_score_card_glass.useCallbackRef(onThumbChange),
1641
+ onThumbPointerUp: require_trust_score_card_glass.useCallbackRef(onThumbPointerUp),
1642
+ onThumbPositionChange: handleThumbPositionChange,
1643
+ onThumbPointerDown: require_trust_score_card_glass.useCallbackRef(onThumbPointerDown),
1644
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
1645
+ ...scrollbarProps,
1646
+ ref: composeRefs,
1647
+ style: {
1648
+ position: "absolute",
1649
+ ...scrollbarProps.style
1650
+ },
1651
+ onPointerDown: require_trust_score_card_glass.composeEventHandlers(props.onPointerDown, (event) => {
1652
+ if (event.button === 0) {
1653
+ event.target.setPointerCapture(event.pointerId);
1654
+ rectRef.current = scrollbar.getBoundingClientRect();
1655
+ prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;
1656
+ document.body.style.webkitUserSelect = "none";
1657
+ if (context.viewport) context.viewport.style.scrollBehavior = "auto";
1658
+ handleDragScroll(event);
1659
+ }
1660
+ }),
1661
+ onPointerMove: require_trust_score_card_glass.composeEventHandlers(props.onPointerMove, handleDragScroll),
1662
+ onPointerUp: require_trust_score_card_glass.composeEventHandlers(props.onPointerUp, (event) => {
1663
+ const element = event.target;
1664
+ if (element.hasPointerCapture(event.pointerId)) element.releasePointerCapture(event.pointerId);
1665
+ document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;
1666
+ if (context.viewport) context.viewport.style.scrollBehavior = "";
1667
+ rectRef.current = null;
1668
+ })
1669
+ })
2921
1670
  });
2922
- if (/* @__PURE__ */ react.isValidElement(data.legendIcon)) {
2923
- var iconProps = _objectSpread$1({}, data);
2924
- delete iconProps.legendIcon;
2925
- return /* @__PURE__ */ react.cloneElement(data.legendIcon, iconProps);
2926
- }
2927
- return /* @__PURE__ */ react.createElement(require_trust_score_card_glass.Symbols, {
2928
- fill: color,
2929
- cx: halfSize,
2930
- cy: halfSize,
2931
- size: SIZE,
2932
- sizeType: "diameter",
2933
- type: preferredIcon
1671
+ });
1672
+ var THUMB_NAME = "ScrollAreaThumb";
1673
+ var ScrollAreaThumb = react.forwardRef((props, forwardedRef) => {
1674
+ const { forceMount, ...thumbProps } = props;
1675
+ const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);
1676
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_trust_score_card_glass.Presence, {
1677
+ present: forceMount || scrollbarContext.hasThumb,
1678
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaThumbImpl, {
1679
+ ref: forwardedRef,
1680
+ ...thumbProps
1681
+ })
2934
1682
  });
2935
- }
2936
- function Items(props) {
2937
- var { payload, iconSize, layout, formatter, inactiveColor, iconType } = props;
2938
- var viewBox = {
2939
- x: 0,
2940
- y: 0,
2941
- width: SIZE,
2942
- height: SIZE
2943
- };
2944
- var itemStyle = {
2945
- display: layout === "horizontal" ? "inline-block" : "block",
2946
- marginRight: 10
2947
- };
2948
- var svgStyle = {
2949
- display: "inline-block",
2950
- verticalAlign: "middle",
2951
- marginRight: 4
2952
- };
2953
- return payload.map((entry, i) => {
2954
- var finalFormatter = entry.formatter || formatter;
2955
- var className = (0, clsx.clsx)({
2956
- "recharts-legend-item": true,
2957
- ["legend-item-".concat(i)]: true,
2958
- inactive: entry.inactive
2959
- });
2960
- if (entry.type === "none") return null;
2961
- var color = entry.inactive ? inactiveColor : entry.color;
2962
- var finalValue = finalFormatter ? finalFormatter(entry.value, entry, i) : entry.value;
2963
- return /* @__PURE__ */ react.createElement("li", _extends$1({
2964
- className,
2965
- style: itemStyle,
2966
- key: "legend-item-".concat(i)
2967
- }, require_trust_score_card_glass.adaptEventsOfChild(props, entry, i)), /* @__PURE__ */ react.createElement(require_trust_score_card_glass.Surface, {
2968
- width: iconSize,
2969
- height: iconSize,
2970
- viewBox,
2971
- style: svgStyle,
2972
- "aria-label": "".concat(finalValue, " legend icon")
2973
- }, /* @__PURE__ */ react.createElement(Icon, {
2974
- data: entry,
2975
- iconType,
2976
- inactiveColor
2977
- })), /* @__PURE__ */ react.createElement("span", {
2978
- className: "recharts-legend-item-text",
2979
- style: { color }
2980
- }, finalValue));
1683
+ });
1684
+ var ScrollAreaThumbImpl = react.forwardRef((props, forwardedRef) => {
1685
+ const { __scopeScrollArea, style, ...thumbProps } = props;
1686
+ const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);
1687
+ const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);
1688
+ const { onThumbPositionChange } = scrollbarContext;
1689
+ const composedRef = require_trust_score_card_glass.useComposedRefs(forwardedRef, (node) => scrollbarContext.onThumbChange(node));
1690
+ const removeUnlinkedScrollListenerRef = react.useRef(void 0);
1691
+ const debounceScrollEnd = useDebounceCallback(() => {
1692
+ if (removeUnlinkedScrollListenerRef.current) {
1693
+ removeUnlinkedScrollListenerRef.current();
1694
+ removeUnlinkedScrollListenerRef.current = void 0;
1695
+ }
1696
+ }, 100);
1697
+ react.useEffect(() => {
1698
+ const viewport = scrollAreaContext.viewport;
1699
+ if (viewport) {
1700
+ const handleScroll = () => {
1701
+ debounceScrollEnd();
1702
+ if (!removeUnlinkedScrollListenerRef.current) {
1703
+ removeUnlinkedScrollListenerRef.current = addUnlinkedScrollListener(viewport, onThumbPositionChange);
1704
+ onThumbPositionChange();
1705
+ }
1706
+ };
1707
+ onThumbPositionChange();
1708
+ viewport.addEventListener("scroll", handleScroll);
1709
+ return () => viewport.removeEventListener("scroll", handleScroll);
1710
+ }
1711
+ }, [
1712
+ scrollAreaContext.viewport,
1713
+ debounceScrollEnd,
1714
+ onThumbPositionChange
1715
+ ]);
1716
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
1717
+ "data-state": scrollbarContext.hasThumb ? "visible" : "hidden",
1718
+ ...thumbProps,
1719
+ ref: composedRef,
1720
+ style: {
1721
+ width: "var(--radix-scroll-area-thumb-width)",
1722
+ height: "var(--radix-scroll-area-thumb-height)",
1723
+ ...style
1724
+ },
1725
+ onPointerDownCapture: require_trust_score_card_glass.composeEventHandlers(props.onPointerDownCapture, (event) => {
1726
+ const thumbRect = event.target.getBoundingClientRect();
1727
+ const x = event.clientX - thumbRect.left;
1728
+ const y = event.clientY - thumbRect.top;
1729
+ scrollbarContext.onThumbPointerDown({
1730
+ x,
1731
+ y
1732
+ });
1733
+ }),
1734
+ onPointerUp: require_trust_score_card_glass.composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)
2981
1735
  });
2982
- }
2983
- var DefaultLegendContent = (outsideProps) => {
2984
- var props = require_trust_score_card_glass.resolveDefaultProps(outsideProps, defaultLegendContentDefaultProps);
2985
- var { payload, layout, align } = props;
2986
- if (!payload || !payload.length) return null;
2987
- var finalStyle = {
2988
- padding: 0,
2989
- margin: 0,
2990
- textAlign: layout === "horizontal" ? align : "left"
2991
- };
2992
- return /* @__PURE__ */ react.createElement("ul", {
2993
- className: "recharts-default-legend",
2994
- style: finalStyle
2995
- }, /* @__PURE__ */ react.createElement(Items, _extends$1({}, props, { payload })));
2996
- };
2997
- function useLegendPayload() {
2998
- return require_trust_score_card_glass.useAppSelector(require_trust_score_card_glass.selectLegendPayload);
2999
- }
3000
- var _excluded = ["contextPayload"];
3001
- function _extends() {
3002
- return _extends = Object.assign ? Object.assign.bind() : function(n) {
3003
- for (var e = 1; e < arguments.length; e++) {
3004
- var t = arguments[e];
3005
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
1736
+ });
1737
+ ScrollAreaThumb.displayName = THUMB_NAME;
1738
+ var CORNER_NAME = "ScrollAreaCorner";
1739
+ var ScrollAreaCorner = react.forwardRef((props, forwardedRef) => {
1740
+ const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea);
1741
+ const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);
1742
+ return context.type !== "scroll" && hasBothScrollbarsVisible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollAreaCornerImpl, {
1743
+ ...props,
1744
+ ref: forwardedRef
1745
+ }) : null;
1746
+ });
1747
+ ScrollAreaCorner.displayName = CORNER_NAME;
1748
+ var ScrollAreaCornerImpl = react.forwardRef((props, forwardedRef) => {
1749
+ const { __scopeScrollArea, ...cornerProps } = props;
1750
+ const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea);
1751
+ const [width, setWidth] = react.useState(0);
1752
+ const [height, setHeight] = react.useState(0);
1753
+ const hasSize = Boolean(width && height);
1754
+ useResizeObserver(context.scrollbarX, () => {
1755
+ const height2 = context.scrollbarX?.offsetHeight || 0;
1756
+ context.onCornerHeightChange(height2);
1757
+ setHeight(height2);
1758
+ });
1759
+ useResizeObserver(context.scrollbarY, () => {
1760
+ const width2 = context.scrollbarY?.offsetWidth || 0;
1761
+ context.onCornerWidthChange(width2);
1762
+ setWidth(width2);
1763
+ });
1764
+ return hasSize ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Primitive.div, {
1765
+ ...cornerProps,
1766
+ ref: forwardedRef,
1767
+ style: {
1768
+ width,
1769
+ height,
1770
+ position: "absolute",
1771
+ right: context.dir === "ltr" ? 0 : void 0,
1772
+ left: context.dir === "rtl" ? 0 : void 0,
1773
+ bottom: 0,
1774
+ ...props.style
3006
1775
  }
3007
- return n;
3008
- }, _extends.apply(null, arguments);
3009
- }
3010
- function ownKeys(e, r) {
3011
- var t = Object.keys(e);
3012
- if (Object.getOwnPropertySymbols) {
3013
- var o = Object.getOwnPropertySymbols(e);
3014
- r && (o = o.filter(function(r$1) {
3015
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
3016
- })), t.push.apply(t, o);
3017
- }
3018
- return t;
3019
- }
3020
- function _objectSpread(e) {
3021
- for (var r = 1; r < arguments.length; r++) {
3022
- var t = null != arguments[r] ? arguments[r] : {};
3023
- r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
3024
- _defineProperty(e, r$1, t[r$1]);
3025
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
3026
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
3027
- });
3028
- }
3029
- return e;
3030
- }
3031
- function _defineProperty(e, r, t) {
3032
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
3033
- value: t,
3034
- enumerable: !0,
3035
- configurable: !0,
3036
- writable: !0
3037
- }) : e[r] = t, e;
3038
- }
3039
- function _toPropertyKey(t) {
3040
- var i = _toPrimitive(t, "string");
3041
- return "symbol" == typeof i ? i : i + "";
3042
- }
3043
- function _toPrimitive(t, r) {
3044
- if ("object" != typeof t || !t) return t;
3045
- var e = t[Symbol.toPrimitive];
3046
- if (void 0 !== e) {
3047
- var i = e.call(t, r || "default");
3048
- if ("object" != typeof i) return i;
3049
- throw new TypeError("@@toPrimitive must return a primitive value.");
3050
- }
3051
- return ("string" === r ? String : Number)(t);
1776
+ }) : null;
1777
+ });
1778
+ function toInt(value) {
1779
+ return value ? parseInt(value, 10) : 0;
3052
1780
  }
3053
- function _objectWithoutProperties(e, t) {
3054
- if (null == e) return {};
3055
- var o, r, i = _objectWithoutPropertiesLoose(e, t);
3056
- if (Object.getOwnPropertySymbols) {
3057
- var n = Object.getOwnPropertySymbols(e);
3058
- for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
3059
- }
3060
- return i;
1781
+ function getThumbRatio(viewportSize, contentSize) {
1782
+ const ratio = viewportSize / contentSize;
1783
+ return isNaN(ratio) ? 0 : ratio;
3061
1784
  }
3062
- function _objectWithoutPropertiesLoose(r, e) {
3063
- if (null == r) return {};
3064
- var t = {};
3065
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
3066
- if (-1 !== e.indexOf(n)) continue;
3067
- t[n] = r[n];
3068
- }
3069
- return t;
1785
+ function getThumbSize(sizes) {
1786
+ const ratio = getThumbRatio(sizes.viewport, sizes.content);
1787
+ const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
1788
+ const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;
1789
+ return Math.max(thumbSize, 18);
3070
1790
  }
3071
- function defaultUniqBy(entry) {
3072
- return entry.value;
1791
+ function getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = "ltr") {
1792
+ const thumbSizePx = getThumbSize(sizes);
1793
+ const thumbCenter = thumbSizePx / 2;
1794
+ const offset = pointerOffset || thumbCenter;
1795
+ const thumbOffsetFromEnd = thumbSizePx - offset;
1796
+ const minPointerPos = sizes.scrollbar.paddingStart + offset;
1797
+ const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;
1798
+ const maxScrollPos = sizes.content - sizes.viewport;
1799
+ const scrollRange = dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];
1800
+ return linearScale([minPointerPos, maxPointerPos], scrollRange)(pointerPos);
3073
1801
  }
3074
- function LegendContent(props) {
3075
- var { contextPayload } = props, otherProps = _objectWithoutProperties(props, _excluded);
3076
- var finalPayload = require_trust_score_card_glass.getUniqPayload(contextPayload, props.payloadUniqBy, defaultUniqBy);
3077
- var contentProps = _objectSpread(_objectSpread({}, otherProps), {}, { payload: finalPayload });
3078
- if (/* @__PURE__ */ react.isValidElement(props.content)) return /* @__PURE__ */ react.cloneElement(props.content, contentProps);
3079
- if (typeof props.content === "function") return /* @__PURE__ */ react.createElement(props.content, contentProps);
3080
- return /* @__PURE__ */ react.createElement(DefaultLegendContent, contentProps);
1802
+ function getThumbOffsetFromScroll(scrollPos, sizes, dir = "ltr") {
1803
+ const thumbSizePx = getThumbSize(sizes);
1804
+ const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;
1805
+ const scrollbar = sizes.scrollbar.size - scrollbarPadding;
1806
+ const maxScrollPos = sizes.content - sizes.viewport;
1807
+ const maxThumbPos = scrollbar - thumbSizePx;
1808
+ const scrollWithoutMomentum = require_trust_score_card_glass.clamp(scrollPos, dir === "ltr" ? [0, maxScrollPos] : [maxScrollPos * -1, 0]);
1809
+ return linearScale([0, maxScrollPos], [0, maxThumbPos])(scrollWithoutMomentum);
3081
1810
  }
3082
- function getDefaultPosition(style, props, margin, chartWidth, chartHeight, box) {
3083
- var { layout, align, verticalAlign } = props;
3084
- var hPos, vPos;
3085
- if (!style || (style.left === void 0 || style.left === null) && (style.right === void 0 || style.right === null)) if (align === "center" && layout === "vertical") hPos = { left: ((chartWidth || 0) - box.width) / 2 };
3086
- else hPos = align === "right" ? { right: margin && margin.right || 0 } : { left: margin && margin.left || 0 };
3087
- if (!style || (style.top === void 0 || style.top === null) && (style.bottom === void 0 || style.bottom === null)) if (verticalAlign === "middle") vPos = { top: ((chartHeight || 0) - box.height) / 2 };
3088
- else vPos = verticalAlign === "bottom" ? { bottom: margin && margin.bottom || 0 } : { top: margin && margin.top || 0 };
3089
- return _objectSpread(_objectSpread({}, hPos), vPos);
1811
+ function linearScale(input, output) {
1812
+ return (value) => {
1813
+ if (input[0] === input[1] || output[0] === output[1]) return output[0];
1814
+ const ratio = (output[1] - output[0]) / (input[1] - input[0]);
1815
+ return output[0] + ratio * (value - input[0]);
1816
+ };
3090
1817
  }
3091
- function LegendSettingsDispatcher(props) {
3092
- var dispatch = require_trust_score_card_glass.useAppDispatch();
3093
- (0, react.useEffect)(() => {
3094
- dispatch(require_trust_score_card_glass.setLegendSettings(props));
3095
- }, [dispatch, props]);
3096
- return null;
1818
+ function isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {
1819
+ return scrollPos > 0 && scrollPos < maxScrollPos;
3097
1820
  }
3098
- function LegendSizeDispatcher(props) {
3099
- var dispatch = require_trust_score_card_glass.useAppDispatch();
3100
- (0, react.useEffect)(() => {
3101
- dispatch(require_trust_score_card_glass.setLegendSize(props));
3102
- return () => {
3103
- dispatch(require_trust_score_card_glass.setLegendSize({
3104
- width: 0,
3105
- height: 0
3106
- }));
1821
+ var addUnlinkedScrollListener = (node, handler = () => {}) => {
1822
+ let prevPosition = {
1823
+ left: node.scrollLeft,
1824
+ top: node.scrollTop
1825
+ };
1826
+ let rAF = 0;
1827
+ (function loop() {
1828
+ const position = {
1829
+ left: node.scrollLeft,
1830
+ top: node.scrollTop
3107
1831
  };
3108
- }, [dispatch, props]);
3109
- return null;
3110
- }
3111
- function getWidthOrHeight(layout, height, width, maxWidth) {
3112
- if (layout === "vertical" && require_trust_score_card_glass.isNumber(height)) return { height };
3113
- if (layout === "horizontal") return { width: width || maxWidth };
3114
- return null;
3115
- }
3116
- var legendDefaultProps = {
3117
- align: "center",
3118
- iconSize: 14,
3119
- itemSorter: "value",
3120
- layout: "horizontal",
3121
- verticalAlign: "bottom"
1832
+ const isHorizontalScroll = prevPosition.left !== position.left;
1833
+ const isVerticalScroll = prevPosition.top !== position.top;
1834
+ if (isHorizontalScroll || isVerticalScroll) handler();
1835
+ prevPosition = position;
1836
+ rAF = window.requestAnimationFrame(loop);
1837
+ })();
1838
+ return () => window.cancelAnimationFrame(rAF);
3122
1839
  };
3123
- function Legend(outsideProps) {
3124
- var props = require_trust_score_card_glass.resolveDefaultProps(outsideProps, legendDefaultProps);
3125
- var contextPayload = useLegendPayload();
3126
- var legendPortalFromContext = require_trust_score_card_glass.useLegendPortal();
3127
- var margin = require_trust_score_card_glass.useMargin();
3128
- var { width: widthFromProps, height: heightFromProps, wrapperStyle, portal: portalFromProps } = props;
3129
- var [lastBoundingBox, updateBoundingBox] = require_trust_score_card_glass.useElementOffset([contextPayload]);
3130
- var chartWidth = require_trust_score_card_glass.useChartWidth();
3131
- var chartHeight = require_trust_score_card_glass.useChartHeight();
3132
- if (chartWidth == null || chartHeight == null) return null;
3133
- var maxWidth = chartWidth - ((margin === null || margin === void 0 ? void 0 : margin.left) || 0) - ((margin === null || margin === void 0 ? void 0 : margin.right) || 0);
3134
- var widthOrHeight = getWidthOrHeight(props.layout, heightFromProps, widthFromProps, maxWidth);
3135
- var outerStyle = portalFromProps ? wrapperStyle : _objectSpread(_objectSpread({
3136
- position: "absolute",
3137
- width: (widthOrHeight === null || widthOrHeight === void 0 ? void 0 : widthOrHeight.width) || widthFromProps || "auto",
3138
- height: (widthOrHeight === null || widthOrHeight === void 0 ? void 0 : widthOrHeight.height) || heightFromProps || "auto"
3139
- }, getDefaultPosition(wrapperStyle, props, margin, chartWidth, chartHeight, lastBoundingBox)), wrapperStyle);
3140
- var legendPortal = portalFromProps !== null && portalFromProps !== void 0 ? portalFromProps : legendPortalFromContext;
3141
- if (legendPortal == null || contextPayload == null) return null;
3142
- return /* @__PURE__ */ (0, react_dom.createPortal)(/* @__PURE__ */ react.createElement("div", {
3143
- className: "recharts-legend-wrapper",
3144
- style: outerStyle,
3145
- ref: updateBoundingBox
3146
- }, /* @__PURE__ */ react.createElement(LegendSettingsDispatcher, {
3147
- layout: props.layout,
3148
- align: props.align,
3149
- verticalAlign: props.verticalAlign,
3150
- itemSorter: props.itemSorter
3151
- }), !portalFromProps && /* @__PURE__ */ react.createElement(LegendSizeDispatcher, {
3152
- width: lastBoundingBox.width,
3153
- height: lastBoundingBox.height
3154
- }), /* @__PURE__ */ react.createElement(LegendContent, _extends({}, props, widthOrHeight, {
3155
- margin,
3156
- chartWidth,
3157
- chartHeight,
3158
- contextPayload
3159
- }))), legendPortal);
1840
+ function useDebounceCallback(callback, delay) {
1841
+ const handleCallback = require_trust_score_card_glass.useCallbackRef(callback);
1842
+ const debounceTimerRef = react.useRef(0);
1843
+ react.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);
1844
+ return react.useCallback(() => {
1845
+ window.clearTimeout(debounceTimerRef.current);
1846
+ debounceTimerRef.current = window.setTimeout(handleCallback, delay);
1847
+ }, [handleCallback, delay]);
3160
1848
  }
3161
- Legend.displayName = "Legend";
1849
+ function useResizeObserver(element, onResize) {
1850
+ const handleResize = require_trust_score_card_glass.useCallbackRef(onResize);
1851
+ require_trust_score_card_glass.useLayoutEffect2(() => {
1852
+ let rAF = 0;
1853
+ if (element) {
1854
+ const resizeObserver = new ResizeObserver(() => {
1855
+ cancelAnimationFrame(rAF);
1856
+ rAF = window.requestAnimationFrame(handleResize);
1857
+ });
1858
+ resizeObserver.observe(element);
1859
+ return () => {
1860
+ window.cancelAnimationFrame(rAF);
1861
+ resizeObserver.unobserve(element);
1862
+ };
1863
+ }
1864
+ }, [element, handleResize]);
1865
+ }
1866
+ var Root = ScrollArea$1;
1867
+ var Viewport = ScrollAreaViewport;
1868
+ var Corner = ScrollAreaCorner;
3162
1869
  function ScrollArea({ className, children, ...props }) {
3163
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root$1, {
1870
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, {
3164
1871
  "data-slot": "scroll-area",
3165
1872
  className: require_utils.cn("relative", className),
3166
1873
  ...props,
@@ -3867,10 +2574,6 @@ exports.ChartTooltipContent = ChartTooltipContent;
3867
2574
  exports.CheckboxGlass = require_trust_score_card_glass.CheckboxGlass;
3868
2575
  exports.CircularMetricGlass = require_trust_score_card_glass.CircularMetricGlass;
3869
2576
  exports.CircularProgressGlass = require_trust_score_card_glass.CircularProgressGlass;
3870
- exports.CollapsibleGlass = CollapsibleGlass;
3871
- exports.CollapsibleGlassContent = CollapsibleGlassContent;
3872
- exports.CollapsibleGlassRoot = CollapsibleGlassRoot;
3873
- exports.CollapsibleGlassTrigger = CollapsibleGlassTrigger;
3874
2577
  exports.ComboBoxGlass = require_trust_score_card_glass.ComboBoxGlass;
3875
2578
  exports.ContributionMetricsGlass = require_trust_score_card_glass.ContributionMetricsGlass;
3876
2579
  exports.DropdownGlass = require_trust_score_card_glass.DropdownGlass;
@@ -3894,12 +2597,6 @@ exports.FlagAlertGlass = require_trust_score_card_glass.FlagAlertGlass;
3894
2597
  exports.FlagsSectionGlass = require_trust_score_card_glass.FlagsSectionGlass;
3895
2598
  exports.FormFieldWrapper = require_trust_score_card_glass.FormFieldWrapper;
3896
2599
  exports.GlassCard = require_trust_score_card_glass.GlassCard;
3897
- exports.GlassCardAction = require_trust_score_card_glass.GlassCardAction;
3898
- exports.GlassCardContent = require_trust_score_card_glass.GlassCardContent;
3899
- exports.GlassCardDescription = require_trust_score_card_glass.GlassCardDescription;
3900
- exports.GlassCardFooter = require_trust_score_card_glass.GlassCardFooter;
3901
- exports.GlassCardHeader = require_trust_score_card_glass.GlassCardHeader;
3902
- exports.GlassCardTitle = require_trust_score_card_glass.GlassCardTitle;
3903
2600
  exports.HeaderBrandingGlass = require_trust_score_card_glass.HeaderBrandingGlass;
3904
2601
  exports.HeaderNavGlass = require_trust_score_card_glass.HeaderNavGlass;
3905
2602
  exports.IconButtonGlass = require_trust_score_card_glass.IconButtonGlass;
@@ -3920,30 +2617,13 @@ exports.ProfileAvatarGlass = require_trust_score_card_glass.ProfileAvatarGlass;
3920
2617
  exports.ProfileHeaderGlass = require_trust_score_card_glass.ProfileHeaderGlass;
3921
2618
  exports.ProgressGlass = require_trust_score_card_glass.ProgressGlass;
3922
2619
  exports.ProjectsListGlass = require_trust_score_card_glass.ProjectsListGlass;
3923
- exports.RadioGroupGlass = RadioGroupGlass;
3924
- exports.RadioGroupGlassItem = RadioGroupGlassItem;
3925
- exports.RadioGroupGlassRoot = RadioGroupGlassRoot;
3926
2620
  exports.RainbowProgressGlass = require_trust_score_card_glass.RainbowProgressGlass;
3927
2621
  exports.RepositoryCardGlass = require_trust_score_card_glass.RepositoryCardGlass;
3928
2622
  exports.RepositoryHeaderGlass = require_trust_score_card_glass.RepositoryHeaderGlass;
3929
2623
  exports.RepositoryMetadataGlass = require_trust_score_card_glass.RepositoryMetadataGlass;
3930
2624
  exports.ResponsiveContainer = require_trust_score_card_glass.ResponsiveContainer;
3931
- exports.ScrollAreaGlass = ScrollAreaGlass;
3932
- exports.ScrollBarGlass = ScrollBarGlass;
3933
2625
  exports.SearchBoxGlass = require_trust_score_card_glass.SearchBoxGlass;
3934
2626
  exports.SegmentedControlGlass = require_trust_score_card_glass.SegmentedControlGlass;
3935
- exports.SeparatorGlass = SeparatorGlass;
3936
- exports.SheetGlass = SheetGlass;
3937
- exports.SheetGlassClose = SheetGlassClose;
3938
- exports.SheetGlassContent = SheetGlassContent;
3939
- exports.SheetGlassDescription = SheetGlassDescription;
3940
- exports.SheetGlassFooter = SheetGlassFooter;
3941
- exports.SheetGlassHeader = SheetGlassHeader;
3942
- exports.SheetGlassOverlay = SheetGlassOverlay;
3943
- exports.SheetGlassPortal = SheetGlassPortal;
3944
- exports.SheetGlassRoot = SheetGlassRoot;
3945
- exports.SheetGlassTitle = SheetGlassTitle;
3946
- exports.SheetGlassTrigger = SheetGlassTrigger;
3947
2627
  exports.SidebarGlass = SidebarGlass;
3948
2628
  exports.SkeletonGlass = require_trust_score_card_glass.SkeletonGlass;
3949
2629
  exports.SliderGlass = require_trust_score_card_glass.SliderGlass;
@@ -3960,9 +2640,6 @@ exports.TabsGlass = require_trust_score_card_glass.TabsGlass;
3960
2640
  exports.ThemeProvider = require_theme_context.ThemeProvider;
3961
2641
  exports.ThemeToggleGlass = require_trust_score_card_glass.ThemeToggleGlass;
3962
2642
  exports.ToggleGlass = require_trust_score_card_glass.ToggleGlass;
3963
- exports.ToggleGroupGlass = ToggleGroupGlass;
3964
- exports.ToggleGroupGlassItem = ToggleGroupGlassItem;
3965
- exports.ToggleGroupGlassRoot = ToggleGroupGlassRoot;
3966
2643
  exports.TooltipGlass = require_trust_score_card_glass.TooltipGlass;
3967
2644
  exports.TooltipGlassContent = require_trust_score_card_glass.TooltipGlassContent;
3968
2645
  exports.TooltipGlassProvider = require_trust_score_card_glass.TooltipGlassProvider;