dp-widgets-framework 1.7.6 → 1.7.8

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 (3) hide show
  1. package/dist/index.esm.js +2025 -884
  2. package/dist/index.js +2025 -883
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var runtimeClientGql = require('@copilotkit/runtime-client-gql');
20
20
  var reactCore = require('@copilotkit/react-core');
21
21
  var jsPDF = require('jspdf');
22
22
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
23
+ var SliderPrimitive = require('@radix-ui/react-slider');
23
24
  var DialogPrimitive = require('@radix-ui/react-dialog');
24
25
  var dateFns = require('date-fns');
25
26
 
@@ -48,6 +49,7 @@ var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(SelectPri
48
49
  var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(ScrollAreaPrimitive);
49
50
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOM);
50
51
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(CheckboxPrimitive);
52
+ var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(SliderPrimitive);
51
53
  var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
52
54
 
53
55
  function getDefaultExportFromCjs (x) {
@@ -1457,40 +1459,40 @@ const KEYS = {
1457
1459
  ESCAPE: "Escape",
1458
1460
  TAB: "Tab"};
1459
1461
 
1460
- var __defProp$q = Object.defineProperty;
1461
- var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
1462
- var __hasOwnProp$q = Object.prototype.hasOwnProperty;
1463
- var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
1464
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1465
- var __spreadValues$q = (a, b) => {
1462
+ var __defProp$u = Object.defineProperty;
1463
+ var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
1464
+ var __hasOwnProp$u = Object.prototype.hasOwnProperty;
1465
+ var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
1466
+ var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1467
+ var __spreadValues$u = (a, b) => {
1466
1468
  for (var prop in b || (b = {}))
1467
- if (__hasOwnProp$q.call(b, prop))
1468
- __defNormalProp$q(a, prop, b[prop]);
1469
- if (__getOwnPropSymbols$q)
1470
- for (var prop of __getOwnPropSymbols$q(b)) {
1471
- if (__propIsEnum$q.call(b, prop))
1472
- __defNormalProp$q(a, prop, b[prop]);
1469
+ if (__hasOwnProp$u.call(b, prop))
1470
+ __defNormalProp$u(a, prop, b[prop]);
1471
+ if (__getOwnPropSymbols$u)
1472
+ for (var prop of __getOwnPropSymbols$u(b)) {
1473
+ if (__propIsEnum$u.call(b, prop))
1474
+ __defNormalProp$u(a, prop, b[prop]);
1473
1475
  }
1474
1476
  return a;
1475
1477
  };
1476
- var __objRest$d = (source, exclude) => {
1478
+ var __objRest$e = (source, exclude) => {
1477
1479
  var target = {};
1478
1480
  for (var prop in source)
1479
- if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
1481
+ if (__hasOwnProp$u.call(source, prop) && exclude.indexOf(prop) < 0)
1480
1482
  target[prop] = source[prop];
1481
- if (source != null && __getOwnPropSymbols$q)
1482
- for (var prop of __getOwnPropSymbols$q(source)) {
1483
- if (exclude.indexOf(prop) < 0 && __propIsEnum$q.call(source, prop))
1483
+ if (source != null && __getOwnPropSymbols$u)
1484
+ for (var prop of __getOwnPropSymbols$u(source)) {
1485
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$u.call(source, prop))
1484
1486
  target[prop] = source[prop];
1485
1487
  }
1486
1488
  return target;
1487
1489
  };
1488
1490
  const Tabs = TabsPrimitive__namespace.Root;
1489
1491
  const TabsList = React__namespace.forwardRef((_a, ref) => {
1490
- var _b = _a, { className } = _b, props = __objRest$d(_b, ["className"]);
1492
+ var _b = _a, { className } = _b, props = __objRest$e(_b, ["className"]);
1491
1493
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1492
1494
  TabsPrimitive__namespace.List,
1493
- __spreadValues$q({
1495
+ __spreadValues$u({
1494
1496
  ref,
1495
1497
  className: cn(
1496
1498
  "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
@@ -1501,10 +1503,10 @@ const TabsList = React__namespace.forwardRef((_a, ref) => {
1501
1503
  });
1502
1504
  TabsList.displayName = TabsPrimitive__namespace.List.displayName;
1503
1505
  const TabsTrigger = React__namespace.forwardRef((_c, ref) => {
1504
- var _d = _c, { className } = _d, props = __objRest$d(_d, ["className"]);
1506
+ var _d = _c, { className } = _d, props = __objRest$e(_d, ["className"]);
1505
1507
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1506
1508
  TabsPrimitive__namespace.Trigger,
1507
- __spreadValues$q({
1509
+ __spreadValues$u({
1508
1510
  ref,
1509
1511
  className: cn(
1510
1512
  "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
@@ -1515,10 +1517,10 @@ const TabsTrigger = React__namespace.forwardRef((_c, ref) => {
1515
1517
  });
1516
1518
  TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
1517
1519
  const TabsContent = React__namespace.forwardRef((_e, ref) => {
1518
- var _f = _e, { className } = _f, props = __objRest$d(_f, ["className"]);
1520
+ var _f = _e, { className } = _f, props = __objRest$e(_f, ["className"]);
1519
1521
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1520
1522
  TabsPrimitive__namespace.Content,
1521
- __spreadValues$q({
1523
+ __spreadValues$u({
1522
1524
  ref,
1523
1525
  className: cn(
1524
1526
  "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
@@ -1529,40 +1531,40 @@ const TabsContent = React__namespace.forwardRef((_e, ref) => {
1529
1531
  });
1530
1532
  TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
1531
1533
 
1532
- var __defProp$p = Object.defineProperty;
1533
- var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
1534
- var __hasOwnProp$p = Object.prototype.hasOwnProperty;
1535
- var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
1536
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1537
- var __spreadValues$p = (a, b) => {
1534
+ var __defProp$t = Object.defineProperty;
1535
+ var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
1536
+ var __hasOwnProp$t = Object.prototype.hasOwnProperty;
1537
+ var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
1538
+ var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1539
+ var __spreadValues$t = (a, b) => {
1538
1540
  for (var prop in b || (b = {}))
1539
- if (__hasOwnProp$p.call(b, prop))
1540
- __defNormalProp$p(a, prop, b[prop]);
1541
- if (__getOwnPropSymbols$p)
1542
- for (var prop of __getOwnPropSymbols$p(b)) {
1543
- if (__propIsEnum$p.call(b, prop))
1544
- __defNormalProp$p(a, prop, b[prop]);
1541
+ if (__hasOwnProp$t.call(b, prop))
1542
+ __defNormalProp$t(a, prop, b[prop]);
1543
+ if (__getOwnPropSymbols$t)
1544
+ for (var prop of __getOwnPropSymbols$t(b)) {
1545
+ if (__propIsEnum$t.call(b, prop))
1546
+ __defNormalProp$t(a, prop, b[prop]);
1545
1547
  }
1546
1548
  return a;
1547
1549
  };
1548
- var __objRest$c = (source, exclude) => {
1550
+ var __objRest$d = (source, exclude) => {
1549
1551
  var target = {};
1550
1552
  for (var prop in source)
1551
- if (__hasOwnProp$p.call(source, prop) && exclude.indexOf(prop) < 0)
1553
+ if (__hasOwnProp$t.call(source, prop) && exclude.indexOf(prop) < 0)
1552
1554
  target[prop] = source[prop];
1553
- if (source != null && __getOwnPropSymbols$p)
1554
- for (var prop of __getOwnPropSymbols$p(source)) {
1555
- if (exclude.indexOf(prop) < 0 && __propIsEnum$p.call(source, prop))
1555
+ if (source != null && __getOwnPropSymbols$t)
1556
+ for (var prop of __getOwnPropSymbols$t(source)) {
1557
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$t.call(source, prop))
1556
1558
  target[prop] = source[prop];
1557
1559
  }
1558
1560
  return target;
1559
1561
  };
1560
1562
  const Input = React__namespace.forwardRef(
1561
1563
  (_a, ref) => {
1562
- var _b = _a, { className, type } = _b, props = __objRest$c(_b, ["className", "type"]);
1564
+ var _b = _a, { className, type } = _b, props = __objRest$d(_b, ["className", "type"]);
1563
1565
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1564
1566
  "input",
1565
- __spreadValues$p({
1567
+ __spreadValues$t({
1566
1568
  type,
1567
1569
  className: cn(
1568
1570
  "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
@@ -1575,30 +1577,30 @@ const Input = React__namespace.forwardRef(
1575
1577
  );
1576
1578
  Input.displayName = "Input";
1577
1579
 
1578
- var __defProp$o = Object.defineProperty;
1579
- var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
1580
- var __hasOwnProp$o = Object.prototype.hasOwnProperty;
1581
- var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
1582
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1583
- var __spreadValues$o = (a, b) => {
1580
+ var __defProp$s = Object.defineProperty;
1581
+ var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
1582
+ var __hasOwnProp$s = Object.prototype.hasOwnProperty;
1583
+ var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
1584
+ var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1585
+ var __spreadValues$s = (a, b) => {
1584
1586
  for (var prop in b || (b = {}))
1585
- if (__hasOwnProp$o.call(b, prop))
1586
- __defNormalProp$o(a, prop, b[prop]);
1587
- if (__getOwnPropSymbols$o)
1588
- for (var prop of __getOwnPropSymbols$o(b)) {
1589
- if (__propIsEnum$o.call(b, prop))
1590
- __defNormalProp$o(a, prop, b[prop]);
1587
+ if (__hasOwnProp$s.call(b, prop))
1588
+ __defNormalProp$s(a, prop, b[prop]);
1589
+ if (__getOwnPropSymbols$s)
1590
+ for (var prop of __getOwnPropSymbols$s(b)) {
1591
+ if (__propIsEnum$s.call(b, prop))
1592
+ __defNormalProp$s(a, prop, b[prop]);
1591
1593
  }
1592
1594
  return a;
1593
1595
  };
1594
- var __objRest$b = (source, exclude) => {
1596
+ var __objRest$c = (source, exclude) => {
1595
1597
  var target = {};
1596
1598
  for (var prop in source)
1597
- if (__hasOwnProp$o.call(source, prop) && exclude.indexOf(prop) < 0)
1599
+ if (__hasOwnProp$s.call(source, prop) && exclude.indexOf(prop) < 0)
1598
1600
  target[prop] = source[prop];
1599
- if (source != null && __getOwnPropSymbols$o)
1600
- for (var prop of __getOwnPropSymbols$o(source)) {
1601
- if (exclude.indexOf(prop) < 0 && __propIsEnum$o.call(source, prop))
1601
+ if (source != null && __getOwnPropSymbols$s)
1602
+ for (var prop of __getOwnPropSymbols$s(source)) {
1603
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$s.call(source, prop))
1602
1604
  target[prop] = source[prop];
1603
1605
  }
1604
1606
  return target;
@@ -1607,10 +1609,10 @@ const labelVariants = classVarianceAuthority.cva(
1607
1609
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1608
1610
  );
1609
1611
  const Label$1 = React__namespace.forwardRef((_a, ref) => {
1610
- var _b = _a, { className } = _b, props = __objRest$b(_b, ["className"]);
1612
+ var _b = _a, { className } = _b, props = __objRest$c(_b, ["className"]);
1611
1613
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1612
1614
  LabelPrimitive__namespace.Root,
1613
- __spreadValues$o({
1615
+ __spreadValues$s({
1614
1616
  ref,
1615
1617
  className: cn(labelVariants(), className)
1616
1618
  }, props)
@@ -1618,42 +1620,42 @@ const Label$1 = React__namespace.forwardRef((_a, ref) => {
1618
1620
  });
1619
1621
  Label$1.displayName = LabelPrimitive__namespace.Root.displayName;
1620
1622
 
1621
- var __defProp$n = Object.defineProperty;
1622
- var __defProps$g = Object.defineProperties;
1623
- var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
1624
- var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
1625
- var __hasOwnProp$n = Object.prototype.hasOwnProperty;
1626
- var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
1627
- var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1628
- var __spreadValues$n = (a, b) => {
1623
+ var __defProp$r = Object.defineProperty;
1624
+ var __defProps$k = Object.defineProperties;
1625
+ var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
1626
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
1627
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
1628
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
1629
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1630
+ var __spreadValues$r = (a, b) => {
1629
1631
  for (var prop in b || (b = {}))
1630
- if (__hasOwnProp$n.call(b, prop))
1631
- __defNormalProp$n(a, prop, b[prop]);
1632
- if (__getOwnPropSymbols$n)
1633
- for (var prop of __getOwnPropSymbols$n(b)) {
1634
- if (__propIsEnum$n.call(b, prop))
1635
- __defNormalProp$n(a, prop, b[prop]);
1632
+ if (__hasOwnProp$r.call(b, prop))
1633
+ __defNormalProp$r(a, prop, b[prop]);
1634
+ if (__getOwnPropSymbols$r)
1635
+ for (var prop of __getOwnPropSymbols$r(b)) {
1636
+ if (__propIsEnum$r.call(b, prop))
1637
+ __defNormalProp$r(a, prop, b[prop]);
1636
1638
  }
1637
1639
  return a;
1638
1640
  };
1639
- var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
1640
- var __objRest$a = (source, exclude) => {
1641
+ var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
1642
+ var __objRest$b = (source, exclude) => {
1641
1643
  var target = {};
1642
1644
  for (var prop in source)
1643
- if (__hasOwnProp$n.call(source, prop) && exclude.indexOf(prop) < 0)
1645
+ if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
1644
1646
  target[prop] = source[prop];
1645
- if (source != null && __getOwnPropSymbols$n)
1646
- for (var prop of __getOwnPropSymbols$n(source)) {
1647
- if (exclude.indexOf(prop) < 0 && __propIsEnum$n.call(source, prop))
1647
+ if (source != null && __getOwnPropSymbols$r)
1648
+ for (var prop of __getOwnPropSymbols$r(source)) {
1649
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$r.call(source, prop))
1648
1650
  target[prop] = source[prop];
1649
1651
  }
1650
1652
  return target;
1651
1653
  };
1652
1654
  const Switch = React__namespace.forwardRef((_a, ref) => {
1653
- var _b = _a, { className } = _b, props = __objRest$a(_b, ["className"]);
1655
+ var _b = _a, { className } = _b, props = __objRest$b(_b, ["className"]);
1654
1656
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1655
1657
  SwitchPrimitives__namespace.Root,
1656
- __spreadProps$g(__spreadValues$n({
1658
+ __spreadProps$k(__spreadValues$r({
1657
1659
  className: cn(
1658
1660
  "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
1659
1661
  className
@@ -1673,33 +1675,33 @@ const Switch = React__namespace.forwardRef((_a, ref) => {
1673
1675
  });
1674
1676
  Switch.displayName = SwitchPrimitives__namespace.Root.displayName;
1675
1677
 
1676
- var __defProp$m = Object.defineProperty;
1677
- var __defProps$f = Object.defineProperties;
1678
- var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
1679
- var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
1680
- var __hasOwnProp$m = Object.prototype.hasOwnProperty;
1681
- var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
1682
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1683
- var __spreadValues$m = (a, b) => {
1678
+ var __defProp$q = Object.defineProperty;
1679
+ var __defProps$j = Object.defineProperties;
1680
+ var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
1681
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
1682
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
1683
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
1684
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1685
+ var __spreadValues$q = (a, b) => {
1684
1686
  for (var prop in b || (b = {}))
1685
- if (__hasOwnProp$m.call(b, prop))
1686
- __defNormalProp$m(a, prop, b[prop]);
1687
- if (__getOwnPropSymbols$m)
1688
- for (var prop of __getOwnPropSymbols$m(b)) {
1689
- if (__propIsEnum$m.call(b, prop))
1690
- __defNormalProp$m(a, prop, b[prop]);
1687
+ if (__hasOwnProp$q.call(b, prop))
1688
+ __defNormalProp$q(a, prop, b[prop]);
1689
+ if (__getOwnPropSymbols$q)
1690
+ for (var prop of __getOwnPropSymbols$q(b)) {
1691
+ if (__propIsEnum$q.call(b, prop))
1692
+ __defNormalProp$q(a, prop, b[prop]);
1691
1693
  }
1692
1694
  return a;
1693
1695
  };
1694
- var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
1695
- var __objRest$9 = (source, exclude) => {
1696
+ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
1697
+ var __objRest$a = (source, exclude) => {
1696
1698
  var target = {};
1697
1699
  for (var prop in source)
1698
- if (__hasOwnProp$m.call(source, prop) && exclude.indexOf(prop) < 0)
1700
+ if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
1699
1701
  target[prop] = source[prop];
1700
- if (source != null && __getOwnPropSymbols$m)
1701
- for (var prop of __getOwnPropSymbols$m(source)) {
1702
- if (exclude.indexOf(prop) < 0 && __propIsEnum$m.call(source, prop))
1702
+ if (source != null && __getOwnPropSymbols$q)
1703
+ for (var prop of __getOwnPropSymbols$q(source)) {
1704
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$q.call(source, prop))
1703
1705
  target[prop] = source[prop];
1704
1706
  }
1705
1707
  return target;
@@ -1707,10 +1709,10 @@ var __objRest$9 = (source, exclude) => {
1707
1709
  const Select = SelectPrimitive__namespace.Root;
1708
1710
  const SelectValue = SelectPrimitive__namespace.Value;
1709
1711
  const SelectTrigger = React__namespace.forwardRef((_a, ref) => {
1710
- var _b = _a, { className, children } = _b, props = __objRest$9(_b, ["className", "children"]);
1712
+ var _b = _a, { className, children } = _b, props = __objRest$a(_b, ["className", "children"]);
1711
1713
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1712
1714
  SelectPrimitive__namespace.Trigger,
1713
- __spreadProps$f(__spreadValues$m({
1715
+ __spreadProps$j(__spreadValues$q({
1714
1716
  ref,
1715
1717
  className: cn(
1716
1718
  "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
@@ -1726,10 +1728,10 @@ const SelectTrigger = React__namespace.forwardRef((_a, ref) => {
1726
1728
  });
1727
1729
  SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
1728
1730
  const SelectScrollUpButton = React__namespace.forwardRef((_c, ref) => {
1729
- var _d = _c, { className } = _d, props = __objRest$9(_d, ["className"]);
1731
+ var _d = _c, { className } = _d, props = __objRest$a(_d, ["className"]);
1730
1732
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1731
1733
  SelectPrimitive__namespace.ScrollUpButton,
1732
- __spreadProps$f(__spreadValues$m({
1734
+ __spreadProps$j(__spreadValues$q({
1733
1735
  ref,
1734
1736
  className: cn(
1735
1737
  "flex cursor-default items-center justify-center py-1",
@@ -1742,10 +1744,10 @@ const SelectScrollUpButton = React__namespace.forwardRef((_c, ref) => {
1742
1744
  });
1743
1745
  SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
1744
1746
  const SelectScrollDownButton = React__namespace.forwardRef((_e, ref) => {
1745
- var _f = _e, { className } = _f, props = __objRest$9(_f, ["className"]);
1747
+ var _f = _e, { className } = _f, props = __objRest$a(_f, ["className"]);
1746
1748
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1747
1749
  SelectPrimitive__namespace.ScrollDownButton,
1748
- __spreadProps$f(__spreadValues$m({
1750
+ __spreadProps$j(__spreadValues$q({
1749
1751
  ref,
1750
1752
  className: cn(
1751
1753
  "flex cursor-default items-center justify-center py-1",
@@ -1758,10 +1760,10 @@ const SelectScrollDownButton = React__namespace.forwardRef((_e, ref) => {
1758
1760
  });
1759
1761
  SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
1760
1762
  const SelectContent = React__namespace.forwardRef((_g, ref) => {
1761
- var _h = _g, { className, children, position = "popper" } = _h, props = __objRest$9(_h, ["className", "children", "position"]);
1763
+ var _h = _g, { className, children, position = "popper" } = _h, props = __objRest$a(_h, ["className", "children", "position"]);
1762
1764
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
1763
1765
  SelectPrimitive__namespace.Content,
1764
- __spreadProps$f(__spreadValues$m({
1766
+ __spreadProps$j(__spreadValues$q({
1765
1767
  ref,
1766
1768
  className: cn(
1767
1769
  "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
@@ -1789,10 +1791,10 @@ const SelectContent = React__namespace.forwardRef((_g, ref) => {
1789
1791
  });
1790
1792
  SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
1791
1793
  const SelectLabel = React__namespace.forwardRef((_i, ref) => {
1792
- var _j = _i, { className } = _j, props = __objRest$9(_j, ["className"]);
1794
+ var _j = _i, { className } = _j, props = __objRest$a(_j, ["className"]);
1793
1795
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1794
1796
  SelectPrimitive__namespace.Label,
1795
- __spreadValues$m({
1797
+ __spreadValues$q({
1796
1798
  ref,
1797
1799
  className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)
1798
1800
  }, props)
@@ -1800,10 +1802,10 @@ const SelectLabel = React__namespace.forwardRef((_i, ref) => {
1800
1802
  });
1801
1803
  SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
1802
1804
  const SelectItem = React__namespace.forwardRef((_k, ref) => {
1803
- var _l = _k, { className, children } = _l, props = __objRest$9(_l, ["className", "children"]);
1805
+ var _l = _k, { className, children } = _l, props = __objRest$a(_l, ["className", "children"]);
1804
1806
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1805
1807
  SelectPrimitive__namespace.Item,
1806
- __spreadProps$f(__spreadValues$m({
1808
+ __spreadProps$j(__spreadValues$q({
1807
1809
  ref,
1808
1810
  className: cn(
1809
1811
  "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
@@ -1819,10 +1821,10 @@ const SelectItem = React__namespace.forwardRef((_k, ref) => {
1819
1821
  });
1820
1822
  SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
1821
1823
  const SelectSeparator = React__namespace.forwardRef((_m, ref) => {
1822
- var _n = _m, { className } = _n, props = __objRest$9(_n, ["className"]);
1824
+ var _n = _m, { className } = _n, props = __objRest$a(_n, ["className"]);
1823
1825
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1824
1826
  SelectPrimitive__namespace.Separator,
1825
- __spreadValues$m({
1827
+ __spreadValues$q({
1826
1828
  ref,
1827
1829
  className: cn("-mx-1 my-1 h-px bg-muted", className)
1828
1830
  }, props)
@@ -1830,42 +1832,42 @@ const SelectSeparator = React__namespace.forwardRef((_m, ref) => {
1830
1832
  });
1831
1833
  SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
1832
1834
 
1833
- var __defProp$l = Object.defineProperty;
1834
- var __defProps$e = Object.defineProperties;
1835
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
1836
- var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
1837
- var __hasOwnProp$l = Object.prototype.hasOwnProperty;
1838
- var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
1839
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1840
- var __spreadValues$l = (a, b) => {
1835
+ var __defProp$p = Object.defineProperty;
1836
+ var __defProps$i = Object.defineProperties;
1837
+ var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
1838
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
1839
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
1840
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
1841
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1842
+ var __spreadValues$p = (a, b) => {
1841
1843
  for (var prop in b || (b = {}))
1842
- if (__hasOwnProp$l.call(b, prop))
1843
- __defNormalProp$l(a, prop, b[prop]);
1844
- if (__getOwnPropSymbols$l)
1845
- for (var prop of __getOwnPropSymbols$l(b)) {
1846
- if (__propIsEnum$l.call(b, prop))
1847
- __defNormalProp$l(a, prop, b[prop]);
1844
+ if (__hasOwnProp$p.call(b, prop))
1845
+ __defNormalProp$p(a, prop, b[prop]);
1846
+ if (__getOwnPropSymbols$p)
1847
+ for (var prop of __getOwnPropSymbols$p(b)) {
1848
+ if (__propIsEnum$p.call(b, prop))
1849
+ __defNormalProp$p(a, prop, b[prop]);
1848
1850
  }
1849
1851
  return a;
1850
1852
  };
1851
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
1852
- var __objRest$8 = (source, exclude) => {
1853
+ var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
1854
+ var __objRest$9 = (source, exclude) => {
1853
1855
  var target = {};
1854
1856
  for (var prop in source)
1855
- if (__hasOwnProp$l.call(source, prop) && exclude.indexOf(prop) < 0)
1857
+ if (__hasOwnProp$p.call(source, prop) && exclude.indexOf(prop) < 0)
1856
1858
  target[prop] = source[prop];
1857
- if (source != null && __getOwnPropSymbols$l)
1858
- for (var prop of __getOwnPropSymbols$l(source)) {
1859
- if (exclude.indexOf(prop) < 0 && __propIsEnum$l.call(source, prop))
1859
+ if (source != null && __getOwnPropSymbols$p)
1860
+ for (var prop of __getOwnPropSymbols$p(source)) {
1861
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$p.call(source, prop))
1860
1862
  target[prop] = source[prop];
1861
1863
  }
1862
1864
  return target;
1863
1865
  };
1864
1866
  const ScrollArea = React__namespace.forwardRef((_a, ref) => {
1865
- var _b = _a, { className, children } = _b, props = __objRest$8(_b, ["className", "children"]);
1867
+ var _b = _a, { className, children } = _b, props = __objRest$9(_b, ["className", "children"]);
1866
1868
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1867
1869
  ScrollAreaPrimitive__namespace.Root,
1868
- __spreadProps$e(__spreadValues$l({
1870
+ __spreadProps$i(__spreadValues$p({
1869
1871
  ref,
1870
1872
  className: cn("relative overflow-hidden", className)
1871
1873
  }, props), {
@@ -1879,10 +1881,10 @@ const ScrollArea = React__namespace.forwardRef((_a, ref) => {
1879
1881
  });
1880
1882
  ScrollArea.displayName = ScrollAreaPrimitive__namespace.Root.displayName;
1881
1883
  const ScrollBar = React__namespace.forwardRef((_c, ref) => {
1882
- var _d = _c, { className, orientation = "vertical" } = _d, props = __objRest$8(_d, ["className", "orientation"]);
1884
+ var _d = _c, { className, orientation = "vertical" } = _d, props = __objRest$9(_d, ["className", "orientation"]);
1883
1885
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1884
1886
  ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
1885
- __spreadProps$e(__spreadValues$l({
1887
+ __spreadProps$i(__spreadValues$p({
1886
1888
  ref,
1887
1889
  orientation,
1888
1890
  className: cn(
@@ -1898,30 +1900,30 @@ const ScrollBar = React__namespace.forwardRef((_c, ref) => {
1898
1900
  });
1899
1901
  ScrollBar.displayName = ScrollAreaPrimitive__namespace.ScrollAreaScrollbar.displayName;
1900
1902
 
1901
- var __defProp$k = Object.defineProperty;
1902
- var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
1903
- var __hasOwnProp$k = Object.prototype.hasOwnProperty;
1904
- var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
1905
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1906
- var __spreadValues$k = (a, b) => {
1903
+ var __defProp$o = Object.defineProperty;
1904
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
1905
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
1906
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
1907
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1908
+ var __spreadValues$o = (a, b) => {
1907
1909
  for (var prop in b || (b = {}))
1908
- if (__hasOwnProp$k.call(b, prop))
1909
- __defNormalProp$k(a, prop, b[prop]);
1910
- if (__getOwnPropSymbols$k)
1911
- for (var prop of __getOwnPropSymbols$k(b)) {
1912
- if (__propIsEnum$k.call(b, prop))
1913
- __defNormalProp$k(a, prop, b[prop]);
1910
+ if (__hasOwnProp$o.call(b, prop))
1911
+ __defNormalProp$o(a, prop, b[prop]);
1912
+ if (__getOwnPropSymbols$o)
1913
+ for (var prop of __getOwnPropSymbols$o(b)) {
1914
+ if (__propIsEnum$o.call(b, prop))
1915
+ __defNormalProp$o(a, prop, b[prop]);
1914
1916
  }
1915
1917
  return a;
1916
1918
  };
1917
- var __objRest$7 = (source, exclude) => {
1919
+ var __objRest$8 = (source, exclude) => {
1918
1920
  var target = {};
1919
1921
  for (var prop in source)
1920
- if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
1922
+ if (__hasOwnProp$o.call(source, prop) && exclude.indexOf(prop) < 0)
1921
1923
  target[prop] = source[prop];
1922
- if (source != null && __getOwnPropSymbols$k)
1923
- for (var prop of __getOwnPropSymbols$k(source)) {
1924
- if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
1924
+ if (source != null && __getOwnPropSymbols$o)
1925
+ for (var prop of __getOwnPropSymbols$o(source)) {
1926
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$o.call(source, prop))
1925
1927
  target[prop] = source[prop];
1926
1928
  }
1927
1929
  return target;
@@ -1953,11 +1955,11 @@ const buttonVariants = classVarianceAuthority.cva(
1953
1955
  );
1954
1956
  const Button = React__namespace.forwardRef(
1955
1957
  (_a, ref) => {
1956
- var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest$7(_b, ["className", "variant", "size", "asChild"]);
1958
+ var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest$8(_b, ["className", "variant", "size", "asChild"]);
1957
1959
  const Comp = asChild ? reactSlot.Slot : "button";
1958
1960
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1959
1961
  Comp,
1960
- __spreadValues$k({
1962
+ __spreadValues$o({
1961
1963
  className: cn(buttonVariants({ variant, size, className })),
1962
1964
  ref
1963
1965
  }, props)
@@ -1966,30 +1968,30 @@ const Button = React__namespace.forwardRef(
1966
1968
  );
1967
1969
  Button.displayName = "Button";
1968
1970
 
1969
- var __defProp$j = Object.defineProperty;
1970
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
1971
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
1972
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
1973
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1974
- var __spreadValues$j = (a, b) => {
1971
+ var __defProp$n = Object.defineProperty;
1972
+ var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
1973
+ var __hasOwnProp$n = Object.prototype.hasOwnProperty;
1974
+ var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
1975
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1976
+ var __spreadValues$n = (a, b) => {
1975
1977
  for (var prop in b || (b = {}))
1976
- if (__hasOwnProp$j.call(b, prop))
1977
- __defNormalProp$j(a, prop, b[prop]);
1978
- if (__getOwnPropSymbols$j)
1979
- for (var prop of __getOwnPropSymbols$j(b)) {
1980
- if (__propIsEnum$j.call(b, prop))
1981
- __defNormalProp$j(a, prop, b[prop]);
1978
+ if (__hasOwnProp$n.call(b, prop))
1979
+ __defNormalProp$n(a, prop, b[prop]);
1980
+ if (__getOwnPropSymbols$n)
1981
+ for (var prop of __getOwnPropSymbols$n(b)) {
1982
+ if (__propIsEnum$n.call(b, prop))
1983
+ __defNormalProp$n(a, prop, b[prop]);
1982
1984
  }
1983
1985
  return a;
1984
1986
  };
1985
- var __objRest$6 = (source, exclude) => {
1987
+ var __objRest$7 = (source, exclude) => {
1986
1988
  var target = {};
1987
1989
  for (var prop in source)
1988
- if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
1990
+ if (__hasOwnProp$n.call(source, prop) && exclude.indexOf(prop) < 0)
1989
1991
  target[prop] = source[prop];
1990
- if (source != null && __getOwnPropSymbols$j)
1991
- for (var prop of __getOwnPropSymbols$j(source)) {
1992
- if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
1992
+ if (source != null && __getOwnPropSymbols$n)
1993
+ for (var prop of __getOwnPropSymbols$n(source)) {
1994
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$n.call(source, prop))
1993
1995
  target[prop] = source[prop];
1994
1996
  }
1995
1997
  return target;
@@ -2009,10 +2011,10 @@ const alertVariants = classVarianceAuthority.cva(
2009
2011
  }
2010
2012
  );
2011
2013
  const Alert = React__namespace.forwardRef((_a, ref) => {
2012
- var _b = _a, { className, variant } = _b, props = __objRest$6(_b, ["className", "variant"]);
2014
+ var _b = _a, { className, variant } = _b, props = __objRest$7(_b, ["className", "variant"]);
2013
2015
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2014
2016
  "div",
2015
- __spreadValues$j({
2017
+ __spreadValues$n({
2016
2018
  ref,
2017
2019
  role: "alert",
2018
2020
  className: cn(alertVariants({ variant }), className)
@@ -2021,10 +2023,10 @@ const Alert = React__namespace.forwardRef((_a, ref) => {
2021
2023
  });
2022
2024
  Alert.displayName = "Alert";
2023
2025
  const AlertTitle = React__namespace.forwardRef((_c, ref) => {
2024
- var _d = _c, { className } = _d, props = __objRest$6(_d, ["className"]);
2026
+ var _d = _c, { className } = _d, props = __objRest$7(_d, ["className"]);
2025
2027
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2026
2028
  "h5",
2027
- __spreadValues$j({
2029
+ __spreadValues$n({
2028
2030
  ref,
2029
2031
  className: cn("mb-1 font-medium leading-none tracking-tight", className)
2030
2032
  }, props)
@@ -2032,10 +2034,10 @@ const AlertTitle = React__namespace.forwardRef((_c, ref) => {
2032
2034
  });
2033
2035
  AlertTitle.displayName = "AlertTitle";
2034
2036
  const AlertDescription = React__namespace.forwardRef((_e, ref) => {
2035
- var _f = _e, { className } = _f, props = __objRest$6(_f, ["className"]);
2037
+ var _f = _e, { className } = _f, props = __objRest$7(_f, ["className"]);
2036
2038
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2037
2039
  "div",
2038
- __spreadValues$j({
2040
+ __spreadValues$n({
2039
2041
  ref,
2040
2042
  className: cn("text-sm [&_p]:leading-relaxed", className)
2041
2043
  }, props)
@@ -2068,25 +2070,25 @@ function CodeEditor({
2068
2070
  );
2069
2071
  }
2070
2072
 
2071
- var __defProp$i = Object.defineProperty;
2072
- var __defProps$d = Object.defineProperties;
2073
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
2074
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
2075
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
2076
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
2077
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2078
- var __spreadValues$i = (a, b) => {
2073
+ var __defProp$m = Object.defineProperty;
2074
+ var __defProps$h = Object.defineProperties;
2075
+ var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
2076
+ var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
2077
+ var __hasOwnProp$m = Object.prototype.hasOwnProperty;
2078
+ var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
2079
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2080
+ var __spreadValues$m = (a, b) => {
2079
2081
  for (var prop in b || (b = {}))
2080
- if (__hasOwnProp$i.call(b, prop))
2081
- __defNormalProp$i(a, prop, b[prop]);
2082
- if (__getOwnPropSymbols$i)
2083
- for (var prop of __getOwnPropSymbols$i(b)) {
2084
- if (__propIsEnum$i.call(b, prop))
2085
- __defNormalProp$i(a, prop, b[prop]);
2082
+ if (__hasOwnProp$m.call(b, prop))
2083
+ __defNormalProp$m(a, prop, b[prop]);
2084
+ if (__getOwnPropSymbols$m)
2085
+ for (var prop of __getOwnPropSymbols$m(b)) {
2086
+ if (__propIsEnum$m.call(b, prop))
2087
+ __defNormalProp$m(a, prop, b[prop]);
2086
2088
  }
2087
2089
  return a;
2088
2090
  };
2089
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
2091
+ var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
2090
2092
  function SearchWidgetFacetSettings({
2091
2093
  value = [],
2092
2094
  onChange,
@@ -2127,14 +2129,14 @@ function SearchWidgetFacetSettings({
2127
2129
  };
2128
2130
  const removeFacet = (index) => {
2129
2131
  const newFields = value.filter((_, i) => i !== index);
2130
- const reorderedFields = newFields.map((field, idx) => __spreadProps$d(__spreadValues$i({}, field), {
2132
+ const reorderedFields = newFields.map((field, idx) => __spreadProps$h(__spreadValues$m({}, field), {
2131
2133
  order: idx
2132
2134
  }));
2133
2135
  onChange(reorderedFields);
2134
2136
  };
2135
2137
  const updateFacet = (index, updates) => {
2136
2138
  const newFields = value.map(
2137
- (field, i) => i === index ? __spreadValues$i(__spreadValues$i({}, field), updates) : field
2139
+ (field, i) => i === index ? __spreadValues$m(__spreadValues$m({}, field), updates) : field
2138
2140
  );
2139
2141
  onChange(newFields);
2140
2142
  };
@@ -2145,8 +2147,8 @@ function SearchWidgetFacetSettings({
2145
2147
  const newFields = [...value];
2146
2148
  const newIndex = direction === "up" ? index - 1 : index + 1;
2147
2149
  [newFields[index], newFields[newIndex]] = [
2148
- __spreadProps$d(__spreadValues$i({}, newFields[newIndex]), { order: index }),
2149
- __spreadProps$d(__spreadValues$i({}, newFields[index]), { order: newIndex })
2150
+ __spreadProps$h(__spreadValues$m({}, newFields[newIndex]), { order: index }),
2151
+ __spreadProps$h(__spreadValues$m({}, newFields[index]), { order: newIndex })
2150
2152
  ];
2151
2153
  onChange(newFields);
2152
2154
  };
@@ -2232,25 +2234,25 @@ function SearchWidgetFacetSettings({
2232
2234
  ] });
2233
2235
  }
2234
2236
 
2235
- var __defProp$h = Object.defineProperty;
2236
- var __defProps$c = Object.defineProperties;
2237
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
2238
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
2239
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
2240
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
2241
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2242
- var __spreadValues$h = (a, b) => {
2237
+ var __defProp$l = Object.defineProperty;
2238
+ var __defProps$g = Object.defineProperties;
2239
+ var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
2240
+ var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
2241
+ var __hasOwnProp$l = Object.prototype.hasOwnProperty;
2242
+ var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
2243
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2244
+ var __spreadValues$l = (a, b) => {
2243
2245
  for (var prop in b || (b = {}))
2244
- if (__hasOwnProp$h.call(b, prop))
2245
- __defNormalProp$h(a, prop, b[prop]);
2246
- if (__getOwnPropSymbols$h)
2247
- for (var prop of __getOwnPropSymbols$h(b)) {
2248
- if (__propIsEnum$h.call(b, prop))
2249
- __defNormalProp$h(a, prop, b[prop]);
2246
+ if (__hasOwnProp$l.call(b, prop))
2247
+ __defNormalProp$l(a, prop, b[prop]);
2248
+ if (__getOwnPropSymbols$l)
2249
+ for (var prop of __getOwnPropSymbols$l(b)) {
2250
+ if (__propIsEnum$l.call(b, prop))
2251
+ __defNormalProp$l(a, prop, b[prop]);
2250
2252
  }
2251
2253
  return a;
2252
2254
  };
2253
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
2255
+ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
2254
2256
  function WidgetSettingsPanel({
2255
2257
  pageId,
2256
2258
  widget,
@@ -2276,14 +2278,14 @@ function WidgetSettingsPanel({
2276
2278
  }
2277
2279
  const pageData = await pageResponse.json();
2278
2280
  const updatedWidgets = pageData.widgets.map(
2279
- (w) => w.id === widgetId ? __spreadValues$h(__spreadValues$h({}, w), updates) : w
2281
+ (w) => w.id === widgetId ? __spreadValues$l(__spreadValues$l({}, w), updates) : w
2280
2282
  );
2281
2283
  const response = await fetch(getApiUrl(`/api/pages/${pageId}`), {
2282
2284
  method: "PUT",
2283
2285
  headers: {
2284
2286
  "Content-Type": "application/json"
2285
2287
  },
2286
- body: JSON.stringify(__spreadProps$c(__spreadValues$h({}, pageData), {
2288
+ body: JSON.stringify(__spreadProps$g(__spreadValues$l({}, pageData), {
2287
2289
  widgets: updatedWidgets
2288
2290
  }))
2289
2291
  });
@@ -2342,12 +2344,12 @@ function WidgetSettingsPanel({
2342
2344
  }
2343
2345
  };
2344
2346
  const updateWidget = (updates) => {
2345
- const updatedWidget = __spreadValues$h(__spreadValues$h({}, localWidget), updates);
2347
+ const updatedWidget = __spreadValues$l(__spreadValues$l({}, localWidget), updates);
2346
2348
  setLocalWidget(updatedWidget);
2347
2349
  };
2348
2350
  const updateConfig = (updates) => {
2349
2351
  console.log("Updating config with:", updates);
2350
- const newConfig = __spreadValues$h(__spreadValues$h({}, localWidget.config), updates);
2352
+ const newConfig = __spreadValues$l(__spreadValues$l({}, localWidget.config), updates);
2351
2353
  console.log("New config will be:", newConfig);
2352
2354
  updateWidget({
2353
2355
  config: newConfig
@@ -2356,8 +2358,8 @@ function WidgetSettingsPanel({
2356
2358
  const updateStyle = (updates) => {
2357
2359
  var _a;
2358
2360
  updateWidget({
2359
- config: __spreadProps$c(__spreadValues$h({}, localWidget.config), {
2360
- styles: __spreadValues$h(__spreadValues$h({}, ((_a = localWidget.config) == null ? void 0 : _a.styles) || {}), updates)
2361
+ config: __spreadProps$g(__spreadValues$l({}, localWidget.config), {
2362
+ styles: __spreadValues$l(__spreadValues$l({}, ((_a = localWidget.config) == null ? void 0 : _a.styles) || {}), updates)
2361
2363
  })
2362
2364
  });
2363
2365
  };
@@ -2624,8 +2626,8 @@ function WidgetSettingsPanel({
2624
2626
  checked: (_k = (_j = (_i = widget.config) == null ? void 0 : _i.facets) == null ? void 0 : _j.enabled) != null ? _k : false,
2625
2627
  onCheckedChange: (checked) => {
2626
2628
  var _a2, _b2, _c2;
2627
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2628
- facets: __spreadProps$c(__spreadValues$h({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2629
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2630
+ facets: __spreadProps$g(__spreadValues$l({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2629
2631
  enabled: checked,
2630
2632
  fields: ((_c2 = (_b2 = widget.config) == null ? void 0 : _b2.facets) == null ? void 0 : _c2.fields) || []
2631
2633
  })
@@ -2641,8 +2643,8 @@ function WidgetSettingsPanel({
2641
2643
  placeHolder: "Select facet field",
2642
2644
  value: widget.config.facets.fields || [],
2643
2645
  onChange: (fields) => {
2644
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2645
- facets: __spreadProps$c(__spreadValues$h({}, widget.config.facets), {
2646
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2647
+ facets: __spreadProps$g(__spreadValues$l({}, widget.config.facets), {
2646
2648
  fields
2647
2649
  })
2648
2650
  });
@@ -2666,7 +2668,7 @@ function WidgetSettingsPanel({
2666
2668
  onValueChange: (value) => {
2667
2669
  var _a2;
2668
2670
  return updateConfig({
2669
- layout: __spreadProps$c(__spreadValues$h({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), { type: value })
2671
+ layout: __spreadProps$g(__spreadValues$l({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), { type: value })
2670
2672
  });
2671
2673
  },
2672
2674
  children: [
@@ -2689,7 +2691,7 @@ function WidgetSettingsPanel({
2689
2691
  onValueChange: (value) => {
2690
2692
  var _a2;
2691
2693
  return updateConfig({
2692
- layout: __spreadProps$c(__spreadValues$h({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2694
+ layout: __spreadProps$g(__spreadValues$l({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2693
2695
  itemsPerPage: parseInt(value)
2694
2696
  })
2695
2697
  });
@@ -2713,7 +2715,7 @@ function WidgetSettingsPanel({
2713
2715
  onCheckedChange: (checked) => {
2714
2716
  var _a2;
2715
2717
  return updateConfig({
2716
- layout: __spreadProps$c(__spreadValues$h({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2718
+ layout: __spreadProps$g(__spreadValues$l({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2717
2719
  infiniteScroll: checked
2718
2720
  })
2719
2721
  });
@@ -2765,8 +2767,8 @@ function WidgetSettingsPanel({
2765
2767
  placeHolder: "Select metadata field",
2766
2768
  value: ((_l = (_k = widget.config) == null ? void 0 : _k.metadata) == null ? void 0 : _l.fields) || [],
2767
2769
  onChange: (fields) => {
2768
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2769
- metadata: __spreadProps$c(__spreadValues$h({}, widget.config.metadata), {
2770
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2771
+ metadata: __spreadProps$g(__spreadValues$l({}, widget.config.metadata), {
2770
2772
  fields
2771
2773
  })
2772
2774
  });
@@ -2842,8 +2844,8 @@ function WidgetSettingsPanel({
2842
2844
  checked: (_f = (_e = (_d = widget.config) == null ? void 0 : _d.facets) == null ? void 0 : _e.enabled) != null ? _f : false,
2843
2845
  onCheckedChange: (checked) => {
2844
2846
  var _a2, _b2, _c2;
2845
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2846
- facets: __spreadProps$c(__spreadValues$h({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2847
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2848
+ facets: __spreadProps$g(__spreadValues$l({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2847
2849
  enabled: checked,
2848
2850
  fields: ((_c2 = (_b2 = widget.config) == null ? void 0 : _b2.facets) == null ? void 0 : _c2.fields) || []
2849
2851
  })
@@ -2860,8 +2862,8 @@ function WidgetSettingsPanel({
2860
2862
  placeHolder: "Select facet field",
2861
2863
  value: widget.config.facets.fields || [],
2862
2864
  onChange: (fields) => {
2863
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2864
- facets: __spreadProps$c(__spreadValues$h({}, widget.config.facets), {
2865
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2866
+ facets: __spreadProps$g(__spreadValues$l({}, widget.config.facets), {
2865
2867
  fields
2866
2868
  })
2867
2869
  });
@@ -2979,39 +2981,39 @@ function WidgetSettingsPanel({
2979
2981
  ] });
2980
2982
  }
2981
2983
 
2982
- var __defProp$g = Object.defineProperty;
2983
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
2984
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
2985
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
2986
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2987
- var __spreadValues$g = (a, b) => {
2984
+ var __defProp$k = Object.defineProperty;
2985
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
2986
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
2987
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
2988
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2989
+ var __spreadValues$k = (a, b) => {
2988
2990
  for (var prop in b || (b = {}))
2989
- if (__hasOwnProp$g.call(b, prop))
2990
- __defNormalProp$g(a, prop, b[prop]);
2991
- if (__getOwnPropSymbols$g)
2992
- for (var prop of __getOwnPropSymbols$g(b)) {
2993
- if (__propIsEnum$g.call(b, prop))
2994
- __defNormalProp$g(a, prop, b[prop]);
2991
+ if (__hasOwnProp$k.call(b, prop))
2992
+ __defNormalProp$k(a, prop, b[prop]);
2993
+ if (__getOwnPropSymbols$k)
2994
+ for (var prop of __getOwnPropSymbols$k(b)) {
2995
+ if (__propIsEnum$k.call(b, prop))
2996
+ __defNormalProp$k(a, prop, b[prop]);
2995
2997
  }
2996
2998
  return a;
2997
2999
  };
2998
- var __objRest$5 = (source, exclude) => {
3000
+ var __objRest$6 = (source, exclude) => {
2999
3001
  var target = {};
3000
3002
  for (var prop in source)
3001
- if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
3003
+ if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
3002
3004
  target[prop] = source[prop];
3003
- if (source != null && __getOwnPropSymbols$g)
3004
- for (var prop of __getOwnPropSymbols$g(source)) {
3005
- if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
3005
+ if (source != null && __getOwnPropSymbols$k)
3006
+ for (var prop of __getOwnPropSymbols$k(source)) {
3007
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
3006
3008
  target[prop] = source[prop];
3007
3009
  }
3008
3010
  return target;
3009
3011
  };
3010
3012
  const Card = React__namespace.forwardRef((_a, ref) => {
3011
- var _b = _a, { className } = _b, props = __objRest$5(_b, ["className"]);
3013
+ var _b = _a, { className } = _b, props = __objRest$6(_b, ["className"]);
3012
3014
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3013
3015
  "div",
3014
- __spreadValues$g({
3016
+ __spreadValues$k({
3015
3017
  ref,
3016
3018
  className: cn(
3017
3019
  "rounded-lg border bg-card text-card-foreground shadow-sm",
@@ -3022,10 +3024,10 @@ const Card = React__namespace.forwardRef((_a, ref) => {
3022
3024
  });
3023
3025
  Card.displayName = "Card";
3024
3026
  const CardHeader = React__namespace.forwardRef((_c, ref) => {
3025
- var _d = _c, { className } = _d, props = __objRest$5(_d, ["className"]);
3027
+ var _d = _c, { className } = _d, props = __objRest$6(_d, ["className"]);
3026
3028
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3027
3029
  "div",
3028
- __spreadValues$g({
3030
+ __spreadValues$k({
3029
3031
  ref,
3030
3032
  className: cn("flex flex-col space-y-1.5 p-6", className)
3031
3033
  }, props)
@@ -3033,10 +3035,10 @@ const CardHeader = React__namespace.forwardRef((_c, ref) => {
3033
3035
  });
3034
3036
  CardHeader.displayName = "CardHeader";
3035
3037
  const CardTitle = React__namespace.forwardRef((_e, ref) => {
3036
- var _f = _e, { className } = _f, props = __objRest$5(_f, ["className"]);
3038
+ var _f = _e, { className } = _f, props = __objRest$6(_f, ["className"]);
3037
3039
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3038
3040
  "div",
3039
- __spreadValues$g({
3041
+ __spreadValues$k({
3040
3042
  ref,
3041
3043
  className: cn(
3042
3044
  "text-2xl font-semibold leading-none tracking-tight",
@@ -3047,10 +3049,10 @@ const CardTitle = React__namespace.forwardRef((_e, ref) => {
3047
3049
  });
3048
3050
  CardTitle.displayName = "CardTitle";
3049
3051
  const CardDescription = React__namespace.forwardRef((_g, ref) => {
3050
- var _h = _g, { className } = _h, props = __objRest$5(_h, ["className"]);
3052
+ var _h = _g, { className } = _h, props = __objRest$6(_h, ["className"]);
3051
3053
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3052
3054
  "div",
3053
- __spreadValues$g({
3055
+ __spreadValues$k({
3054
3056
  ref,
3055
3057
  className: cn("text-sm text-muted-foreground", className)
3056
3058
  }, props)
@@ -3058,15 +3060,15 @@ const CardDescription = React__namespace.forwardRef((_g, ref) => {
3058
3060
  });
3059
3061
  CardDescription.displayName = "CardDescription";
3060
3062
  const CardContent = React__namespace.forwardRef((_i, ref) => {
3061
- var _j = _i, { className } = _j, props = __objRest$5(_j, ["className"]);
3062
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$g({ ref, className: cn("p-6 pt-0", className) }, props));
3063
+ var _j = _i, { className } = _j, props = __objRest$6(_j, ["className"]);
3064
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$k({ ref, className: cn("p-6 pt-0", className) }, props));
3063
3065
  });
3064
3066
  CardContent.displayName = "CardContent";
3065
3067
  const CardFooter = React__namespace.forwardRef((_k, ref) => {
3066
- var _l = _k, { className } = _l, props = __objRest$5(_l, ["className"]);
3068
+ var _l = _k, { className } = _l, props = __objRest$6(_l, ["className"]);
3067
3069
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3068
3070
  "div",
3069
- __spreadValues$g({
3071
+ __spreadValues$k({
3070
3072
  ref,
3071
3073
  className: cn("flex items-center p-6 pt-0", className)
3072
3074
  }, props)
@@ -3175,30 +3177,141 @@ function WidgetPalette({ widgetBackendUrl } = {}) {
3175
3177
  ] });
3176
3178
  }
3177
3179
 
3178
- var __defProp$f = Object.defineProperty;
3179
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
3180
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
3181
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
3182
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3183
- var __spreadValues$f = (a, b) => {
3180
+ class WidgetService {
3181
+ constructor() {
3182
+ this.baseUrl = "/api/widgets";
3183
+ }
3184
+ async getWidgetTypes() {
3185
+ try {
3186
+ const response = await fetch(`${this.baseUrl}/types`);
3187
+ if (!response.ok) {
3188
+ throw new Error(`Failed to fetch widget types: ${response.statusText}`);
3189
+ }
3190
+ const data = await response.json();
3191
+ return data;
3192
+ } catch (error) {
3193
+ console.error("Error fetching widget types:", error);
3194
+ throw error;
3195
+ }
3196
+ }
3197
+ async getWidgetTemplates() {
3198
+ try {
3199
+ const response = await fetch(`${this.baseUrl}/templates`);
3200
+ if (!response.ok) {
3201
+ throw new Error(
3202
+ `Failed to fetch widget templates: ${response.statusText}`
3203
+ );
3204
+ }
3205
+ return await response.json();
3206
+ } catch (error) {
3207
+ console.error("Error fetching widget templates:", error);
3208
+ throw error;
3209
+ }
3210
+ }
3211
+ async getWidgetCategories() {
3212
+ try {
3213
+ const response = await fetch(`${this.baseUrl}/categories`);
3214
+ if (!response.ok) {
3215
+ throw new Error(
3216
+ `Failed to fetch widget categories: ${response.statusText}`
3217
+ );
3218
+ }
3219
+ return await response.json();
3220
+ } catch (error) {
3221
+ console.error("Error fetching widget categories:", error);
3222
+ throw error;
3223
+ }
3224
+ }
3225
+ async getPageWidgets(pageId) {
3226
+ try {
3227
+ const response = await fetch(`${this.baseUrl}/page/${pageId}`);
3228
+ if (!response.ok) {
3229
+ throw new Error(`Failed to fetch page widgets: ${response.statusText}`);
3230
+ }
3231
+ return await response.json();
3232
+ } catch (error) {
3233
+ console.error("Error fetching page widgets:", error);
3234
+ throw error;
3235
+ }
3236
+ }
3237
+ async saveWidget(widget) {
3238
+ try {
3239
+ const response = await fetch(this.baseUrl, {
3240
+ method: widget.id ? "PUT" : "POST",
3241
+ headers: {
3242
+ "Content-Type": "application/json"
3243
+ },
3244
+ body: JSON.stringify(widget)
3245
+ });
3246
+ if (!response.ok) {
3247
+ throw new Error(`Failed to save widget: ${response.statusText}`);
3248
+ }
3249
+ return await response.json();
3250
+ } catch (error) {
3251
+ console.error("Error saving widget:", error);
3252
+ throw error;
3253
+ }
3254
+ }
3255
+ async deleteWidget(widgetId) {
3256
+ try {
3257
+ const response = await fetch(`${this.baseUrl}/${widgetId}`, {
3258
+ method: "DELETE"
3259
+ });
3260
+ if (!response.ok) {
3261
+ throw new Error(`Failed to delete widget: ${response.statusText}`);
3262
+ }
3263
+ return true;
3264
+ } catch (error) {
3265
+ console.error("Error deleting widget:", error);
3266
+ throw error;
3267
+ }
3268
+ }
3269
+ async updateWidgetPositions(widgets) {
3270
+ try {
3271
+ const response = await fetch(`${this.baseUrl}/positions`, {
3272
+ method: "PUT",
3273
+ headers: {
3274
+ "Content-Type": "application/json"
3275
+ },
3276
+ body: JSON.stringify(widgets)
3277
+ });
3278
+ if (!response.ok) {
3279
+ throw new Error(
3280
+ `Failed to update widget positions: ${response.statusText}`
3281
+ );
3282
+ }
3283
+ return await response.json();
3284
+ } catch (error) {
3285
+ console.error("Error updating widget positions:", error);
3286
+ throw error;
3287
+ }
3288
+ }
3289
+ }
3290
+
3291
+ var __defProp$j = Object.defineProperty;
3292
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
3293
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
3294
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
3295
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3296
+ var __spreadValues$j = (a, b) => {
3184
3297
  for (var prop in b || (b = {}))
3185
- if (__hasOwnProp$f.call(b, prop))
3186
- __defNormalProp$f(a, prop, b[prop]);
3187
- if (__getOwnPropSymbols$f)
3188
- for (var prop of __getOwnPropSymbols$f(b)) {
3189
- if (__propIsEnum$f.call(b, prop))
3190
- __defNormalProp$f(a, prop, b[prop]);
3298
+ if (__hasOwnProp$j.call(b, prop))
3299
+ __defNormalProp$j(a, prop, b[prop]);
3300
+ if (__getOwnPropSymbols$j)
3301
+ for (var prop of __getOwnPropSymbols$j(b)) {
3302
+ if (__propIsEnum$j.call(b, prop))
3303
+ __defNormalProp$j(a, prop, b[prop]);
3191
3304
  }
3192
3305
  return a;
3193
3306
  };
3194
- var __objRest$4 = (source, exclude) => {
3307
+ var __objRest$5 = (source, exclude) => {
3195
3308
  var target = {};
3196
3309
  for (var prop in source)
3197
- if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
3310
+ if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
3198
3311
  target[prop] = source[prop];
3199
- if (source != null && __getOwnPropSymbols$f)
3200
- for (var prop of __getOwnPropSymbols$f(source)) {
3201
- if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
3312
+ if (source != null && __getOwnPropSymbols$j)
3313
+ for (var prop of __getOwnPropSymbols$j(source)) {
3314
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
3202
3315
  target[prop] = source[prop];
3203
3316
  }
3204
3317
  return target;
@@ -3225,8 +3338,8 @@ const badgeVariants = classVarianceAuthority.cva(
3225
3338
  }
3226
3339
  );
3227
3340
  function Badge(_a) {
3228
- var _b = _a, { className, variant } = _b, props = __objRest$4(_b, ["className", "variant"]);
3229
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$f({ className: cn(badgeVariants({ variant }), className) }, props));
3341
+ var _b = _a, { className, variant } = _b, props = __objRest$5(_b, ["className", "variant"]);
3342
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$j({ className: cn(badgeVariants({ variant }), className) }, props));
3230
3343
  }
3231
3344
 
3232
3345
  // src/primitive.tsx
@@ -3631,10 +3744,6 @@ const oppositeSideMap = {
3631
3744
  bottom: 'top',
3632
3745
  top: 'bottom'
3633
3746
  };
3634
- const oppositeAlignmentMap = {
3635
- start: 'end',
3636
- end: 'start'
3637
- };
3638
3747
  function clamp(start, value, end) {
3639
3748
  return max(start, min(value, end));
3640
3749
  }
@@ -3653,9 +3762,9 @@ function getOppositeAxis(axis) {
3653
3762
  function getAxisLength(axis) {
3654
3763
  return axis === 'y' ? 'height' : 'width';
3655
3764
  }
3656
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
3657
3765
  function getSideAxis(placement) {
3658
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
3766
+ const firstChar = placement[0];
3767
+ return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
3659
3768
  }
3660
3769
  function getAlignmentAxis(placement) {
3661
3770
  return getOppositeAxis(getSideAxis(placement));
@@ -3678,7 +3787,7 @@ function getExpandedPlacements(placement) {
3678
3787
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
3679
3788
  }
3680
3789
  function getOppositeAlignmentPlacement(placement) {
3681
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
3790
+ return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
3682
3791
  }
3683
3792
  const lrPlacement = ['left', 'right'];
3684
3793
  const rlPlacement = ['right', 'left'];
@@ -3709,7 +3818,8 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
3709
3818
  return list;
3710
3819
  }
3711
3820
  function getOppositePlacement(placement) {
3712
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
3821
+ const side = getSide(placement);
3822
+ return oppositeSideMap[side] + placement.slice(side.length);
3713
3823
  }
3714
3824
  function expandPaddingObject(padding) {
3715
3825
  return {
@@ -3868,6 +3978,9 @@ async function detectOverflow(state, options) {
3868
3978
  };
3869
3979
  }
3870
3980
 
3981
+ // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
3982
+ const MAX_RESET_COUNT = 50;
3983
+
3871
3984
  /**
3872
3985
  * Computes the `x` and `y` coordinates that will place the floating element
3873
3986
  * next to a given reference element.
@@ -3882,7 +3995,10 @@ const computePosition$1 = async (reference, floating, config) => {
3882
3995
  middleware = [],
3883
3996
  platform
3884
3997
  } = config;
3885
- const validMiddleware = middleware.filter(Boolean);
3998
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
3999
+ ...platform,
4000
+ detectOverflow
4001
+ };
3886
4002
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
3887
4003
  let rects = await platform.getElementRects({
3888
4004
  reference,
@@ -3894,14 +4010,17 @@ const computePosition$1 = async (reference, floating, config) => {
3894
4010
  y
3895
4011
  } = computeCoordsFromPlacement(rects, placement, rtl);
3896
4012
  let statefulPlacement = placement;
3897
- let middlewareData = {};
3898
4013
  let resetCount = 0;
3899
- for (let i = 0; i < validMiddleware.length; i++) {
3900
- var _platform$detectOverf;
4014
+ const middlewareData = {};
4015
+ for (let i = 0; i < middleware.length; i++) {
4016
+ const currentMiddleware = middleware[i];
4017
+ if (!currentMiddleware) {
4018
+ continue;
4019
+ }
3901
4020
  const {
3902
4021
  name,
3903
4022
  fn
3904
- } = validMiddleware[i];
4023
+ } = currentMiddleware;
3905
4024
  const {
3906
4025
  x: nextX,
3907
4026
  y: nextY,
@@ -3915,10 +4034,7 @@ const computePosition$1 = async (reference, floating, config) => {
3915
4034
  strategy,
3916
4035
  middlewareData,
3917
4036
  rects,
3918
- platform: {
3919
- ...platform,
3920
- detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
3921
- },
4037
+ platform: platformWithDetectOverflow,
3922
4038
  elements: {
3923
4039
  reference,
3924
4040
  floating
@@ -3926,14 +4042,11 @@ const computePosition$1 = async (reference, floating, config) => {
3926
4042
  });
3927
4043
  x = nextX != null ? nextX : x;
3928
4044
  y = nextY != null ? nextY : y;
3929
- middlewareData = {
3930
- ...middlewareData,
3931
- [name]: {
3932
- ...middlewareData[name],
3933
- ...data
3934
- }
4045
+ middlewareData[name] = {
4046
+ ...middlewareData[name],
4047
+ ...data
3935
4048
  };
3936
- if (reset && resetCount <= 50) {
4049
+ if (reset && resetCount < MAX_RESET_COUNT) {
3937
4050
  resetCount++;
3938
4051
  if (typeof reset === 'object') {
3939
4052
  if (reset.placement) {
@@ -4608,7 +4721,6 @@ function isShadowRoot(value) {
4608
4721
  }
4609
4722
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
4610
4723
  }
4611
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
4612
4724
  function isOverflowElement(element) {
4613
4725
  const {
4614
4726
  overflow,
@@ -4616,32 +4728,35 @@ function isOverflowElement(element) {
4616
4728
  overflowY,
4617
4729
  display
4618
4730
  } = getComputedStyle$2(element);
4619
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
4731
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
4620
4732
  }
4621
- const tableElements$1 = /*#__PURE__*/new Set(['table', 'td', 'th']);
4622
4733
  function isTableElement(element) {
4623
- return tableElements$1.has(getNodeName(element));
4734
+ return /^(table|td|th)$/.test(getNodeName(element));
4624
4735
  }
4625
- const topLayerSelectors = [':popover-open', ':modal'];
4626
4736
  function isTopLayer(element) {
4627
- return topLayerSelectors.some(selector => {
4628
- try {
4629
- return element.matches(selector);
4630
- } catch (_e) {
4631
- return false;
4737
+ try {
4738
+ if (element.matches(':popover-open')) {
4739
+ return true;
4632
4740
  }
4633
- });
4741
+ } catch (_e) {
4742
+ // no-op
4743
+ }
4744
+ try {
4745
+ return element.matches(':modal');
4746
+ } catch (_e) {
4747
+ return false;
4748
+ }
4634
4749
  }
4635
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
4636
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
4637
- const containValues = ['paint', 'layout', 'strict', 'content'];
4750
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
4751
+ const containRe = /paint|layout|strict|content/;
4752
+ const isNotNone = value => !!value && value !== 'none';
4753
+ let isWebKitValue;
4638
4754
  function isContainingBlock(elementOrCss) {
4639
- const webkit = isWebKit();
4640
4755
  const css = isElement(elementOrCss) ? getComputedStyle$2(elementOrCss) : elementOrCss;
4641
4756
 
4642
4757
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
4643
4758
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
4644
- return transformProperties.some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || willChangeValues.some(value => (css.willChange || '').includes(value)) || containValues.some(value => (css.contain || '').includes(value));
4759
+ return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
4645
4760
  }
4646
4761
  function getContainingBlock(element) {
4647
4762
  let currentNode = getParentNode(element);
@@ -4656,12 +4771,13 @@ function getContainingBlock(element) {
4656
4771
  return null;
4657
4772
  }
4658
4773
  function isWebKit() {
4659
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
4660
- return CSS.supports('-webkit-backdrop-filter', 'none');
4774
+ if (isWebKitValue == null) {
4775
+ isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
4776
+ }
4777
+ return isWebKitValue;
4661
4778
  }
4662
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
4663
4779
  function isLastTraversableNode(node) {
4664
- return lastTraversableNodeNames.has(getNodeName(node));
4780
+ return /^(html|body|#document)$/.test(getNodeName(node));
4665
4781
  }
4666
4782
  function getComputedStyle$2(element) {
4667
4783
  return getWindow(element).getComputedStyle(element);
@@ -4717,8 +4833,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
4717
4833
  if (isBody) {
4718
4834
  const frameElement = getFrameElement(win);
4719
4835
  return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
4836
+ } else {
4837
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
4720
4838
  }
4721
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
4722
4839
  }
4723
4840
  function getFrameElement(win) {
4724
4841
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
@@ -4895,7 +5012,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
4895
5012
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
4896
5013
  scroll = getNodeScroll(offsetParent);
4897
5014
  }
4898
- if (isHTMLElement(offsetParent)) {
5015
+ if (isOffsetParentAnElement) {
4899
5016
  const offsetRect = getBoundingClientRect(offsetParent);
4900
5017
  scale = getScale(offsetParent);
4901
5018
  offsets.x = offsetRect.x + offsetParent.clientLeft;
@@ -4983,7 +5100,6 @@ function getViewportRect(element, strategy) {
4983
5100
  };
4984
5101
  }
4985
5102
 
4986
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
4987
5103
  // Returns the inner client rect, subtracting scrollbars if present.
4988
5104
  function getInnerBoundingClientRect(element, strategy) {
4989
5105
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
@@ -5048,7 +5164,7 @@ function getClippingElementAncestors(element, cache) {
5048
5164
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
5049
5165
  currentContainingBlockComputedStyle = null;
5050
5166
  }
5051
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
5167
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
5052
5168
  if (shouldDropCurrentNode) {
5053
5169
  // Drop non-containing blocks.
5054
5170
  result = result.filter(ancestor => ancestor !== currentNode);
@@ -5073,20 +5189,23 @@ function getClippingRect(_ref) {
5073
5189
  } = _ref;
5074
5190
  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
5075
5191
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
5076
- const firstClippingAncestor = clippingAncestors[0];
5077
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
5078
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
5079
- accRect.top = max(rect.top, accRect.top);
5080
- accRect.right = min(rect.right, accRect.right);
5081
- accRect.bottom = min(rect.bottom, accRect.bottom);
5082
- accRect.left = max(rect.left, accRect.left);
5083
- return accRect;
5084
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
5192
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
5193
+ let top = firstRect.top;
5194
+ let right = firstRect.right;
5195
+ let bottom = firstRect.bottom;
5196
+ let left = firstRect.left;
5197
+ for (let i = 1; i < clippingAncestors.length; i++) {
5198
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
5199
+ top = max(rect.top, top);
5200
+ right = min(rect.right, right);
5201
+ bottom = min(rect.bottom, bottom);
5202
+ left = max(rect.left, left);
5203
+ }
5085
5204
  return {
5086
- width: clippingRect.right - clippingRect.left,
5087
- height: clippingRect.bottom - clippingRect.top,
5088
- x: clippingRect.left,
5089
- y: clippingRect.top
5205
+ width: right - left,
5206
+ height: bottom - top,
5207
+ x: left,
5208
+ y: top
5090
5209
  };
5091
5210
  }
5092
5211
 
@@ -5337,7 +5456,7 @@ function autoUpdate(reference, floating, update, options) {
5337
5456
  animationFrame = false
5338
5457
  } = options;
5339
5458
  const referenceEl = unwrapElement(reference);
5340
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
5459
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
5341
5460
  ancestors.forEach(ancestor => {
5342
5461
  ancestorScroll && ancestor.addEventListener('scroll', update, {
5343
5462
  passive: true
@@ -5350,7 +5469,7 @@ function autoUpdate(reference, floating, update, options) {
5350
5469
  if (elementResize) {
5351
5470
  resizeObserver = new ResizeObserver(_ref => {
5352
5471
  let [firstEntry] = _ref;
5353
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
5472
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
5354
5473
  // Prevent update loops when using the `size` middleware.
5355
5474
  // https://github.com/floating-ui/floating-ui/issues/1740
5356
5475
  resizeObserver.unobserve(floating);
@@ -5365,7 +5484,9 @@ function autoUpdate(reference, floating, update, options) {
5365
5484
  if (referenceEl && !animationFrame) {
5366
5485
  resizeObserver.observe(referenceEl);
5367
5486
  }
5368
- resizeObserver.observe(floating);
5487
+ if (floating) {
5488
+ resizeObserver.observe(floating);
5489
+ }
5369
5490
  }
5370
5491
  let frameId;
5371
5492
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
@@ -5747,28 +5868,39 @@ const arrow$1 = options => {
5747
5868
  * object may be passed.
5748
5869
  * @see https://floating-ui.com/docs/offset
5749
5870
  */
5750
- const offset = (options, deps) => ({
5751
- ...offset$1(options),
5752
- options: [options, deps]
5753
- });
5871
+ const offset = (options, deps) => {
5872
+ const result = offset$1(options);
5873
+ return {
5874
+ name: result.name,
5875
+ fn: result.fn,
5876
+ options: [options, deps]
5877
+ };
5878
+ };
5754
5879
 
5755
5880
  /**
5756
5881
  * Optimizes the visibility of the floating element by shifting it in order to
5757
5882
  * keep it in view when it will overflow the clipping boundary.
5758
5883
  * @see https://floating-ui.com/docs/shift
5759
5884
  */
5760
- const shift = (options, deps) => ({
5761
- ...shift$1(options),
5762
- options: [options, deps]
5763
- });
5885
+ const shift = (options, deps) => {
5886
+ const result = shift$1(options);
5887
+ return {
5888
+ name: result.name,
5889
+ fn: result.fn,
5890
+ options: [options, deps]
5891
+ };
5892
+ };
5764
5893
 
5765
5894
  /**
5766
5895
  * Built-in `limiter` that will stop `shift()` at a certain point.
5767
5896
  */
5768
- const limitShift = (options, deps) => ({
5769
- ...limitShift$1(options),
5770
- options: [options, deps]
5771
- });
5897
+ const limitShift = (options, deps) => {
5898
+ const result = limitShift$1(options);
5899
+ return {
5900
+ fn: result.fn,
5901
+ options: [options, deps]
5902
+ };
5903
+ };
5772
5904
 
5773
5905
  /**
5774
5906
  * Optimizes the visibility of the floating element by flipping the `placement`
@@ -5776,10 +5908,14 @@ const limitShift = (options, deps) => ({
5776
5908
  * clipping boundary. Alternative to `autoPlacement`.
5777
5909
  * @see https://floating-ui.com/docs/flip
5778
5910
  */
5779
- const flip = (options, deps) => ({
5780
- ...flip$1(options),
5781
- options: [options, deps]
5782
- });
5911
+ const flip = (options, deps) => {
5912
+ const result = flip$1(options);
5913
+ return {
5914
+ name: result.name,
5915
+ fn: result.fn,
5916
+ options: [options, deps]
5917
+ };
5918
+ };
5783
5919
 
5784
5920
  /**
5785
5921
  * Provides data that allows you to change the size of the floating element —
@@ -5787,20 +5923,28 @@ const flip = (options, deps) => ({
5787
5923
  * width of the reference element.
5788
5924
  * @see https://floating-ui.com/docs/size
5789
5925
  */
5790
- const size = (options, deps) => ({
5791
- ...size$1(options),
5792
- options: [options, deps]
5793
- });
5926
+ const size = (options, deps) => {
5927
+ const result = size$1(options);
5928
+ return {
5929
+ name: result.name,
5930
+ fn: result.fn,
5931
+ options: [options, deps]
5932
+ };
5933
+ };
5794
5934
 
5795
5935
  /**
5796
5936
  * Provides data to hide the floating element in applicable situations, such as
5797
5937
  * when it is not in the same clipping context as the reference element.
5798
5938
  * @see https://floating-ui.com/docs/hide
5799
5939
  */
5800
- const hide = (options, deps) => ({
5801
- ...hide$1(options),
5802
- options: [options, deps]
5803
- });
5940
+ const hide = (options, deps) => {
5941
+ const result = hide$1(options);
5942
+ return {
5943
+ name: result.name,
5944
+ fn: result.fn,
5945
+ options: [options, deps]
5946
+ };
5947
+ };
5804
5948
 
5805
5949
  /**
5806
5950
  * Provides data to position an inner element of the floating element so that it
@@ -5808,10 +5952,14 @@ const hide = (options, deps) => ({
5808
5952
  * This wraps the core `arrow` middleware to allow React refs as the element.
5809
5953
  * @see https://floating-ui.com/docs/arrow
5810
5954
  */
5811
- const arrow = (options, deps) => ({
5812
- ...arrow$1(options),
5813
- options: [options, deps]
5814
- });
5955
+ const arrow = (options, deps) => {
5956
+ const result = arrow$1(options);
5957
+ return {
5958
+ name: result.name,
5959
+ fn: result.fn,
5960
+ options: [options, deps]
5961
+ };
5962
+ };
5815
5963
 
5816
5964
  // src/arrow.tsx
5817
5965
  var NAME$1 = "Arrow";
@@ -6827,30 +6975,30 @@ var Root3 = Tooltip$2;
6827
6975
  var Trigger = TooltipTrigger$1;
6828
6976
  var Content2 = TooltipContent$1;
6829
6977
 
6830
- var __defProp$e = Object.defineProperty;
6831
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
6832
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
6833
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
6834
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6835
- var __spreadValues$e = (a, b) => {
6978
+ var __defProp$i = Object.defineProperty;
6979
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6980
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
6981
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
6982
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6983
+ var __spreadValues$i = (a, b) => {
6836
6984
  for (var prop in b || (b = {}))
6837
- if (__hasOwnProp$e.call(b, prop))
6838
- __defNormalProp$e(a, prop, b[prop]);
6839
- if (__getOwnPropSymbols$e)
6840
- for (var prop of __getOwnPropSymbols$e(b)) {
6841
- if (__propIsEnum$e.call(b, prop))
6842
- __defNormalProp$e(a, prop, b[prop]);
6985
+ if (__hasOwnProp$i.call(b, prop))
6986
+ __defNormalProp$i(a, prop, b[prop]);
6987
+ if (__getOwnPropSymbols$i)
6988
+ for (var prop of __getOwnPropSymbols$i(b)) {
6989
+ if (__propIsEnum$i.call(b, prop))
6990
+ __defNormalProp$i(a, prop, b[prop]);
6843
6991
  }
6844
6992
  return a;
6845
6993
  };
6846
- var __objRest$3 = (source, exclude) => {
6994
+ var __objRest$4 = (source, exclude) => {
6847
6995
  var target = {};
6848
6996
  for (var prop in source)
6849
- if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
6997
+ if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
6850
6998
  target[prop] = source[prop];
6851
- if (source != null && __getOwnPropSymbols$e)
6852
- for (var prop of __getOwnPropSymbols$e(source)) {
6853
- if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
6999
+ if (source != null && __getOwnPropSymbols$i)
7000
+ for (var prop of __getOwnPropSymbols$i(source)) {
7001
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(source, prop))
6854
7002
  target[prop] = source[prop];
6855
7003
  }
6856
7004
  return target;
@@ -6859,10 +7007,10 @@ const TooltipProvider = Provider;
6859
7007
  const Tooltip$1 = Root3;
6860
7008
  const TooltipTrigger = Trigger;
6861
7009
  const TooltipContent = React__namespace.forwardRef((_a, ref) => {
6862
- var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest$3(_b, ["className", "sideOffset"]);
7010
+ var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest$4(_b, ["className", "sideOffset"]);
6863
7011
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
6864
7012
  Content2,
6865
- __spreadValues$e({
7013
+ __spreadValues$i({
6866
7014
  ref,
6867
7015
  sideOffset,
6868
7016
  className: cn(
@@ -7024,11 +7172,16 @@ function getWidgetStyles(widget) {
7024
7172
  };
7025
7173
  }
7026
7174
  function shuffleColors(colors, count) {
7027
- const shuffled = [...colors].sort(() => Math.random() - 0.5);
7028
- while (shuffled.length < count) {
7029
- shuffled.push(...[...colors].sort(() => Math.random() - 0.5));
7175
+ const shuffled = [...colors];
7176
+ for (let i = shuffled.length - 1; i > 0; i--) {
7177
+ const j = Math.floor(Math.random() * (i + 1));
7178
+ [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
7179
+ }
7180
+ let result = [...shuffled];
7181
+ while (result.length < count) {
7182
+ result.push(...shuffled);
7030
7183
  }
7031
- return shuffled.slice(0, count);
7184
+ return result.slice(0, count);
7032
7185
  }
7033
7186
  function getBorderRadiusValue(value) {
7034
7187
  switch (value) {
@@ -7059,25 +7212,25 @@ function getPaddingValue(value) {
7059
7212
  }
7060
7213
  }
7061
7214
 
7062
- var __defProp$d = Object.defineProperty;
7063
- var __defProps$b = Object.defineProperties;
7064
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
7065
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
7066
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
7067
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
7068
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7069
- var __spreadValues$d = (a, b) => {
7215
+ var __defProp$h = Object.defineProperty;
7216
+ var __defProps$f = Object.defineProperties;
7217
+ var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
7218
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
7219
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
7220
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
7221
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7222
+ var __spreadValues$h = (a, b) => {
7070
7223
  for (var prop in b || (b = {}))
7071
- if (__hasOwnProp$d.call(b, prop))
7072
- __defNormalProp$d(a, prop, b[prop]);
7073
- if (__getOwnPropSymbols$d)
7074
- for (var prop of __getOwnPropSymbols$d(b)) {
7075
- if (__propIsEnum$d.call(b, prop))
7076
- __defNormalProp$d(a, prop, b[prop]);
7224
+ if (__hasOwnProp$h.call(b, prop))
7225
+ __defNormalProp$h(a, prop, b[prop]);
7226
+ if (__getOwnPropSymbols$h)
7227
+ for (var prop of __getOwnPropSymbols$h(b)) {
7228
+ if (__propIsEnum$h.call(b, prop))
7229
+ __defNormalProp$h(a, prop, b[prop]);
7077
7230
  }
7078
7231
  return a;
7079
7232
  };
7080
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
7233
+ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
7081
7234
  function FacetWidget({
7082
7235
  widget,
7083
7236
  showHeader = true,
@@ -7136,7 +7289,7 @@ function FacetWidget({
7136
7289
  };
7137
7290
  const updateConfig = (newFields) => {
7138
7291
  if (onConfigUpdate) {
7139
- onConfigUpdate(__spreadProps$b(__spreadValues$d({}, widget.config), {
7292
+ onConfigUpdate(__spreadProps$f(__spreadValues$h({}, widget.config), {
7140
7293
  fields: newFields
7141
7294
  }));
7142
7295
  }
@@ -20133,9 +20286,28 @@ function BarChart({ orientation, title, data, options, className, units, content
20133
20286
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data, options: options != null ? options : defaultOptions, plugins: [barValuePlugin] });
20134
20287
  }
20135
20288
 
20289
+ var __defProp$g = Object.defineProperty;
20290
+ var __defProps$e = Object.defineProperties;
20291
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
20292
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
20293
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
20294
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
20295
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20296
+ var __spreadValues$g = (a, b) => {
20297
+ for (var prop in b || (b = {}))
20298
+ if (__hasOwnProp$g.call(b, prop))
20299
+ __defNormalProp$g(a, prop, b[prop]);
20300
+ if (__getOwnPropSymbols$g)
20301
+ for (var prop of __getOwnPropSymbols$g(b)) {
20302
+ if (__propIsEnum$g.call(b, prop))
20303
+ __defNormalProp$g(a, prop, b[prop]);
20304
+ }
20305
+ return a;
20306
+ };
20307
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
20136
20308
  Chart$1.register(CategoryScale, LinearScale, BarElement, plugin_title, plugin_tooltip, plugin_legend);
20137
- function SeriesChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title }) {
20138
- var _a, _b;
20309
+ function SeriesChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title, chartSettings }) {
20310
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
20139
20311
  const formatValue = (value) => {
20140
20312
  const numValue = typeof value === "string" ? parseFloat(value) : value;
20141
20313
  if (!isNaN(numValue)) {
@@ -20148,15 +20320,17 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20148
20320
  afterDatasetsDraw(chart) {
20149
20321
  if (!(content == null ? void 0 : content.showLabels)) return;
20150
20322
  const { ctx } = chart;
20323
+ const chartHeight = chart.height;
20324
+ const fontSize = Math.max(11, Math.min(14, Math.floor(chartHeight * 0.025)));
20151
20325
  chart.data.datasets.forEach((dataset, i) => {
20152
20326
  const meta = chart.getDatasetMeta(i);
20153
20327
  meta.data.forEach((bar, index) => {
20154
20328
  const value = dataset.data[index];
20155
20329
  ctx.save();
20156
- ctx.font = "12px sans-serif";
20330
+ ctx.font = `bold ${fontSize}px sans-serif`;
20157
20331
  ctx.textAlign = "center";
20158
- ctx.fillStyle = "black";
20159
- ctx.fillText(value, bar.x, bar.y - 5);
20332
+ ctx.fillStyle = "#0F172A";
20333
+ ctx.fillText(value, bar.x, bar.y - 8);
20160
20334
  ctx.restore();
20161
20335
  });
20162
20336
  });
@@ -20176,10 +20350,10 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20176
20350
  indexAxis: orientation === "horizontal" ? "y" : "x",
20177
20351
  layout: {
20178
20352
  padding: {
20179
- bottom: 0,
20180
- top: 0,
20181
- left: 0,
20182
- right: 0
20353
+ bottom: 8,
20354
+ top: 24,
20355
+ left: 4,
20356
+ right: 16
20183
20357
  }
20184
20358
  },
20185
20359
  plugins: {
@@ -20191,24 +20365,27 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20191
20365
  return false;
20192
20366
  }),
20193
20367
  labels: {
20194
- boxWidth: 12,
20195
- boxHeight: 12
20368
+ boxWidth: 16,
20369
+ boxHeight: 16,
20370
+ padding: 16,
20371
+ font: { size: 13, weight: "normal" },
20372
+ usePointStyle: true,
20373
+ pointStyle: "rect"
20196
20374
  },
20197
20375
  position: "bottom"
20198
20376
  },
20199
20377
  datalabels: {
20200
20378
  display: false
20201
20379
  },
20202
- title: {
20203
- display: true,
20204
- text: title,
20205
- font: {
20206
- size: 18,
20207
- weight: "bold"
20208
- },
20209
- color: "#0F172A"
20210
- },
20211
20380
  tooltip: {
20381
+ mode: "index",
20382
+ intersect: false,
20383
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
20384
+ titleFont: { size: 13, weight: "bold" },
20385
+ bodyFont: { size: 12 },
20386
+ padding: 12,
20387
+ borderColor: "#ccc",
20388
+ borderWidth: 1,
20212
20389
  callbacks: {
20213
20390
  label: function(context) {
20214
20391
  var _a2, _b2;
@@ -20222,28 +20399,91 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20222
20399
  x: {
20223
20400
  title: {
20224
20401
  display: !!x_axis_title,
20225
- text: x_axis_title
20402
+ text: x_axis_title,
20403
+ font: { size: 13, weight: "bold" },
20404
+ padding: 8
20226
20405
  },
20227
- ticks: { autoSkip: false, maxRotation: 45, minRotation: 0 }
20406
+ ticks: {
20407
+ autoSkip: true,
20408
+ maxRotation: 45,
20409
+ minRotation: 0,
20410
+ font: { size: 12 },
20411
+ maxTicksLimit: 12
20412
+ },
20413
+ grid: {
20414
+ color: "rgba(0, 0, 0, 0.05)"
20415
+ }
20228
20416
  },
20229
20417
  y: {
20230
20418
  title: {
20231
20419
  display: true,
20232
- text: y_axis_title || ((data == null ? void 0 : data.datasets) && ((_a = data == null ? void 0 : data.datasets) == null ? void 0 : _a.length) === 1 ? (_b = data == null ? void 0 : data.datasets) == null ? void 0 : _b[0].label : getAxisLabel(units != null ? units : ""))
20420
+ text: y_axis_title || ((data == null ? void 0 : data.datasets) && ((_a = data == null ? void 0 : data.datasets) == null ? void 0 : _a.length) === 1 ? (_b = data == null ? void 0 : data.datasets) == null ? void 0 : _b[0].label : getAxisLabel(units != null ? units : "")),
20421
+ font: { size: 13, weight: "bold" },
20422
+ padding: 12
20233
20423
  },
20234
20424
  beginAtZero: true,
20235
20425
  ticks: {
20426
+ font: { size: 12 },
20236
20427
  callback: function(value) {
20237
20428
  if (units === "$") {
20238
20429
  return `${units}${formatValue(value)}`;
20239
20430
  }
20240
20431
  return units ? `${formatValue(value)} ${(units == null ? void 0 : units.length) < 3 ? units : ""}` : value;
20241
20432
  }
20433
+ },
20434
+ grid: {
20435
+ color: "rgba(0, 0, 0, 0.05)"
20242
20436
  }
20243
20437
  }
20244
20438
  }
20245
20439
  };
20246
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data, options: options != null ? options : defaultOptions, plugins: [barValuePlugin] });
20440
+ const mergedOptions = chartSettings ? __spreadProps$e(__spreadValues$g({}, defaultOptions), {
20441
+ plugins: __spreadProps$e(__spreadValues$g({}, defaultOptions.plugins), {
20442
+ legend: __spreadProps$e(__spreadValues$g({}, (_c = defaultOptions.plugins) == null ? void 0 : _c.legend), {
20443
+ display: chartSettings.showLegend !== false,
20444
+ labels: __spreadProps$e(__spreadValues$g({}, (_e = (_d = defaultOptions.plugins) == null ? void 0 : _d.legend) == null ? void 0 : _e.labels), {
20445
+ boxWidth: (_f = chartSettings.legendBoxSize) != null ? _f : 16,
20446
+ boxHeight: (_g = chartSettings.legendBoxSize) != null ? _g : 16,
20447
+ font: { size: (_h = chartSettings.legendFontSize) != null ? _h : 13 }
20448
+ })
20449
+ }),
20450
+ tooltip: __spreadProps$e(__spreadValues$g({}, (_i = defaultOptions.plugins) == null ? void 0 : _i.tooltip), {
20451
+ bodyFont: { size: (_j = chartSettings.tooltipFontSize) != null ? _j : 12 },
20452
+ titleFont: { size: (_k = chartSettings.tooltipFontSize) != null ? _k : 12 }
20453
+ })
20454
+ }),
20455
+ scales: __spreadProps$e(__spreadValues$g({}, defaultOptions.scales), {
20456
+ x: __spreadProps$e(__spreadValues$g({}, (_l = defaultOptions.scales) == null ? void 0 : _l.x), {
20457
+ title: __spreadProps$e(__spreadValues$g({}, (_n = (_m = defaultOptions.scales) == null ? void 0 : _m.x) == null ? void 0 : _n.title), {
20458
+ font: { size: (_o = chartSettings.xAxisTitleFontSize) != null ? _o : 13, weight: "bold" }
20459
+ }),
20460
+ ticks: __spreadProps$e(__spreadValues$g({}, (_q = (_p = defaultOptions.scales) == null ? void 0 : _p.x) == null ? void 0 : _q.ticks), {
20461
+ font: { size: (_r = chartSettings.xAxisTickFontSize) != null ? _r : 12 }
20462
+ })
20463
+ }),
20464
+ y: __spreadProps$e(__spreadValues$g({}, (_s = defaultOptions.scales) == null ? void 0 : _s.y), {
20465
+ title: __spreadProps$e(__spreadValues$g({}, (_u = (_t = defaultOptions.scales) == null ? void 0 : _t.y) == null ? void 0 : _u.title), {
20466
+ font: { size: (_v = chartSettings.yAxisTitleFontSize) != null ? _v : 13, weight: "bold" }
20467
+ }),
20468
+ ticks: __spreadProps$e(__spreadValues$g({}, (_x = (_w = defaultOptions.scales) == null ? void 0 : _w.y) == null ? void 0 : _x.ticks), {
20469
+ font: { size: (_y = chartSettings.yAxisTickFontSize) != null ? _y : 12 }
20470
+ })
20471
+ })
20472
+ })
20473
+ }) : defaultOptions;
20474
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full", children: [
20475
+ ((chartSettings == null ? void 0 : chartSettings.titleText) || title) && (chartSettings == null ? void 0 : chartSettings.showTitle) !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(
20476
+ "p",
20477
+ {
20478
+ style: {
20479
+ fontSize: `${(_z = chartSettings == null ? void 0 : chartSettings.titleFontSize) != null ? _z : 16}px`
20480
+ },
20481
+ className: "font-bold text-slate-900 text-center px-2 pt-4 pb-2 select-text cursor-text shrink-0",
20482
+ children: (chartSettings == null ? void 0 : chartSettings.titleText) || title
20483
+ }
20484
+ ),
20485
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data, options: options != null ? options : mergedOptions, plugins: [barValuePlugin] }) })
20486
+ ] });
20247
20487
  }
20248
20488
 
20249
20489
  /*!
@@ -21594,9 +21834,28 @@ var plugin$1 = {
21594
21834
  }
21595
21835
  };
21596
21836
 
21597
- Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
21598
- function SeriesLineChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title }) {
21599
- var _a, _b;
21837
+ var __defProp$f = Object.defineProperty;
21838
+ var __defProps$d = Object.defineProperties;
21839
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
21840
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
21841
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
21842
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
21843
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21844
+ var __spreadValues$f = (a, b) => {
21845
+ for (var prop in b || (b = {}))
21846
+ if (__hasOwnProp$f.call(b, prop))
21847
+ __defNormalProp$f(a, prop, b[prop]);
21848
+ if (__getOwnPropSymbols$f)
21849
+ for (var prop of __getOwnPropSymbols$f(b)) {
21850
+ if (__propIsEnum$f.call(b, prop))
21851
+ __defNormalProp$f(a, prop, b[prop]);
21852
+ }
21853
+ return a;
21854
+ };
21855
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
21856
+ Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_tooltip, plugin_legend);
21857
+ function SeriesLineChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title, chartSettings }) {
21858
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
21600
21859
  const formatValue = (value) => {
21601
21860
  const numValue = typeof value === "string" ? parseFloat(value) : value;
21602
21861
  if (!isNaN(numValue)) {
@@ -21617,10 +21876,10 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21617
21876
  maintainAspectRatio: false,
21618
21877
  layout: {
21619
21878
  padding: {
21620
- bottom: 0,
21621
- top: 0,
21622
- left: 0,
21623
- right: 0
21879
+ bottom: 8,
21880
+ top: 8,
21881
+ left: 4,
21882
+ right: 16
21624
21883
  }
21625
21884
  },
21626
21885
  plugins: {
@@ -21632,8 +21891,12 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21632
21891
  return false;
21633
21892
  }),
21634
21893
  labels: {
21635
- boxWidth: 12,
21636
- boxHeight: 12
21894
+ boxWidth: 16,
21895
+ boxHeight: 16,
21896
+ padding: 16,
21897
+ font: { size: 13, weight: "normal" },
21898
+ usePointStyle: true,
21899
+ pointStyle: "circle"
21637
21900
  },
21638
21901
  position: "bottom"
21639
21902
  },
@@ -21653,16 +21916,15 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21653
21916
  },
21654
21917
  formatter: (value) => value
21655
21918
  },
21656
- title: {
21657
- display: true,
21658
- text: title,
21659
- font: {
21660
- size: 18,
21661
- weight: "bold"
21662
- },
21663
- color: "#0F172A"
21664
- },
21665
21919
  tooltip: {
21920
+ mode: "index",
21921
+ intersect: false,
21922
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
21923
+ titleFont: { size: 13, weight: "bold" },
21924
+ bodyFont: { size: 12 },
21925
+ padding: 12,
21926
+ borderColor: "#ccc",
21927
+ borderWidth: 1,
21666
21928
  callbacks: {
21667
21929
  label: function(context) {
21668
21930
  var _a2;
@@ -21676,33 +21938,111 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21676
21938
  x: {
21677
21939
  title: {
21678
21940
  display: !!x_axis_title,
21679
- text: x_axis_title
21941
+ text: x_axis_title,
21942
+ font: { size: 13, weight: "bold" },
21943
+ padding: 8
21680
21944
  },
21681
- ticks: { autoSkip: true, maxTicksLimit: 8, maxRotation: 45, minRotation: 0 }
21945
+ ticks: {
21946
+ autoSkip: true,
21947
+ maxRotation: 45,
21948
+ minRotation: 0,
21949
+ font: { size: 12 },
21950
+ maxTicksLimit: 10
21951
+ },
21952
+ grid: {
21953
+ color: "rgba(0, 0, 0, 0.05)"
21954
+ }
21682
21955
  },
21683
21956
  y: {
21684
21957
  title: {
21685
21958
  display: true,
21686
- text: y_axis_title || ((data == null ? void 0 : data.datasets) && ((_a = data == null ? void 0 : data.datasets) == null ? void 0 : _a.length) === 1 ? (_b = data == null ? void 0 : data.datasets) == null ? void 0 : _b[0].label : getAxisLabel(units != null ? units : ""))
21959
+ text: y_axis_title || ((data == null ? void 0 : data.datasets) && ((_a = data == null ? void 0 : data.datasets) == null ? void 0 : _a.length) === 1 ? (_b = data == null ? void 0 : data.datasets) == null ? void 0 : _b[0].label : getAxisLabel(units != null ? units : "")),
21960
+ font: { size: 13, weight: "bold" },
21961
+ padding: 12
21687
21962
  },
21688
21963
  beginAtZero: true,
21689
21964
  ticks: {
21965
+ font: { size: 12 },
21690
21966
  callback: function(value) {
21691
21967
  return units ? `${formatValue(value)} ${units}` : value;
21692
21968
  }
21969
+ },
21970
+ grid: {
21971
+ color: "rgba(0, 0, 0, 0.05)"
21693
21972
  }
21694
21973
  }
21695
21974
  },
21696
21975
  elements: {
21697
21976
  line: {
21698
- tension: 0.1
21977
+ tension: 0.3
21699
21978
  },
21700
21979
  point: {
21701
21980
  radius: 4
21702
21981
  }
21703
21982
  }
21704
21983
  };
21705
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Line, { data, options: options != null ? options : defaultOptions, plugins: [plugin$1] });
21984
+ const mergedOptions = chartSettings ? __spreadProps$d(__spreadValues$f({}, defaultOptions), {
21985
+ plugins: __spreadProps$d(__spreadValues$f({}, defaultOptions.plugins), {
21986
+ legend: __spreadProps$d(__spreadValues$f({}, (_c = defaultOptions.plugins) == null ? void 0 : _c.legend), {
21987
+ display: chartSettings.showLegend !== false,
21988
+ labels: __spreadProps$d(__spreadValues$f({}, (_e = (_d = defaultOptions.plugins) == null ? void 0 : _d.legend) == null ? void 0 : _e.labels), {
21989
+ boxWidth: (_f = chartSettings.legendBoxSize) != null ? _f : 16,
21990
+ boxHeight: (_g = chartSettings.legendBoxSize) != null ? _g : 16,
21991
+ font: { size: (_h = chartSettings.legendFontSize) != null ? _h : 13 }
21992
+ })
21993
+ }),
21994
+ datalabels: __spreadProps$d(__spreadValues$f({}, (_i = defaultOptions.plugins) == null ? void 0 : _i.datalabels), {
21995
+ display: (context) => {
21996
+ var _a2;
21997
+ return context.dataset.data[context.dataIndex] !== null && ((_a2 = chartSettings.showLabels) != null ? _a2 : false);
21998
+ },
21999
+ font: { size: (_j = chartSettings.dataLabelsFontSize) != null ? _j : 12 }
22000
+ }),
22001
+ tooltip: __spreadProps$d(__spreadValues$f({}, (_k = defaultOptions.plugins) == null ? void 0 : _k.tooltip), {
22002
+ bodyFont: { size: (_l = chartSettings.tooltipFontSize) != null ? _l : 12 },
22003
+ titleFont: { size: (_m = chartSettings.tooltipFontSize) != null ? _m : 12 }
22004
+ })
22005
+ }),
22006
+ scales: __spreadProps$d(__spreadValues$f({}, defaultOptions.scales), {
22007
+ x: __spreadProps$d(__spreadValues$f({}, (_n = defaultOptions.scales) == null ? void 0 : _n.x), {
22008
+ title: __spreadProps$d(__spreadValues$f({}, (_p = (_o = defaultOptions.scales) == null ? void 0 : _o.x) == null ? void 0 : _p.title), {
22009
+ font: { size: (_q = chartSettings.xAxisTitleFontSize) != null ? _q : 13, weight: "bold" }
22010
+ }),
22011
+ ticks: __spreadProps$d(__spreadValues$f({}, (_s = (_r = defaultOptions.scales) == null ? void 0 : _r.x) == null ? void 0 : _s.ticks), {
22012
+ font: { size: (_t = chartSettings.xAxisTickFontSize) != null ? _t : 12 }
22013
+ })
22014
+ }),
22015
+ y: __spreadProps$d(__spreadValues$f({}, (_u = defaultOptions.scales) == null ? void 0 : _u.y), {
22016
+ title: __spreadProps$d(__spreadValues$f({}, (_w = (_v = defaultOptions.scales) == null ? void 0 : _v.y) == null ? void 0 : _w.title), {
22017
+ font: { size: (_x = chartSettings.yAxisTitleFontSize) != null ? _x : 13, weight: "bold" }
22018
+ }),
22019
+ ticks: __spreadProps$d(__spreadValues$f({}, (_z = (_y = defaultOptions.scales) == null ? void 0 : _y.y) == null ? void 0 : _z.ticks), {
22020
+ font: { size: (_A = chartSettings.yAxisTickFontSize) != null ? _A : 12 }
22021
+ })
22022
+ })
22023
+ }),
22024
+ elements: {
22025
+ line: {
22026
+ tension: (_B = chartSettings.lineTension) != null ? _B : 0.3
22027
+ },
22028
+ point: {
22029
+ radius: (_C = chartSettings.pointRadius) != null ? _C : 4
22030
+ }
22031
+ }
22032
+ }) : defaultOptions;
22033
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full", children: [
22034
+ ((chartSettings == null ? void 0 : chartSettings.titleText) || title) && (chartSettings == null ? void 0 : chartSettings.showTitle) !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(
22035
+ "p",
22036
+ {
22037
+ style: {
22038
+ fontSize: `${(_D = chartSettings == null ? void 0 : chartSettings.titleFontSize) != null ? _D : 16}px`
22039
+ },
22040
+ className: "font-bold text-slate-900 text-center px-2 pt-4 pb-2 select-text cursor-text shrink-0",
22041
+ children: (chartSettings == null ? void 0 : chartSettings.titleText) || title
22042
+ }
22043
+ ),
22044
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Line, { data, options: options != null ? options : mergedOptions, plugins: [plugin$1] }) })
22045
+ ] });
21706
22046
  }
21707
22047
 
21708
22048
  /*!
@@ -22487,9 +22827,29 @@ var plugin = {
22487
22827
  },
22488
22828
  };
22489
22829
 
22830
+ var __defProp$e = Object.defineProperty;
22831
+ var __defProps$c = Object.defineProperties;
22832
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
22833
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
22834
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
22835
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
22836
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22837
+ var __spreadValues$e = (a, b) => {
22838
+ for (var prop in b || (b = {}))
22839
+ if (__hasOwnProp$e.call(b, prop))
22840
+ __defNormalProp$e(a, prop, b[prop]);
22841
+ if (__getOwnPropSymbols$e)
22842
+ for (var prop of __getOwnPropSymbols$e(b)) {
22843
+ if (__propIsEnum$e.call(b, prop))
22844
+ __defNormalProp$e(a, prop, b[prop]);
22845
+ }
22846
+ return a;
22847
+ };
22848
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
22490
22849
  Chart$1.register(ArcElement, plugin_tooltip, plugin_legend);
22491
22850
  const PieChart = (props) => {
22492
- const { data, title, options, units, content } = props;
22851
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
22852
+ const { data, title, options, units, content, chartSettings } = props;
22493
22853
  const formatValue = (value) => {
22494
22854
  const numValue = typeof value === "string" ? parseFloat(value) : value;
22495
22855
  if (units === "$" && !isNaN(numValue)) {
@@ -22503,52 +22863,55 @@ const PieChart = (props) => {
22503
22863
  plugins: {
22504
22864
  legend: {
22505
22865
  labels: {
22506
- boxWidth: 4,
22507
- boxHeight: 4
22866
+ boxWidth: 16,
22867
+ boxHeight: 16,
22868
+ padding: 12,
22869
+ font: { size: 13, weight: "normal" },
22870
+ usePointStyle: true,
22871
+ pointStyle: "circle"
22508
22872
  },
22509
22873
  position: "bottom"
22510
22874
  },
22511
22875
  outlabels: {
22512
22876
  display: (context) => {
22513
- var _a;
22514
- return context.dataset.data[context.dataIndex] !== null && ((_a = content == null ? void 0 : content.showLabels) != null ? _a : false);
22877
+ var _a2;
22878
+ return context.dataset.data[context.dataIndex] !== null && ((_a2 = content == null ? void 0 : content.showLabels) != null ? _a2 : false);
22515
22879
  },
22516
22880
  text: (ctx) => {
22517
- var _a;
22881
+ var _a2;
22518
22882
  const dataset = ctx.dataset.data;
22519
22883
  const total = dataset.reduce((a, b) => a + b, 0);
22520
22884
  const value = dataset[ctx.dataIndex];
22521
22885
  const percent = value / total * 100;
22522
- return percent >= 5 ? `${(_a = ctx.chart.data.labels) == null ? void 0 : _a[ctx.dataIndex]} ${value}` : "";
22886
+ return percent >= 5 ? `${(_a2 = ctx.chart.data.labels) == null ? void 0 : _a2[ctx.dataIndex]} ${value}` : "";
22523
22887
  },
22524
- color: "black",
22525
- stretch: 15,
22888
+ color: "#0F172A",
22889
+ stretch: 25,
22890
+ padding: 4,
22526
22891
  font: {
22527
22892
  resizable: true,
22528
- minSize: 12,
22529
- maxSize: 18
22893
+ minSize: 11,
22894
+ maxSize: 14,
22895
+ weight: "bold"
22530
22896
  },
22531
22897
  backgroundColor: (ctx) => {
22532
22898
  const dataset = ctx.dataset.data;
22533
22899
  const total = dataset.reduce((a, b) => a + b, 0);
22534
22900
  const value = dataset[ctx.dataIndex];
22535
22901
  const percent = value / total * 100;
22536
- return percent >= 5 ? "rgba(255,255,255,0.7)" : "transparent";
22902
+ return percent >= 5 ? "rgba(255,255,255,0.85)" : "transparent";
22537
22903
  }
22538
22904
  },
22539
22905
  datalabels: {
22540
22906
  display: false
22541
22907
  },
22542
- title: {
22543
- display: true,
22544
- text: title,
22545
- font: {
22546
- size: 18,
22547
- weight: "bold"
22548
- },
22549
- color: "#0F172A"
22550
- },
22551
22908
  tooltip: {
22909
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
22910
+ titleFont: { size: 13, weight: "bold" },
22911
+ bodyFont: { size: 12 },
22912
+ padding: 12,
22913
+ borderColor: "#ccc",
22914
+ borderWidth: 1,
22552
22915
  callbacks: {
22553
22916
  label: function(context) {
22554
22917
  const value = context.parsed;
@@ -22559,14 +22922,48 @@ const PieChart = (props) => {
22559
22922
  },
22560
22923
  layout: {
22561
22924
  padding: {
22562
- bottom: 0,
22563
- top: 0,
22564
- left: 0,
22565
- right: 0
22925
+ bottom: 4,
22926
+ top: 24,
22927
+ left: 4,
22928
+ right: 4
22566
22929
  }
22567
22930
  }
22568
22931
  };
22569
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Pie, { data, options: options != null ? options : defaultOptions, plugins: [plugin] });
22932
+ const mergedOptions = chartSettings ? __spreadProps$c(__spreadValues$e({}, defaultOptions), {
22933
+ plugins: __spreadProps$c(__spreadValues$e({}, defaultOptions.plugins), {
22934
+ legend: __spreadProps$c(__spreadValues$e({}, (_a = defaultOptions.plugins) == null ? void 0 : _a.legend), {
22935
+ display: chartSettings.showLegend !== false,
22936
+ labels: __spreadProps$c(__spreadValues$e({}, (_c = (_b = defaultOptions.plugins) == null ? void 0 : _b.legend) == null ? void 0 : _c.labels), {
22937
+ boxWidth: (_d = chartSettings.legendBoxSize) != null ? _d : 16,
22938
+ boxHeight: (_e = chartSettings.legendBoxSize) != null ? _e : 16,
22939
+ font: { size: (_f = chartSettings.legendFontSize) != null ? _f : 13 }
22940
+ })
22941
+ }),
22942
+ outlabels: __spreadProps$c(__spreadValues$e({}, (_g = defaultOptions.plugins) == null ? void 0 : _g.outlabels), {
22943
+ font: __spreadProps$c(__spreadValues$e({}, (_i = (_h = defaultOptions.plugins) == null ? void 0 : _h.outlabels) == null ? void 0 : _i.font), {
22944
+ minSize: (_j = chartSettings.dataLabelsFontSize) != null ? _j : 11,
22945
+ maxSize: ((_k = chartSettings.dataLabelsFontSize) != null ? _k : 12) + 2
22946
+ })
22947
+ }),
22948
+ tooltip: __spreadProps$c(__spreadValues$e({}, (_l = defaultOptions.plugins) == null ? void 0 : _l.tooltip), {
22949
+ bodyFont: { size: (_m = chartSettings.tooltipFontSize) != null ? _m : 12 },
22950
+ titleFont: { size: (_n = chartSettings.tooltipFontSize) != null ? _n : 12 }
22951
+ })
22952
+ })
22953
+ }) : defaultOptions;
22954
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full", children: [
22955
+ ((chartSettings == null ? void 0 : chartSettings.titleText) || title) && (chartSettings == null ? void 0 : chartSettings.showTitle) !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(
22956
+ "p",
22957
+ {
22958
+ style: {
22959
+ fontSize: `${(_o = chartSettings == null ? void 0 : chartSettings.titleFontSize) != null ? _o : 16}px`
22960
+ },
22961
+ className: "font-bold text-slate-900 text-center px-2 pt-4 pb-2 select-text cursor-text shrink-0",
22962
+ children: (chartSettings == null ? void 0 : chartSettings.titleText) || title
22963
+ }
22964
+ ),
22965
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Pie, { data, options: options != null ? options : mergedOptions, plugins: [plugin] }) })
22966
+ ] });
22570
22967
  };
22571
22968
 
22572
22969
  Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
@@ -36931,7 +37328,7 @@ const own$2 = {}.hasOwnProperty;
36931
37328
  * mdast tree.
36932
37329
  */
36933
37330
  function fromMarkdown(value, encoding, options) {
36934
- if (typeof encoding !== 'string') {
37331
+ if (encoding && typeof encoding === 'object') {
36935
37332
  options = encoding;
36936
37333
  encoding = undefined;
36937
37334
  }
@@ -43491,27 +43888,27 @@ function SummaryWidget({ title, data, metadata, className }) {
43491
43888
  ] });
43492
43889
  }
43493
43890
 
43494
- var __defProp$c = Object.defineProperty;
43495
- var __defProps$a = Object.defineProperties;
43496
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
43497
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
43498
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
43499
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
43500
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
43501
- var __spreadValues$c = (a, b) => {
43891
+ var __defProp$d = Object.defineProperty;
43892
+ var __defProps$b = Object.defineProperties;
43893
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
43894
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
43895
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
43896
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
43897
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
43898
+ var __spreadValues$d = (a, b) => {
43502
43899
  for (var prop in b || (b = {}))
43503
- if (__hasOwnProp$c.call(b, prop))
43504
- __defNormalProp$c(a, prop, b[prop]);
43505
- if (__getOwnPropSymbols$c)
43506
- for (var prop of __getOwnPropSymbols$c(b)) {
43507
- if (__propIsEnum$c.call(b, prop))
43508
- __defNormalProp$c(a, prop, b[prop]);
43900
+ if (__hasOwnProp$d.call(b, prop))
43901
+ __defNormalProp$d(a, prop, b[prop]);
43902
+ if (__getOwnPropSymbols$d)
43903
+ for (var prop of __getOwnPropSymbols$d(b)) {
43904
+ if (__propIsEnum$d.call(b, prop))
43905
+ __defNormalProp$d(a, prop, b[prop]);
43509
43906
  }
43510
43907
  return a;
43511
43908
  };
43512
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
43909
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
43513
43910
  const CHART_REFRESH_TIMEOUT$4 = 3e3;
43514
- const DEFAULT_COLORS$3 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
43911
+ const DEFAULT_COLORS$4 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
43515
43912
  const LINE_COLORS = ["#243D84", "#69238B", "#4A959F", "#D0A677", "#B31E47", "#396431"];
43516
43913
  const clearChat$5 = async (widgetBackendUrl, widgetId) => {
43517
43914
  if (!widgetBackendUrl || !widgetId) return;
@@ -43541,7 +43938,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43541
43938
  const baseState = { dataset_id: datasetId || "home_generation_dataset" };
43542
43939
  switch (agentType) {
43543
43940
  case "Pie Chart Agent":
43544
- return __spreadValues$c({
43941
+ return __spreadValues$d({
43545
43942
  pie_chart_data: {
43546
43943
  title: "",
43547
43944
  type: "pie",
@@ -43552,7 +43949,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43552
43949
  }, baseState);
43553
43950
  case "Line Chart Agent":
43554
43951
  case "Bar Chart Agent":
43555
- return __spreadValues$c({
43952
+ return __spreadValues$d({
43556
43953
  bar_chart_data: {
43557
43954
  title: "",
43558
43955
  type: agentType === "Line Chart Agent" ? "line" : "bar",
@@ -43564,7 +43961,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43564
43961
  }, baseState);
43565
43962
  case "Series Bar Chart Agent":
43566
43963
  case "Series Line Chart Agent":
43567
- return __spreadValues$c({
43964
+ return __spreadValues$d({
43568
43965
  series_bar_chart_data: {
43569
43966
  title: "",
43570
43967
  type: "series_bar",
@@ -43590,7 +43987,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43590
43987
  }
43591
43988
  }, baseState);
43592
43989
  case "Data Grid Agent":
43593
- return __spreadValues$c({
43990
+ return __spreadValues$d({
43594
43991
  matrix_grid_data: {
43595
43992
  title: "",
43596
43993
  type: "data_grid",
@@ -43601,7 +43998,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43601
43998
  }
43602
43999
  }, baseState);
43603
44000
  case "Summary Agent":
43604
- return __spreadValues$c({
44001
+ return __spreadValues$d({
43605
44002
  summary_data: {
43606
44003
  title: "",
43607
44004
  type: "summary",
@@ -43610,7 +44007,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43610
44007
  }
43611
44008
  }, baseState);
43612
44009
  default:
43613
- return __spreadValues$c({ widget_ids: widgetIds }, baseState);
44010
+ return __spreadValues$d({ widget_ids: widgetIds }, baseState);
43614
44011
  }
43615
44012
  };
43616
44013
  const loadAgentState$5 = async (widgetBackendUrl, threadId, agentName) => {
@@ -43650,7 +44047,7 @@ const parseAndUpdateChartState$4 = (apiResponse, setChartState) => {
43650
44047
  if (parsedState.state) {
43651
44048
  const chartData = parsedState.state;
43652
44049
  setChartState((prevState) => {
43653
- const newChartState = __spreadValues$c({}, prevState);
44050
+ const newChartState = __spreadValues$d({}, prevState);
43654
44051
  if (chartData.bar_chart_data) {
43655
44052
  newChartState.bar_chart_data = chartData.bar_chart_data;
43656
44053
  }
@@ -43749,7 +44146,7 @@ function BarChartComponent({
43749
44146
  }
43750
44147
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43751
44148
  const finalColors = React.useMemo(() => {
43752
- return shuffleColors(DEFAULT_COLORS$3, labels == null ? void 0 : labels.length);
44149
+ return shuffleColors(DEFAULT_COLORS$4, labels == null ? void 0 : labels.length);
43753
44150
  }, [labels.length]);
43754
44151
  if (isEmpty) {
43755
44152
  return createLoadingComponent$5();
@@ -43815,7 +44212,7 @@ function SeriesBarChartComponent$2({
43815
44212
  }
43816
44213
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43817
44214
  const finalColors = React.useMemo(() => {
43818
- return shuffleColors(DEFAULT_COLORS$3, series == null ? void 0 : series.length);
44215
+ return shuffleColors(DEFAULT_COLORS$4, series == null ? void 0 : series.length);
43819
44216
  }, [series.length]);
43820
44217
  if (isEmpty) {
43821
44218
  return createLoadingComponent$5();
@@ -43879,7 +44276,7 @@ function SeriesLineChartComponent({
43879
44276
  }
43880
44277
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43881
44278
  const finalColors = React.useMemo(() => {
43882
- return shuffleColors([...LINE_COLORS, ...DEFAULT_COLORS$3], series == null ? void 0 : series.length);
44279
+ return shuffleColors([...LINE_COLORS, ...DEFAULT_COLORS$4], series == null ? void 0 : series.length);
43883
44280
  }, [series.length]);
43884
44281
  if (isEmpty) {
43885
44282
  return createLoadingComponent$5();
@@ -43948,7 +44345,7 @@ function PieChartComponent$1({
43948
44345
  }
43949
44346
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43950
44347
  const backgroundColors = React.useMemo(() => {
43951
- return shuffleColors(DEFAULT_COLORS$3, labels.length);
44348
+ return shuffleColors(DEFAULT_COLORS$4, labels.length);
43952
44349
  }, [labels.length]);
43953
44350
  if (isEmpty) {
43954
44351
  return createLoadingComponent$5();
@@ -44127,7 +44524,7 @@ function SummaryComponent({
44127
44524
  React.useEffect(() => {
44128
44525
  if (isEmpty && query && isFirstLoad && !(summaryState == null ? void 0 : summaryState.agent_message) && !hasCalledRef.current) {
44129
44526
  hasCalledRef.current = true;
44130
- setChartState(__spreadProps$a(__spreadValues$c({}, summaryState), {
44527
+ setChartState(__spreadProps$b(__spreadValues$d({}, summaryState), {
44131
44528
  widget_ids
44132
44529
  }));
44133
44530
  setTimeout(() => {
@@ -44204,7 +44601,7 @@ function CopilotKitAgent({
44204
44601
  if (apiCallCount >= 10) {
44205
44602
  console.log("API call limit reached for widget:", widget.id);
44206
44603
  setHasTimeoutError(true);
44207
- setChartState((prevState) => __spreadProps$a(__spreadValues$c({}, prevState), {
44604
+ setChartState((prevState) => __spreadProps$b(__spreadValues$d({}, prevState), {
44208
44605
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
44209
44606
  }));
44210
44607
  return;
@@ -44613,25 +45010,25 @@ function exportChatToPDF(options) {
44613
45010
  doc.save(filename);
44614
45011
  }
44615
45012
 
44616
- var __defProp$b = Object.defineProperty;
44617
- var __defProps$9 = Object.defineProperties;
44618
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
44619
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
44620
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
44621
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
44622
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44623
- var __spreadValues$b = (a, b) => {
45013
+ var __defProp$c = Object.defineProperty;
45014
+ var __defProps$a = Object.defineProperties;
45015
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
45016
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
45017
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
45018
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
45019
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45020
+ var __spreadValues$c = (a, b) => {
44624
45021
  for (var prop in b || (b = {}))
44625
- if (__hasOwnProp$b.call(b, prop))
44626
- __defNormalProp$b(a, prop, b[prop]);
44627
- if (__getOwnPropSymbols$b)
44628
- for (var prop of __getOwnPropSymbols$b(b)) {
44629
- if (__propIsEnum$b.call(b, prop))
44630
- __defNormalProp$b(a, prop, b[prop]);
45022
+ if (__hasOwnProp$c.call(b, prop))
45023
+ __defNormalProp$c(a, prop, b[prop]);
45024
+ if (__getOwnPropSymbols$c)
45025
+ for (var prop of __getOwnPropSymbols$c(b)) {
45026
+ if (__propIsEnum$c.call(b, prop))
45027
+ __defNormalProp$c(a, prop, b[prop]);
44631
45028
  }
44632
45029
  return a;
44633
45030
  };
44634
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
45031
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
44635
45032
  const getStyleValues$4 = (styles = {}) => {
44636
45033
  const borderRadiusMap = {
44637
45034
  none: "0px",
@@ -44662,7 +45059,9 @@ function CopilotKitChatbot({
44662
45059
  onResetReady,
44663
45060
  widgetIds,
44664
45061
  datasetId,
44665
- dashboardName
45062
+ dashboardName,
45063
+ onClearChat,
45064
+ isClearing = false
44666
45065
  }) {
44667
45066
  var _a, _b, _c, _d;
44668
45067
  const { threadId, setThreadId } = reactCore.useCopilotContext();
@@ -44749,7 +45148,7 @@ function CopilotKitChatbot({
44749
45148
  const handleSubmit = (e) => {
44750
45149
  e.preventDefault();
44751
45150
  if (!inputValue.trim()) return;
44752
- setChatbotState((prevState) => __spreadProps$9(__spreadValues$b({}, prevState), {
45151
+ setChatbotState((prevState) => __spreadProps$a(__spreadValues$c({}, prevState), {
44753
45152
  widget_ids: widgetIds,
44754
45153
  dataset_id: datasetId
44755
45154
  }));
@@ -44771,25 +45170,46 @@ function CopilotKitChatbot({
44771
45170
  /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-medium", children: widget.title })
44772
45171
  ] }) }),
44773
45172
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 h-full flex flex-col", children: [
44774
- chatMessages.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start px-4 py-2 border-b border-gray-100", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
44775
- "button",
44776
- {
44777
- onClick: handleExport,
44778
- disabled: isExporting,
44779
- className: cn(
44780
- "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md",
44781
- "bg-gray-100 border border-gray-200",
44782
- "text-gray-700 hover:bg-gray-200 hover:border-gray-300",
44783
- "disabled:opacity-50 disabled:cursor-not-allowed",
44784
- "transition-colors duration-150"
44785
- ),
44786
- title: "Export conversation as PDF",
44787
- children: [
44788
- isExporting ? /* @__PURE__ */ jsxRuntimeExports.jsx(lucideReact.Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(lucideReact.Download, { className: "h-3.5 w-3.5" }),
44789
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Export PDF" })
44790
- ]
44791
- }
44792
- ) }),
45173
+ chatMessages.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-start gap-2 px-4 py-2 border-b border-gray-100", children: [
45174
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
45175
+ "button",
45176
+ {
45177
+ onClick: handleExport,
45178
+ disabled: isExporting,
45179
+ className: cn(
45180
+ "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md",
45181
+ "bg-gray-100 border border-gray-200",
45182
+ "text-gray-700 hover:bg-gray-200 hover:border-gray-300",
45183
+ "disabled:opacity-50 disabled:cursor-not-allowed",
45184
+ "transition-colors duration-150"
45185
+ ),
45186
+ title: "Export conversation as PDF",
45187
+ children: [
45188
+ isExporting ? /* @__PURE__ */ jsxRuntimeExports.jsx(lucideReact.Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(lucideReact.Download, { className: "h-3.5 w-3.5" }),
45189
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Export PDF" })
45190
+ ]
45191
+ }
45192
+ ),
45193
+ onClearChat && /* @__PURE__ */ jsxRuntimeExports.jsxs(
45194
+ "button",
45195
+ {
45196
+ onClick: onClearChat,
45197
+ disabled: isClearing,
45198
+ className: cn(
45199
+ "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md",
45200
+ "bg-gray-100 border border-gray-200",
45201
+ "text-gray-700 hover:bg-gray-200 hover:border-gray-300",
45202
+ "disabled:opacity-50 disabled:cursor-not-allowed",
45203
+ "transition-colors duration-150"
45204
+ ),
45205
+ title: "Clear chat conversation",
45206
+ children: [
45207
+ isClearing ? /* @__PURE__ */ jsxRuntimeExports.jsx(lucideReact.Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(lucideReact.MessageCircleX, { className: "h-3.5 w-3.5" }),
45208
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Clear Chat" })
45209
+ ]
45210
+ }
45211
+ )
45212
+ ] }),
44793
45213
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto p-4 space-y-4", children: chatMessages.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center text-gray-500 text-xs mt-8", children: ((_b = widget.config) == null ? void 0 : _b.copilotInitialMessage) || ((_c = widget.config) == null ? void 0 : _c.placeholder) || "How can I help you today?" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
44794
45214
  chatMessages.map((message) => /* @__PURE__ */ jsxRuntimeExports.jsx(
44795
45215
  "div",
@@ -44866,7 +45286,9 @@ function ChatbotWidget({
44866
45286
  onResetReady,
44867
45287
  widgetIds,
44868
45288
  datasetId,
44869
- dashboardName
45289
+ dashboardName,
45290
+ onClearChat,
45291
+ isClearing = false
44870
45292
  }) {
44871
45293
  var _a, _b;
44872
45294
  const styles = getStyleValues$4((_a = widget.config) == null ? void 0 : _a.styles);
@@ -44891,49 +45313,51 @@ function ChatbotWidget({
44891
45313
  onResetReady,
44892
45314
  widgetIds,
44893
45315
  datasetId,
44894
- dashboardName
45316
+ dashboardName,
45317
+ onClearChat,
45318
+ isClearing
44895
45319
  }
44896
45320
  )
44897
45321
  }
44898
45322
  );
44899
45323
  }
44900
45324
 
44901
- var __defProp$a = Object.defineProperty;
44902
- var __defProps$8 = Object.defineProperties;
44903
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
44904
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
44905
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
44906
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
44907
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44908
- var __spreadValues$a = (a, b) => {
45325
+ var __defProp$b = Object.defineProperty;
45326
+ var __defProps$9 = Object.defineProperties;
45327
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
45328
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
45329
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
45330
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
45331
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45332
+ var __spreadValues$b = (a, b) => {
44909
45333
  for (var prop in b || (b = {}))
44910
- if (__hasOwnProp$a.call(b, prop))
44911
- __defNormalProp$a(a, prop, b[prop]);
44912
- if (__getOwnPropSymbols$a)
44913
- for (var prop of __getOwnPropSymbols$a(b)) {
44914
- if (__propIsEnum$a.call(b, prop))
44915
- __defNormalProp$a(a, prop, b[prop]);
45334
+ if (__hasOwnProp$b.call(b, prop))
45335
+ __defNormalProp$b(a, prop, b[prop]);
45336
+ if (__getOwnPropSymbols$b)
45337
+ for (var prop of __getOwnPropSymbols$b(b)) {
45338
+ if (__propIsEnum$b.call(b, prop))
45339
+ __defNormalProp$b(a, prop, b[prop]);
44916
45340
  }
44917
45341
  return a;
44918
45342
  };
44919
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
44920
- var __objRest$2 = (source, exclude) => {
45343
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
45344
+ var __objRest$3 = (source, exclude) => {
44921
45345
  var target = {};
44922
45346
  for (var prop in source)
44923
- if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
45347
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
44924
45348
  target[prop] = source[prop];
44925
- if (source != null && __getOwnPropSymbols$a)
44926
- for (var prop of __getOwnPropSymbols$a(source)) {
44927
- if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
45349
+ if (source != null && __getOwnPropSymbols$b)
45350
+ for (var prop of __getOwnPropSymbols$b(source)) {
45351
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
44928
45352
  target[prop] = source[prop];
44929
45353
  }
44930
45354
  return target;
44931
45355
  };
44932
45356
  const Checkbox = React__namespace.forwardRef((_a, ref) => {
44933
- var _b = _a, { className } = _b, props = __objRest$2(_b, ["className"]);
45357
+ var _b = _a, { className } = _b, props = __objRest$3(_b, ["className"]);
44934
45358
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
44935
45359
  CheckboxPrimitive__namespace.Root,
44936
- __spreadProps$8(__spreadValues$a({
45360
+ __spreadProps$9(__spreadValues$b({
44937
45361
  ref,
44938
45362
  className: cn(
44939
45363
  "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
@@ -44952,25 +45376,25 @@ const Checkbox = React__namespace.forwardRef((_a, ref) => {
44952
45376
  });
44953
45377
  Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
44954
45378
 
44955
- var __defProp$9 = Object.defineProperty;
44956
- var __defProps$7 = Object.defineProperties;
44957
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
44958
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
44959
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
44960
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
44961
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44962
- var __spreadValues$9 = (a, b) => {
45379
+ var __defProp$a = Object.defineProperty;
45380
+ var __defProps$8 = Object.defineProperties;
45381
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
45382
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
45383
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
45384
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
45385
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45386
+ var __spreadValues$a = (a, b) => {
44963
45387
  for (var prop in b || (b = {}))
44964
- if (__hasOwnProp$9.call(b, prop))
44965
- __defNormalProp$9(a, prop, b[prop]);
44966
- if (__getOwnPropSymbols$9)
44967
- for (var prop of __getOwnPropSymbols$9(b)) {
44968
- if (__propIsEnum$9.call(b, prop))
44969
- __defNormalProp$9(a, prop, b[prop]);
45388
+ if (__hasOwnProp$a.call(b, prop))
45389
+ __defNormalProp$a(a, prop, b[prop]);
45390
+ if (__getOwnPropSymbols$a)
45391
+ for (var prop of __getOwnPropSymbols$a(b)) {
45392
+ if (__propIsEnum$a.call(b, prop))
45393
+ __defNormalProp$a(a, prop, b[prop]);
44970
45394
  }
44971
45395
  return a;
44972
45396
  };
44973
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
45397
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
44974
45398
  const FILTER_REFRESH_TIMEOUT = 3e3;
44975
45399
  const clearChat$4 = async (widgetBackendUrl, widgetId) => {
44976
45400
  if (!widgetBackendUrl || !widgetId) return;
@@ -45039,7 +45463,7 @@ const parseAndUpdateFilterState = (apiResponse, setFilterState) => {
45039
45463
  if (parsedState.state) {
45040
45464
  const filterData = parsedState.state;
45041
45465
  setFilterState((prevState) => {
45042
- const newFilterState = __spreadValues$9({}, prevState);
45466
+ const newFilterState = __spreadValues$a({}, prevState);
45043
45467
  if (filterData.column_values) {
45044
45468
  newFilterState.column_values = filterData.column_values;
45045
45469
  }
@@ -45128,7 +45552,7 @@ function TableSelectionConfirmation({
45128
45552
  {
45129
45553
  value: selectedTables[col.column] || "",
45130
45554
  onChange: (e) => {
45131
- setSelectedTables((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
45555
+ setSelectedTables((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45132
45556
  [col.column]: e.target.value
45133
45557
  }));
45134
45558
  },
@@ -45244,7 +45668,7 @@ function FiltersContent({
45244
45668
  }
45245
45669
  }, [(_a = widget.config) == null ? void 0 : _a.filters, filterGroups]);
45246
45670
  const toggleGroup = (groupId) => {
45247
- setExpandedGroups((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
45671
+ setExpandedGroups((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45248
45672
  [groupId]: !prev[groupId]
45249
45673
  }));
45250
45674
  };
@@ -45257,7 +45681,7 @@ function FiltersContent({
45257
45681
  } else {
45258
45682
  newGroupFilters = groupFilters.filter((id) => id !== optionId);
45259
45683
  }
45260
- const newFilters = __spreadProps$7(__spreadValues$9({}, prev), {
45684
+ const newFilters = __spreadProps$8(__spreadValues$a({}, prev), {
45261
45685
  [groupId]: newGroupFilters
45262
45686
  });
45263
45687
  if (onFilterChange) {
@@ -45267,7 +45691,7 @@ function FiltersContent({
45267
45691
  });
45268
45692
  };
45269
45693
  const handleSearchChange = (groupId, query2) => {
45270
- setSearchQueries((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
45694
+ setSearchQueries((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45271
45695
  [groupId]: query2
45272
45696
  }));
45273
45697
  };
@@ -45285,7 +45709,7 @@ function FiltersContent({
45285
45709
  };
45286
45710
  const clearGroupFilters = (groupId) => {
45287
45711
  setSelectedFilters((prev) => {
45288
- const newFilters = __spreadProps$7(__spreadValues$9({}, prev), { [groupId]: [] });
45712
+ const newFilters = __spreadProps$8(__spreadValues$a({}, prev), { [groupId]: [] });
45289
45713
  if (onFilterChange) {
45290
45714
  onFilterChange(newFilters);
45291
45715
  }
@@ -45447,7 +45871,7 @@ function FiltersContent({
45447
45871
  "Content-Type": "application/json"
45448
45872
  },
45449
45873
  body: JSON.stringify({
45450
- config: __spreadProps$7(__spreadValues$9({}, widget.config), {
45874
+ config: __spreadProps$8(__spreadValues$a({}, widget.config), {
45451
45875
  filters: filtersWithLabels
45452
45876
  })
45453
45877
  })
@@ -45527,7 +45951,7 @@ function CopilotKitFilters({
45527
45951
  if (apiCallCount >= 30) {
45528
45952
  console.log("API call limit reached for widget:", widget.id);
45529
45953
  setHasTimeoutError(true);
45530
- setFilterState((prevState) => __spreadProps$7(__spreadValues$9({}, prevState), {
45954
+ setFilterState((prevState) => __spreadProps$8(__spreadValues$a({}, prevState), {
45531
45955
  agent_message: "Timeout: Unable to load filter data after multiple attempts. Please try refreshing the widget."
45532
45956
  }));
45533
45957
  return;
@@ -45668,7 +46092,7 @@ function CopilotKitFilters({
45668
46092
  startLoadingTimeout();
45669
46093
  }, [filterState.filter_columns, filterState.ambiguous_columns, (_f = widget.config) == null ? void 0 : _f.query, datasetId, appendMessage, setFilterState, setAgentState, startLoadingTimeout, setApiCallCount, setHasTimeoutError]);
45670
46094
  const handleCancelConfirmation = React.useCallback(() => {
45671
- setFilterState((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
46095
+ setFilterState((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45672
46096
  status: void 0,
45673
46097
  ambiguous_columns: void 0,
45674
46098
  message: void 0
@@ -45762,27 +46186,27 @@ function FiltersWidget({
45762
46186
  );
45763
46187
  }
45764
46188
 
45765
- var __defProp$8 = Object.defineProperty;
45766
- var __defProps$6 = Object.defineProperties;
45767
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
45768
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
45769
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
45770
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
45771
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45772
- var __spreadValues$8 = (a, b) => {
46189
+ var __defProp$9 = Object.defineProperty;
46190
+ var __defProps$7 = Object.defineProperties;
46191
+ var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
46192
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
46193
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
46194
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
46195
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46196
+ var __spreadValues$9 = (a, b) => {
45773
46197
  for (var prop in b || (b = {}))
45774
- if (__hasOwnProp$8.call(b, prop))
45775
- __defNormalProp$8(a, prop, b[prop]);
45776
- if (__getOwnPropSymbols$8)
45777
- for (var prop of __getOwnPropSymbols$8(b)) {
45778
- if (__propIsEnum$8.call(b, prop))
45779
- __defNormalProp$8(a, prop, b[prop]);
46198
+ if (__hasOwnProp$9.call(b, prop))
46199
+ __defNormalProp$9(a, prop, b[prop]);
46200
+ if (__getOwnPropSymbols$9)
46201
+ for (var prop of __getOwnPropSymbols$9(b)) {
46202
+ if (__propIsEnum$9.call(b, prop))
46203
+ __defNormalProp$9(a, prop, b[prop]);
45780
46204
  }
45781
46205
  return a;
45782
46206
  };
45783
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
46207
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
45784
46208
  const CHART_REFRESH_TIMEOUT$3 = 3e3;
45785
- const DEFAULT_COLORS$2 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
46209
+ const DEFAULT_COLORS$3 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
45786
46210
  const clearChat$3 = async (widgetBackendUrl, widgetId) => {
45787
46211
  if (!widgetBackendUrl || !widgetId) return;
45788
46212
  console.log("clearChat called for widgetId:", widgetId);
@@ -45856,7 +46280,7 @@ const parseAndUpdateChartState$3 = (apiResponse, setChartState) => {
45856
46280
  if (parsedState.state) {
45857
46281
  const chartData = parsedState.state;
45858
46282
  setChartState((prevState) => {
45859
- const newChartState = __spreadValues$8({}, prevState);
46283
+ const newChartState = __spreadValues$9({}, prevState);
45860
46284
  if (chartData.pie_chart_data) {
45861
46285
  newChartState.pie_chart_data = chartData.pie_chart_data;
45862
46286
  }
@@ -45905,9 +46329,11 @@ function PieChartComponent({
45905
46329
  startLoadingTimeout,
45906
46330
  clearLoadingTimeout,
45907
46331
  content,
45908
- hasWidgetData
46332
+ hasWidgetData,
46333
+ chartSettings,
46334
+ onConfigUpdate
45909
46335
  }) {
45910
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
46336
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
45911
46337
  const hasCalledRef = React.useRef(false);
45912
46338
  const labels = ((_b = (_a = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) || [];
45913
46339
  const values = ((_d = (_c = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.values) || [];
@@ -45915,6 +46341,10 @@ function PieChartComponent({
45915
46341
  const chartTitle = ((_g = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _g.title) || "";
45916
46342
  const units = ((_h = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _h.units) || "";
45917
46343
  const isEmpty = labels.length === 0 || values.length === 0;
46344
+ React.useEffect(() => {
46345
+ console.log("[PieChartComponent] chartSettings:", chartSettings);
46346
+ console.log("[PieChartComponent] seriesColors:", chartSettings == null ? void 0 : chartSettings.seriesColors);
46347
+ }, [chartSettings]);
45918
46348
  const handleRefresh = async () => {
45919
46349
  if (query) {
45920
46350
  await clearChat$3(widgetBackendUrl, widgetId);
@@ -45944,24 +46374,49 @@ function PieChartComponent({
45944
46374
  }
45945
46375
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout, pieChartState]);
45946
46376
  const backgroundColors = React.useMemo(() => {
45947
- return shuffleColors(DEFAULT_COLORS$2, labels.length);
46377
+ return shuffleColors(DEFAULT_COLORS$3, labels.length);
45948
46378
  }, [labels.length]);
46379
+ const sortedIndices = React.useMemo(() => {
46380
+ return labels.map((label, index) => ({ label, index, value: values[index] })).sort((a, b) => a.label.localeCompare(b.label)).map((item) => item.index);
46381
+ }, [labels, values]);
46382
+ const sortedLabels = React.useMemo(() => {
46383
+ return sortedIndices.map((i) => labels[i]);
46384
+ }, [sortedIndices, labels]);
46385
+ const sortedValues = React.useMemo(() => {
46386
+ return sortedIndices.map((i) => values[i]);
46387
+ }, [sortedIndices, values]);
46388
+ const colors = React.useMemo(() => {
46389
+ var _a2, _b2;
46390
+ if ((chartSettings == null ? void 0 : chartSettings.seriesColors) && chartSettings.seriesColors.length > 0) {
46391
+ return chartSettings.seriesColors.slice(0, sortedLabels.length);
46392
+ }
46393
+ return ((_b2 = (_a2 = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.colors) || sortedLabels.map((_, index) => backgroundColors[index % backgroundColors.length]);
46394
+ }, [chartSettings == null ? void 0 : chartSettings.seriesColors, sortedLabels, (_j = (_i = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _i.data) == null ? void 0 : _j.colors]);
46395
+ React.useEffect(() => {
46396
+ var _a2;
46397
+ if (!isEmpty && colors.length > 0 && !((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2.length) && onConfigUpdate && widgetId) {
46398
+ onConfigUpdate(widgetId, {
46399
+ chartSettings: __spreadProps$7(__spreadValues$9({}, chartSettings), {
46400
+ seriesColors: colors
46401
+ })
46402
+ });
46403
+ }
46404
+ }, [sortedLabels.length, (_k = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _k.length, onConfigUpdate, widgetId, isEmpty]);
45949
46405
  if (isEmpty) {
45950
46406
  return createLoadingComponent$3();
45951
46407
  }
45952
- const colors = ((_j = (_i = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _i.data) == null ? void 0 : _j.colors) || labels.map((_, index) => backgroundColors[index % backgroundColors.length]);
45953
46408
  const transformedData = {
45954
- labels,
46409
+ labels: sortedLabels,
45955
46410
  datasets: [
45956
46411
  {
45957
46412
  label: chartTitle || "Data",
45958
- data: values,
46413
+ data: sortedValues,
45959
46414
  backgroundColor: colors,
45960
46415
  borderWidth: 0
45961
46416
  }
45962
46417
  ]
45963
46418
  };
45964
- return /* @__PURE__ */ jsxRuntimeExports.jsx(PieChart, { title: chartTitle, data: transformedData, units, content });
46419
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(PieChart, { title: chartTitle, data: transformedData, units, content, chartSettings });
45965
46420
  }
45966
46421
  function CopilotKitPieChart({
45967
46422
  widget,
@@ -45970,9 +46425,10 @@ function CopilotKitPieChart({
45970
46425
  onResetReady,
45971
46426
  widgetBackendUrl,
45972
46427
  datasetId,
45973
- widgetData
46428
+ widgetData,
46429
+ onConfigUpdate
45974
46430
  }) {
45975
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
46431
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
45976
46432
  const isFirstLoad = (_a = widget.config) == null ? void 0 : _a.isFirstLoad;
45977
46433
  const content = (_b = widget.config) == null ? void 0 : _b.content;
45978
46434
  const widget_data = (_c = widget.widget_data) == null ? void 0 : _c.pie_chart_data;
@@ -46012,7 +46468,7 @@ function CopilotKitPieChart({
46012
46468
  if (apiCallCount >= 30) {
46013
46469
  console.log("API call limit reached for widget:", widget.id);
46014
46470
  setHasTimeoutError(true);
46015
- setChartState((prevState) => __spreadProps$6(__spreadValues$8({}, prevState), {
46471
+ setChartState((prevState) => __spreadProps$7(__spreadValues$9({}, prevState), {
46016
46472
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
46017
46473
  }));
46018
46474
  return;
@@ -46112,7 +46568,9 @@ function CopilotKitPieChart({
46112
46568
  widgetId: widget.id,
46113
46569
  startLoadingTimeout,
46114
46570
  clearLoadingTimeout,
46115
- hasWidgetData: !!(((_o = (_n = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _n.labels) == null ? void 0 : _o.length) && ((_q = (_p = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _p.values) == null ? void 0 : _q.length))
46571
+ hasWidgetData: !!(((_o = (_n = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _n.labels) == null ? void 0 : _o.length) && ((_q = (_p = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _p.values) == null ? void 0 : _q.length)),
46572
+ chartSettings: (_r = widget.config) == null ? void 0 : _r.chartSettings,
46573
+ onConfigUpdate
46116
46574
  }
46117
46575
  ) })
46118
46576
  ] });
@@ -46124,7 +46582,8 @@ function PieChartWidget({
46124
46582
  onResetReady,
46125
46583
  widgetIds,
46126
46584
  datasetId,
46127
- widgetData
46585
+ widgetData,
46586
+ onConfigUpdate
46128
46587
  }) {
46129
46588
  var _a, _b;
46130
46589
  const styles = getStyleValues$3((_a = widget.config) == null ? void 0 : _a.styles);
@@ -46148,34 +46607,35 @@ function PieChartWidget({
46148
46607
  styles,
46149
46608
  onResetReady,
46150
46609
  widgetBackendUrl,
46151
- datasetId
46610
+ datasetId,
46611
+ onConfigUpdate
46152
46612
  }
46153
46613
  )
46154
46614
  }
46155
46615
  );
46156
46616
  }
46157
46617
 
46158
- var __defProp$7 = Object.defineProperty;
46159
- var __defProps$5 = Object.defineProperties;
46160
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
46161
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
46162
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
46163
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
46164
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46165
- var __spreadValues$7 = (a, b) => {
46618
+ var __defProp$8 = Object.defineProperty;
46619
+ var __defProps$6 = Object.defineProperties;
46620
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
46621
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
46622
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
46623
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
46624
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46625
+ var __spreadValues$8 = (a, b) => {
46166
46626
  for (var prop in b || (b = {}))
46167
- if (__hasOwnProp$7.call(b, prop))
46168
- __defNormalProp$7(a, prop, b[prop]);
46169
- if (__getOwnPropSymbols$7)
46170
- for (var prop of __getOwnPropSymbols$7(b)) {
46171
- if (__propIsEnum$7.call(b, prop))
46172
- __defNormalProp$7(a, prop, b[prop]);
46627
+ if (__hasOwnProp$8.call(b, prop))
46628
+ __defNormalProp$8(a, prop, b[prop]);
46629
+ if (__getOwnPropSymbols$8)
46630
+ for (var prop of __getOwnPropSymbols$8(b)) {
46631
+ if (__propIsEnum$8.call(b, prop))
46632
+ __defNormalProp$8(a, prop, b[prop]);
46173
46633
  }
46174
46634
  return a;
46175
46635
  };
46176
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
46636
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
46177
46637
  const CHART_REFRESH_TIMEOUT$2 = 3e3;
46178
- const DEFAULT_COLORS$1 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
46638
+ const DEFAULT_COLORS$2 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
46179
46639
  const clearChat$2 = async (widgetBackendUrl, widgetId) => {
46180
46640
  if (!widgetBackendUrl || !widgetId) return;
46181
46641
  console.log("clearChat called for widgetId:", widgetId);
@@ -46270,7 +46730,7 @@ const parseAndUpdateChartState$2 = (apiResponse, setChartState) => {
46270
46730
  if (parsedState.state) {
46271
46731
  const chartData = parsedState.state;
46272
46732
  setChartState((prevState) => {
46273
- const newChartState = __spreadValues$7({}, prevState);
46733
+ const newChartState = __spreadValues$8({}, prevState);
46274
46734
  if (chartData.series_bar_chart_data) {
46275
46735
  newChartState.series_bar_chart_data = chartData.series_bar_chart_data;
46276
46736
  }
@@ -46320,9 +46780,11 @@ function SeriesBarChartComponent$1({
46320
46780
  startLoadingTimeout,
46321
46781
  clearLoadingTimeout,
46322
46782
  content,
46323
- hasWidgetData
46783
+ hasWidgetData,
46784
+ chartSettings,
46785
+ onConfigUpdate
46324
46786
  }) {
46325
- var _a, _b, _c, _d, _e, _f, _g, _h;
46787
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
46326
46788
  const hasCalledRef = React.useRef(false);
46327
46789
  const labels = ((_b = (_a = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) || [];
46328
46790
  const series = ((_d = (_c = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.series) || [];
@@ -46360,18 +46822,40 @@ function SeriesBarChartComponent$1({
46360
46822
  }
46361
46823
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout, seriesBarChartState]);
46362
46824
  const finalColors = React.useMemo(() => {
46363
- return shuffleColors(DEFAULT_COLORS$1, series.length);
46825
+ return shuffleColors(DEFAULT_COLORS$2, series.length);
46364
46826
  }, [series.length]);
46827
+ const sortedSeries = React.useMemo(() => {
46828
+ return [...series].sort(
46829
+ (a, b) => (a.name || "").localeCompare(b.name || "")
46830
+ );
46831
+ }, [series]);
46832
+ const colors = React.useMemo(() => {
46833
+ return sortedSeries.map((_, index) => finalColors[index % finalColors.length]);
46834
+ }, [sortedSeries, finalColors]);
46835
+ React.useEffect(() => {
46836
+ var _a2;
46837
+ if (!isEmpty && colors.length > 0 && !((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2.length) && onConfigUpdate && widgetId) {
46838
+ onConfigUpdate(widgetId, {
46839
+ chartSettings: __spreadProps$6(__spreadValues$8({}, chartSettings), {
46840
+ seriesColors: colors
46841
+ })
46842
+ });
46843
+ }
46844
+ }, [series.length, (_i = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _i.length, onConfigUpdate, widgetId, isEmpty]);
46365
46845
  if (isEmpty) {
46366
46846
  return createLoadingComponent$2();
46367
46847
  }
46368
46848
  const transformedData = {
46369
46849
  labels,
46370
- datasets: series.map((seriesItem, index) => ({
46371
- label: seriesItem.name,
46372
- data: seriesItem.values,
46373
- backgroundColor: (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length]
46374
- }))
46850
+ datasets: sortedSeries.map((seriesItem, index) => {
46851
+ var _a2;
46852
+ const color = ((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2[index]) || (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length];
46853
+ return {
46854
+ label: seriesItem.name,
46855
+ data: seriesItem.values,
46856
+ backgroundColor: color
46857
+ };
46858
+ })
46375
46859
  };
46376
46860
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
46377
46861
  SeriesChart,
@@ -46382,7 +46866,8 @@ function SeriesBarChartComponent$1({
46382
46866
  units,
46383
46867
  content,
46384
46868
  x_axis_title,
46385
- y_axis_title
46869
+ y_axis_title,
46870
+ chartSettings
46386
46871
  }
46387
46872
  );
46388
46873
  }
@@ -46393,9 +46878,10 @@ function CopilotKitSeriesBarChart$1({
46393
46878
  onResetReady,
46394
46879
  widgetBackendUrl,
46395
46880
  datasetId,
46396
- widgetData
46881
+ widgetData,
46882
+ onConfigUpdate
46397
46883
  }) {
46398
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
46884
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
46399
46885
  const orientation = ((_a = widget.config) == null ? void 0 : _a.orientation) || "vertical";
46400
46886
  const isFirstLoad = (_b = widget.config) == null ? void 0 : _b.isFirstLoad;
46401
46887
  const content = (_c = widget.config) == null ? void 0 : _c.content;
@@ -46436,7 +46922,7 @@ function CopilotKitSeriesBarChart$1({
46436
46922
  if (apiCallCount >= 30) {
46437
46923
  console.log("API call limit reached for widget:", widget.id);
46438
46924
  setHasTimeoutError(true);
46439
- setChartState((prevState) => __spreadProps$5(__spreadValues$7({}, prevState), {
46925
+ setChartState((prevState) => __spreadProps$6(__spreadValues$8({}, prevState), {
46440
46926
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
46441
46927
  }));
46442
46928
  return;
@@ -46537,7 +47023,9 @@ function CopilotKitSeriesBarChart$1({
46537
47023
  widgetId: widget.id,
46538
47024
  startLoadingTimeout,
46539
47025
  clearLoadingTimeout,
46540
- hasWidgetData: !!(((_p = (_o = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _o.labels) == null ? void 0 : _p.length) && ((_r = (_q = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _q.series) == null ? void 0 : _r.length))
47026
+ hasWidgetData: !!(((_p = (_o = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _o.labels) == null ? void 0 : _p.length) && ((_r = (_q = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _q.series) == null ? void 0 : _r.length)),
47027
+ chartSettings: (_s = widget.config) == null ? void 0 : _s.chartSettings,
47028
+ onConfigUpdate
46541
47029
  }
46542
47030
  ) })
46543
47031
  ] });
@@ -46549,7 +47037,8 @@ function SeriesBarChartWidget({
46549
47037
  onResetReady,
46550
47038
  widgetIds,
46551
47039
  datasetId,
46552
- widgetData
47040
+ widgetData,
47041
+ onConfigUpdate
46553
47042
  }) {
46554
47043
  var _a, _b;
46555
47044
  const styles = getStyleValues$2((_a = widget.config) == null ? void 0 : _a.styles);
@@ -46573,34 +47062,35 @@ function SeriesBarChartWidget({
46573
47062
  styles,
46574
47063
  onResetReady,
46575
47064
  widgetBackendUrl,
46576
- datasetId
47065
+ datasetId,
47066
+ onConfigUpdate
46577
47067
  }
46578
47068
  )
46579
47069
  }
46580
47070
  );
46581
47071
  }
46582
47072
 
46583
- var __defProp$6 = Object.defineProperty;
46584
- var __defProps$4 = Object.defineProperties;
46585
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
46586
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
46587
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
46588
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
46589
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46590
- var __spreadValues$6 = (a, b) => {
47073
+ var __defProp$7 = Object.defineProperty;
47074
+ var __defProps$5 = Object.defineProperties;
47075
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
47076
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
47077
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
47078
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
47079
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47080
+ var __spreadValues$7 = (a, b) => {
46591
47081
  for (var prop in b || (b = {}))
46592
- if (__hasOwnProp$6.call(b, prop))
46593
- __defNormalProp$6(a, prop, b[prop]);
46594
- if (__getOwnPropSymbols$6)
46595
- for (var prop of __getOwnPropSymbols$6(b)) {
46596
- if (__propIsEnum$6.call(b, prop))
46597
- __defNormalProp$6(a, prop, b[prop]);
47082
+ if (__hasOwnProp$7.call(b, prop))
47083
+ __defNormalProp$7(a, prop, b[prop]);
47084
+ if (__getOwnPropSymbols$7)
47085
+ for (var prop of __getOwnPropSymbols$7(b)) {
47086
+ if (__propIsEnum$7.call(b, prop))
47087
+ __defNormalProp$7(a, prop, b[prop]);
46598
47088
  }
46599
47089
  return a;
46600
47090
  };
46601
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
47091
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
46602
47092
  const CHART_REFRESH_TIMEOUT$1 = 3e3;
46603
- const DEFAULT_COLORS = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
47093
+ const DEFAULT_COLORS$1 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
46604
47094
  const clearChat$1 = async (widgetBackendUrl, widgetId) => {
46605
47095
  if (!widgetBackendUrl || !widgetId) return;
46606
47096
  console.log("clearChat called for widgetId:", widgetId);
@@ -46695,7 +47185,7 @@ const parseAndUpdateChartState$1 = (apiResponse, setChartState) => {
46695
47185
  if (parsedState.state) {
46696
47186
  const chartData = parsedState.state;
46697
47187
  setChartState((prevState) => {
46698
- const newChartState = __spreadValues$6({}, prevState);
47188
+ const newChartState = __spreadValues$7({}, prevState);
46699
47189
  if (chartData.series_bar_chart_data) {
46700
47190
  newChartState.series_bar_chart_data = chartData.series_bar_chart_data;
46701
47191
  }
@@ -46745,9 +47235,11 @@ function SeriesBarChartComponent({
46745
47235
  startLoadingTimeout,
46746
47236
  clearLoadingTimeout,
46747
47237
  content,
46748
- hasWidgetData
47238
+ hasWidgetData,
47239
+ chartSettings,
47240
+ onConfigUpdate
46749
47241
  }) {
46750
- var _a, _b, _c, _d, _e, _f, _g, _h;
47242
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
46751
47243
  const hasCalledRef = React.useRef(false);
46752
47244
  const labels = ((_b = (_a = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) || [];
46753
47245
  const series = ((_d = (_c = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.series) || [];
@@ -46785,18 +47277,49 @@ function SeriesBarChartComponent({
46785
47277
  }
46786
47278
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout, seriesBarChartState]);
46787
47279
  const finalColors = React.useMemo(() => {
46788
- return shuffleColors(DEFAULT_COLORS, series.length);
47280
+ return shuffleColors(DEFAULT_COLORS$1, series.length);
46789
47281
  }, [series.length]);
47282
+ const sortedSeries = React.useMemo(() => {
47283
+ return [...series].sort(
47284
+ (a, b) => (a.name || "").localeCompare(b.name || "")
47285
+ );
47286
+ }, [series]);
47287
+ const colors = React.useMemo(() => {
47288
+ return sortedSeries.map((_, index) => finalColors[index % finalColors.length]);
47289
+ }, [sortedSeries, finalColors]);
47290
+ React.useEffect(() => {
47291
+ var _a2;
47292
+ if (!isEmpty && colors.length > 0 && !((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2.length) && onConfigUpdate && widgetId) {
47293
+ onConfigUpdate(widgetId, {
47294
+ chartSettings: __spreadProps$5(__spreadValues$7({}, chartSettings), {
47295
+ seriesColors: colors
47296
+ })
47297
+ });
47298
+ }
47299
+ }, [series.length, (_i = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _i.length, onConfigUpdate, widgetId, isEmpty]);
46790
47300
  if (isEmpty) {
46791
47301
  return createLoadingComponent$1();
46792
47302
  }
46793
47303
  const transformedData = {
46794
47304
  labels,
46795
- datasets: series.map((seriesItem, index) => ({
46796
- label: seriesItem.name,
46797
- data: seriesItem.values,
46798
- backgroundColor: (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length]
46799
- }))
47305
+ datasets: sortedSeries.map((seriesItem, index) => {
47306
+ var _a2, _b2, _c2;
47307
+ const color = ((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2[index]) || (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length];
47308
+ return {
47309
+ label: seriesItem.name,
47310
+ data: seriesItem.values,
47311
+ borderColor: color,
47312
+ backgroundColor: color + "26",
47313
+ // 15% opacity for subtle fill under curve
47314
+ borderWidth: (_b2 = chartSettings == null ? void 0 : chartSettings.lineWidth) != null ? _b2 : 2.5,
47315
+ fill: false,
47316
+ pointRadius: (_c2 = chartSettings == null ? void 0 : chartSettings.pointRadius) != null ? _c2 : 4,
47317
+ pointHoverRadius: 6,
47318
+ pointBackgroundColor: color,
47319
+ pointBorderColor: "#ffffff",
47320
+ pointBorderWidth: 2
47321
+ };
47322
+ })
46800
47323
  };
46801
47324
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
46802
47325
  SeriesLineChart,
@@ -46807,7 +47330,8 @@ function SeriesBarChartComponent({
46807
47330
  units,
46808
47331
  content,
46809
47332
  x_axis_title,
46810
- y_axis_title
47333
+ y_axis_title,
47334
+ chartSettings
46811
47335
  }
46812
47336
  );
46813
47337
  }
@@ -46818,9 +47342,10 @@ function CopilotKitSeriesBarChart({
46818
47342
  onResetReady,
46819
47343
  widgetBackendUrl,
46820
47344
  datasetId,
46821
- widgetData
47345
+ widgetData,
47346
+ onConfigUpdate
46822
47347
  }) {
46823
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
47348
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
46824
47349
  const orientation = ((_a = widget.config) == null ? void 0 : _a.orientation) || "vertical";
46825
47350
  const isFirstLoad = (_b = widget.config) == null ? void 0 : _b.isFirstLoad;
46826
47351
  const content = (_c = widget.config) == null ? void 0 : _c.content;
@@ -46861,7 +47386,7 @@ function CopilotKitSeriesBarChart({
46861
47386
  if (apiCallCount >= 30) {
46862
47387
  console.log("API call limit reached for widget:", widget.id);
46863
47388
  setHasTimeoutError(true);
46864
- setChartState((prevState) => __spreadProps$4(__spreadValues$6({}, prevState), {
47389
+ setChartState((prevState) => __spreadProps$5(__spreadValues$7({}, prevState), {
46865
47390
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
46866
47391
  }));
46867
47392
  return;
@@ -46962,7 +47487,9 @@ function CopilotKitSeriesBarChart({
46962
47487
  widgetId: widget.id,
46963
47488
  startLoadingTimeout,
46964
47489
  clearLoadingTimeout,
46965
- hasWidgetData: !!(((_p = (_o = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _o.labels) == null ? void 0 : _p.length) && ((_r = (_q = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _q.series) == null ? void 0 : _r.length))
47490
+ hasWidgetData: !!(((_p = (_o = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _o.labels) == null ? void 0 : _p.length) && ((_r = (_q = widget_data == null ? void 0 : widget_data.data) == null ? void 0 : _q.series) == null ? void 0 : _r.length)),
47491
+ chartSettings: (_s = widget.config) == null ? void 0 : _s.chartSettings,
47492
+ onConfigUpdate
46966
47493
  }
46967
47494
  ) })
46968
47495
  ] });
@@ -46974,7 +47501,8 @@ function SeriesLineChartWidget({
46974
47501
  onResetReady,
46975
47502
  widgetIds,
46976
47503
  datasetId,
46977
- widgetData
47504
+ widgetData,
47505
+ onConfigUpdate
46978
47506
  }) {
46979
47507
  var _a, _b;
46980
47508
  const styles = getStyleValues$1((_a = widget.config) == null ? void 0 : _a.styles);
@@ -46998,32 +47526,33 @@ function SeriesLineChartWidget({
46998
47526
  styles,
46999
47527
  onResetReady,
47000
47528
  widgetBackendUrl,
47001
- datasetId
47529
+ datasetId,
47530
+ onConfigUpdate
47002
47531
  }
47003
47532
  )
47004
47533
  }
47005
47534
  );
47006
47535
  }
47007
47536
 
47008
- var __defProp$5 = Object.defineProperty;
47009
- var __defProps$3 = Object.defineProperties;
47010
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
47011
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
47012
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
47013
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
47014
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47015
- var __spreadValues$5 = (a, b) => {
47537
+ var __defProp$6 = Object.defineProperty;
47538
+ var __defProps$4 = Object.defineProperties;
47539
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
47540
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
47541
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
47542
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
47543
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47544
+ var __spreadValues$6 = (a, b) => {
47016
47545
  for (var prop in b || (b = {}))
47017
- if (__hasOwnProp$5.call(b, prop))
47018
- __defNormalProp$5(a, prop, b[prop]);
47019
- if (__getOwnPropSymbols$5)
47020
- for (var prop of __getOwnPropSymbols$5(b)) {
47021
- if (__propIsEnum$5.call(b, prop))
47022
- __defNormalProp$5(a, prop, b[prop]);
47546
+ if (__hasOwnProp$6.call(b, prop))
47547
+ __defNormalProp$6(a, prop, b[prop]);
47548
+ if (__getOwnPropSymbols$6)
47549
+ for (var prop of __getOwnPropSymbols$6(b)) {
47550
+ if (__propIsEnum$6.call(b, prop))
47551
+ __defNormalProp$6(a, prop, b[prop]);
47023
47552
  }
47024
47553
  return a;
47025
47554
  };
47026
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
47555
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
47027
47556
  const CHART_REFRESH_TIMEOUT = 3e3;
47028
47557
  const clearChat = async (widgetBackendUrl, widgetId) => {
47029
47558
  if (!widgetBackendUrl || !widgetId) return;
@@ -47110,7 +47639,7 @@ const parseAndUpdateChartState = (apiResponse, setChartState) => {
47110
47639
  if (parsedState.state) {
47111
47640
  const chartData = parsedState.state;
47112
47641
  setChartState((prevState) => {
47113
- const newChartState = __spreadValues$5({}, prevState);
47642
+ const newChartState = __spreadValues$6({}, prevState);
47114
47643
  if (chartData.matrix_grid_data) {
47115
47644
  newChartState.matrix_grid_data = chartData.matrix_grid_data;
47116
47645
  }
@@ -47257,7 +47786,7 @@ function CopilotKitDataGrid({
47257
47786
  if (apiCallCount >= 30) {
47258
47787
  console.log("API call limit reached for widget:", widget.id);
47259
47788
  setHasTimeoutError(true);
47260
- setChartState((prevState) => __spreadProps$3(__spreadValues$5({}, prevState), {
47789
+ setChartState((prevState) => __spreadProps$4(__spreadValues$6({}, prevState), {
47261
47790
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
47262
47791
  }));
47263
47792
  return;
@@ -47411,7 +47940,9 @@ function WidgetRenderer({
47411
47940
  pageId,
47412
47941
  onApplyFilters,
47413
47942
  isEditing = false,
47414
- dashboardName
47943
+ dashboardName,
47944
+ onClearChat,
47945
+ isClearing
47415
47946
  }) {
47416
47947
  const handleConfigUpdate = (config) => {
47417
47948
  if (onConfigUpdate) {
@@ -47443,7 +47974,7 @@ function WidgetRenderer({
47443
47974
  }
47444
47975
  );
47445
47976
  case "chatbot":
47446
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ChatbotWidget, { widget, showHeader: false, widgetBackendUrl, onResetReady, widgetIds, datasetId, dashboardName });
47977
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ChatbotWidget, { widget, showHeader: false, widgetBackendUrl, onResetReady, widgetIds, datasetId, dashboardName, onClearChat: onClearChat ? () => onClearChat(widget.id) : void 0, isClearing: isClearing === widget.id });
47447
47978
  case "filters":
47448
47979
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
47449
47980
  FiltersWidget,
@@ -47467,7 +47998,8 @@ function WidgetRenderer({
47467
47998
  widgetBackendUrl,
47468
47999
  onResetReady,
47469
48000
  widgetIds,
47470
- datasetId
48001
+ datasetId,
48002
+ onConfigUpdate
47471
48003
  }
47472
48004
  ) : widget.config.agentType === "Series Bar Chart Agent" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
47473
48005
  SeriesBarChartWidget,
@@ -47477,7 +48009,8 @@ function WidgetRenderer({
47477
48009
  widgetBackendUrl,
47478
48010
  onResetReady,
47479
48011
  widgetIds,
47480
- datasetId
48012
+ datasetId,
48013
+ onConfigUpdate
47481
48014
  }
47482
48015
  ) : widget.config.agentType === "Series Line Chart Agent" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
47483
48016
  SeriesLineChartWidget,
@@ -47487,7 +48020,8 @@ function WidgetRenderer({
47487
48020
  widgetBackendUrl,
47488
48021
  onResetReady,
47489
48022
  widgetIds,
47490
- datasetId
48023
+ datasetId,
48024
+ onConfigUpdate
47491
48025
  }
47492
48026
  ) : widget.config.agentType === "Data Grid Agent" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
47493
48027
  DatagridWidget,
@@ -47520,39 +48054,39 @@ function WidgetRenderer({
47520
48054
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${(widget == null ? void 0 : widget.type) === "text" ? "" : "h-full"}`, children: renderWidget() });
47521
48055
  }
47522
48056
 
47523
- var __defProp$4 = Object.defineProperty;
47524
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
47525
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
47526
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
47527
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47528
- var __spreadValues$4 = (a, b) => {
48057
+ var __defProp$5 = Object.defineProperty;
48058
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
48059
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
48060
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
48061
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
48062
+ var __spreadValues$5 = (a, b) => {
47529
48063
  for (var prop in b || (b = {}))
47530
- if (__hasOwnProp$4.call(b, prop))
47531
- __defNormalProp$4(a, prop, b[prop]);
47532
- if (__getOwnPropSymbols$4)
47533
- for (var prop of __getOwnPropSymbols$4(b)) {
47534
- if (__propIsEnum$4.call(b, prop))
47535
- __defNormalProp$4(a, prop, b[prop]);
48064
+ if (__hasOwnProp$5.call(b, prop))
48065
+ __defNormalProp$5(a, prop, b[prop]);
48066
+ if (__getOwnPropSymbols$5)
48067
+ for (var prop of __getOwnPropSymbols$5(b)) {
48068
+ if (__propIsEnum$5.call(b, prop))
48069
+ __defNormalProp$5(a, prop, b[prop]);
47536
48070
  }
47537
48071
  return a;
47538
48072
  };
47539
- var __objRest$1 = (source, exclude) => {
48073
+ var __objRest$2 = (source, exclude) => {
47540
48074
  var target = {};
47541
48075
  for (var prop in source)
47542
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
48076
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
47543
48077
  target[prop] = source[prop];
47544
- if (source != null && __getOwnPropSymbols$4)
47545
- for (var prop of __getOwnPropSymbols$4(source)) {
47546
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
48078
+ if (source != null && __getOwnPropSymbols$5)
48079
+ for (var prop of __getOwnPropSymbols$5(source)) {
48080
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
47547
48081
  target[prop] = source[prop];
47548
48082
  }
47549
48083
  return target;
47550
48084
  };
47551
48085
  const Textarea = React__namespace.forwardRef((_a, ref) => {
47552
- var _b = _a, { className } = _b, props = __objRest$1(_b, ["className"]);
48086
+ var _b = _a, { className } = _b, props = __objRest$2(_b, ["className"]);
47553
48087
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
47554
48088
  "textarea",
47555
- __spreadValues$4({
48089
+ __spreadValues$5({
47556
48090
  className: cn(
47557
48091
  "flex min-h-[120px] w-full rounded-md border border-gray-300 bg-transparent px-3 py-2 text-base ring-offset-gray-300 placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
47558
48092
  className
@@ -47673,6 +48207,57 @@ function Modal({
47673
48207
  );
47674
48208
  }
47675
48209
 
48210
+ var __defProp$4 = Object.defineProperty;
48211
+ var __defProps$3 = Object.defineProperties;
48212
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
48213
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
48214
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
48215
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
48216
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
48217
+ var __spreadValues$4 = (a, b) => {
48218
+ for (var prop in b || (b = {}))
48219
+ if (__hasOwnProp$4.call(b, prop))
48220
+ __defNormalProp$4(a, prop, b[prop]);
48221
+ if (__getOwnPropSymbols$4)
48222
+ for (var prop of __getOwnPropSymbols$4(b)) {
48223
+ if (__propIsEnum$4.call(b, prop))
48224
+ __defNormalProp$4(a, prop, b[prop]);
48225
+ }
48226
+ return a;
48227
+ };
48228
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
48229
+ var __objRest$1 = (source, exclude) => {
48230
+ var target = {};
48231
+ for (var prop in source)
48232
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
48233
+ target[prop] = source[prop];
48234
+ if (source != null && __getOwnPropSymbols$4)
48235
+ for (var prop of __getOwnPropSymbols$4(source)) {
48236
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
48237
+ target[prop] = source[prop];
48238
+ }
48239
+ return target;
48240
+ };
48241
+ const Slider = React__namespace.forwardRef((_a, ref) => {
48242
+ var _b = _a, { className } = _b, props = __objRest$1(_b, ["className"]);
48243
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
48244
+ SliderPrimitive__namespace.Root,
48245
+ __spreadProps$3(__spreadValues$4({
48246
+ ref,
48247
+ className: cn(
48248
+ "relative flex w-full touch-none select-none items-center",
48249
+ className
48250
+ )
48251
+ }, props), {
48252
+ children: [
48253
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SliderPrimitive__namespace.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SliderPrimitive__namespace.Range, { className: "absolute h-full bg-primary" }) }),
48254
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SliderPrimitive__namespace.Thumb, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" })
48255
+ ]
48256
+ })
48257
+ );
48258
+ });
48259
+ Slider.displayName = SliderPrimitive__namespace.Root.displayName;
48260
+
47676
48261
  var __defProp$3 = Object.defineProperty;
47677
48262
  var __defProps$2 = Object.defineProperties;
47678
48263
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
@@ -47692,9 +48277,63 @@ var __spreadValues$3 = (a, b) => {
47692
48277
  return a;
47693
48278
  };
47694
48279
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
48280
+ const isChartWidget = (agentType) => {
48281
+ if (!agentType) return false;
48282
+ return agentType === "Pie Chart Agent" || agentType === "Line Chart Agent" || agentType === "Series Line Chart Agent" || agentType === "Bar Chart Agent" || agentType === "Series Bar Chart Agent";
48283
+ };
48284
+ const isLineChart = (agentType) => {
48285
+ if (!agentType) return false;
48286
+ return agentType === "Line Chart Agent" || agentType === "Series Line Chart Agent";
48287
+ };
48288
+ const DEFAULT_COLORS = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
48289
+ const getSeriesNames = (widget) => {
48290
+ var _a, _b, _c, _d;
48291
+ const data = widget == null ? void 0 : widget.widget_data;
48292
+ if (!data) return [];
48293
+ if (((_b = (_a = data == null ? void 0 : data.pie_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) && Array.isArray(data.pie_chart_data.data.labels)) {
48294
+ return data.pie_chart_data.data.labels.sort();
48295
+ }
48296
+ if (((_d = (_c = data == null ? void 0 : data.series_bar_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.series) && Array.isArray(data.series_bar_chart_data.data.series)) {
48297
+ return data.series_bar_chart_data.data.series.map((item) => item.name || item.label || "").filter((name) => name !== "").sort();
48298
+ }
48299
+ if (Array.isArray(data)) {
48300
+ const names = /* @__PURE__ */ new Set();
48301
+ data.forEach((item) => {
48302
+ if (item.series_name) names.add(item.series_name);
48303
+ if (item.label) names.add(item.label);
48304
+ });
48305
+ return Array.from(names).sort();
48306
+ }
48307
+ return [];
48308
+ };
48309
+ const getDefaultSeriesColors = (widget) => {
48310
+ var _a, _b, _c, _d;
48311
+ const data = widget == null ? void 0 : widget.widget_data;
48312
+ if (!data) return [];
48313
+ if (((_b = (_a = data == null ? void 0 : data.pie_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) && Array.isArray(data.pie_chart_data.data.labels)) {
48314
+ const labels = data.pie_chart_data.data.labels;
48315
+ return shuffleColors(DEFAULT_COLORS, labels.length);
48316
+ }
48317
+ if (((_d = (_c = data == null ? void 0 : data.series_bar_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.series) && Array.isArray(data.series_bar_chart_data.data.series)) {
48318
+ const series = data.series_bar_chart_data.data.series;
48319
+ return shuffleColors(DEFAULT_COLORS, series.length);
48320
+ }
48321
+ if (Array.isArray(data)) {
48322
+ const series = /* @__PURE__ */ new Set();
48323
+ data.forEach((item) => {
48324
+ if (item.series_name) series.add(item.series_name);
48325
+ if (item.label) series.add(item.label);
48326
+ });
48327
+ const seriesArray = Array.from(series).sort();
48328
+ return shuffleColors(DEFAULT_COLORS, seriesArray.length);
48329
+ }
48330
+ return [];
48331
+ };
47695
48332
  function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onClose, onSubmit }) {
47696
- var _a;
48333
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
47697
48334
  const agentType = (_a = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _a.agentType;
48335
+ const isChart = isChartWidget(agentType);
48336
+ const isLine = isLineChart(agentType);
47698
48337
  const [query, setQuery] = React.useState("");
47699
48338
  const [displayText, setDisplayText] = React.useState("");
47700
48339
  const [blockType, setBlockType] = React.useState("");
@@ -47702,13 +48341,42 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
47702
48341
  const [divider, setDivider] = React.useState("no");
47703
48342
  const [showLabels, setShowLabels] = React.useState(false);
47704
48343
  const [styles, setStyles] = React.useState("");
48344
+ const [chartSettings, setChartSettings] = React.useState({
48345
+ showLegend: true,
48346
+ legendBoxSize: 16,
48347
+ legendFontSize: 13,
48348
+ lineWidth: 2.5,
48349
+ lineTension: 0.3,
48350
+ pointRadius: 4,
48351
+ showLabels: false,
48352
+ seriesColors: [],
48353
+ dataLabelsFontSize: 12,
48354
+ showTitle: true,
48355
+ titleText: "",
48356
+ titleFontSize: 16,
48357
+ xAxisTitleFontSize: 13,
48358
+ yAxisTitleFontSize: 13,
48359
+ xAxisTickFontSize: 12,
48360
+ yAxisTickFontSize: 12,
48361
+ tooltipFontSize: 12
48362
+ });
48363
+ const seriesNames = getSeriesNames(editingWidget);
48364
+ const defaultSeriesColors = getDefaultSeriesColors(editingWidget);
48365
+ const colorCount = seriesNames.length || ((_b = chartSettings.seriesColors) == null ? void 0 : _b.length) || defaultSeriesColors.length || 0;
48366
+ const displaySeriesNames = seriesNames.length > 0 ? seriesNames : Array.from({ length: colorCount }, (_, i) => `Series ${i + 1}`);
48367
+ React.useEffect(() => {
48368
+ console.log("[EditWidgetDialog] Series names:", seriesNames);
48369
+ console.log("[EditWidgetDialog] Default colors:", defaultSeriesColors);
48370
+ console.log("[EditWidgetDialog] Display series names:", displaySeriesNames);
48371
+ }, [seriesNames, defaultSeriesColors, displaySeriesNames]);
47705
48372
  React.useEffect(() => {
47706
48373
  setQuery(initialText);
47707
48374
  }, [initialText]);
47708
48375
  React.useEffect(() => {
47709
- var _a2, _b;
48376
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q, _r, _s, _t;
47710
48377
  const content = (_a2 = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _a2.content;
47711
- const cssStyles = (_b = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _b.styles;
48378
+ const cssStyles = (_b2 = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _b2.styles;
48379
+ const savedChartSettings = (_c2 = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _c2.chartSettings;
47712
48380
  const text = content == null ? void 0 : content.displayText;
47713
48381
  if (text == null ? void 0 : text.length) {
47714
48382
  setDisplayText(text);
@@ -47729,63 +48397,114 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
47729
48397
  if (hasShowLabel !== void 0) {
47730
48398
  setShowLabels(hasShowLabel);
47731
48399
  }
48400
+ if (savedChartSettings) {
48401
+ setChartSettings({
48402
+ showLegend: (_d2 = savedChartSettings.showLegend) != null ? _d2 : true,
48403
+ legendBoxSize: (_e2 = savedChartSettings.legendBoxSize) != null ? _e2 : 16,
48404
+ legendFontSize: (_f2 = savedChartSettings.legendFontSize) != null ? _f2 : 13,
48405
+ lineWidth: (_g2 = savedChartSettings.lineWidth) != null ? _g2 : 2.5,
48406
+ lineTension: (_h2 = savedChartSettings.lineTension) != null ? _h2 : 0.3,
48407
+ pointRadius: (_i2 = savedChartSettings.pointRadius) != null ? _i2 : 4,
48408
+ showLabels: (_j2 = savedChartSettings.showLabels) != null ? _j2 : false,
48409
+ seriesColors: (_k2 = savedChartSettings.seriesColors) != null ? _k2 : defaultSeriesColors,
48410
+ dataLabelsFontSize: (_l2 = savedChartSettings.dataLabelsFontSize) != null ? _l2 : 12,
48411
+ showTitle: (_m2 = savedChartSettings.showTitle) != null ? _m2 : true,
48412
+ titleText: (_n2 = savedChartSettings.titleText) != null ? _n2 : "",
48413
+ titleFontSize: (_o2 = savedChartSettings.titleFontSize) != null ? _o2 : 16,
48414
+ xAxisTitleFontSize: (_p2 = savedChartSettings.xAxisTitleFontSize) != null ? _p2 : 13,
48415
+ yAxisTitleFontSize: (_q = savedChartSettings.yAxisTitleFontSize) != null ? _q : 13,
48416
+ xAxisTickFontSize: (_r = savedChartSettings.xAxisTickFontSize) != null ? _r : 12,
48417
+ yAxisTickFontSize: (_s = savedChartSettings.yAxisTickFontSize) != null ? _s : 12,
48418
+ tooltipFontSize: (_t = savedChartSettings.tooltipFontSize) != null ? _t : 12
48419
+ });
48420
+ } else {
48421
+ setChartSettings({
48422
+ showLegend: true,
48423
+ legendBoxSize: 16,
48424
+ legendFontSize: 13,
48425
+ lineWidth: 2.5,
48426
+ lineTension: 0.3,
48427
+ pointRadius: 4,
48428
+ showLabels: hasShowLabel != null ? hasShowLabel : false,
48429
+ seriesColors: defaultSeriesColors,
48430
+ dataLabelsFontSize: 12,
48431
+ showTitle: true,
48432
+ titleText: "",
48433
+ titleFontSize: 16,
48434
+ xAxisTitleFontSize: 13,
48435
+ yAxisTitleFontSize: 13,
48436
+ xAxisTickFontSize: 12,
48437
+ yAxisTickFontSize: 12,
48438
+ tooltipFontSize: 12
48439
+ });
48440
+ }
47732
48441
  }, [editingWidget]);
47733
48442
  const handleSubmit = () => {
48443
+ var _a2;
47734
48444
  if (onSubmit && query.trim()) {
47735
- onSubmit(query, showLabels);
48445
+ if (isChart) {
48446
+ onSubmit(query, (_a2 = chartSettings.showLabels) != null ? _a2 : false, chartSettings);
48447
+ } else {
48448
+ onSubmit(query, showLabels);
48449
+ }
47736
48450
  }
47737
48451
  if (editingWidget.type === "text") {
47738
48452
  const widgetId = editingWidget == null ? void 0 : editingWidget.id;
47739
- setWidgets && setWidgets((prev) => prev.map((w) => {
47740
- if (w.id === widgetId) {
47741
- return __spreadProps$2(__spreadValues$3({}, w), {
47742
- config: __spreadProps$2(__spreadValues$3({}, w.config), {
47743
- content: __spreadProps$2(__spreadValues$3({}, w.config.content), {
47744
- displayText,
47745
- blockType,
47746
- divider
47747
- }),
47748
- styles: __spreadValues$3(__spreadValues$3({}, w.config.styles), alignment && alignment.length > 0 ? { textAlign: alignment } : {})
47749
- })
47750
- });
47751
- }
47752
- return w;
47753
- }));
48453
+ setWidgets && setWidgets(
48454
+ (prev) => prev.map((w) => {
48455
+ if (w.id === widgetId) {
48456
+ return __spreadProps$2(__spreadValues$3({}, w), {
48457
+ config: __spreadProps$2(__spreadValues$3({}, w.config), {
48458
+ content: __spreadProps$2(__spreadValues$3({}, w.config.content), {
48459
+ displayText,
48460
+ blockType,
48461
+ divider
48462
+ }),
48463
+ styles: __spreadValues$3(__spreadValues$3({}, w.config.styles), alignment && alignment.length > 0 ? { textAlign: alignment } : {})
48464
+ })
48465
+ });
48466
+ }
48467
+ return w;
48468
+ })
48469
+ );
47754
48470
  onClose && onClose();
47755
48471
  }
47756
48472
  };
47757
48473
  if (!isOpen) return null;
47758
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
48474
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
47759
48475
  Modal,
47760
48476
  {
47761
48477
  isOpen,
47762
48478
  onClose,
47763
48479
  title: "Edit Widget",
47764
- size: "lg",
48480
+ size: "xl",
47765
48481
  noOverflowHidden: true,
47766
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
47767
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-gray-700", children: "Customize the widget\u2019s appearance" }),
47768
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pt-7", children: [
47769
- (agentType === "Pie Chart Agent" || agentType === "Line Chart Agent" || agentType === "Series Line Chart Agent" || agentType === "Bar Chart Agent" || agentType === "Series Bar Chart Agent") && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 mb-4", children: [
47770
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Data Labels:" }),
47771
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47772
- Select,
47773
- {
47774
- value: showLabels ? "yes" : "no",
47775
- onValueChange: (value) => setShowLabels(value === "yes"),
47776
- children: [
47777
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Visible data labels?" }) }),
47778
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47779
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
47780
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
47781
- ] })
47782
- ]
47783
- }
47784
- )
47785
- ] }),
47786
- (editingWidget == null ? void 0 : editingWidget.type) === "text" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-5", children: [
47787
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47788
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Display text:" }),
48482
+ children: [
48483
+ /* @__PURE__ */ jsxRuntimeExports.jsx("style", { children: `
48484
+ .dialog-scrollable::-webkit-scrollbar {
48485
+ width: 6px;
48486
+ }
48487
+ .dialog-scrollable::-webkit-scrollbar-track {
48488
+ background: #f1f5f9;
48489
+ border-radius: 3px;
48490
+ }
48491
+ .dialog-scrollable::-webkit-scrollbar-thumb {
48492
+ background: #cbd5e1;
48493
+ border-radius: 3px;
48494
+ }
48495
+ .dialog-scrollable::-webkit-scrollbar-thumb:hover {
48496
+ background: #94a3b8;
48497
+ }
48498
+ .dialog-scrollable {
48499
+ scrollbar-width: thin;
48500
+ scrollbar-color: #cbd5e1 #f1f5f9;
48501
+ }
48502
+ ` }),
48503
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-[calc(100vh-260px)] bg-white rounded-lg", children: [
48504
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-6 py-4 border-b border-gray-200 flex-shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700 font-medium", children: "Customize your widget settings" }) }),
48505
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto dialog-scrollable px-6 py-4 flex flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0", children: (editingWidget == null ? void 0 : editingWidget.type) === "text" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-5", children: [
48506
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48507
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Display text" }),
47789
48508
  /* @__PURE__ */ jsxRuntimeExports.jsx(
47790
48509
  Input,
47791
48510
  {
@@ -47795,88 +48514,463 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
47795
48514
  }
47796
48515
  )
47797
48516
  ] }),
47798
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47799
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Block type:" }),
47800
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47801
- Select,
47802
- {
47803
- value: blockType,
47804
- onValueChange: (value) => setBlockType(value),
47805
- children: [
47806
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }),
47807
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47808
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-1", children: "Heading 1" }),
47809
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-2", children: "Heading 2" }),
47810
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-3", children: "Heading 3" }),
47811
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "paragraph", children: "Paragraph" })
47812
- ] })
47813
- ]
47814
- }
47815
- )
48517
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48518
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Block type" }),
48519
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: blockType, onValueChange: (value) => setBlockType(value), children: [
48520
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }),
48521
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48522
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-1", children: "Heading 1" }),
48523
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-2", children: "Heading 2" }),
48524
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-3", children: "Heading 3" }),
48525
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "paragraph", children: "Paragraph" })
48526
+ ] })
48527
+ ] })
47816
48528
  ] }),
47817
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47818
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Align:" }),
47819
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47820
- Select,
47821
- {
47822
- value: alignment,
47823
- onValueChange: (value) => setAlignment(value),
47824
- children: [
47825
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }),
47826
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47827
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "left", children: "Left" }),
47828
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "center", children: "Center" }),
47829
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "right", children: "Right" }),
47830
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "justify", children: "Justify" })
47831
- ] })
47832
- ]
47833
- }
47834
- )
48529
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48530
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Alignment" }),
48531
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: alignment, onValueChange: (value) => setAlignment(value), children: [
48532
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select alignment" }) }),
48533
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48534
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "left", children: "Left" }),
48535
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "center", children: "Center" }),
48536
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "right", children: "Right" }),
48537
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "justify", children: "Justify" })
48538
+ ] })
48539
+ ] })
47835
48540
  ] }),
47836
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47837
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Divider:" }),
47838
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47839
- Select,
48541
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48542
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Divider" }),
48543
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: divider, onValueChange: (value) => setDivider(value), children: [
48544
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "No" }) }),
48545
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48546
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" }),
48547
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" })
48548
+ ] })
48549
+ ] })
48550
+ ] })
48551
+ ] }) : isChart ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6", children: [
48552
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48553
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Query" }),
48554
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
48555
+ Textarea,
47840
48556
  {
47841
- value: divider,
47842
- onValueChange: (value) => setDivider(value),
47843
- children: [
47844
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "No" }) }),
47845
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47846
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" }),
47847
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" })
47848
- ] })
47849
- ]
48557
+ className: "w-full p-2 min-h-[120px]",
48558
+ value: query,
48559
+ onChange: (e) => {
48560
+ var _a2;
48561
+ return setQuery((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value);
48562
+ }
47850
48563
  }
47851
- )
47852
- ] }),
47853
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47854
- "button",
47855
- {
47856
- onClick: handleSubmit,
47857
- className: "font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500 px-6 py-2 text-sm flex items-center gap-2",
47858
- children: "Submit"
47859
- }
47860
- ) })
47861
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
47862
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47863
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Query:" }),
47864
- /* @__PURE__ */ jsxRuntimeExports.jsx(Textarea, { className: "w-full p-2", value: query, onChange: (e) => {
47865
- var _a2;
47866
- return setQuery((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value);
47867
- } })
48564
+ ) })
47868
48565
  ] }),
47869
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end pt-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47870
- "button",
48566
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6", children: [
48567
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48568
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Legend" }),
48569
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48570
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48571
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Show Legend" }) }),
48572
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
48573
+ Select,
48574
+ {
48575
+ value: chartSettings.showLegend !== false ? "yes" : "no",
48576
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48577
+ showLegend: value === "yes"
48578
+ })),
48579
+ children: [
48580
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Show legend?" }) }),
48581
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48582
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
48583
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
48584
+ ] })
48585
+ ]
48586
+ }
48587
+ )
48588
+ ] }),
48589
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48590
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48591
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Box Size" }),
48592
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48593
+ chartSettings.legendBoxSize,
48594
+ "px"
48595
+ ] })
48596
+ ] }),
48597
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48598
+ Slider,
48599
+ {
48600
+ min: 8,
48601
+ max: 32,
48602
+ step: 1,
48603
+ value: [(_c = chartSettings.legendBoxSize) != null ? _c : 16],
48604
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48605
+ legendBoxSize: value[0]
48606
+ })),
48607
+ className: "w-full"
48608
+ }
48609
+ )
48610
+ ] }),
48611
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48612
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48613
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48614
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48615
+ chartSettings.legendFontSize,
48616
+ "px"
48617
+ ] })
48618
+ ] }),
48619
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48620
+ Slider,
48621
+ {
48622
+ min: 10,
48623
+ max: 18,
48624
+ step: 1,
48625
+ value: [(_d = chartSettings.legendFontSize) != null ? _d : 13],
48626
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48627
+ legendFontSize: value[0]
48628
+ })),
48629
+ className: "w-full"
48630
+ }
48631
+ )
48632
+ ] })
48633
+ ] })
48634
+ ] }),
48635
+ displaySeriesNames.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48636
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Series Colors" }),
48637
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-3", children: displaySeriesNames.map((seriesName, index) => {
48638
+ var _a2;
48639
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
48640
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium flex-1 truncate", children: seriesName }),
48641
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48642
+ "input",
48643
+ {
48644
+ type: "color",
48645
+ value: ((_a2 = chartSettings.seriesColors) == null ? void 0 : _a2[index]) || defaultSeriesColors[index] || "#3B82F6",
48646
+ onChange: (e) => {
48647
+ const newColors = [...chartSettings.seriesColors || []];
48648
+ newColors[index] = e.target.value;
48649
+ setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48650
+ seriesColors: newColors
48651
+ }));
48652
+ },
48653
+ className: "w-10 h-10 rounded cursor-pointer border border-gray-300"
48654
+ }
48655
+ )
48656
+ ] }, index);
48657
+ }) })
48658
+ ] }),
48659
+ isLine && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48660
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Line Style" }),
48661
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48662
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48663
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48664
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Line Width" }),
48665
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-600", children: chartSettings.lineWidth })
48666
+ ] }),
48667
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48668
+ Slider,
48669
+ {
48670
+ min: 1,
48671
+ max: 5,
48672
+ step: 0.5,
48673
+ value: [(_e = chartSettings.lineWidth) != null ? _e : 2.5],
48674
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48675
+ lineWidth: value[0]
48676
+ })),
48677
+ className: "w-full"
48678
+ }
48679
+ )
48680
+ ] }),
48681
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48682
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48683
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Tension" }),
48684
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-600", children: ((_f = chartSettings.lineTension) != null ? _f : 0.3).toFixed(2) })
48685
+ ] }),
48686
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48687
+ Slider,
48688
+ {
48689
+ min: 0,
48690
+ max: 0.8,
48691
+ step: 0.05,
48692
+ value: [(_g = chartSettings.lineTension) != null ? _g : 0.3],
48693
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48694
+ lineTension: value[0]
48695
+ })),
48696
+ className: "w-full"
48697
+ }
48698
+ )
48699
+ ] }),
48700
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48701
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48702
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Point Size" }),
48703
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48704
+ chartSettings.pointRadius,
48705
+ "px"
48706
+ ] })
48707
+ ] }),
48708
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48709
+ Slider,
48710
+ {
48711
+ min: 0,
48712
+ max: 8,
48713
+ step: 0.5,
48714
+ value: [(_h = chartSettings.pointRadius) != null ? _h : 4],
48715
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48716
+ pointRadius: value[0]
48717
+ })),
48718
+ className: "w-full"
48719
+ }
48720
+ )
48721
+ ] })
48722
+ ] })
48723
+ ] }),
48724
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48725
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Chart Title" }),
48726
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48727
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48728
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Show Title" }) }),
48729
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
48730
+ Select,
48731
+ {
48732
+ value: chartSettings.showTitle !== false ? "yes" : "no",
48733
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48734
+ showTitle: value === "yes"
48735
+ })),
48736
+ children: [
48737
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Show title?" }) }),
48738
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48739
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
48740
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
48741
+ ] })
48742
+ ]
48743
+ }
48744
+ )
48745
+ ] }),
48746
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48747
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Title Text" }) }),
48748
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48749
+ "input",
48750
+ {
48751
+ type: "text",
48752
+ placeholder: "Enter custom title (optional)",
48753
+ value: (_i = chartSettings.titleText) != null ? _i : "",
48754
+ onChange: (e) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48755
+ titleText: e.target.value
48756
+ })),
48757
+ className: "w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
48758
+ }
48759
+ )
48760
+ ] }),
48761
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48762
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48763
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48764
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48765
+ chartSettings.titleFontSize,
48766
+ "px"
48767
+ ] })
48768
+ ] }),
48769
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48770
+ Slider,
48771
+ {
48772
+ min: 12,
48773
+ max: 28,
48774
+ step: 1,
48775
+ value: [(_j = chartSettings.titleFontSize) != null ? _j : 16],
48776
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48777
+ titleFontSize: value[0]
48778
+ })),
48779
+ className: "w-full"
48780
+ }
48781
+ )
48782
+ ] })
48783
+ ] })
48784
+ ] }),
48785
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48786
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Data Labels" }),
48787
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48788
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48789
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Show Labels" }) }),
48790
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
48791
+ Select,
48792
+ {
48793
+ value: chartSettings.showLabels ? "yes" : "no",
48794
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48795
+ showLabels: value === "yes"
48796
+ })),
48797
+ children: [
48798
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Show data labels?" }) }),
48799
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48800
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
48801
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
48802
+ ] })
48803
+ ]
48804
+ }
48805
+ )
48806
+ ] }),
48807
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48808
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48809
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48810
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48811
+ chartSettings.dataLabelsFontSize,
48812
+ "px"
48813
+ ] })
48814
+ ] }),
48815
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48816
+ Slider,
48817
+ {
48818
+ min: 10,
48819
+ max: 18,
48820
+ step: 1,
48821
+ value: [(_k = chartSettings.dataLabelsFontSize) != null ? _k : 12],
48822
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48823
+ dataLabelsFontSize: value[0]
48824
+ })),
48825
+ className: "w-full"
48826
+ }
48827
+ )
48828
+ ] })
48829
+ ] })
48830
+ ] }),
48831
+ (agentType === "Series Bar Chart Agent" || agentType === "Bar Chart Agent" || agentType === "Series Line Chart Agent" || agentType === "Line Chart Agent") && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48832
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Axes" }),
48833
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48834
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48835
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48836
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "X-Axis Title Font Size" }),
48837
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48838
+ chartSettings.xAxisTitleFontSize,
48839
+ "px"
48840
+ ] })
48841
+ ] }),
48842
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48843
+ Slider,
48844
+ {
48845
+ min: 10,
48846
+ max: 18,
48847
+ step: 1,
48848
+ value: [(_l = chartSettings.xAxisTitleFontSize) != null ? _l : 13],
48849
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48850
+ xAxisTitleFontSize: value[0]
48851
+ })),
48852
+ className: "w-full"
48853
+ }
48854
+ )
48855
+ ] }),
48856
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48857
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48858
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "X-Axis Tick Font Size" }),
48859
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48860
+ chartSettings.xAxisTickFontSize,
48861
+ "px"
48862
+ ] })
48863
+ ] }),
48864
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48865
+ Slider,
48866
+ {
48867
+ min: 10,
48868
+ max: 14,
48869
+ step: 1,
48870
+ value: [(_m = chartSettings.xAxisTickFontSize) != null ? _m : 12],
48871
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48872
+ xAxisTickFontSize: value[0]
48873
+ })),
48874
+ className: "w-full"
48875
+ }
48876
+ )
48877
+ ] }),
48878
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48879
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48880
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Y-Axis Title Font Size" }),
48881
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48882
+ chartSettings.yAxisTitleFontSize,
48883
+ "px"
48884
+ ] })
48885
+ ] }),
48886
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48887
+ Slider,
48888
+ {
48889
+ min: 10,
48890
+ max: 18,
48891
+ step: 1,
48892
+ value: [(_n = chartSettings.yAxisTitleFontSize) != null ? _n : 13],
48893
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48894
+ yAxisTitleFontSize: value[0]
48895
+ })),
48896
+ className: "w-full"
48897
+ }
48898
+ )
48899
+ ] }),
48900
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48901
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48902
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Y-Axis Tick Font Size" }),
48903
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48904
+ chartSettings.yAxisTickFontSize,
48905
+ "px"
48906
+ ] })
48907
+ ] }),
48908
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48909
+ Slider,
48910
+ {
48911
+ min: 10,
48912
+ max: 14,
48913
+ step: 1,
48914
+ value: [(_o = chartSettings.yAxisTickFontSize) != null ? _o : 12],
48915
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48916
+ yAxisTickFontSize: value[0]
48917
+ })),
48918
+ className: "w-full"
48919
+ }
48920
+ )
48921
+ ] })
48922
+ ] })
48923
+ ] }),
48924
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
48925
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Tooltip" }),
48926
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-3", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48927
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48928
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48929
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48930
+ chartSettings.tooltipFontSize,
48931
+ "px"
48932
+ ] })
48933
+ ] }),
48934
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48935
+ Slider,
48936
+ {
48937
+ min: 10,
48938
+ max: 16,
48939
+ step: 1,
48940
+ value: [(_p = chartSettings.tooltipFontSize) != null ? _p : 12],
48941
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48942
+ tooltipFontSize: value[0]
48943
+ })),
48944
+ className: "w-full"
48945
+ }
48946
+ )
48947
+ ] }) })
48948
+ ] })
48949
+ ] })
48950
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48951
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Query" }),
48952
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48953
+ Textarea,
47871
48954
  {
47872
- onClick: handleSubmit,
47873
- className: "font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary-600 text-white hover:bg-primary-700 focus:ring-primary-500 px-6 py-2 text-sm flex items-center gap-2",
47874
- children: "Submit"
48955
+ className: "w-full p-2 min-h-[120px]",
48956
+ value: query,
48957
+ onChange: (e) => {
48958
+ var _a2;
48959
+ return setQuery((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value);
48960
+ }
47875
48961
  }
47876
- ) })
47877
- ] })
48962
+ )
48963
+ ] }) }) }) }),
48964
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-shrink-0 px-6 py-4 border-t border-gray-200 bg-gradient-to-b from-white to-gray-50 flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
48965
+ "button",
48966
+ {
48967
+ onClick: handleSubmit,
48968
+ className: "font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none bg-primary text-primary-foreground hover:bg-primary/80 focus:ring-primary px-6 py-2 text-sm flex items-center gap-2",
48969
+ children: "Submit"
48970
+ }
48971
+ ) })
47878
48972
  ] })
47879
- ] })
48973
+ ]
47880
48974
  }
47881
48975
  );
47882
48976
  }
@@ -48323,11 +49417,11 @@ function WidgetDashboard({
48323
49417
  const [internalSelectedWidget, setInternalSelectedWidget] = React.useState(selectedWidget);
48324
49418
  const [currentLayouts, setCurrentLayouts] = React.useState(defaultLayouts);
48325
49419
  const [draftLayouts, setDraftLayouts] = React.useState(defaultLayouts);
48326
- const [visibleClearButton, setVisibleClearButton] = React.useState("");
48327
49420
  const [showEditModal, setShowEditModal] = React.useState(false);
48328
49421
  const [editInitialQuery, setEditInitialQuery] = React.useState("");
48329
49422
  const [editingWidget, setEditingWidget] = React.useState(null);
48330
49423
  const [widgetResetFunctions, setWidgetResetFunctions] = React.useState(/* @__PURE__ */ new Map());
49424
+ const [clearingChatWidget, setClearingChatWidget] = React.useState("");
48331
49425
  const displayWidgets = React.useMemo(() => {
48332
49426
  if (focusWidgetId) {
48333
49427
  return widgets.filter((w) => w.id === focusWidgetId);
@@ -48380,20 +49474,52 @@ function WidgetDashboard({
48380
49474
  };
48381
49475
  const onClickSettings = (widget) => {
48382
49476
  var _a;
49477
+ const currentWidget = widgets.find((w) => w.id === widget.id) || widget;
48383
49478
  setShowEditModal(true);
48384
- setEditingWidget(widget);
48385
- let query = (_a = widget == null ? void 0 : widget.config) == null ? void 0 : _a.query;
49479
+ setEditingWidget(currentWidget);
49480
+ let query = (_a = currentWidget == null ? void 0 : currentWidget.config) == null ? void 0 : _a.query;
48386
49481
  if (query) {
48387
49482
  setEditInitialQuery(query);
48388
49483
  } else {
48389
49484
  setEditInitialQuery("");
48390
49485
  }
48391
49486
  };
48392
- const handleEditSubmit = async (newQuery, showLabels) => {
49487
+ const saveWidgetConfigToBackend = React.useCallback(
49488
+ lodash.debounce(async (widget) => {
49489
+ try {
49490
+ const widgetService = new WidgetService();
49491
+ await widgetService.saveWidget(widget);
49492
+ console.log(`[WidgetDashboard] Widget ${widget.id} config saved to backend`);
49493
+ } catch (error) {
49494
+ console.error(`[WidgetDashboard] Failed to save widget config:`, error);
49495
+ }
49496
+ }, 1e3),
49497
+ []
49498
+ );
49499
+ const handleConfigUpdate = (widgetId, config) => {
49500
+ setWidgets((prevWidgets) => {
49501
+ const updatedWidgets = prevWidgets.map(
49502
+ (w) => w.id === widgetId ? __spreadProps$1(__spreadValues$1({}, w), {
49503
+ config: __spreadValues$1(__spreadValues$1({}, w.config), config)
49504
+ }) : w
49505
+ );
49506
+ const updatedWidget = updatedWidgets.find((w) => w.id === widgetId);
49507
+ if (updatedWidget) {
49508
+ saveWidgetConfigToBackend(updatedWidget);
49509
+ }
49510
+ return updatedWidgets;
49511
+ });
49512
+ };
49513
+ const handleEditSubmit = async (newQuery, showLabels, chartSettings) => {
48393
49514
  var _a, _b;
48394
49515
  if (!editingWidget) return;
48395
49516
  const updatedWidgets = widgets.map(
48396
- (w) => w.id === editingWidget.id ? __spreadProps$1(__spreadValues$1({}, w), { config: __spreadProps$1(__spreadValues$1({}, w.config), { query: newQuery, content: __spreadProps$1(__spreadValues$1({}, w.config.content), { showLabels }) }) }) : w
49517
+ (w) => w.id === editingWidget.id ? __spreadProps$1(__spreadValues$1({}, w), {
49518
+ config: __spreadValues$1(__spreadProps$1(__spreadValues$1({}, w.config), {
49519
+ query: newQuery,
49520
+ content: __spreadProps$1(__spreadValues$1({}, w.config.content), { showLabels })
49521
+ }), chartSettings && { chartSettings })
49522
+ }) : w
48397
49523
  );
48398
49524
  setWidgets(updatedWidgets);
48399
49525
  setShowEditModal(false);
@@ -48483,6 +49609,11 @@ function WidgetDashboard({
48483
49609
  setTimeout(() => pollForSqlQuery(), 2e3);
48484
49610
  }
48485
49611
  }
49612
+ try {
49613
+ await stableSaveLayout();
49614
+ } catch (error) {
49615
+ console.error("Failed to save widget configuration:", error);
49616
+ }
48486
49617
  };
48487
49618
  const handleResetReady = React.useCallback((widgetId, resetFn) => {
48488
49619
  setWidgetResetFunctions((prev) => {
@@ -48493,6 +49624,7 @@ function WidgetDashboard({
48493
49624
  }, []);
48494
49625
  const handleClearChat = async (widgetId) => {
48495
49626
  try {
49627
+ setClearingChatWidget(widgetId);
48496
49628
  const response = await fetch(getApiUrl("/api/clear-chat"), {
48497
49629
  method: "POST",
48498
49630
  headers: {
@@ -48514,9 +49646,12 @@ function WidgetDashboard({
48514
49646
  }
48515
49647
  } catch (error) {
48516
49648
  console.error("Error clearing chat:", error);
49649
+ } finally {
49650
+ setClearingChatWidget("");
48517
49651
  }
48518
49652
  };
48519
49653
  const loadData = React.useCallback(async () => {
49654
+ var _a;
48520
49655
  if (!pageId) {
48521
49656
  setIsLoading(false);
48522
49657
  return;
@@ -48537,6 +49672,12 @@ function WidgetDashboard({
48537
49672
  setPageData(data);
48538
49673
  setWidgets(data.widgets || []);
48539
49674
  setDatasetId(data == null ? void 0 : data.dataset_id);
49675
+ (_a = data.widgets) == null ? void 0 : _a.forEach((w) => {
49676
+ var _a2;
49677
+ if ((_a2 = w.config) == null ? void 0 : _a2.chartSettings) {
49678
+ console.log(`[WidgetDashboard] Widget ${w.id} has chartSettings:`, w.config.chartSettings);
49679
+ }
49680
+ });
48540
49681
  } catch (err) {
48541
49682
  console.error("Error loading page data:", err);
48542
49683
  } finally {
@@ -48582,6 +49723,23 @@ function WidgetDashboard({
48582
49723
  const newAgentWidgetIds = widgets.filter((w) => w.type === "agent" && !originalWidgetIdsRef.current.has(w.id)).map((w) => w.id);
48583
49724
  const hasFilterWidget = widgets.some((w) => w.type === "filters");
48584
49725
  try {
49726
+ const widgetsToSave = widgets.map((widget) => __spreadProps$1(__spreadValues$1({}, widget), {
49727
+ config: __spreadProps$1(__spreadValues$1({}, widget.config), {
49728
+ isFirstLoad: false
49729
+ }),
49730
+ position: {
49731
+ x: widget.position_x,
49732
+ y: widget.position_y,
49733
+ width: widget.width,
49734
+ height: widget.height
49735
+ }
49736
+ }));
49737
+ widgetsToSave.forEach((w) => {
49738
+ var _a;
49739
+ if ((_a = w.config) == null ? void 0 : _a.chartSettings) {
49740
+ console.log(`[WidgetDashboard] Saving widget ${w.id} with chartSettings:`, w.config.chartSettings);
49741
+ }
49742
+ });
48585
49743
  const response = await fetch(getApiUrl(`/api/pages/${pageId}`), {
48586
49744
  method: "PUT",
48587
49745
  headers: {
@@ -48590,17 +49748,7 @@ function WidgetDashboard({
48590
49748
  body: JSON.stringify(__spreadProps$1(__spreadValues$1({
48591
49749
  id: pageId
48592
49750
  }, pageData), {
48593
- widgets: widgets.map((widget) => __spreadProps$1(__spreadValues$1({}, widget), {
48594
- config: __spreadProps$1(__spreadValues$1({}, widget.config), {
48595
- isFirstLoad: false
48596
- }),
48597
- position: {
48598
- x: widget.position_x,
48599
- y: widget.position_y,
48600
- width: widget.width,
48601
- height: widget.height
48602
- }
48603
- }))
49751
+ widgets: widgetsToSave
48604
49752
  }))
48605
49753
  });
48606
49754
  if (!response.ok) {
@@ -49043,10 +50191,10 @@ function WidgetDashboard({
49043
50191
  const filterStatus = w.type === "agent" ? getWidgetFilterStatus(w.id) : null;
49044
50192
  const badgeInfo = filterStatus ? getFilterStatusBadge(filterStatus.status) : null;
49045
50193
  const isFocusMode = focusWidgetId && w.id === focusWidgetId;
49046
- const widgetBaseStyles = "rounded-xl border border-gray-200 !bg-white";
49047
- const widgetHoverStyles = isEditing ? "hover:border-primary-500 hover:shadow-lg transition-all duration-200" : "";
49048
- const widgetShadow = "shadow-[0_2px_8px_-2px_rgba(0,0,0,0.15)]";
49049
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { "data-widget-id": w.id, className: `${w.type === "text" || w.type === "spacer" ? `${((_b = (_a = w == null ? void 0 : w.config) == null ? void 0 : _a.content) == null ? void 0 : _b.divider) === "yes" && "border-b border-gray-300"} ${isEditing ? `${widgetBaseStyles} ${widgetShadow} ${widgetHoverStyles}` : "flex items-center"}` : `${widgetBaseStyles} ${widgetShadow} ${widgetHoverStyles} p-4 ${isEditing ? "pb-14" : "pb-5"}`} ${isFocusMode ? "h-full" : ""} relative`, children: [
50194
+ const widgetBaseStyles = "rounded-xl border-2 border-gray-300 !bg-white";
50195
+ const widgetHoverStyles = isEditing ? "hover:border-primary-500 hover:shadow-lg transition-all duration-200 cursor-pointer" : "";
50196
+ const widgetShadow = "shadow-[0_4px_12px_-2px_rgba(0,0,0,0.2)]";
50197
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { "data-widget-id": w.id, className: `${w.type === "text" || w.type === "spacer" ? `${((_b = (_a = w == null ? void 0 : w.config) == null ? void 0 : _a.content) == null ? void 0 : _b.divider) === "yes" && "border-b border-gray-300"} ${isEditing ? `${widgetBaseStyles} ${widgetShadow} ${widgetHoverStyles}` : "flex items-center"}` : `${widgetBaseStyles} ${widgetShadow} ${widgetHoverStyles} p-4 ${isEditing ? "pb-14" : "pb-5"}`} ${isFocusMode ? "h-full" : ""} relative overflow-hidden`, children: [
49050
50198
  w.type === "agent" && badgeInfo && !isApplyingFilters && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-2 right-2 z-10", title: (filterStatus == null ? void 0 : filterStatus.reason) || (filterStatus == null ? void 0 : filterStatus.error) || "", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Badge, { variant: badgeInfo.variant, className: "text-[10px] px-2 py-0.5 gap-1", children: [
49051
50199
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: badgeInfo.icon }),
49052
50200
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: badgeInfo.label })
@@ -49073,13 +50221,7 @@ function WidgetDashboard({
49073
50221
  w.type !== "spacer" && w.type !== "chatbot" && /* @__PURE__ */ jsxRuntimeExports.jsx(lucideReact.Edit, { onClick: () => onClickSettings && onClickSettings(w), className: "w-5 h-5 text-gray-600" })
49074
50222
  ] })
49075
50223
  ] }),
49076
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${(w == null ? void 0 : w.type) === "text" || (w == null ? void 0 : w.type) === "spacer" ? `${isEditing ? "px-4" : ""}` : "h-full"} w-full relative`, children: [
49077
- (w == null ? void 0 : w.type) === "chatbot" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [
49078
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { onClick: () => handleClearChat(w == null ? void 0 : w.id), onMouseOver: () => setVisibleClearButton(w == null ? void 0 : w.id), onMouseLeave: () => setVisibleClearButton(""), className: "absolute top-[12px] right-0 z-40 flex align-middle justify-center gap-2 text-sm px-4 py-2 border-primary-300 rounded-l-sm w-fit bg-primary-700 text-white cursor-pointer shadow-md transition-all", children: /* @__PURE__ */ jsxRuntimeExports.jsx(lucideReact.MessageCircleX, { className: "w-5 h-5" }) }),
49079
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `absolute top-[56px] right-[16px] z-50 w-max py-1 text-xs px-2 rounded-sm text-white bg-gray-950 ${visibleClearButton === (w == null ? void 0 : w.id) ? "block" : "hidden"}`, children: "Clear Chat" })
49080
- ] }),
49081
- /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetRenderer, { widget: w, widgetBackendUrl, onResetReady: handleResetReady, widgetIds: widgets.filter((widget) => widget.type !== "chatbot").map((widget) => widget.id), datasetId, pageId, onApplyFilters, isEditing, dashboardName: ((_c = pageData == null ? void 0 : pageData.basic) == null ? void 0 : _c.title) || (pageData == null ? void 0 : pageData.name) || (pageData == null ? void 0 : pageData.title) })
49082
- ] })
50224
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${(w == null ? void 0 : w.type) === "text" || (w == null ? void 0 : w.type) === "spacer" ? `${isEditing ? "px-4" : ""}` : "h-full"} w-full relative`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetRenderer, { widget: w, widgetBackendUrl, onResetReady: handleResetReady, widgetIds: widgets.filter((widget) => widget.type !== "chatbot").map((widget) => widget.id), datasetId, pageId, onApplyFilters, isEditing, dashboardName: ((_c = pageData == null ? void 0 : pageData.basic) == null ? void 0 : _c.title) || (pageData == null ? void 0 : pageData.name) || (pageData == null ? void 0 : pageData.title), onClearChat: handleClearChat, isClearing: clearingChatWidget, onConfigUpdate: handleConfigUpdate }) })
49083
50225
  ] }, w.id);
49084
50226
  })
49085
50227
  }
@@ -49374,7 +50516,7 @@ function PresentationMode({
49374
50516
  }
49375
50517
  )
49376
50518
  ] }),
49377
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 bg-white p-6 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full rounded-xl border border-gray-200 bg-white shadow-sm overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
50519
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 bg-white p-6 min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full rounded-xl border-2 border-gray-300 bg-white shadow-[0_4px_12px_-2px_rgba(0,0,0,0.2)] overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
49378
50520
  WidgetRenderer,
49379
50521
  {
49380
50522
  widget: currentFocusWidget,