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.esm.js CHANGED
@@ -7,7 +7,7 @@ import * as LabelPrimitive from '@radix-ui/react-label';
7
7
  import { cva } from 'class-variance-authority';
8
8
  import * as SwitchPrimitives from '@radix-ui/react-switch';
9
9
  import * as SelectPrimitive from '@radix-ui/react-select';
10
- import { ChevronDown, ChevronUp, Check, AlertCircle, MoveUp, MoveDown, Trash2, Plus, Bot, Type, Layout, LayoutGrid, BarChart as BarChart$1, Filter, Search, ArrowUp, ArrowDown, ChevronRight, RefreshCw, Loader2, Download, Send, X, AlignVerticalSpaceAround, LineChart as LineChart$1, PieChart as PieChart$1, Table, SlidersHorizontal, GripHorizontal, Edit, MessageCircleX, ChevronLeft, Maximize2, Grid3X3, Edit2 } from 'lucide-react';
10
+ import { ChevronDown, ChevronUp, Check, AlertCircle, MoveUp, MoveDown, Trash2, Plus, Bot, Type, Layout, LayoutGrid, BarChart as BarChart$1, Filter, Search, ArrowUp, ArrowDown, ChevronRight, RefreshCw, Loader2, Download, MessageCircleX, Send, X, AlignVerticalSpaceAround, LineChart as LineChart$1, PieChart as PieChart$1, Table, SlidersHorizontal, GripHorizontal, Edit, ChevronLeft, Maximize2, Grid3X3, Edit2 } from 'lucide-react';
11
11
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
12
12
  import { Slot, createSlot, createSlottable } from '@radix-ui/react-slot';
13
13
  import { debounce as debounce$1 } from 'lodash';
@@ -19,6 +19,7 @@ import { TextMessage, Role } from '@copilotkit/runtime-client-gql';
19
19
  import { CopilotKit, useCopilotContext, useCoAgent, useCopilotChat } from '@copilotkit/react-core';
20
20
  import jsPDF from 'jspdf';
21
21
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
22
+ import * as SliderPrimitive from '@radix-ui/react-slider';
22
23
  import * as DialogPrimitive from '@radix-ui/react-dialog';
23
24
  import { format } from 'date-fns';
24
25
 
@@ -1429,40 +1430,40 @@ const KEYS = {
1429
1430
  ESCAPE: "Escape",
1430
1431
  TAB: "Tab"};
1431
1432
 
1432
- var __defProp$q = Object.defineProperty;
1433
- var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
1434
- var __hasOwnProp$q = Object.prototype.hasOwnProperty;
1435
- var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
1436
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1437
- var __spreadValues$q = (a, b) => {
1433
+ var __defProp$u = Object.defineProperty;
1434
+ var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
1435
+ var __hasOwnProp$u = Object.prototype.hasOwnProperty;
1436
+ var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
1437
+ var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1438
+ var __spreadValues$u = (a, b) => {
1438
1439
  for (var prop in b || (b = {}))
1439
- if (__hasOwnProp$q.call(b, prop))
1440
- __defNormalProp$q(a, prop, b[prop]);
1441
- if (__getOwnPropSymbols$q)
1442
- for (var prop of __getOwnPropSymbols$q(b)) {
1443
- if (__propIsEnum$q.call(b, prop))
1444
- __defNormalProp$q(a, prop, b[prop]);
1440
+ if (__hasOwnProp$u.call(b, prop))
1441
+ __defNormalProp$u(a, prop, b[prop]);
1442
+ if (__getOwnPropSymbols$u)
1443
+ for (var prop of __getOwnPropSymbols$u(b)) {
1444
+ if (__propIsEnum$u.call(b, prop))
1445
+ __defNormalProp$u(a, prop, b[prop]);
1445
1446
  }
1446
1447
  return a;
1447
1448
  };
1448
- var __objRest$d = (source, exclude) => {
1449
+ var __objRest$e = (source, exclude) => {
1449
1450
  var target = {};
1450
1451
  for (var prop in source)
1451
- if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
1452
+ if (__hasOwnProp$u.call(source, prop) && exclude.indexOf(prop) < 0)
1452
1453
  target[prop] = source[prop];
1453
- if (source != null && __getOwnPropSymbols$q)
1454
- for (var prop of __getOwnPropSymbols$q(source)) {
1455
- if (exclude.indexOf(prop) < 0 && __propIsEnum$q.call(source, prop))
1454
+ if (source != null && __getOwnPropSymbols$u)
1455
+ for (var prop of __getOwnPropSymbols$u(source)) {
1456
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$u.call(source, prop))
1456
1457
  target[prop] = source[prop];
1457
1458
  }
1458
1459
  return target;
1459
1460
  };
1460
1461
  const Tabs = TabsPrimitive.Root;
1461
1462
  const TabsList = React.forwardRef((_a, ref) => {
1462
- var _b = _a, { className } = _b, props = __objRest$d(_b, ["className"]);
1463
+ var _b = _a, { className } = _b, props = __objRest$e(_b, ["className"]);
1463
1464
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1464
1465
  TabsPrimitive.List,
1465
- __spreadValues$q({
1466
+ __spreadValues$u({
1466
1467
  ref,
1467
1468
  className: cn(
1468
1469
  "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
@@ -1473,10 +1474,10 @@ const TabsList = React.forwardRef((_a, ref) => {
1473
1474
  });
1474
1475
  TabsList.displayName = TabsPrimitive.List.displayName;
1475
1476
  const TabsTrigger = React.forwardRef((_c, ref) => {
1476
- var _d = _c, { className } = _d, props = __objRest$d(_d, ["className"]);
1477
+ var _d = _c, { className } = _d, props = __objRest$e(_d, ["className"]);
1477
1478
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1478
1479
  TabsPrimitive.Trigger,
1479
- __spreadValues$q({
1480
+ __spreadValues$u({
1480
1481
  ref,
1481
1482
  className: cn(
1482
1483
  "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",
@@ -1487,10 +1488,10 @@ const TabsTrigger = React.forwardRef((_c, ref) => {
1487
1488
  });
1488
1489
  TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
1489
1490
  const TabsContent = React.forwardRef((_e, ref) => {
1490
- var _f = _e, { className } = _f, props = __objRest$d(_f, ["className"]);
1491
+ var _f = _e, { className } = _f, props = __objRest$e(_f, ["className"]);
1491
1492
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1492
1493
  TabsPrimitive.Content,
1493
- __spreadValues$q({
1494
+ __spreadValues$u({
1494
1495
  ref,
1495
1496
  className: cn(
1496
1497
  "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
@@ -1501,40 +1502,40 @@ const TabsContent = React.forwardRef((_e, ref) => {
1501
1502
  });
1502
1503
  TabsContent.displayName = TabsPrimitive.Content.displayName;
1503
1504
 
1504
- var __defProp$p = Object.defineProperty;
1505
- var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
1506
- var __hasOwnProp$p = Object.prototype.hasOwnProperty;
1507
- var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
1508
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1509
- var __spreadValues$p = (a, b) => {
1505
+ var __defProp$t = Object.defineProperty;
1506
+ var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
1507
+ var __hasOwnProp$t = Object.prototype.hasOwnProperty;
1508
+ var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
1509
+ var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1510
+ var __spreadValues$t = (a, b) => {
1510
1511
  for (var prop in b || (b = {}))
1511
- if (__hasOwnProp$p.call(b, prop))
1512
- __defNormalProp$p(a, prop, b[prop]);
1513
- if (__getOwnPropSymbols$p)
1514
- for (var prop of __getOwnPropSymbols$p(b)) {
1515
- if (__propIsEnum$p.call(b, prop))
1516
- __defNormalProp$p(a, prop, b[prop]);
1512
+ if (__hasOwnProp$t.call(b, prop))
1513
+ __defNormalProp$t(a, prop, b[prop]);
1514
+ if (__getOwnPropSymbols$t)
1515
+ for (var prop of __getOwnPropSymbols$t(b)) {
1516
+ if (__propIsEnum$t.call(b, prop))
1517
+ __defNormalProp$t(a, prop, b[prop]);
1517
1518
  }
1518
1519
  return a;
1519
1520
  };
1520
- var __objRest$c = (source, exclude) => {
1521
+ var __objRest$d = (source, exclude) => {
1521
1522
  var target = {};
1522
1523
  for (var prop in source)
1523
- if (__hasOwnProp$p.call(source, prop) && exclude.indexOf(prop) < 0)
1524
+ if (__hasOwnProp$t.call(source, prop) && exclude.indexOf(prop) < 0)
1524
1525
  target[prop] = source[prop];
1525
- if (source != null && __getOwnPropSymbols$p)
1526
- for (var prop of __getOwnPropSymbols$p(source)) {
1527
- if (exclude.indexOf(prop) < 0 && __propIsEnum$p.call(source, prop))
1526
+ if (source != null && __getOwnPropSymbols$t)
1527
+ for (var prop of __getOwnPropSymbols$t(source)) {
1528
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$t.call(source, prop))
1528
1529
  target[prop] = source[prop];
1529
1530
  }
1530
1531
  return target;
1531
1532
  };
1532
1533
  const Input = React.forwardRef(
1533
1534
  (_a, ref) => {
1534
- var _b = _a, { className, type } = _b, props = __objRest$c(_b, ["className", "type"]);
1535
+ var _b = _a, { className, type } = _b, props = __objRest$d(_b, ["className", "type"]);
1535
1536
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1536
1537
  "input",
1537
- __spreadValues$p({
1538
+ __spreadValues$t({
1538
1539
  type,
1539
1540
  className: cn(
1540
1541
  "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",
@@ -1547,30 +1548,30 @@ const Input = React.forwardRef(
1547
1548
  );
1548
1549
  Input.displayName = "Input";
1549
1550
 
1550
- var __defProp$o = Object.defineProperty;
1551
- var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
1552
- var __hasOwnProp$o = Object.prototype.hasOwnProperty;
1553
- var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
1554
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1555
- var __spreadValues$o = (a, b) => {
1551
+ var __defProp$s = Object.defineProperty;
1552
+ var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
1553
+ var __hasOwnProp$s = Object.prototype.hasOwnProperty;
1554
+ var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
1555
+ var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1556
+ var __spreadValues$s = (a, b) => {
1556
1557
  for (var prop in b || (b = {}))
1557
- if (__hasOwnProp$o.call(b, prop))
1558
- __defNormalProp$o(a, prop, b[prop]);
1559
- if (__getOwnPropSymbols$o)
1560
- for (var prop of __getOwnPropSymbols$o(b)) {
1561
- if (__propIsEnum$o.call(b, prop))
1562
- __defNormalProp$o(a, prop, b[prop]);
1558
+ if (__hasOwnProp$s.call(b, prop))
1559
+ __defNormalProp$s(a, prop, b[prop]);
1560
+ if (__getOwnPropSymbols$s)
1561
+ for (var prop of __getOwnPropSymbols$s(b)) {
1562
+ if (__propIsEnum$s.call(b, prop))
1563
+ __defNormalProp$s(a, prop, b[prop]);
1563
1564
  }
1564
1565
  return a;
1565
1566
  };
1566
- var __objRest$b = (source, exclude) => {
1567
+ var __objRest$c = (source, exclude) => {
1567
1568
  var target = {};
1568
1569
  for (var prop in source)
1569
- if (__hasOwnProp$o.call(source, prop) && exclude.indexOf(prop) < 0)
1570
+ if (__hasOwnProp$s.call(source, prop) && exclude.indexOf(prop) < 0)
1570
1571
  target[prop] = source[prop];
1571
- if (source != null && __getOwnPropSymbols$o)
1572
- for (var prop of __getOwnPropSymbols$o(source)) {
1573
- if (exclude.indexOf(prop) < 0 && __propIsEnum$o.call(source, prop))
1572
+ if (source != null && __getOwnPropSymbols$s)
1573
+ for (var prop of __getOwnPropSymbols$s(source)) {
1574
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$s.call(source, prop))
1574
1575
  target[prop] = source[prop];
1575
1576
  }
1576
1577
  return target;
@@ -1579,10 +1580,10 @@ const labelVariants = cva(
1579
1580
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1580
1581
  );
1581
1582
  const Label$1 = React.forwardRef((_a, ref) => {
1582
- var _b = _a, { className } = _b, props = __objRest$b(_b, ["className"]);
1583
+ var _b = _a, { className } = _b, props = __objRest$c(_b, ["className"]);
1583
1584
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1584
1585
  LabelPrimitive.Root,
1585
- __spreadValues$o({
1586
+ __spreadValues$s({
1586
1587
  ref,
1587
1588
  className: cn(labelVariants(), className)
1588
1589
  }, props)
@@ -1590,42 +1591,42 @@ const Label$1 = React.forwardRef((_a, ref) => {
1590
1591
  });
1591
1592
  Label$1.displayName = LabelPrimitive.Root.displayName;
1592
1593
 
1593
- var __defProp$n = Object.defineProperty;
1594
- var __defProps$g = Object.defineProperties;
1595
- var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
1596
- var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
1597
- var __hasOwnProp$n = Object.prototype.hasOwnProperty;
1598
- var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
1599
- var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1600
- var __spreadValues$n = (a, b) => {
1594
+ var __defProp$r = Object.defineProperty;
1595
+ var __defProps$k = Object.defineProperties;
1596
+ var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
1597
+ var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
1598
+ var __hasOwnProp$r = Object.prototype.hasOwnProperty;
1599
+ var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
1600
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1601
+ var __spreadValues$r = (a, b) => {
1601
1602
  for (var prop in b || (b = {}))
1602
- if (__hasOwnProp$n.call(b, prop))
1603
- __defNormalProp$n(a, prop, b[prop]);
1604
- if (__getOwnPropSymbols$n)
1605
- for (var prop of __getOwnPropSymbols$n(b)) {
1606
- if (__propIsEnum$n.call(b, prop))
1607
- __defNormalProp$n(a, prop, b[prop]);
1603
+ if (__hasOwnProp$r.call(b, prop))
1604
+ __defNormalProp$r(a, prop, b[prop]);
1605
+ if (__getOwnPropSymbols$r)
1606
+ for (var prop of __getOwnPropSymbols$r(b)) {
1607
+ if (__propIsEnum$r.call(b, prop))
1608
+ __defNormalProp$r(a, prop, b[prop]);
1608
1609
  }
1609
1610
  return a;
1610
1611
  };
1611
- var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
1612
- var __objRest$a = (source, exclude) => {
1612
+ var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
1613
+ var __objRest$b = (source, exclude) => {
1613
1614
  var target = {};
1614
1615
  for (var prop in source)
1615
- if (__hasOwnProp$n.call(source, prop) && exclude.indexOf(prop) < 0)
1616
+ if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
1616
1617
  target[prop] = source[prop];
1617
- if (source != null && __getOwnPropSymbols$n)
1618
- for (var prop of __getOwnPropSymbols$n(source)) {
1619
- if (exclude.indexOf(prop) < 0 && __propIsEnum$n.call(source, prop))
1618
+ if (source != null && __getOwnPropSymbols$r)
1619
+ for (var prop of __getOwnPropSymbols$r(source)) {
1620
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$r.call(source, prop))
1620
1621
  target[prop] = source[prop];
1621
1622
  }
1622
1623
  return target;
1623
1624
  };
1624
1625
  const Switch = React.forwardRef((_a, ref) => {
1625
- var _b = _a, { className } = _b, props = __objRest$a(_b, ["className"]);
1626
+ var _b = _a, { className } = _b, props = __objRest$b(_b, ["className"]);
1626
1627
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1627
1628
  SwitchPrimitives.Root,
1628
- __spreadProps$g(__spreadValues$n({
1629
+ __spreadProps$k(__spreadValues$r({
1629
1630
  className: cn(
1630
1631
  "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",
1631
1632
  className
@@ -1645,33 +1646,33 @@ const Switch = React.forwardRef((_a, ref) => {
1645
1646
  });
1646
1647
  Switch.displayName = SwitchPrimitives.Root.displayName;
1647
1648
 
1648
- var __defProp$m = Object.defineProperty;
1649
- var __defProps$f = Object.defineProperties;
1650
- var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
1651
- var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
1652
- var __hasOwnProp$m = Object.prototype.hasOwnProperty;
1653
- var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
1654
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1655
- var __spreadValues$m = (a, b) => {
1649
+ var __defProp$q = Object.defineProperty;
1650
+ var __defProps$j = Object.defineProperties;
1651
+ var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
1652
+ var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
1653
+ var __hasOwnProp$q = Object.prototype.hasOwnProperty;
1654
+ var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
1655
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1656
+ var __spreadValues$q = (a, b) => {
1656
1657
  for (var prop in b || (b = {}))
1657
- if (__hasOwnProp$m.call(b, prop))
1658
- __defNormalProp$m(a, prop, b[prop]);
1659
- if (__getOwnPropSymbols$m)
1660
- for (var prop of __getOwnPropSymbols$m(b)) {
1661
- if (__propIsEnum$m.call(b, prop))
1662
- __defNormalProp$m(a, prop, b[prop]);
1658
+ if (__hasOwnProp$q.call(b, prop))
1659
+ __defNormalProp$q(a, prop, b[prop]);
1660
+ if (__getOwnPropSymbols$q)
1661
+ for (var prop of __getOwnPropSymbols$q(b)) {
1662
+ if (__propIsEnum$q.call(b, prop))
1663
+ __defNormalProp$q(a, prop, b[prop]);
1663
1664
  }
1664
1665
  return a;
1665
1666
  };
1666
- var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
1667
- var __objRest$9 = (source, exclude) => {
1667
+ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
1668
+ var __objRest$a = (source, exclude) => {
1668
1669
  var target = {};
1669
1670
  for (var prop in source)
1670
- if (__hasOwnProp$m.call(source, prop) && exclude.indexOf(prop) < 0)
1671
+ if (__hasOwnProp$q.call(source, prop) && exclude.indexOf(prop) < 0)
1671
1672
  target[prop] = source[prop];
1672
- if (source != null && __getOwnPropSymbols$m)
1673
- for (var prop of __getOwnPropSymbols$m(source)) {
1674
- if (exclude.indexOf(prop) < 0 && __propIsEnum$m.call(source, prop))
1673
+ if (source != null && __getOwnPropSymbols$q)
1674
+ for (var prop of __getOwnPropSymbols$q(source)) {
1675
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$q.call(source, prop))
1675
1676
  target[prop] = source[prop];
1676
1677
  }
1677
1678
  return target;
@@ -1679,10 +1680,10 @@ var __objRest$9 = (source, exclude) => {
1679
1680
  const Select = SelectPrimitive.Root;
1680
1681
  const SelectValue = SelectPrimitive.Value;
1681
1682
  const SelectTrigger = React.forwardRef((_a, ref) => {
1682
- var _b = _a, { className, children } = _b, props = __objRest$9(_b, ["className", "children"]);
1683
+ var _b = _a, { className, children } = _b, props = __objRest$a(_b, ["className", "children"]);
1683
1684
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1684
1685
  SelectPrimitive.Trigger,
1685
- __spreadProps$f(__spreadValues$m({
1686
+ __spreadProps$j(__spreadValues$q({
1686
1687
  ref,
1687
1688
  className: cn(
1688
1689
  "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",
@@ -1698,10 +1699,10 @@ const SelectTrigger = React.forwardRef((_a, ref) => {
1698
1699
  });
1699
1700
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
1700
1701
  const SelectScrollUpButton = React.forwardRef((_c, ref) => {
1701
- var _d = _c, { className } = _d, props = __objRest$9(_d, ["className"]);
1702
+ var _d = _c, { className } = _d, props = __objRest$a(_d, ["className"]);
1702
1703
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1703
1704
  SelectPrimitive.ScrollUpButton,
1704
- __spreadProps$f(__spreadValues$m({
1705
+ __spreadProps$j(__spreadValues$q({
1705
1706
  ref,
1706
1707
  className: cn(
1707
1708
  "flex cursor-default items-center justify-center py-1",
@@ -1714,10 +1715,10 @@ const SelectScrollUpButton = React.forwardRef((_c, ref) => {
1714
1715
  });
1715
1716
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
1716
1717
  const SelectScrollDownButton = React.forwardRef((_e, ref) => {
1717
- var _f = _e, { className } = _f, props = __objRest$9(_f, ["className"]);
1718
+ var _f = _e, { className } = _f, props = __objRest$a(_f, ["className"]);
1718
1719
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1719
1720
  SelectPrimitive.ScrollDownButton,
1720
- __spreadProps$f(__spreadValues$m({
1721
+ __spreadProps$j(__spreadValues$q({
1721
1722
  ref,
1722
1723
  className: cn(
1723
1724
  "flex cursor-default items-center justify-center py-1",
@@ -1730,10 +1731,10 @@ const SelectScrollDownButton = React.forwardRef((_e, ref) => {
1730
1731
  });
1731
1732
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
1732
1733
  const SelectContent = React.forwardRef((_g, ref) => {
1733
- var _h = _g, { className, children, position = "popper" } = _h, props = __objRest$9(_h, ["className", "children", "position"]);
1734
+ var _h = _g, { className, children, position = "popper" } = _h, props = __objRest$a(_h, ["className", "children", "position"]);
1734
1735
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
1735
1736
  SelectPrimitive.Content,
1736
- __spreadProps$f(__spreadValues$m({
1737
+ __spreadProps$j(__spreadValues$q({
1737
1738
  ref,
1738
1739
  className: cn(
1739
1740
  "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",
@@ -1761,10 +1762,10 @@ const SelectContent = React.forwardRef((_g, ref) => {
1761
1762
  });
1762
1763
  SelectContent.displayName = SelectPrimitive.Content.displayName;
1763
1764
  const SelectLabel = React.forwardRef((_i, ref) => {
1764
- var _j = _i, { className } = _j, props = __objRest$9(_j, ["className"]);
1765
+ var _j = _i, { className } = _j, props = __objRest$a(_j, ["className"]);
1765
1766
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1766
1767
  SelectPrimitive.Label,
1767
- __spreadValues$m({
1768
+ __spreadValues$q({
1768
1769
  ref,
1769
1770
  className: cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)
1770
1771
  }, props)
@@ -1772,10 +1773,10 @@ const SelectLabel = React.forwardRef((_i, ref) => {
1772
1773
  });
1773
1774
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
1774
1775
  const SelectItem = React.forwardRef((_k, ref) => {
1775
- var _l = _k, { className, children } = _l, props = __objRest$9(_l, ["className", "children"]);
1776
+ var _l = _k, { className, children } = _l, props = __objRest$a(_l, ["className", "children"]);
1776
1777
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1777
1778
  SelectPrimitive.Item,
1778
- __spreadProps$f(__spreadValues$m({
1779
+ __spreadProps$j(__spreadValues$q({
1779
1780
  ref,
1780
1781
  className: cn(
1781
1782
  "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",
@@ -1791,10 +1792,10 @@ const SelectItem = React.forwardRef((_k, ref) => {
1791
1792
  });
1792
1793
  SelectItem.displayName = SelectPrimitive.Item.displayName;
1793
1794
  const SelectSeparator = React.forwardRef((_m, ref) => {
1794
- var _n = _m, { className } = _n, props = __objRest$9(_n, ["className"]);
1795
+ var _n = _m, { className } = _n, props = __objRest$a(_n, ["className"]);
1795
1796
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1796
1797
  SelectPrimitive.Separator,
1797
- __spreadValues$m({
1798
+ __spreadValues$q({
1798
1799
  ref,
1799
1800
  className: cn("-mx-1 my-1 h-px bg-muted", className)
1800
1801
  }, props)
@@ -1802,42 +1803,42 @@ const SelectSeparator = React.forwardRef((_m, ref) => {
1802
1803
  });
1803
1804
  SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
1804
1805
 
1805
- var __defProp$l = Object.defineProperty;
1806
- var __defProps$e = Object.defineProperties;
1807
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
1808
- var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
1809
- var __hasOwnProp$l = Object.prototype.hasOwnProperty;
1810
- var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
1811
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1812
- var __spreadValues$l = (a, b) => {
1806
+ var __defProp$p = Object.defineProperty;
1807
+ var __defProps$i = Object.defineProperties;
1808
+ var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
1809
+ var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
1810
+ var __hasOwnProp$p = Object.prototype.hasOwnProperty;
1811
+ var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
1812
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1813
+ var __spreadValues$p = (a, b) => {
1813
1814
  for (var prop in b || (b = {}))
1814
- if (__hasOwnProp$l.call(b, prop))
1815
- __defNormalProp$l(a, prop, b[prop]);
1816
- if (__getOwnPropSymbols$l)
1817
- for (var prop of __getOwnPropSymbols$l(b)) {
1818
- if (__propIsEnum$l.call(b, prop))
1819
- __defNormalProp$l(a, prop, b[prop]);
1815
+ if (__hasOwnProp$p.call(b, prop))
1816
+ __defNormalProp$p(a, prop, b[prop]);
1817
+ if (__getOwnPropSymbols$p)
1818
+ for (var prop of __getOwnPropSymbols$p(b)) {
1819
+ if (__propIsEnum$p.call(b, prop))
1820
+ __defNormalProp$p(a, prop, b[prop]);
1820
1821
  }
1821
1822
  return a;
1822
1823
  };
1823
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
1824
- var __objRest$8 = (source, exclude) => {
1824
+ var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
1825
+ var __objRest$9 = (source, exclude) => {
1825
1826
  var target = {};
1826
1827
  for (var prop in source)
1827
- if (__hasOwnProp$l.call(source, prop) && exclude.indexOf(prop) < 0)
1828
+ if (__hasOwnProp$p.call(source, prop) && exclude.indexOf(prop) < 0)
1828
1829
  target[prop] = source[prop];
1829
- if (source != null && __getOwnPropSymbols$l)
1830
- for (var prop of __getOwnPropSymbols$l(source)) {
1831
- if (exclude.indexOf(prop) < 0 && __propIsEnum$l.call(source, prop))
1830
+ if (source != null && __getOwnPropSymbols$p)
1831
+ for (var prop of __getOwnPropSymbols$p(source)) {
1832
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$p.call(source, prop))
1832
1833
  target[prop] = source[prop];
1833
1834
  }
1834
1835
  return target;
1835
1836
  };
1836
1837
  const ScrollArea = React.forwardRef((_a, ref) => {
1837
- var _b = _a, { className, children } = _b, props = __objRest$8(_b, ["className", "children"]);
1838
+ var _b = _a, { className, children } = _b, props = __objRest$9(_b, ["className", "children"]);
1838
1839
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1839
1840
  ScrollAreaPrimitive.Root,
1840
- __spreadProps$e(__spreadValues$l({
1841
+ __spreadProps$i(__spreadValues$p({
1841
1842
  ref,
1842
1843
  className: cn("relative overflow-hidden", className)
1843
1844
  }, props), {
@@ -1851,10 +1852,10 @@ const ScrollArea = React.forwardRef((_a, ref) => {
1851
1852
  });
1852
1853
  ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
1853
1854
  const ScrollBar = React.forwardRef((_c, ref) => {
1854
- var _d = _c, { className, orientation = "vertical" } = _d, props = __objRest$8(_d, ["className", "orientation"]);
1855
+ var _d = _c, { className, orientation = "vertical" } = _d, props = __objRest$9(_d, ["className", "orientation"]);
1855
1856
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1856
1857
  ScrollAreaPrimitive.ScrollAreaScrollbar,
1857
- __spreadProps$e(__spreadValues$l({
1858
+ __spreadProps$i(__spreadValues$p({
1858
1859
  ref,
1859
1860
  orientation,
1860
1861
  className: cn(
@@ -1870,30 +1871,30 @@ const ScrollBar = React.forwardRef((_c, ref) => {
1870
1871
  });
1871
1872
  ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
1872
1873
 
1873
- var __defProp$k = Object.defineProperty;
1874
- var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
1875
- var __hasOwnProp$k = Object.prototype.hasOwnProperty;
1876
- var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
1877
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1878
- var __spreadValues$k = (a, b) => {
1874
+ var __defProp$o = Object.defineProperty;
1875
+ var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
1876
+ var __hasOwnProp$o = Object.prototype.hasOwnProperty;
1877
+ var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
1878
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1879
+ var __spreadValues$o = (a, b) => {
1879
1880
  for (var prop in b || (b = {}))
1880
- if (__hasOwnProp$k.call(b, prop))
1881
- __defNormalProp$k(a, prop, b[prop]);
1882
- if (__getOwnPropSymbols$k)
1883
- for (var prop of __getOwnPropSymbols$k(b)) {
1884
- if (__propIsEnum$k.call(b, prop))
1885
- __defNormalProp$k(a, prop, b[prop]);
1881
+ if (__hasOwnProp$o.call(b, prop))
1882
+ __defNormalProp$o(a, prop, b[prop]);
1883
+ if (__getOwnPropSymbols$o)
1884
+ for (var prop of __getOwnPropSymbols$o(b)) {
1885
+ if (__propIsEnum$o.call(b, prop))
1886
+ __defNormalProp$o(a, prop, b[prop]);
1886
1887
  }
1887
1888
  return a;
1888
1889
  };
1889
- var __objRest$7 = (source, exclude) => {
1890
+ var __objRest$8 = (source, exclude) => {
1890
1891
  var target = {};
1891
1892
  for (var prop in source)
1892
- if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
1893
+ if (__hasOwnProp$o.call(source, prop) && exclude.indexOf(prop) < 0)
1893
1894
  target[prop] = source[prop];
1894
- if (source != null && __getOwnPropSymbols$k)
1895
- for (var prop of __getOwnPropSymbols$k(source)) {
1896
- if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
1895
+ if (source != null && __getOwnPropSymbols$o)
1896
+ for (var prop of __getOwnPropSymbols$o(source)) {
1897
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$o.call(source, prop))
1897
1898
  target[prop] = source[prop];
1898
1899
  }
1899
1900
  return target;
@@ -1925,11 +1926,11 @@ const buttonVariants = cva(
1925
1926
  );
1926
1927
  const Button = React.forwardRef(
1927
1928
  (_a, ref) => {
1928
- var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest$7(_b, ["className", "variant", "size", "asChild"]);
1929
+ var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest$8(_b, ["className", "variant", "size", "asChild"]);
1929
1930
  const Comp = asChild ? Slot : "button";
1930
1931
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1931
1932
  Comp,
1932
- __spreadValues$k({
1933
+ __spreadValues$o({
1933
1934
  className: cn(buttonVariants({ variant, size, className })),
1934
1935
  ref
1935
1936
  }, props)
@@ -1938,30 +1939,30 @@ const Button = React.forwardRef(
1938
1939
  );
1939
1940
  Button.displayName = "Button";
1940
1941
 
1941
- var __defProp$j = Object.defineProperty;
1942
- var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
1943
- var __hasOwnProp$j = Object.prototype.hasOwnProperty;
1944
- var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
1945
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1946
- var __spreadValues$j = (a, b) => {
1942
+ var __defProp$n = Object.defineProperty;
1943
+ var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
1944
+ var __hasOwnProp$n = Object.prototype.hasOwnProperty;
1945
+ var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
1946
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1947
+ var __spreadValues$n = (a, b) => {
1947
1948
  for (var prop in b || (b = {}))
1948
- if (__hasOwnProp$j.call(b, prop))
1949
- __defNormalProp$j(a, prop, b[prop]);
1950
- if (__getOwnPropSymbols$j)
1951
- for (var prop of __getOwnPropSymbols$j(b)) {
1952
- if (__propIsEnum$j.call(b, prop))
1953
- __defNormalProp$j(a, prop, b[prop]);
1949
+ if (__hasOwnProp$n.call(b, prop))
1950
+ __defNormalProp$n(a, prop, b[prop]);
1951
+ if (__getOwnPropSymbols$n)
1952
+ for (var prop of __getOwnPropSymbols$n(b)) {
1953
+ if (__propIsEnum$n.call(b, prop))
1954
+ __defNormalProp$n(a, prop, b[prop]);
1954
1955
  }
1955
1956
  return a;
1956
1957
  };
1957
- var __objRest$6 = (source, exclude) => {
1958
+ var __objRest$7 = (source, exclude) => {
1958
1959
  var target = {};
1959
1960
  for (var prop in source)
1960
- if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
1961
+ if (__hasOwnProp$n.call(source, prop) && exclude.indexOf(prop) < 0)
1961
1962
  target[prop] = source[prop];
1962
- if (source != null && __getOwnPropSymbols$j)
1963
- for (var prop of __getOwnPropSymbols$j(source)) {
1964
- if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
1963
+ if (source != null && __getOwnPropSymbols$n)
1964
+ for (var prop of __getOwnPropSymbols$n(source)) {
1965
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$n.call(source, prop))
1965
1966
  target[prop] = source[prop];
1966
1967
  }
1967
1968
  return target;
@@ -1981,10 +1982,10 @@ const alertVariants = cva(
1981
1982
  }
1982
1983
  );
1983
1984
  const Alert = React.forwardRef((_a, ref) => {
1984
- var _b = _a, { className, variant } = _b, props = __objRest$6(_b, ["className", "variant"]);
1985
+ var _b = _a, { className, variant } = _b, props = __objRest$7(_b, ["className", "variant"]);
1985
1986
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1986
1987
  "div",
1987
- __spreadValues$j({
1988
+ __spreadValues$n({
1988
1989
  ref,
1989
1990
  role: "alert",
1990
1991
  className: cn(alertVariants({ variant }), className)
@@ -1993,10 +1994,10 @@ const Alert = React.forwardRef((_a, ref) => {
1993
1994
  });
1994
1995
  Alert.displayName = "Alert";
1995
1996
  const AlertTitle = React.forwardRef((_c, ref) => {
1996
- var _d = _c, { className } = _d, props = __objRest$6(_d, ["className"]);
1997
+ var _d = _c, { className } = _d, props = __objRest$7(_d, ["className"]);
1997
1998
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
1998
1999
  "h5",
1999
- __spreadValues$j({
2000
+ __spreadValues$n({
2000
2001
  ref,
2001
2002
  className: cn("mb-1 font-medium leading-none tracking-tight", className)
2002
2003
  }, props)
@@ -2004,10 +2005,10 @@ const AlertTitle = React.forwardRef((_c, ref) => {
2004
2005
  });
2005
2006
  AlertTitle.displayName = "AlertTitle";
2006
2007
  const AlertDescription = React.forwardRef((_e, ref) => {
2007
- var _f = _e, { className } = _f, props = __objRest$6(_f, ["className"]);
2008
+ var _f = _e, { className } = _f, props = __objRest$7(_f, ["className"]);
2008
2009
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2009
2010
  "div",
2010
- __spreadValues$j({
2011
+ __spreadValues$n({
2011
2012
  ref,
2012
2013
  className: cn("text-sm [&_p]:leading-relaxed", className)
2013
2014
  }, props)
@@ -2040,25 +2041,25 @@ function CodeEditor({
2040
2041
  );
2041
2042
  }
2042
2043
 
2043
- var __defProp$i = Object.defineProperty;
2044
- var __defProps$d = Object.defineProperties;
2045
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
2046
- var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
2047
- var __hasOwnProp$i = Object.prototype.hasOwnProperty;
2048
- var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
2049
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2050
- var __spreadValues$i = (a, b) => {
2044
+ var __defProp$m = Object.defineProperty;
2045
+ var __defProps$h = Object.defineProperties;
2046
+ var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
2047
+ var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
2048
+ var __hasOwnProp$m = Object.prototype.hasOwnProperty;
2049
+ var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
2050
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2051
+ var __spreadValues$m = (a, b) => {
2051
2052
  for (var prop in b || (b = {}))
2052
- if (__hasOwnProp$i.call(b, prop))
2053
- __defNormalProp$i(a, prop, b[prop]);
2054
- if (__getOwnPropSymbols$i)
2055
- for (var prop of __getOwnPropSymbols$i(b)) {
2056
- if (__propIsEnum$i.call(b, prop))
2057
- __defNormalProp$i(a, prop, b[prop]);
2053
+ if (__hasOwnProp$m.call(b, prop))
2054
+ __defNormalProp$m(a, prop, b[prop]);
2055
+ if (__getOwnPropSymbols$m)
2056
+ for (var prop of __getOwnPropSymbols$m(b)) {
2057
+ if (__propIsEnum$m.call(b, prop))
2058
+ __defNormalProp$m(a, prop, b[prop]);
2058
2059
  }
2059
2060
  return a;
2060
2061
  };
2061
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
2062
+ var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
2062
2063
  function SearchWidgetFacetSettings({
2063
2064
  value = [],
2064
2065
  onChange,
@@ -2099,14 +2100,14 @@ function SearchWidgetFacetSettings({
2099
2100
  };
2100
2101
  const removeFacet = (index) => {
2101
2102
  const newFields = value.filter((_, i) => i !== index);
2102
- const reorderedFields = newFields.map((field, idx) => __spreadProps$d(__spreadValues$i({}, field), {
2103
+ const reorderedFields = newFields.map((field, idx) => __spreadProps$h(__spreadValues$m({}, field), {
2103
2104
  order: idx
2104
2105
  }));
2105
2106
  onChange(reorderedFields);
2106
2107
  };
2107
2108
  const updateFacet = (index, updates) => {
2108
2109
  const newFields = value.map(
2109
- (field, i) => i === index ? __spreadValues$i(__spreadValues$i({}, field), updates) : field
2110
+ (field, i) => i === index ? __spreadValues$m(__spreadValues$m({}, field), updates) : field
2110
2111
  );
2111
2112
  onChange(newFields);
2112
2113
  };
@@ -2117,8 +2118,8 @@ function SearchWidgetFacetSettings({
2117
2118
  const newFields = [...value];
2118
2119
  const newIndex = direction === "up" ? index - 1 : index + 1;
2119
2120
  [newFields[index], newFields[newIndex]] = [
2120
- __spreadProps$d(__spreadValues$i({}, newFields[newIndex]), { order: index }),
2121
- __spreadProps$d(__spreadValues$i({}, newFields[index]), { order: newIndex })
2121
+ __spreadProps$h(__spreadValues$m({}, newFields[newIndex]), { order: index }),
2122
+ __spreadProps$h(__spreadValues$m({}, newFields[index]), { order: newIndex })
2122
2123
  ];
2123
2124
  onChange(newFields);
2124
2125
  };
@@ -2204,25 +2205,25 @@ function SearchWidgetFacetSettings({
2204
2205
  ] });
2205
2206
  }
2206
2207
 
2207
- var __defProp$h = Object.defineProperty;
2208
- var __defProps$c = Object.defineProperties;
2209
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
2210
- var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
2211
- var __hasOwnProp$h = Object.prototype.hasOwnProperty;
2212
- var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
2213
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2214
- var __spreadValues$h = (a, b) => {
2208
+ var __defProp$l = Object.defineProperty;
2209
+ var __defProps$g = Object.defineProperties;
2210
+ var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
2211
+ var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
2212
+ var __hasOwnProp$l = Object.prototype.hasOwnProperty;
2213
+ var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
2214
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2215
+ var __spreadValues$l = (a, b) => {
2215
2216
  for (var prop in b || (b = {}))
2216
- if (__hasOwnProp$h.call(b, prop))
2217
- __defNormalProp$h(a, prop, b[prop]);
2218
- if (__getOwnPropSymbols$h)
2219
- for (var prop of __getOwnPropSymbols$h(b)) {
2220
- if (__propIsEnum$h.call(b, prop))
2221
- __defNormalProp$h(a, prop, b[prop]);
2217
+ if (__hasOwnProp$l.call(b, prop))
2218
+ __defNormalProp$l(a, prop, b[prop]);
2219
+ if (__getOwnPropSymbols$l)
2220
+ for (var prop of __getOwnPropSymbols$l(b)) {
2221
+ if (__propIsEnum$l.call(b, prop))
2222
+ __defNormalProp$l(a, prop, b[prop]);
2222
2223
  }
2223
2224
  return a;
2224
2225
  };
2225
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
2226
+ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
2226
2227
  function WidgetSettingsPanel({
2227
2228
  pageId,
2228
2229
  widget,
@@ -2248,14 +2249,14 @@ function WidgetSettingsPanel({
2248
2249
  }
2249
2250
  const pageData = await pageResponse.json();
2250
2251
  const updatedWidgets = pageData.widgets.map(
2251
- (w) => w.id === widgetId ? __spreadValues$h(__spreadValues$h({}, w), updates) : w
2252
+ (w) => w.id === widgetId ? __spreadValues$l(__spreadValues$l({}, w), updates) : w
2252
2253
  );
2253
2254
  const response = await fetch(getApiUrl(`/api/pages/${pageId}`), {
2254
2255
  method: "PUT",
2255
2256
  headers: {
2256
2257
  "Content-Type": "application/json"
2257
2258
  },
2258
- body: JSON.stringify(__spreadProps$c(__spreadValues$h({}, pageData), {
2259
+ body: JSON.stringify(__spreadProps$g(__spreadValues$l({}, pageData), {
2259
2260
  widgets: updatedWidgets
2260
2261
  }))
2261
2262
  });
@@ -2314,12 +2315,12 @@ function WidgetSettingsPanel({
2314
2315
  }
2315
2316
  };
2316
2317
  const updateWidget = (updates) => {
2317
- const updatedWidget = __spreadValues$h(__spreadValues$h({}, localWidget), updates);
2318
+ const updatedWidget = __spreadValues$l(__spreadValues$l({}, localWidget), updates);
2318
2319
  setLocalWidget(updatedWidget);
2319
2320
  };
2320
2321
  const updateConfig = (updates) => {
2321
2322
  console.log("Updating config with:", updates);
2322
- const newConfig = __spreadValues$h(__spreadValues$h({}, localWidget.config), updates);
2323
+ const newConfig = __spreadValues$l(__spreadValues$l({}, localWidget.config), updates);
2323
2324
  console.log("New config will be:", newConfig);
2324
2325
  updateWidget({
2325
2326
  config: newConfig
@@ -2328,8 +2329,8 @@ function WidgetSettingsPanel({
2328
2329
  const updateStyle = (updates) => {
2329
2330
  var _a;
2330
2331
  updateWidget({
2331
- config: __spreadProps$c(__spreadValues$h({}, localWidget.config), {
2332
- styles: __spreadValues$h(__spreadValues$h({}, ((_a = localWidget.config) == null ? void 0 : _a.styles) || {}), updates)
2332
+ config: __spreadProps$g(__spreadValues$l({}, localWidget.config), {
2333
+ styles: __spreadValues$l(__spreadValues$l({}, ((_a = localWidget.config) == null ? void 0 : _a.styles) || {}), updates)
2333
2334
  })
2334
2335
  });
2335
2336
  };
@@ -2596,8 +2597,8 @@ function WidgetSettingsPanel({
2596
2597
  checked: (_k = (_j = (_i = widget.config) == null ? void 0 : _i.facets) == null ? void 0 : _j.enabled) != null ? _k : false,
2597
2598
  onCheckedChange: (checked) => {
2598
2599
  var _a2, _b2, _c2;
2599
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2600
- facets: __spreadProps$c(__spreadValues$h({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2600
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2601
+ facets: __spreadProps$g(__spreadValues$l({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2601
2602
  enabled: checked,
2602
2603
  fields: ((_c2 = (_b2 = widget.config) == null ? void 0 : _b2.facets) == null ? void 0 : _c2.fields) || []
2603
2604
  })
@@ -2613,8 +2614,8 @@ function WidgetSettingsPanel({
2613
2614
  placeHolder: "Select facet field",
2614
2615
  value: widget.config.facets.fields || [],
2615
2616
  onChange: (fields) => {
2616
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2617
- facets: __spreadProps$c(__spreadValues$h({}, widget.config.facets), {
2617
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2618
+ facets: __spreadProps$g(__spreadValues$l({}, widget.config.facets), {
2618
2619
  fields
2619
2620
  })
2620
2621
  });
@@ -2638,7 +2639,7 @@ function WidgetSettingsPanel({
2638
2639
  onValueChange: (value) => {
2639
2640
  var _a2;
2640
2641
  return updateConfig({
2641
- layout: __spreadProps$c(__spreadValues$h({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), { type: value })
2642
+ layout: __spreadProps$g(__spreadValues$l({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), { type: value })
2642
2643
  });
2643
2644
  },
2644
2645
  children: [
@@ -2661,7 +2662,7 @@ function WidgetSettingsPanel({
2661
2662
  onValueChange: (value) => {
2662
2663
  var _a2;
2663
2664
  return updateConfig({
2664
- layout: __spreadProps$c(__spreadValues$h({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2665
+ layout: __spreadProps$g(__spreadValues$l({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2665
2666
  itemsPerPage: parseInt(value)
2666
2667
  })
2667
2668
  });
@@ -2685,7 +2686,7 @@ function WidgetSettingsPanel({
2685
2686
  onCheckedChange: (checked) => {
2686
2687
  var _a2;
2687
2688
  return updateConfig({
2688
- layout: __spreadProps$c(__spreadValues$h({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2689
+ layout: __spreadProps$g(__spreadValues$l({}, (_a2 = localWidget.config) == null ? void 0 : _a2.layout), {
2689
2690
  infiniteScroll: checked
2690
2691
  })
2691
2692
  });
@@ -2737,8 +2738,8 @@ function WidgetSettingsPanel({
2737
2738
  placeHolder: "Select metadata field",
2738
2739
  value: ((_l = (_k = widget.config) == null ? void 0 : _k.metadata) == null ? void 0 : _l.fields) || [],
2739
2740
  onChange: (fields) => {
2740
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2741
- metadata: __spreadProps$c(__spreadValues$h({}, widget.config.metadata), {
2741
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2742
+ metadata: __spreadProps$g(__spreadValues$l({}, widget.config.metadata), {
2742
2743
  fields
2743
2744
  })
2744
2745
  });
@@ -2814,8 +2815,8 @@ function WidgetSettingsPanel({
2814
2815
  checked: (_f = (_e = (_d = widget.config) == null ? void 0 : _d.facets) == null ? void 0 : _e.enabled) != null ? _f : false,
2815
2816
  onCheckedChange: (checked) => {
2816
2817
  var _a2, _b2, _c2;
2817
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2818
- facets: __spreadProps$c(__spreadValues$h({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2818
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2819
+ facets: __spreadProps$g(__spreadValues$l({}, ((_a2 = widget.config) == null ? void 0 : _a2.facets) || {}), {
2819
2820
  enabled: checked,
2820
2821
  fields: ((_c2 = (_b2 = widget.config) == null ? void 0 : _b2.facets) == null ? void 0 : _c2.fields) || []
2821
2822
  })
@@ -2832,8 +2833,8 @@ function WidgetSettingsPanel({
2832
2833
  placeHolder: "Select facet field",
2833
2834
  value: widget.config.facets.fields || [],
2834
2835
  onChange: (fields) => {
2835
- const newConfig = __spreadProps$c(__spreadValues$h({}, widget.config), {
2836
- facets: __spreadProps$c(__spreadValues$h({}, widget.config.facets), {
2836
+ const newConfig = __spreadProps$g(__spreadValues$l({}, widget.config), {
2837
+ facets: __spreadProps$g(__spreadValues$l({}, widget.config.facets), {
2837
2838
  fields
2838
2839
  })
2839
2840
  });
@@ -2951,39 +2952,39 @@ function WidgetSettingsPanel({
2951
2952
  ] });
2952
2953
  }
2953
2954
 
2954
- var __defProp$g = Object.defineProperty;
2955
- var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
2956
- var __hasOwnProp$g = Object.prototype.hasOwnProperty;
2957
- var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
2958
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2959
- var __spreadValues$g = (a, b) => {
2955
+ var __defProp$k = Object.defineProperty;
2956
+ var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
2957
+ var __hasOwnProp$k = Object.prototype.hasOwnProperty;
2958
+ var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
2959
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2960
+ var __spreadValues$k = (a, b) => {
2960
2961
  for (var prop in b || (b = {}))
2961
- if (__hasOwnProp$g.call(b, prop))
2962
- __defNormalProp$g(a, prop, b[prop]);
2963
- if (__getOwnPropSymbols$g)
2964
- for (var prop of __getOwnPropSymbols$g(b)) {
2965
- if (__propIsEnum$g.call(b, prop))
2966
- __defNormalProp$g(a, prop, b[prop]);
2962
+ if (__hasOwnProp$k.call(b, prop))
2963
+ __defNormalProp$k(a, prop, b[prop]);
2964
+ if (__getOwnPropSymbols$k)
2965
+ for (var prop of __getOwnPropSymbols$k(b)) {
2966
+ if (__propIsEnum$k.call(b, prop))
2967
+ __defNormalProp$k(a, prop, b[prop]);
2967
2968
  }
2968
2969
  return a;
2969
2970
  };
2970
- var __objRest$5 = (source, exclude) => {
2971
+ var __objRest$6 = (source, exclude) => {
2971
2972
  var target = {};
2972
2973
  for (var prop in source)
2973
- if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
2974
+ if (__hasOwnProp$k.call(source, prop) && exclude.indexOf(prop) < 0)
2974
2975
  target[prop] = source[prop];
2975
- if (source != null && __getOwnPropSymbols$g)
2976
- for (var prop of __getOwnPropSymbols$g(source)) {
2977
- if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
2976
+ if (source != null && __getOwnPropSymbols$k)
2977
+ for (var prop of __getOwnPropSymbols$k(source)) {
2978
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$k.call(source, prop))
2978
2979
  target[prop] = source[prop];
2979
2980
  }
2980
2981
  return target;
2981
2982
  };
2982
2983
  const Card = React.forwardRef((_a, ref) => {
2983
- var _b = _a, { className } = _b, props = __objRest$5(_b, ["className"]);
2984
+ var _b = _a, { className } = _b, props = __objRest$6(_b, ["className"]);
2984
2985
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2985
2986
  "div",
2986
- __spreadValues$g({
2987
+ __spreadValues$k({
2987
2988
  ref,
2988
2989
  className: cn(
2989
2990
  "rounded-lg border bg-card text-card-foreground shadow-sm",
@@ -2994,10 +2995,10 @@ const Card = React.forwardRef((_a, ref) => {
2994
2995
  });
2995
2996
  Card.displayName = "Card";
2996
2997
  const CardHeader = React.forwardRef((_c, ref) => {
2997
- var _d = _c, { className } = _d, props = __objRest$5(_d, ["className"]);
2998
+ var _d = _c, { className } = _d, props = __objRest$6(_d, ["className"]);
2998
2999
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2999
3000
  "div",
3000
- __spreadValues$g({
3001
+ __spreadValues$k({
3001
3002
  ref,
3002
3003
  className: cn("flex flex-col space-y-1.5 p-6", className)
3003
3004
  }, props)
@@ -3005,10 +3006,10 @@ const CardHeader = React.forwardRef((_c, ref) => {
3005
3006
  });
3006
3007
  CardHeader.displayName = "CardHeader";
3007
3008
  const CardTitle = React.forwardRef((_e, ref) => {
3008
- var _f = _e, { className } = _f, props = __objRest$5(_f, ["className"]);
3009
+ var _f = _e, { className } = _f, props = __objRest$6(_f, ["className"]);
3009
3010
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3010
3011
  "div",
3011
- __spreadValues$g({
3012
+ __spreadValues$k({
3012
3013
  ref,
3013
3014
  className: cn(
3014
3015
  "text-2xl font-semibold leading-none tracking-tight",
@@ -3019,10 +3020,10 @@ const CardTitle = React.forwardRef((_e, ref) => {
3019
3020
  });
3020
3021
  CardTitle.displayName = "CardTitle";
3021
3022
  const CardDescription = React.forwardRef((_g, ref) => {
3022
- var _h = _g, { className } = _h, props = __objRest$5(_h, ["className"]);
3023
+ var _h = _g, { className } = _h, props = __objRest$6(_h, ["className"]);
3023
3024
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3024
3025
  "div",
3025
- __spreadValues$g({
3026
+ __spreadValues$k({
3026
3027
  ref,
3027
3028
  className: cn("text-sm text-muted-foreground", className)
3028
3029
  }, props)
@@ -3030,15 +3031,15 @@ const CardDescription = React.forwardRef((_g, ref) => {
3030
3031
  });
3031
3032
  CardDescription.displayName = "CardDescription";
3032
3033
  const CardContent = React.forwardRef((_i, ref) => {
3033
- var _j = _i, { className } = _j, props = __objRest$5(_j, ["className"]);
3034
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$g({ ref, className: cn("p-6 pt-0", className) }, props));
3034
+ var _j = _i, { className } = _j, props = __objRest$6(_j, ["className"]);
3035
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$k({ ref, className: cn("p-6 pt-0", className) }, props));
3035
3036
  });
3036
3037
  CardContent.displayName = "CardContent";
3037
3038
  const CardFooter = React.forwardRef((_k, ref) => {
3038
- var _l = _k, { className } = _l, props = __objRest$5(_l, ["className"]);
3039
+ var _l = _k, { className } = _l, props = __objRest$6(_l, ["className"]);
3039
3040
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3040
3041
  "div",
3041
- __spreadValues$g({
3042
+ __spreadValues$k({
3042
3043
  ref,
3043
3044
  className: cn("flex items-center p-6 pt-0", className)
3044
3045
  }, props)
@@ -3147,30 +3148,141 @@ function WidgetPalette({ widgetBackendUrl } = {}) {
3147
3148
  ] });
3148
3149
  }
3149
3150
 
3150
- var __defProp$f = Object.defineProperty;
3151
- var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
3152
- var __hasOwnProp$f = Object.prototype.hasOwnProperty;
3153
- var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
3154
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3155
- var __spreadValues$f = (a, b) => {
3151
+ class WidgetService {
3152
+ constructor() {
3153
+ this.baseUrl = "/api/widgets";
3154
+ }
3155
+ async getWidgetTypes() {
3156
+ try {
3157
+ const response = await fetch(`${this.baseUrl}/types`);
3158
+ if (!response.ok) {
3159
+ throw new Error(`Failed to fetch widget types: ${response.statusText}`);
3160
+ }
3161
+ const data = await response.json();
3162
+ return data;
3163
+ } catch (error) {
3164
+ console.error("Error fetching widget types:", error);
3165
+ throw error;
3166
+ }
3167
+ }
3168
+ async getWidgetTemplates() {
3169
+ try {
3170
+ const response = await fetch(`${this.baseUrl}/templates`);
3171
+ if (!response.ok) {
3172
+ throw new Error(
3173
+ `Failed to fetch widget templates: ${response.statusText}`
3174
+ );
3175
+ }
3176
+ return await response.json();
3177
+ } catch (error) {
3178
+ console.error("Error fetching widget templates:", error);
3179
+ throw error;
3180
+ }
3181
+ }
3182
+ async getWidgetCategories() {
3183
+ try {
3184
+ const response = await fetch(`${this.baseUrl}/categories`);
3185
+ if (!response.ok) {
3186
+ throw new Error(
3187
+ `Failed to fetch widget categories: ${response.statusText}`
3188
+ );
3189
+ }
3190
+ return await response.json();
3191
+ } catch (error) {
3192
+ console.error("Error fetching widget categories:", error);
3193
+ throw error;
3194
+ }
3195
+ }
3196
+ async getPageWidgets(pageId) {
3197
+ try {
3198
+ const response = await fetch(`${this.baseUrl}/page/${pageId}`);
3199
+ if (!response.ok) {
3200
+ throw new Error(`Failed to fetch page widgets: ${response.statusText}`);
3201
+ }
3202
+ return await response.json();
3203
+ } catch (error) {
3204
+ console.error("Error fetching page widgets:", error);
3205
+ throw error;
3206
+ }
3207
+ }
3208
+ async saveWidget(widget) {
3209
+ try {
3210
+ const response = await fetch(this.baseUrl, {
3211
+ method: widget.id ? "PUT" : "POST",
3212
+ headers: {
3213
+ "Content-Type": "application/json"
3214
+ },
3215
+ body: JSON.stringify(widget)
3216
+ });
3217
+ if (!response.ok) {
3218
+ throw new Error(`Failed to save widget: ${response.statusText}`);
3219
+ }
3220
+ return await response.json();
3221
+ } catch (error) {
3222
+ console.error("Error saving widget:", error);
3223
+ throw error;
3224
+ }
3225
+ }
3226
+ async deleteWidget(widgetId) {
3227
+ try {
3228
+ const response = await fetch(`${this.baseUrl}/${widgetId}`, {
3229
+ method: "DELETE"
3230
+ });
3231
+ if (!response.ok) {
3232
+ throw new Error(`Failed to delete widget: ${response.statusText}`);
3233
+ }
3234
+ return true;
3235
+ } catch (error) {
3236
+ console.error("Error deleting widget:", error);
3237
+ throw error;
3238
+ }
3239
+ }
3240
+ async updateWidgetPositions(widgets) {
3241
+ try {
3242
+ const response = await fetch(`${this.baseUrl}/positions`, {
3243
+ method: "PUT",
3244
+ headers: {
3245
+ "Content-Type": "application/json"
3246
+ },
3247
+ body: JSON.stringify(widgets)
3248
+ });
3249
+ if (!response.ok) {
3250
+ throw new Error(
3251
+ `Failed to update widget positions: ${response.statusText}`
3252
+ );
3253
+ }
3254
+ return await response.json();
3255
+ } catch (error) {
3256
+ console.error("Error updating widget positions:", error);
3257
+ throw error;
3258
+ }
3259
+ }
3260
+ }
3261
+
3262
+ var __defProp$j = Object.defineProperty;
3263
+ var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
3264
+ var __hasOwnProp$j = Object.prototype.hasOwnProperty;
3265
+ var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
3266
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3267
+ var __spreadValues$j = (a, b) => {
3156
3268
  for (var prop in b || (b = {}))
3157
- if (__hasOwnProp$f.call(b, prop))
3158
- __defNormalProp$f(a, prop, b[prop]);
3159
- if (__getOwnPropSymbols$f)
3160
- for (var prop of __getOwnPropSymbols$f(b)) {
3161
- if (__propIsEnum$f.call(b, prop))
3162
- __defNormalProp$f(a, prop, b[prop]);
3269
+ if (__hasOwnProp$j.call(b, prop))
3270
+ __defNormalProp$j(a, prop, b[prop]);
3271
+ if (__getOwnPropSymbols$j)
3272
+ for (var prop of __getOwnPropSymbols$j(b)) {
3273
+ if (__propIsEnum$j.call(b, prop))
3274
+ __defNormalProp$j(a, prop, b[prop]);
3163
3275
  }
3164
3276
  return a;
3165
3277
  };
3166
- var __objRest$4 = (source, exclude) => {
3278
+ var __objRest$5 = (source, exclude) => {
3167
3279
  var target = {};
3168
3280
  for (var prop in source)
3169
- if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
3281
+ if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
3170
3282
  target[prop] = source[prop];
3171
- if (source != null && __getOwnPropSymbols$f)
3172
- for (var prop of __getOwnPropSymbols$f(source)) {
3173
- if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
3283
+ if (source != null && __getOwnPropSymbols$j)
3284
+ for (var prop of __getOwnPropSymbols$j(source)) {
3285
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$j.call(source, prop))
3174
3286
  target[prop] = source[prop];
3175
3287
  }
3176
3288
  return target;
@@ -3197,8 +3309,8 @@ const badgeVariants = cva(
3197
3309
  }
3198
3310
  );
3199
3311
  function Badge(_a) {
3200
- var _b = _a, { className, variant } = _b, props = __objRest$4(_b, ["className", "variant"]);
3201
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$f({ className: cn(badgeVariants({ variant }), className) }, props));
3312
+ var _b = _a, { className, variant } = _b, props = __objRest$5(_b, ["className", "variant"]);
3313
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", __spreadValues$j({ className: cn(badgeVariants({ variant }), className) }, props));
3202
3314
  }
3203
3315
 
3204
3316
  // src/primitive.tsx
@@ -3603,10 +3715,6 @@ const oppositeSideMap = {
3603
3715
  bottom: 'top',
3604
3716
  top: 'bottom'
3605
3717
  };
3606
- const oppositeAlignmentMap = {
3607
- start: 'end',
3608
- end: 'start'
3609
- };
3610
3718
  function clamp(start, value, end) {
3611
3719
  return max(start, min(value, end));
3612
3720
  }
@@ -3625,9 +3733,9 @@ function getOppositeAxis(axis) {
3625
3733
  function getAxisLength(axis) {
3626
3734
  return axis === 'y' ? 'height' : 'width';
3627
3735
  }
3628
- const yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);
3629
3736
  function getSideAxis(placement) {
3630
- return yAxisSides.has(getSide(placement)) ? 'y' : 'x';
3737
+ const firstChar = placement[0];
3738
+ return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
3631
3739
  }
3632
3740
  function getAlignmentAxis(placement) {
3633
3741
  return getOppositeAxis(getSideAxis(placement));
@@ -3650,7 +3758,7 @@ function getExpandedPlacements(placement) {
3650
3758
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
3651
3759
  }
3652
3760
  function getOppositeAlignmentPlacement(placement) {
3653
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
3761
+ return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
3654
3762
  }
3655
3763
  const lrPlacement = ['left', 'right'];
3656
3764
  const rlPlacement = ['right', 'left'];
@@ -3681,7 +3789,8 @@ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
3681
3789
  return list;
3682
3790
  }
3683
3791
  function getOppositePlacement(placement) {
3684
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
3792
+ const side = getSide(placement);
3793
+ return oppositeSideMap[side] + placement.slice(side.length);
3685
3794
  }
3686
3795
  function expandPaddingObject(padding) {
3687
3796
  return {
@@ -3840,6 +3949,9 @@ async function detectOverflow(state, options) {
3840
3949
  };
3841
3950
  }
3842
3951
 
3952
+ // Maximum number of resets that can occur before bailing to avoid infinite reset loops.
3953
+ const MAX_RESET_COUNT = 50;
3954
+
3843
3955
  /**
3844
3956
  * Computes the `x` and `y` coordinates that will place the floating element
3845
3957
  * next to a given reference element.
@@ -3854,7 +3966,10 @@ const computePosition$1 = async (reference, floating, config) => {
3854
3966
  middleware = [],
3855
3967
  platform
3856
3968
  } = config;
3857
- const validMiddleware = middleware.filter(Boolean);
3969
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
3970
+ ...platform,
3971
+ detectOverflow
3972
+ };
3858
3973
  const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
3859
3974
  let rects = await platform.getElementRects({
3860
3975
  reference,
@@ -3866,14 +3981,17 @@ const computePosition$1 = async (reference, floating, config) => {
3866
3981
  y
3867
3982
  } = computeCoordsFromPlacement(rects, placement, rtl);
3868
3983
  let statefulPlacement = placement;
3869
- let middlewareData = {};
3870
3984
  let resetCount = 0;
3871
- for (let i = 0; i < validMiddleware.length; i++) {
3872
- var _platform$detectOverf;
3985
+ const middlewareData = {};
3986
+ for (let i = 0; i < middleware.length; i++) {
3987
+ const currentMiddleware = middleware[i];
3988
+ if (!currentMiddleware) {
3989
+ continue;
3990
+ }
3873
3991
  const {
3874
3992
  name,
3875
3993
  fn
3876
- } = validMiddleware[i];
3994
+ } = currentMiddleware;
3877
3995
  const {
3878
3996
  x: nextX,
3879
3997
  y: nextY,
@@ -3887,10 +4005,7 @@ const computePosition$1 = async (reference, floating, config) => {
3887
4005
  strategy,
3888
4006
  middlewareData,
3889
4007
  rects,
3890
- platform: {
3891
- ...platform,
3892
- detectOverflow: (_platform$detectOverf = platform.detectOverflow) != null ? _platform$detectOverf : detectOverflow
3893
- },
4008
+ platform: platformWithDetectOverflow,
3894
4009
  elements: {
3895
4010
  reference,
3896
4011
  floating
@@ -3898,14 +4013,11 @@ const computePosition$1 = async (reference, floating, config) => {
3898
4013
  });
3899
4014
  x = nextX != null ? nextX : x;
3900
4015
  y = nextY != null ? nextY : y;
3901
- middlewareData = {
3902
- ...middlewareData,
3903
- [name]: {
3904
- ...middlewareData[name],
3905
- ...data
3906
- }
4016
+ middlewareData[name] = {
4017
+ ...middlewareData[name],
4018
+ ...data
3907
4019
  };
3908
- if (reset && resetCount <= 50) {
4020
+ if (reset && resetCount < MAX_RESET_COUNT) {
3909
4021
  resetCount++;
3910
4022
  if (typeof reset === 'object') {
3911
4023
  if (reset.placement) {
@@ -4580,7 +4692,6 @@ function isShadowRoot(value) {
4580
4692
  }
4581
4693
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
4582
4694
  }
4583
- const invalidOverflowDisplayValues = /*#__PURE__*/new Set(['inline', 'contents']);
4584
4695
  function isOverflowElement(element) {
4585
4696
  const {
4586
4697
  overflow,
@@ -4588,32 +4699,35 @@ function isOverflowElement(element) {
4588
4699
  overflowY,
4589
4700
  display
4590
4701
  } = getComputedStyle$2(element);
4591
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
4702
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
4592
4703
  }
4593
- const tableElements$1 = /*#__PURE__*/new Set(['table', 'td', 'th']);
4594
4704
  function isTableElement(element) {
4595
- return tableElements$1.has(getNodeName(element));
4705
+ return /^(table|td|th)$/.test(getNodeName(element));
4596
4706
  }
4597
- const topLayerSelectors = [':popover-open', ':modal'];
4598
4707
  function isTopLayer(element) {
4599
- return topLayerSelectors.some(selector => {
4600
- try {
4601
- return element.matches(selector);
4602
- } catch (_e) {
4603
- return false;
4708
+ try {
4709
+ if (element.matches(':popover-open')) {
4710
+ return true;
4604
4711
  }
4605
- });
4712
+ } catch (_e) {
4713
+ // no-op
4714
+ }
4715
+ try {
4716
+ return element.matches(':modal');
4717
+ } catch (_e) {
4718
+ return false;
4719
+ }
4606
4720
  }
4607
- const transformProperties = ['transform', 'translate', 'scale', 'rotate', 'perspective'];
4608
- const willChangeValues = ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'];
4609
- const containValues = ['paint', 'layout', 'strict', 'content'];
4721
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
4722
+ const containRe = /paint|layout|strict|content/;
4723
+ const isNotNone = value => !!value && value !== 'none';
4724
+ let isWebKitValue;
4610
4725
  function isContainingBlock(elementOrCss) {
4611
- const webkit = isWebKit();
4612
4726
  const css = isElement(elementOrCss) ? getComputedStyle$2(elementOrCss) : elementOrCss;
4613
4727
 
4614
4728
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
4615
4729
  // https://drafts.csswg.org/css-transforms-2/#individual-transforms
4616
- 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));
4730
+ 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 || '');
4617
4731
  }
4618
4732
  function getContainingBlock(element) {
4619
4733
  let currentNode = getParentNode(element);
@@ -4628,12 +4742,13 @@ function getContainingBlock(element) {
4628
4742
  return null;
4629
4743
  }
4630
4744
  function isWebKit() {
4631
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
4632
- return CSS.supports('-webkit-backdrop-filter', 'none');
4745
+ if (isWebKitValue == null) {
4746
+ isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
4747
+ }
4748
+ return isWebKitValue;
4633
4749
  }
4634
- const lastTraversableNodeNames = /*#__PURE__*/new Set(['html', 'body', '#document']);
4635
4750
  function isLastTraversableNode(node) {
4636
- return lastTraversableNodeNames.has(getNodeName(node));
4751
+ return /^(html|body|#document)$/.test(getNodeName(node));
4637
4752
  }
4638
4753
  function getComputedStyle$2(element) {
4639
4754
  return getWindow(element).getComputedStyle(element);
@@ -4689,8 +4804,9 @@ function getOverflowAncestors(node, list, traverseIframes) {
4689
4804
  if (isBody) {
4690
4805
  const frameElement = getFrameElement(win);
4691
4806
  return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
4807
+ } else {
4808
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
4692
4809
  }
4693
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
4694
4810
  }
4695
4811
  function getFrameElement(win) {
4696
4812
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
@@ -4867,7 +4983,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
4867
4983
  if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
4868
4984
  scroll = getNodeScroll(offsetParent);
4869
4985
  }
4870
- if (isHTMLElement(offsetParent)) {
4986
+ if (isOffsetParentAnElement) {
4871
4987
  const offsetRect = getBoundingClientRect(offsetParent);
4872
4988
  scale = getScale(offsetParent);
4873
4989
  offsets.x = offsetRect.x + offsetParent.clientLeft;
@@ -4955,7 +5071,6 @@ function getViewportRect(element, strategy) {
4955
5071
  };
4956
5072
  }
4957
5073
 
4958
- const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
4959
5074
  // Returns the inner client rect, subtracting scrollbars if present.
4960
5075
  function getInnerBoundingClientRect(element, strategy) {
4961
5076
  const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
@@ -5020,7 +5135,7 @@ function getClippingElementAncestors(element, cache) {
5020
5135
  if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
5021
5136
  currentContainingBlockComputedStyle = null;
5022
5137
  }
5023
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
5138
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
5024
5139
  if (shouldDropCurrentNode) {
5025
5140
  // Drop non-containing blocks.
5026
5141
  result = result.filter(ancestor => ancestor !== currentNode);
@@ -5045,20 +5160,23 @@ function getClippingRect(_ref) {
5045
5160
  } = _ref;
5046
5161
  const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
5047
5162
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
5048
- const firstClippingAncestor = clippingAncestors[0];
5049
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
5050
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
5051
- accRect.top = max(rect.top, accRect.top);
5052
- accRect.right = min(rect.right, accRect.right);
5053
- accRect.bottom = min(rect.bottom, accRect.bottom);
5054
- accRect.left = max(rect.left, accRect.left);
5055
- return accRect;
5056
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
5163
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
5164
+ let top = firstRect.top;
5165
+ let right = firstRect.right;
5166
+ let bottom = firstRect.bottom;
5167
+ let left = firstRect.left;
5168
+ for (let i = 1; i < clippingAncestors.length; i++) {
5169
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
5170
+ top = max(rect.top, top);
5171
+ right = min(rect.right, right);
5172
+ bottom = min(rect.bottom, bottom);
5173
+ left = max(rect.left, left);
5174
+ }
5057
5175
  return {
5058
- width: clippingRect.right - clippingRect.left,
5059
- height: clippingRect.bottom - clippingRect.top,
5060
- x: clippingRect.left,
5061
- y: clippingRect.top
5176
+ width: right - left,
5177
+ height: bottom - top,
5178
+ x: left,
5179
+ y: top
5062
5180
  };
5063
5181
  }
5064
5182
 
@@ -5309,7 +5427,7 @@ function autoUpdate(reference, floating, update, options) {
5309
5427
  animationFrame = false
5310
5428
  } = options;
5311
5429
  const referenceEl = unwrapElement(reference);
5312
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
5430
+ const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
5313
5431
  ancestors.forEach(ancestor => {
5314
5432
  ancestorScroll && ancestor.addEventListener('scroll', update, {
5315
5433
  passive: true
@@ -5322,7 +5440,7 @@ function autoUpdate(reference, floating, update, options) {
5322
5440
  if (elementResize) {
5323
5441
  resizeObserver = new ResizeObserver(_ref => {
5324
5442
  let [firstEntry] = _ref;
5325
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
5443
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
5326
5444
  // Prevent update loops when using the `size` middleware.
5327
5445
  // https://github.com/floating-ui/floating-ui/issues/1740
5328
5446
  resizeObserver.unobserve(floating);
@@ -5337,7 +5455,9 @@ function autoUpdate(reference, floating, update, options) {
5337
5455
  if (referenceEl && !animationFrame) {
5338
5456
  resizeObserver.observe(referenceEl);
5339
5457
  }
5340
- resizeObserver.observe(floating);
5458
+ if (floating) {
5459
+ resizeObserver.observe(floating);
5460
+ }
5341
5461
  }
5342
5462
  let frameId;
5343
5463
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
@@ -5719,28 +5839,39 @@ const arrow$1 = options => {
5719
5839
  * object may be passed.
5720
5840
  * @see https://floating-ui.com/docs/offset
5721
5841
  */
5722
- const offset = (options, deps) => ({
5723
- ...offset$1(options),
5724
- options: [options, deps]
5725
- });
5842
+ const offset = (options, deps) => {
5843
+ const result = offset$1(options);
5844
+ return {
5845
+ name: result.name,
5846
+ fn: result.fn,
5847
+ options: [options, deps]
5848
+ };
5849
+ };
5726
5850
 
5727
5851
  /**
5728
5852
  * Optimizes the visibility of the floating element by shifting it in order to
5729
5853
  * keep it in view when it will overflow the clipping boundary.
5730
5854
  * @see https://floating-ui.com/docs/shift
5731
5855
  */
5732
- const shift = (options, deps) => ({
5733
- ...shift$1(options),
5734
- options: [options, deps]
5735
- });
5856
+ const shift = (options, deps) => {
5857
+ const result = shift$1(options);
5858
+ return {
5859
+ name: result.name,
5860
+ fn: result.fn,
5861
+ options: [options, deps]
5862
+ };
5863
+ };
5736
5864
 
5737
5865
  /**
5738
5866
  * Built-in `limiter` that will stop `shift()` at a certain point.
5739
5867
  */
5740
- const limitShift = (options, deps) => ({
5741
- ...limitShift$1(options),
5742
- options: [options, deps]
5743
- });
5868
+ const limitShift = (options, deps) => {
5869
+ const result = limitShift$1(options);
5870
+ return {
5871
+ fn: result.fn,
5872
+ options: [options, deps]
5873
+ };
5874
+ };
5744
5875
 
5745
5876
  /**
5746
5877
  * Optimizes the visibility of the floating element by flipping the `placement`
@@ -5748,10 +5879,14 @@ const limitShift = (options, deps) => ({
5748
5879
  * clipping boundary. Alternative to `autoPlacement`.
5749
5880
  * @see https://floating-ui.com/docs/flip
5750
5881
  */
5751
- const flip = (options, deps) => ({
5752
- ...flip$1(options),
5753
- options: [options, deps]
5754
- });
5882
+ const flip = (options, deps) => {
5883
+ const result = flip$1(options);
5884
+ return {
5885
+ name: result.name,
5886
+ fn: result.fn,
5887
+ options: [options, deps]
5888
+ };
5889
+ };
5755
5890
 
5756
5891
  /**
5757
5892
  * Provides data that allows you to change the size of the floating element —
@@ -5759,20 +5894,28 @@ const flip = (options, deps) => ({
5759
5894
  * width of the reference element.
5760
5895
  * @see https://floating-ui.com/docs/size
5761
5896
  */
5762
- const size = (options, deps) => ({
5763
- ...size$1(options),
5764
- options: [options, deps]
5765
- });
5897
+ const size = (options, deps) => {
5898
+ const result = size$1(options);
5899
+ return {
5900
+ name: result.name,
5901
+ fn: result.fn,
5902
+ options: [options, deps]
5903
+ };
5904
+ };
5766
5905
 
5767
5906
  /**
5768
5907
  * Provides data to hide the floating element in applicable situations, such as
5769
5908
  * when it is not in the same clipping context as the reference element.
5770
5909
  * @see https://floating-ui.com/docs/hide
5771
5910
  */
5772
- const hide = (options, deps) => ({
5773
- ...hide$1(options),
5774
- options: [options, deps]
5775
- });
5911
+ const hide = (options, deps) => {
5912
+ const result = hide$1(options);
5913
+ return {
5914
+ name: result.name,
5915
+ fn: result.fn,
5916
+ options: [options, deps]
5917
+ };
5918
+ };
5776
5919
 
5777
5920
  /**
5778
5921
  * Provides data to position an inner element of the floating element so that it
@@ -5780,10 +5923,14 @@ const hide = (options, deps) => ({
5780
5923
  * This wraps the core `arrow` middleware to allow React refs as the element.
5781
5924
  * @see https://floating-ui.com/docs/arrow
5782
5925
  */
5783
- const arrow = (options, deps) => ({
5784
- ...arrow$1(options),
5785
- options: [options, deps]
5786
- });
5926
+ const arrow = (options, deps) => {
5927
+ const result = arrow$1(options);
5928
+ return {
5929
+ name: result.name,
5930
+ fn: result.fn,
5931
+ options: [options, deps]
5932
+ };
5933
+ };
5787
5934
 
5788
5935
  // src/arrow.tsx
5789
5936
  var NAME$1 = "Arrow";
@@ -6799,30 +6946,30 @@ var Root3 = Tooltip$2;
6799
6946
  var Trigger = TooltipTrigger$1;
6800
6947
  var Content2 = TooltipContent$1;
6801
6948
 
6802
- var __defProp$e = Object.defineProperty;
6803
- var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
6804
- var __hasOwnProp$e = Object.prototype.hasOwnProperty;
6805
- var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
6806
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6807
- var __spreadValues$e = (a, b) => {
6949
+ var __defProp$i = Object.defineProperty;
6950
+ var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
6951
+ var __hasOwnProp$i = Object.prototype.hasOwnProperty;
6952
+ var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
6953
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6954
+ var __spreadValues$i = (a, b) => {
6808
6955
  for (var prop in b || (b = {}))
6809
- if (__hasOwnProp$e.call(b, prop))
6810
- __defNormalProp$e(a, prop, b[prop]);
6811
- if (__getOwnPropSymbols$e)
6812
- for (var prop of __getOwnPropSymbols$e(b)) {
6813
- if (__propIsEnum$e.call(b, prop))
6814
- __defNormalProp$e(a, prop, b[prop]);
6956
+ if (__hasOwnProp$i.call(b, prop))
6957
+ __defNormalProp$i(a, prop, b[prop]);
6958
+ if (__getOwnPropSymbols$i)
6959
+ for (var prop of __getOwnPropSymbols$i(b)) {
6960
+ if (__propIsEnum$i.call(b, prop))
6961
+ __defNormalProp$i(a, prop, b[prop]);
6815
6962
  }
6816
6963
  return a;
6817
6964
  };
6818
- var __objRest$3 = (source, exclude) => {
6965
+ var __objRest$4 = (source, exclude) => {
6819
6966
  var target = {};
6820
6967
  for (var prop in source)
6821
- if (__hasOwnProp$e.call(source, prop) && exclude.indexOf(prop) < 0)
6968
+ if (__hasOwnProp$i.call(source, prop) && exclude.indexOf(prop) < 0)
6822
6969
  target[prop] = source[prop];
6823
- if (source != null && __getOwnPropSymbols$e)
6824
- for (var prop of __getOwnPropSymbols$e(source)) {
6825
- if (exclude.indexOf(prop) < 0 && __propIsEnum$e.call(source, prop))
6970
+ if (source != null && __getOwnPropSymbols$i)
6971
+ for (var prop of __getOwnPropSymbols$i(source)) {
6972
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$i.call(source, prop))
6826
6973
  target[prop] = source[prop];
6827
6974
  }
6828
6975
  return target;
@@ -6831,10 +6978,10 @@ const TooltipProvider = Provider;
6831
6978
  const Tooltip$1 = Root3;
6832
6979
  const TooltipTrigger = Trigger;
6833
6980
  const TooltipContent = React.forwardRef((_a, ref) => {
6834
- var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest$3(_b, ["className", "sideOffset"]);
6981
+ var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest$4(_b, ["className", "sideOffset"]);
6835
6982
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
6836
6983
  Content2,
6837
- __spreadValues$e({
6984
+ __spreadValues$i({
6838
6985
  ref,
6839
6986
  sideOffset,
6840
6987
  className: cn(
@@ -6996,11 +7143,16 @@ function getWidgetStyles(widget) {
6996
7143
  };
6997
7144
  }
6998
7145
  function shuffleColors(colors, count) {
6999
- const shuffled = [...colors].sort(() => Math.random() - 0.5);
7000
- while (shuffled.length < count) {
7001
- shuffled.push(...[...colors].sort(() => Math.random() - 0.5));
7146
+ const shuffled = [...colors];
7147
+ for (let i = shuffled.length - 1; i > 0; i--) {
7148
+ const j = Math.floor(Math.random() * (i + 1));
7149
+ [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
7150
+ }
7151
+ let result = [...shuffled];
7152
+ while (result.length < count) {
7153
+ result.push(...shuffled);
7002
7154
  }
7003
- return shuffled.slice(0, count);
7155
+ return result.slice(0, count);
7004
7156
  }
7005
7157
  function getBorderRadiusValue(value) {
7006
7158
  switch (value) {
@@ -7031,25 +7183,25 @@ function getPaddingValue(value) {
7031
7183
  }
7032
7184
  }
7033
7185
 
7034
- var __defProp$d = Object.defineProperty;
7035
- var __defProps$b = Object.defineProperties;
7036
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
7037
- var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
7038
- var __hasOwnProp$d = Object.prototype.hasOwnProperty;
7039
- var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
7040
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7041
- var __spreadValues$d = (a, b) => {
7186
+ var __defProp$h = Object.defineProperty;
7187
+ var __defProps$f = Object.defineProperties;
7188
+ var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
7189
+ var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
7190
+ var __hasOwnProp$h = Object.prototype.hasOwnProperty;
7191
+ var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
7192
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7193
+ var __spreadValues$h = (a, b) => {
7042
7194
  for (var prop in b || (b = {}))
7043
- if (__hasOwnProp$d.call(b, prop))
7044
- __defNormalProp$d(a, prop, b[prop]);
7045
- if (__getOwnPropSymbols$d)
7046
- for (var prop of __getOwnPropSymbols$d(b)) {
7047
- if (__propIsEnum$d.call(b, prop))
7048
- __defNormalProp$d(a, prop, b[prop]);
7195
+ if (__hasOwnProp$h.call(b, prop))
7196
+ __defNormalProp$h(a, prop, b[prop]);
7197
+ if (__getOwnPropSymbols$h)
7198
+ for (var prop of __getOwnPropSymbols$h(b)) {
7199
+ if (__propIsEnum$h.call(b, prop))
7200
+ __defNormalProp$h(a, prop, b[prop]);
7049
7201
  }
7050
7202
  return a;
7051
7203
  };
7052
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
7204
+ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
7053
7205
  function FacetWidget({
7054
7206
  widget,
7055
7207
  showHeader = true,
@@ -7108,7 +7260,7 @@ function FacetWidget({
7108
7260
  };
7109
7261
  const updateConfig = (newFields) => {
7110
7262
  if (onConfigUpdate) {
7111
- onConfigUpdate(__spreadProps$b(__spreadValues$d({}, widget.config), {
7263
+ onConfigUpdate(__spreadProps$f(__spreadValues$h({}, widget.config), {
7112
7264
  fields: newFields
7113
7265
  }));
7114
7266
  }
@@ -20105,9 +20257,28 @@ function BarChart({ orientation, title, data, options, className, units, content
20105
20257
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data, options: options != null ? options : defaultOptions, plugins: [barValuePlugin] });
20106
20258
  }
20107
20259
 
20260
+ var __defProp$g = Object.defineProperty;
20261
+ var __defProps$e = Object.defineProperties;
20262
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
20263
+ var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
20264
+ var __hasOwnProp$g = Object.prototype.hasOwnProperty;
20265
+ var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
20266
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20267
+ var __spreadValues$g = (a, b) => {
20268
+ for (var prop in b || (b = {}))
20269
+ if (__hasOwnProp$g.call(b, prop))
20270
+ __defNormalProp$g(a, prop, b[prop]);
20271
+ if (__getOwnPropSymbols$g)
20272
+ for (var prop of __getOwnPropSymbols$g(b)) {
20273
+ if (__propIsEnum$g.call(b, prop))
20274
+ __defNormalProp$g(a, prop, b[prop]);
20275
+ }
20276
+ return a;
20277
+ };
20278
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
20108
20279
  Chart$1.register(CategoryScale, LinearScale, BarElement, plugin_title, plugin_tooltip, plugin_legend);
20109
- function SeriesChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title }) {
20110
- var _a, _b;
20280
+ function SeriesChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title, chartSettings }) {
20281
+ 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;
20111
20282
  const formatValue = (value) => {
20112
20283
  const numValue = typeof value === "string" ? parseFloat(value) : value;
20113
20284
  if (!isNaN(numValue)) {
@@ -20120,15 +20291,17 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20120
20291
  afterDatasetsDraw(chart) {
20121
20292
  if (!(content == null ? void 0 : content.showLabels)) return;
20122
20293
  const { ctx } = chart;
20294
+ const chartHeight = chart.height;
20295
+ const fontSize = Math.max(11, Math.min(14, Math.floor(chartHeight * 0.025)));
20123
20296
  chart.data.datasets.forEach((dataset, i) => {
20124
20297
  const meta = chart.getDatasetMeta(i);
20125
20298
  meta.data.forEach((bar, index) => {
20126
20299
  const value = dataset.data[index];
20127
20300
  ctx.save();
20128
- ctx.font = "12px sans-serif";
20301
+ ctx.font = `bold ${fontSize}px sans-serif`;
20129
20302
  ctx.textAlign = "center";
20130
- ctx.fillStyle = "black";
20131
- ctx.fillText(value, bar.x, bar.y - 5);
20303
+ ctx.fillStyle = "#0F172A";
20304
+ ctx.fillText(value, bar.x, bar.y - 8);
20132
20305
  ctx.restore();
20133
20306
  });
20134
20307
  });
@@ -20148,10 +20321,10 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20148
20321
  indexAxis: orientation === "horizontal" ? "y" : "x",
20149
20322
  layout: {
20150
20323
  padding: {
20151
- bottom: 0,
20152
- top: 0,
20153
- left: 0,
20154
- right: 0
20324
+ bottom: 8,
20325
+ top: 24,
20326
+ left: 4,
20327
+ right: 16
20155
20328
  }
20156
20329
  },
20157
20330
  plugins: {
@@ -20163,24 +20336,27 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20163
20336
  return false;
20164
20337
  }),
20165
20338
  labels: {
20166
- boxWidth: 12,
20167
- boxHeight: 12
20339
+ boxWidth: 16,
20340
+ boxHeight: 16,
20341
+ padding: 16,
20342
+ font: { size: 13, weight: "normal" },
20343
+ usePointStyle: true,
20344
+ pointStyle: "rect"
20168
20345
  },
20169
20346
  position: "bottom"
20170
20347
  },
20171
20348
  datalabels: {
20172
20349
  display: false
20173
20350
  },
20174
- title: {
20175
- display: true,
20176
- text: title,
20177
- font: {
20178
- size: 18,
20179
- weight: "bold"
20180
- },
20181
- color: "#0F172A"
20182
- },
20183
20351
  tooltip: {
20352
+ mode: "index",
20353
+ intersect: false,
20354
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
20355
+ titleFont: { size: 13, weight: "bold" },
20356
+ bodyFont: { size: 12 },
20357
+ padding: 12,
20358
+ borderColor: "#ccc",
20359
+ borderWidth: 1,
20184
20360
  callbacks: {
20185
20361
  label: function(context) {
20186
20362
  var _a2, _b2;
@@ -20194,28 +20370,91 @@ function SeriesChart({ orientation, title, data, options, className, units, cont
20194
20370
  x: {
20195
20371
  title: {
20196
20372
  display: !!x_axis_title,
20197
- text: x_axis_title
20373
+ text: x_axis_title,
20374
+ font: { size: 13, weight: "bold" },
20375
+ padding: 8
20198
20376
  },
20199
- ticks: { autoSkip: false, maxRotation: 45, minRotation: 0 }
20377
+ ticks: {
20378
+ autoSkip: true,
20379
+ maxRotation: 45,
20380
+ minRotation: 0,
20381
+ font: { size: 12 },
20382
+ maxTicksLimit: 12
20383
+ },
20384
+ grid: {
20385
+ color: "rgba(0, 0, 0, 0.05)"
20386
+ }
20200
20387
  },
20201
20388
  y: {
20202
20389
  title: {
20203
20390
  display: true,
20204
- 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 : ""))
20391
+ 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 : "")),
20392
+ font: { size: 13, weight: "bold" },
20393
+ padding: 12
20205
20394
  },
20206
20395
  beginAtZero: true,
20207
20396
  ticks: {
20397
+ font: { size: 12 },
20208
20398
  callback: function(value) {
20209
20399
  if (units === "$") {
20210
20400
  return `${units}${formatValue(value)}`;
20211
20401
  }
20212
20402
  return units ? `${formatValue(value)} ${(units == null ? void 0 : units.length) < 3 ? units : ""}` : value;
20213
20403
  }
20404
+ },
20405
+ grid: {
20406
+ color: "rgba(0, 0, 0, 0.05)"
20214
20407
  }
20215
20408
  }
20216
20409
  }
20217
20410
  };
20218
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data, options: options != null ? options : defaultOptions, plugins: [barValuePlugin] });
20411
+ const mergedOptions = chartSettings ? __spreadProps$e(__spreadValues$g({}, defaultOptions), {
20412
+ plugins: __spreadProps$e(__spreadValues$g({}, defaultOptions.plugins), {
20413
+ legend: __spreadProps$e(__spreadValues$g({}, (_c = defaultOptions.plugins) == null ? void 0 : _c.legend), {
20414
+ display: chartSettings.showLegend !== false,
20415
+ labels: __spreadProps$e(__spreadValues$g({}, (_e = (_d = defaultOptions.plugins) == null ? void 0 : _d.legend) == null ? void 0 : _e.labels), {
20416
+ boxWidth: (_f = chartSettings.legendBoxSize) != null ? _f : 16,
20417
+ boxHeight: (_g = chartSettings.legendBoxSize) != null ? _g : 16,
20418
+ font: { size: (_h = chartSettings.legendFontSize) != null ? _h : 13 }
20419
+ })
20420
+ }),
20421
+ tooltip: __spreadProps$e(__spreadValues$g({}, (_i = defaultOptions.plugins) == null ? void 0 : _i.tooltip), {
20422
+ bodyFont: { size: (_j = chartSettings.tooltipFontSize) != null ? _j : 12 },
20423
+ titleFont: { size: (_k = chartSettings.tooltipFontSize) != null ? _k : 12 }
20424
+ })
20425
+ }),
20426
+ scales: __spreadProps$e(__spreadValues$g({}, defaultOptions.scales), {
20427
+ x: __spreadProps$e(__spreadValues$g({}, (_l = defaultOptions.scales) == null ? void 0 : _l.x), {
20428
+ title: __spreadProps$e(__spreadValues$g({}, (_n = (_m = defaultOptions.scales) == null ? void 0 : _m.x) == null ? void 0 : _n.title), {
20429
+ font: { size: (_o = chartSettings.xAxisTitleFontSize) != null ? _o : 13, weight: "bold" }
20430
+ }),
20431
+ ticks: __spreadProps$e(__spreadValues$g({}, (_q = (_p = defaultOptions.scales) == null ? void 0 : _p.x) == null ? void 0 : _q.ticks), {
20432
+ font: { size: (_r = chartSettings.xAxisTickFontSize) != null ? _r : 12 }
20433
+ })
20434
+ }),
20435
+ y: __spreadProps$e(__spreadValues$g({}, (_s = defaultOptions.scales) == null ? void 0 : _s.y), {
20436
+ title: __spreadProps$e(__spreadValues$g({}, (_u = (_t = defaultOptions.scales) == null ? void 0 : _t.y) == null ? void 0 : _u.title), {
20437
+ font: { size: (_v = chartSettings.yAxisTitleFontSize) != null ? _v : 13, weight: "bold" }
20438
+ }),
20439
+ ticks: __spreadProps$e(__spreadValues$g({}, (_x = (_w = defaultOptions.scales) == null ? void 0 : _w.y) == null ? void 0 : _x.ticks), {
20440
+ font: { size: (_y = chartSettings.yAxisTickFontSize) != null ? _y : 12 }
20441
+ })
20442
+ })
20443
+ })
20444
+ }) : defaultOptions;
20445
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full", children: [
20446
+ ((chartSettings == null ? void 0 : chartSettings.titleText) || title) && (chartSettings == null ? void 0 : chartSettings.showTitle) !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(
20447
+ "p",
20448
+ {
20449
+ style: {
20450
+ fontSize: `${(_z = chartSettings == null ? void 0 : chartSettings.titleFontSize) != null ? _z : 16}px`
20451
+ },
20452
+ className: "font-bold text-slate-900 text-center px-2 pt-4 pb-2 select-text cursor-text shrink-0",
20453
+ children: (chartSettings == null ? void 0 : chartSettings.titleText) || title
20454
+ }
20455
+ ),
20456
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Bar, { data, options: options != null ? options : mergedOptions, plugins: [barValuePlugin] }) })
20457
+ ] });
20219
20458
  }
20220
20459
 
20221
20460
  /*!
@@ -21566,9 +21805,28 @@ var plugin$1 = {
21566
21805
  }
21567
21806
  };
21568
21807
 
21569
- Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
21570
- function SeriesLineChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title }) {
21571
- var _a, _b;
21808
+ var __defProp$f = Object.defineProperty;
21809
+ var __defProps$d = Object.defineProperties;
21810
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
21811
+ var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
21812
+ var __hasOwnProp$f = Object.prototype.hasOwnProperty;
21813
+ var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
21814
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21815
+ var __spreadValues$f = (a, b) => {
21816
+ for (var prop in b || (b = {}))
21817
+ if (__hasOwnProp$f.call(b, prop))
21818
+ __defNormalProp$f(a, prop, b[prop]);
21819
+ if (__getOwnPropSymbols$f)
21820
+ for (var prop of __getOwnPropSymbols$f(b)) {
21821
+ if (__propIsEnum$f.call(b, prop))
21822
+ __defNormalProp$f(a, prop, b[prop]);
21823
+ }
21824
+ return a;
21825
+ };
21826
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
21827
+ Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_tooltip, plugin_legend);
21828
+ function SeriesLineChart({ orientation, title, data, options, className, units, content, x_axis_title, y_axis_title, chartSettings }) {
21829
+ 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;
21572
21830
  const formatValue = (value) => {
21573
21831
  const numValue = typeof value === "string" ? parseFloat(value) : value;
21574
21832
  if (!isNaN(numValue)) {
@@ -21589,10 +21847,10 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21589
21847
  maintainAspectRatio: false,
21590
21848
  layout: {
21591
21849
  padding: {
21592
- bottom: 0,
21593
- top: 0,
21594
- left: 0,
21595
- right: 0
21850
+ bottom: 8,
21851
+ top: 8,
21852
+ left: 4,
21853
+ right: 16
21596
21854
  }
21597
21855
  },
21598
21856
  plugins: {
@@ -21604,8 +21862,12 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21604
21862
  return false;
21605
21863
  }),
21606
21864
  labels: {
21607
- boxWidth: 12,
21608
- boxHeight: 12
21865
+ boxWidth: 16,
21866
+ boxHeight: 16,
21867
+ padding: 16,
21868
+ font: { size: 13, weight: "normal" },
21869
+ usePointStyle: true,
21870
+ pointStyle: "circle"
21609
21871
  },
21610
21872
  position: "bottom"
21611
21873
  },
@@ -21625,16 +21887,15 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21625
21887
  },
21626
21888
  formatter: (value) => value
21627
21889
  },
21628
- title: {
21629
- display: true,
21630
- text: title,
21631
- font: {
21632
- size: 18,
21633
- weight: "bold"
21634
- },
21635
- color: "#0F172A"
21636
- },
21637
21890
  tooltip: {
21891
+ mode: "index",
21892
+ intersect: false,
21893
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
21894
+ titleFont: { size: 13, weight: "bold" },
21895
+ bodyFont: { size: 12 },
21896
+ padding: 12,
21897
+ borderColor: "#ccc",
21898
+ borderWidth: 1,
21638
21899
  callbacks: {
21639
21900
  label: function(context) {
21640
21901
  var _a2;
@@ -21648,33 +21909,111 @@ function SeriesLineChart({ orientation, title, data, options, className, units,
21648
21909
  x: {
21649
21910
  title: {
21650
21911
  display: !!x_axis_title,
21651
- text: x_axis_title
21912
+ text: x_axis_title,
21913
+ font: { size: 13, weight: "bold" },
21914
+ padding: 8
21652
21915
  },
21653
- ticks: { autoSkip: true, maxTicksLimit: 8, maxRotation: 45, minRotation: 0 }
21916
+ ticks: {
21917
+ autoSkip: true,
21918
+ maxRotation: 45,
21919
+ minRotation: 0,
21920
+ font: { size: 12 },
21921
+ maxTicksLimit: 10
21922
+ },
21923
+ grid: {
21924
+ color: "rgba(0, 0, 0, 0.05)"
21925
+ }
21654
21926
  },
21655
21927
  y: {
21656
21928
  title: {
21657
21929
  display: true,
21658
- 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 : ""))
21930
+ 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 : "")),
21931
+ font: { size: 13, weight: "bold" },
21932
+ padding: 12
21659
21933
  },
21660
21934
  beginAtZero: true,
21661
21935
  ticks: {
21936
+ font: { size: 12 },
21662
21937
  callback: function(value) {
21663
21938
  return units ? `${formatValue(value)} ${units}` : value;
21664
21939
  }
21940
+ },
21941
+ grid: {
21942
+ color: "rgba(0, 0, 0, 0.05)"
21665
21943
  }
21666
21944
  }
21667
21945
  },
21668
21946
  elements: {
21669
21947
  line: {
21670
- tension: 0.1
21948
+ tension: 0.3
21671
21949
  },
21672
21950
  point: {
21673
21951
  radius: 4
21674
21952
  }
21675
21953
  }
21676
21954
  };
21677
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Line, { data, options: options != null ? options : defaultOptions, plugins: [plugin$1] });
21955
+ const mergedOptions = chartSettings ? __spreadProps$d(__spreadValues$f({}, defaultOptions), {
21956
+ plugins: __spreadProps$d(__spreadValues$f({}, defaultOptions.plugins), {
21957
+ legend: __spreadProps$d(__spreadValues$f({}, (_c = defaultOptions.plugins) == null ? void 0 : _c.legend), {
21958
+ display: chartSettings.showLegend !== false,
21959
+ labels: __spreadProps$d(__spreadValues$f({}, (_e = (_d = defaultOptions.plugins) == null ? void 0 : _d.legend) == null ? void 0 : _e.labels), {
21960
+ boxWidth: (_f = chartSettings.legendBoxSize) != null ? _f : 16,
21961
+ boxHeight: (_g = chartSettings.legendBoxSize) != null ? _g : 16,
21962
+ font: { size: (_h = chartSettings.legendFontSize) != null ? _h : 13 }
21963
+ })
21964
+ }),
21965
+ datalabels: __spreadProps$d(__spreadValues$f({}, (_i = defaultOptions.plugins) == null ? void 0 : _i.datalabels), {
21966
+ display: (context) => {
21967
+ var _a2;
21968
+ return context.dataset.data[context.dataIndex] !== null && ((_a2 = chartSettings.showLabels) != null ? _a2 : false);
21969
+ },
21970
+ font: { size: (_j = chartSettings.dataLabelsFontSize) != null ? _j : 12 }
21971
+ }),
21972
+ tooltip: __spreadProps$d(__spreadValues$f({}, (_k = defaultOptions.plugins) == null ? void 0 : _k.tooltip), {
21973
+ bodyFont: { size: (_l = chartSettings.tooltipFontSize) != null ? _l : 12 },
21974
+ titleFont: { size: (_m = chartSettings.tooltipFontSize) != null ? _m : 12 }
21975
+ })
21976
+ }),
21977
+ scales: __spreadProps$d(__spreadValues$f({}, defaultOptions.scales), {
21978
+ x: __spreadProps$d(__spreadValues$f({}, (_n = defaultOptions.scales) == null ? void 0 : _n.x), {
21979
+ title: __spreadProps$d(__spreadValues$f({}, (_p = (_o = defaultOptions.scales) == null ? void 0 : _o.x) == null ? void 0 : _p.title), {
21980
+ font: { size: (_q = chartSettings.xAxisTitleFontSize) != null ? _q : 13, weight: "bold" }
21981
+ }),
21982
+ ticks: __spreadProps$d(__spreadValues$f({}, (_s = (_r = defaultOptions.scales) == null ? void 0 : _r.x) == null ? void 0 : _s.ticks), {
21983
+ font: { size: (_t = chartSettings.xAxisTickFontSize) != null ? _t : 12 }
21984
+ })
21985
+ }),
21986
+ y: __spreadProps$d(__spreadValues$f({}, (_u = defaultOptions.scales) == null ? void 0 : _u.y), {
21987
+ title: __spreadProps$d(__spreadValues$f({}, (_w = (_v = defaultOptions.scales) == null ? void 0 : _v.y) == null ? void 0 : _w.title), {
21988
+ font: { size: (_x = chartSettings.yAxisTitleFontSize) != null ? _x : 13, weight: "bold" }
21989
+ }),
21990
+ ticks: __spreadProps$d(__spreadValues$f({}, (_z = (_y = defaultOptions.scales) == null ? void 0 : _y.y) == null ? void 0 : _z.ticks), {
21991
+ font: { size: (_A = chartSettings.yAxisTickFontSize) != null ? _A : 12 }
21992
+ })
21993
+ })
21994
+ }),
21995
+ elements: {
21996
+ line: {
21997
+ tension: (_B = chartSettings.lineTension) != null ? _B : 0.3
21998
+ },
21999
+ point: {
22000
+ radius: (_C = chartSettings.pointRadius) != null ? _C : 4
22001
+ }
22002
+ }
22003
+ }) : defaultOptions;
22004
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full", children: [
22005
+ ((chartSettings == null ? void 0 : chartSettings.titleText) || title) && (chartSettings == null ? void 0 : chartSettings.showTitle) !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(
22006
+ "p",
22007
+ {
22008
+ style: {
22009
+ fontSize: `${(_D = chartSettings == null ? void 0 : chartSettings.titleFontSize) != null ? _D : 16}px`
22010
+ },
22011
+ className: "font-bold text-slate-900 text-center px-2 pt-4 pb-2 select-text cursor-text shrink-0",
22012
+ children: (chartSettings == null ? void 0 : chartSettings.titleText) || title
22013
+ }
22014
+ ),
22015
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Line, { data, options: options != null ? options : mergedOptions, plugins: [plugin$1] }) })
22016
+ ] });
21678
22017
  }
21679
22018
 
21680
22019
  /*!
@@ -22459,9 +22798,29 @@ var plugin = {
22459
22798
  },
22460
22799
  };
22461
22800
 
22801
+ var __defProp$e = Object.defineProperty;
22802
+ var __defProps$c = Object.defineProperties;
22803
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
22804
+ var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
22805
+ var __hasOwnProp$e = Object.prototype.hasOwnProperty;
22806
+ var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
22807
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22808
+ var __spreadValues$e = (a, b) => {
22809
+ for (var prop in b || (b = {}))
22810
+ if (__hasOwnProp$e.call(b, prop))
22811
+ __defNormalProp$e(a, prop, b[prop]);
22812
+ if (__getOwnPropSymbols$e)
22813
+ for (var prop of __getOwnPropSymbols$e(b)) {
22814
+ if (__propIsEnum$e.call(b, prop))
22815
+ __defNormalProp$e(a, prop, b[prop]);
22816
+ }
22817
+ return a;
22818
+ };
22819
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
22462
22820
  Chart$1.register(ArcElement, plugin_tooltip, plugin_legend);
22463
22821
  const PieChart = (props) => {
22464
- const { data, title, options, units, content } = props;
22822
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
22823
+ const { data, title, options, units, content, chartSettings } = props;
22465
22824
  const formatValue = (value) => {
22466
22825
  const numValue = typeof value === "string" ? parseFloat(value) : value;
22467
22826
  if (units === "$" && !isNaN(numValue)) {
@@ -22475,52 +22834,55 @@ const PieChart = (props) => {
22475
22834
  plugins: {
22476
22835
  legend: {
22477
22836
  labels: {
22478
- boxWidth: 4,
22479
- boxHeight: 4
22837
+ boxWidth: 16,
22838
+ boxHeight: 16,
22839
+ padding: 12,
22840
+ font: { size: 13, weight: "normal" },
22841
+ usePointStyle: true,
22842
+ pointStyle: "circle"
22480
22843
  },
22481
22844
  position: "bottom"
22482
22845
  },
22483
22846
  outlabels: {
22484
22847
  display: (context) => {
22485
- var _a;
22486
- return context.dataset.data[context.dataIndex] !== null && ((_a = content == null ? void 0 : content.showLabels) != null ? _a : false);
22848
+ var _a2;
22849
+ return context.dataset.data[context.dataIndex] !== null && ((_a2 = content == null ? void 0 : content.showLabels) != null ? _a2 : false);
22487
22850
  },
22488
22851
  text: (ctx) => {
22489
- var _a;
22852
+ var _a2;
22490
22853
  const dataset = ctx.dataset.data;
22491
22854
  const total = dataset.reduce((a, b) => a + b, 0);
22492
22855
  const value = dataset[ctx.dataIndex];
22493
22856
  const percent = value / total * 100;
22494
- return percent >= 5 ? `${(_a = ctx.chart.data.labels) == null ? void 0 : _a[ctx.dataIndex]} ${value}` : "";
22857
+ return percent >= 5 ? `${(_a2 = ctx.chart.data.labels) == null ? void 0 : _a2[ctx.dataIndex]} ${value}` : "";
22495
22858
  },
22496
- color: "black",
22497
- stretch: 15,
22859
+ color: "#0F172A",
22860
+ stretch: 25,
22861
+ padding: 4,
22498
22862
  font: {
22499
22863
  resizable: true,
22500
- minSize: 12,
22501
- maxSize: 18
22864
+ minSize: 11,
22865
+ maxSize: 14,
22866
+ weight: "bold"
22502
22867
  },
22503
22868
  backgroundColor: (ctx) => {
22504
22869
  const dataset = ctx.dataset.data;
22505
22870
  const total = dataset.reduce((a, b) => a + b, 0);
22506
22871
  const value = dataset[ctx.dataIndex];
22507
22872
  const percent = value / total * 100;
22508
- return percent >= 5 ? "rgba(255,255,255,0.7)" : "transparent";
22873
+ return percent >= 5 ? "rgba(255,255,255,0.85)" : "transparent";
22509
22874
  }
22510
22875
  },
22511
22876
  datalabels: {
22512
22877
  display: false
22513
22878
  },
22514
- title: {
22515
- display: true,
22516
- text: title,
22517
- font: {
22518
- size: 18,
22519
- weight: "bold"
22520
- },
22521
- color: "#0F172A"
22522
- },
22523
22879
  tooltip: {
22880
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
22881
+ titleFont: { size: 13, weight: "bold" },
22882
+ bodyFont: { size: 12 },
22883
+ padding: 12,
22884
+ borderColor: "#ccc",
22885
+ borderWidth: 1,
22524
22886
  callbacks: {
22525
22887
  label: function(context) {
22526
22888
  const value = context.parsed;
@@ -22531,14 +22893,48 @@ const PieChart = (props) => {
22531
22893
  },
22532
22894
  layout: {
22533
22895
  padding: {
22534
- bottom: 0,
22535
- top: 0,
22536
- left: 0,
22537
- right: 0
22896
+ bottom: 4,
22897
+ top: 24,
22898
+ left: 4,
22899
+ right: 4
22538
22900
  }
22539
22901
  }
22540
22902
  };
22541
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Pie, { data, options: options != null ? options : defaultOptions, plugins: [plugin] });
22903
+ const mergedOptions = chartSettings ? __spreadProps$c(__spreadValues$e({}, defaultOptions), {
22904
+ plugins: __spreadProps$c(__spreadValues$e({}, defaultOptions.plugins), {
22905
+ legend: __spreadProps$c(__spreadValues$e({}, (_a = defaultOptions.plugins) == null ? void 0 : _a.legend), {
22906
+ display: chartSettings.showLegend !== false,
22907
+ labels: __spreadProps$c(__spreadValues$e({}, (_c = (_b = defaultOptions.plugins) == null ? void 0 : _b.legend) == null ? void 0 : _c.labels), {
22908
+ boxWidth: (_d = chartSettings.legendBoxSize) != null ? _d : 16,
22909
+ boxHeight: (_e = chartSettings.legendBoxSize) != null ? _e : 16,
22910
+ font: { size: (_f = chartSettings.legendFontSize) != null ? _f : 13 }
22911
+ })
22912
+ }),
22913
+ outlabels: __spreadProps$c(__spreadValues$e({}, (_g = defaultOptions.plugins) == null ? void 0 : _g.outlabels), {
22914
+ font: __spreadProps$c(__spreadValues$e({}, (_i = (_h = defaultOptions.plugins) == null ? void 0 : _h.outlabels) == null ? void 0 : _i.font), {
22915
+ minSize: (_j = chartSettings.dataLabelsFontSize) != null ? _j : 11,
22916
+ maxSize: ((_k = chartSettings.dataLabelsFontSize) != null ? _k : 12) + 2
22917
+ })
22918
+ }),
22919
+ tooltip: __spreadProps$c(__spreadValues$e({}, (_l = defaultOptions.plugins) == null ? void 0 : _l.tooltip), {
22920
+ bodyFont: { size: (_m = chartSettings.tooltipFontSize) != null ? _m : 12 },
22921
+ titleFont: { size: (_n = chartSettings.tooltipFontSize) != null ? _n : 12 }
22922
+ })
22923
+ })
22924
+ }) : defaultOptions;
22925
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-full", children: [
22926
+ ((chartSettings == null ? void 0 : chartSettings.titleText) || title) && (chartSettings == null ? void 0 : chartSettings.showTitle) !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(
22927
+ "p",
22928
+ {
22929
+ style: {
22930
+ fontSize: `${(_o = chartSettings == null ? void 0 : chartSettings.titleFontSize) != null ? _o : 16}px`
22931
+ },
22932
+ className: "font-bold text-slate-900 text-center px-2 pt-4 pb-2 select-text cursor-text shrink-0",
22933
+ children: (chartSettings == null ? void 0 : chartSettings.titleText) || title
22934
+ }
22935
+ ),
22936
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Pie, { data, options: options != null ? options : mergedOptions, plugins: [plugin] }) })
22937
+ ] });
22542
22938
  };
22543
22939
 
22544
22940
  Chart$1.register(CategoryScale, LinearScale, PointElement, LineElement, plugin_title, plugin_tooltip, plugin_legend);
@@ -36903,7 +37299,7 @@ const own$2 = {}.hasOwnProperty;
36903
37299
  * mdast tree.
36904
37300
  */
36905
37301
  function fromMarkdown(value, encoding, options) {
36906
- if (typeof encoding !== 'string') {
37302
+ if (encoding && typeof encoding === 'object') {
36907
37303
  options = encoding;
36908
37304
  encoding = undefined;
36909
37305
  }
@@ -43463,27 +43859,27 @@ function SummaryWidget({ title, data, metadata, className }) {
43463
43859
  ] });
43464
43860
  }
43465
43861
 
43466
- var __defProp$c = Object.defineProperty;
43467
- var __defProps$a = Object.defineProperties;
43468
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
43469
- var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
43470
- var __hasOwnProp$c = Object.prototype.hasOwnProperty;
43471
- var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
43472
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
43473
- var __spreadValues$c = (a, b) => {
43862
+ var __defProp$d = Object.defineProperty;
43863
+ var __defProps$b = Object.defineProperties;
43864
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
43865
+ var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
43866
+ var __hasOwnProp$d = Object.prototype.hasOwnProperty;
43867
+ var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
43868
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
43869
+ var __spreadValues$d = (a, b) => {
43474
43870
  for (var prop in b || (b = {}))
43475
- if (__hasOwnProp$c.call(b, prop))
43476
- __defNormalProp$c(a, prop, b[prop]);
43477
- if (__getOwnPropSymbols$c)
43478
- for (var prop of __getOwnPropSymbols$c(b)) {
43479
- if (__propIsEnum$c.call(b, prop))
43480
- __defNormalProp$c(a, prop, b[prop]);
43871
+ if (__hasOwnProp$d.call(b, prop))
43872
+ __defNormalProp$d(a, prop, b[prop]);
43873
+ if (__getOwnPropSymbols$d)
43874
+ for (var prop of __getOwnPropSymbols$d(b)) {
43875
+ if (__propIsEnum$d.call(b, prop))
43876
+ __defNormalProp$d(a, prop, b[prop]);
43481
43877
  }
43482
43878
  return a;
43483
43879
  };
43484
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
43880
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
43485
43881
  const CHART_REFRESH_TIMEOUT$4 = 3e3;
43486
- const DEFAULT_COLORS$3 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
43882
+ const DEFAULT_COLORS$4 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
43487
43883
  const LINE_COLORS = ["#243D84", "#69238B", "#4A959F", "#D0A677", "#B31E47", "#396431"];
43488
43884
  const clearChat$5 = async (widgetBackendUrl, widgetId) => {
43489
43885
  if (!widgetBackendUrl || !widgetId) return;
@@ -43513,7 +43909,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43513
43909
  const baseState = { dataset_id: datasetId || "home_generation_dataset" };
43514
43910
  switch (agentType) {
43515
43911
  case "Pie Chart Agent":
43516
- return __spreadValues$c({
43912
+ return __spreadValues$d({
43517
43913
  pie_chart_data: {
43518
43914
  title: "",
43519
43915
  type: "pie",
@@ -43524,7 +43920,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43524
43920
  }, baseState);
43525
43921
  case "Line Chart Agent":
43526
43922
  case "Bar Chart Agent":
43527
- return __spreadValues$c({
43923
+ return __spreadValues$d({
43528
43924
  bar_chart_data: {
43529
43925
  title: "",
43530
43926
  type: agentType === "Line Chart Agent" ? "line" : "bar",
@@ -43536,7 +43932,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43536
43932
  }, baseState);
43537
43933
  case "Series Bar Chart Agent":
43538
43934
  case "Series Line Chart Agent":
43539
- return __spreadValues$c({
43935
+ return __spreadValues$d({
43540
43936
  series_bar_chart_data: {
43541
43937
  title: "",
43542
43938
  type: "series_bar",
@@ -43562,7 +43958,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43562
43958
  }
43563
43959
  }, baseState);
43564
43960
  case "Data Grid Agent":
43565
- return __spreadValues$c({
43961
+ return __spreadValues$d({
43566
43962
  matrix_grid_data: {
43567
43963
  title: "",
43568
43964
  type: "data_grid",
@@ -43573,7 +43969,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43573
43969
  }
43574
43970
  }, baseState);
43575
43971
  case "Summary Agent":
43576
- return __spreadValues$c({
43972
+ return __spreadValues$d({
43577
43973
  summary_data: {
43578
43974
  title: "",
43579
43975
  type: "summary",
@@ -43582,7 +43978,7 @@ const createInitialChartState$4 = (agentType, widgetIds, datasetId) => {
43582
43978
  }
43583
43979
  }, baseState);
43584
43980
  default:
43585
- return __spreadValues$c({ widget_ids: widgetIds }, baseState);
43981
+ return __spreadValues$d({ widget_ids: widgetIds }, baseState);
43586
43982
  }
43587
43983
  };
43588
43984
  const loadAgentState$5 = async (widgetBackendUrl, threadId, agentName) => {
@@ -43622,7 +44018,7 @@ const parseAndUpdateChartState$4 = (apiResponse, setChartState) => {
43622
44018
  if (parsedState.state) {
43623
44019
  const chartData = parsedState.state;
43624
44020
  setChartState((prevState) => {
43625
- const newChartState = __spreadValues$c({}, prevState);
44021
+ const newChartState = __spreadValues$d({}, prevState);
43626
44022
  if (chartData.bar_chart_data) {
43627
44023
  newChartState.bar_chart_data = chartData.bar_chart_data;
43628
44024
  }
@@ -43721,7 +44117,7 @@ function BarChartComponent({
43721
44117
  }
43722
44118
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43723
44119
  const finalColors = useMemo(() => {
43724
- return shuffleColors(DEFAULT_COLORS$3, labels == null ? void 0 : labels.length);
44120
+ return shuffleColors(DEFAULT_COLORS$4, labels == null ? void 0 : labels.length);
43725
44121
  }, [labels.length]);
43726
44122
  if (isEmpty) {
43727
44123
  return createLoadingComponent$5();
@@ -43787,7 +44183,7 @@ function SeriesBarChartComponent$2({
43787
44183
  }
43788
44184
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43789
44185
  const finalColors = useMemo(() => {
43790
- return shuffleColors(DEFAULT_COLORS$3, series == null ? void 0 : series.length);
44186
+ return shuffleColors(DEFAULT_COLORS$4, series == null ? void 0 : series.length);
43791
44187
  }, [series.length]);
43792
44188
  if (isEmpty) {
43793
44189
  return createLoadingComponent$5();
@@ -43851,7 +44247,7 @@ function SeriesLineChartComponent({
43851
44247
  }
43852
44248
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43853
44249
  const finalColors = useMemo(() => {
43854
- return shuffleColors([...LINE_COLORS, ...DEFAULT_COLORS$3], series == null ? void 0 : series.length);
44250
+ return shuffleColors([...LINE_COLORS, ...DEFAULT_COLORS$4], series == null ? void 0 : series.length);
43855
44251
  }, [series.length]);
43856
44252
  if (isEmpty) {
43857
44253
  return createLoadingComponent$5();
@@ -43920,7 +44316,7 @@ function PieChartComponent$1({
43920
44316
  }
43921
44317
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout]);
43922
44318
  const backgroundColors = useMemo(() => {
43923
- return shuffleColors(DEFAULT_COLORS$3, labels.length);
44319
+ return shuffleColors(DEFAULT_COLORS$4, labels.length);
43924
44320
  }, [labels.length]);
43925
44321
  if (isEmpty) {
43926
44322
  return createLoadingComponent$5();
@@ -44099,7 +44495,7 @@ function SummaryComponent({
44099
44495
  useEffect(() => {
44100
44496
  if (isEmpty && query && isFirstLoad && !(summaryState == null ? void 0 : summaryState.agent_message) && !hasCalledRef.current) {
44101
44497
  hasCalledRef.current = true;
44102
- setChartState(__spreadProps$a(__spreadValues$c({}, summaryState), {
44498
+ setChartState(__spreadProps$b(__spreadValues$d({}, summaryState), {
44103
44499
  widget_ids
44104
44500
  }));
44105
44501
  setTimeout(() => {
@@ -44176,7 +44572,7 @@ function CopilotKitAgent({
44176
44572
  if (apiCallCount >= 10) {
44177
44573
  console.log("API call limit reached for widget:", widget.id);
44178
44574
  setHasTimeoutError(true);
44179
- setChartState((prevState) => __spreadProps$a(__spreadValues$c({}, prevState), {
44575
+ setChartState((prevState) => __spreadProps$b(__spreadValues$d({}, prevState), {
44180
44576
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
44181
44577
  }));
44182
44578
  return;
@@ -44585,25 +44981,25 @@ function exportChatToPDF(options) {
44585
44981
  doc.save(filename);
44586
44982
  }
44587
44983
 
44588
- var __defProp$b = Object.defineProperty;
44589
- var __defProps$9 = Object.defineProperties;
44590
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
44591
- var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
44592
- var __hasOwnProp$b = Object.prototype.hasOwnProperty;
44593
- var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
44594
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44595
- var __spreadValues$b = (a, b) => {
44984
+ var __defProp$c = Object.defineProperty;
44985
+ var __defProps$a = Object.defineProperties;
44986
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
44987
+ var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
44988
+ var __hasOwnProp$c = Object.prototype.hasOwnProperty;
44989
+ var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
44990
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44991
+ var __spreadValues$c = (a, b) => {
44596
44992
  for (var prop in b || (b = {}))
44597
- if (__hasOwnProp$b.call(b, prop))
44598
- __defNormalProp$b(a, prop, b[prop]);
44599
- if (__getOwnPropSymbols$b)
44600
- for (var prop of __getOwnPropSymbols$b(b)) {
44601
- if (__propIsEnum$b.call(b, prop))
44602
- __defNormalProp$b(a, prop, b[prop]);
44993
+ if (__hasOwnProp$c.call(b, prop))
44994
+ __defNormalProp$c(a, prop, b[prop]);
44995
+ if (__getOwnPropSymbols$c)
44996
+ for (var prop of __getOwnPropSymbols$c(b)) {
44997
+ if (__propIsEnum$c.call(b, prop))
44998
+ __defNormalProp$c(a, prop, b[prop]);
44603
44999
  }
44604
45000
  return a;
44605
45001
  };
44606
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
45002
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
44607
45003
  const getStyleValues$4 = (styles = {}) => {
44608
45004
  const borderRadiusMap = {
44609
45005
  none: "0px",
@@ -44634,7 +45030,9 @@ function CopilotKitChatbot({
44634
45030
  onResetReady,
44635
45031
  widgetIds,
44636
45032
  datasetId,
44637
- dashboardName
45033
+ dashboardName,
45034
+ onClearChat,
45035
+ isClearing = false
44638
45036
  }) {
44639
45037
  var _a, _b, _c, _d;
44640
45038
  const { threadId, setThreadId } = useCopilotContext();
@@ -44721,7 +45119,7 @@ function CopilotKitChatbot({
44721
45119
  const handleSubmit = (e) => {
44722
45120
  e.preventDefault();
44723
45121
  if (!inputValue.trim()) return;
44724
- setChatbotState((prevState) => __spreadProps$9(__spreadValues$b({}, prevState), {
45122
+ setChatbotState((prevState) => __spreadProps$a(__spreadValues$c({}, prevState), {
44725
45123
  widget_ids: widgetIds,
44726
45124
  dataset_id: datasetId
44727
45125
  }));
@@ -44743,25 +45141,46 @@ function CopilotKitChatbot({
44743
45141
  /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-medium", children: widget.title })
44744
45142
  ] }) }),
44745
45143
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 h-full flex flex-col", children: [
44746
- 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(
44747
- "button",
44748
- {
44749
- onClick: handleExport,
44750
- disabled: isExporting,
44751
- className: cn(
44752
- "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md",
44753
- "bg-gray-100 border border-gray-200",
44754
- "text-gray-700 hover:bg-gray-200 hover:border-gray-300",
44755
- "disabled:opacity-50 disabled:cursor-not-allowed",
44756
- "transition-colors duration-150"
44757
- ),
44758
- title: "Export conversation as PDF",
44759
- children: [
44760
- isExporting ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Download, { className: "h-3.5 w-3.5" }),
44761
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Export PDF" })
44762
- ]
44763
- }
44764
- ) }),
45144
+ 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: [
45145
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
45146
+ "button",
45147
+ {
45148
+ onClick: handleExport,
45149
+ disabled: isExporting,
45150
+ className: cn(
45151
+ "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md",
45152
+ "bg-gray-100 border border-gray-200",
45153
+ "text-gray-700 hover:bg-gray-200 hover:border-gray-300",
45154
+ "disabled:opacity-50 disabled:cursor-not-allowed",
45155
+ "transition-colors duration-150"
45156
+ ),
45157
+ title: "Export conversation as PDF",
45158
+ children: [
45159
+ isExporting ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Download, { className: "h-3.5 w-3.5" }),
45160
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Export PDF" })
45161
+ ]
45162
+ }
45163
+ ),
45164
+ onClearChat && /* @__PURE__ */ jsxRuntimeExports.jsxs(
45165
+ "button",
45166
+ {
45167
+ onClick: onClearChat,
45168
+ disabled: isClearing,
45169
+ className: cn(
45170
+ "flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md",
45171
+ "bg-gray-100 border border-gray-200",
45172
+ "text-gray-700 hover:bg-gray-200 hover:border-gray-300",
45173
+ "disabled:opacity-50 disabled:cursor-not-allowed",
45174
+ "transition-colors duration-150"
45175
+ ),
45176
+ title: "Clear chat conversation",
45177
+ children: [
45178
+ isClearing ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MessageCircleX, { className: "h-3.5 w-3.5" }),
45179
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Clear Chat" })
45180
+ ]
45181
+ }
45182
+ )
45183
+ ] }),
44765
45184
  /* @__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: [
44766
45185
  chatMessages.map((message) => /* @__PURE__ */ jsxRuntimeExports.jsx(
44767
45186
  "div",
@@ -44838,7 +45257,9 @@ function ChatbotWidget({
44838
45257
  onResetReady,
44839
45258
  widgetIds,
44840
45259
  datasetId,
44841
- dashboardName
45260
+ dashboardName,
45261
+ onClearChat,
45262
+ isClearing = false
44842
45263
  }) {
44843
45264
  var _a, _b;
44844
45265
  const styles = getStyleValues$4((_a = widget.config) == null ? void 0 : _a.styles);
@@ -44863,49 +45284,51 @@ function ChatbotWidget({
44863
45284
  onResetReady,
44864
45285
  widgetIds,
44865
45286
  datasetId,
44866
- dashboardName
45287
+ dashboardName,
45288
+ onClearChat,
45289
+ isClearing
44867
45290
  }
44868
45291
  )
44869
45292
  }
44870
45293
  );
44871
45294
  }
44872
45295
 
44873
- var __defProp$a = Object.defineProperty;
44874
- var __defProps$8 = Object.defineProperties;
44875
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
44876
- var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
44877
- var __hasOwnProp$a = Object.prototype.hasOwnProperty;
44878
- var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
44879
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44880
- var __spreadValues$a = (a, b) => {
45296
+ var __defProp$b = Object.defineProperty;
45297
+ var __defProps$9 = Object.defineProperties;
45298
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
45299
+ var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
45300
+ var __hasOwnProp$b = Object.prototype.hasOwnProperty;
45301
+ var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
45302
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45303
+ var __spreadValues$b = (a, b) => {
44881
45304
  for (var prop in b || (b = {}))
44882
- if (__hasOwnProp$a.call(b, prop))
44883
- __defNormalProp$a(a, prop, b[prop]);
44884
- if (__getOwnPropSymbols$a)
44885
- for (var prop of __getOwnPropSymbols$a(b)) {
44886
- if (__propIsEnum$a.call(b, prop))
44887
- __defNormalProp$a(a, prop, b[prop]);
45305
+ if (__hasOwnProp$b.call(b, prop))
45306
+ __defNormalProp$b(a, prop, b[prop]);
45307
+ if (__getOwnPropSymbols$b)
45308
+ for (var prop of __getOwnPropSymbols$b(b)) {
45309
+ if (__propIsEnum$b.call(b, prop))
45310
+ __defNormalProp$b(a, prop, b[prop]);
44888
45311
  }
44889
45312
  return a;
44890
45313
  };
44891
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
44892
- var __objRest$2 = (source, exclude) => {
45314
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
45315
+ var __objRest$3 = (source, exclude) => {
44893
45316
  var target = {};
44894
45317
  for (var prop in source)
44895
- if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
45318
+ if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
44896
45319
  target[prop] = source[prop];
44897
- if (source != null && __getOwnPropSymbols$a)
44898
- for (var prop of __getOwnPropSymbols$a(source)) {
44899
- if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
45320
+ if (source != null && __getOwnPropSymbols$b)
45321
+ for (var prop of __getOwnPropSymbols$b(source)) {
45322
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
44900
45323
  target[prop] = source[prop];
44901
45324
  }
44902
45325
  return target;
44903
45326
  };
44904
45327
  const Checkbox = React.forwardRef((_a, ref) => {
44905
- var _b = _a, { className } = _b, props = __objRest$2(_b, ["className"]);
45328
+ var _b = _a, { className } = _b, props = __objRest$3(_b, ["className"]);
44906
45329
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
44907
45330
  CheckboxPrimitive.Root,
44908
- __spreadProps$8(__spreadValues$a({
45331
+ __spreadProps$9(__spreadValues$b({
44909
45332
  ref,
44910
45333
  className: cn(
44911
45334
  "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",
@@ -44924,25 +45347,25 @@ const Checkbox = React.forwardRef((_a, ref) => {
44924
45347
  });
44925
45348
  Checkbox.displayName = CheckboxPrimitive.Root.displayName;
44926
45349
 
44927
- var __defProp$9 = Object.defineProperty;
44928
- var __defProps$7 = Object.defineProperties;
44929
- var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
44930
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
44931
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
44932
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
44933
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44934
- var __spreadValues$9 = (a, b) => {
45350
+ var __defProp$a = Object.defineProperty;
45351
+ var __defProps$8 = Object.defineProperties;
45352
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
45353
+ var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
45354
+ var __hasOwnProp$a = Object.prototype.hasOwnProperty;
45355
+ var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
45356
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45357
+ var __spreadValues$a = (a, b) => {
44935
45358
  for (var prop in b || (b = {}))
44936
- if (__hasOwnProp$9.call(b, prop))
44937
- __defNormalProp$9(a, prop, b[prop]);
44938
- if (__getOwnPropSymbols$9)
44939
- for (var prop of __getOwnPropSymbols$9(b)) {
44940
- if (__propIsEnum$9.call(b, prop))
44941
- __defNormalProp$9(a, prop, b[prop]);
45359
+ if (__hasOwnProp$a.call(b, prop))
45360
+ __defNormalProp$a(a, prop, b[prop]);
45361
+ if (__getOwnPropSymbols$a)
45362
+ for (var prop of __getOwnPropSymbols$a(b)) {
45363
+ if (__propIsEnum$a.call(b, prop))
45364
+ __defNormalProp$a(a, prop, b[prop]);
44942
45365
  }
44943
45366
  return a;
44944
45367
  };
44945
- var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
45368
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
44946
45369
  const FILTER_REFRESH_TIMEOUT = 3e3;
44947
45370
  const clearChat$4 = async (widgetBackendUrl, widgetId) => {
44948
45371
  if (!widgetBackendUrl || !widgetId) return;
@@ -45011,7 +45434,7 @@ const parseAndUpdateFilterState = (apiResponse, setFilterState) => {
45011
45434
  if (parsedState.state) {
45012
45435
  const filterData = parsedState.state;
45013
45436
  setFilterState((prevState) => {
45014
- const newFilterState = __spreadValues$9({}, prevState);
45437
+ const newFilterState = __spreadValues$a({}, prevState);
45015
45438
  if (filterData.column_values) {
45016
45439
  newFilterState.column_values = filterData.column_values;
45017
45440
  }
@@ -45100,7 +45523,7 @@ function TableSelectionConfirmation({
45100
45523
  {
45101
45524
  value: selectedTables[col.column] || "",
45102
45525
  onChange: (e) => {
45103
- setSelectedTables((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
45526
+ setSelectedTables((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45104
45527
  [col.column]: e.target.value
45105
45528
  }));
45106
45529
  },
@@ -45216,7 +45639,7 @@ function FiltersContent({
45216
45639
  }
45217
45640
  }, [(_a = widget.config) == null ? void 0 : _a.filters, filterGroups]);
45218
45641
  const toggleGroup = (groupId) => {
45219
- setExpandedGroups((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
45642
+ setExpandedGroups((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45220
45643
  [groupId]: !prev[groupId]
45221
45644
  }));
45222
45645
  };
@@ -45229,7 +45652,7 @@ function FiltersContent({
45229
45652
  } else {
45230
45653
  newGroupFilters = groupFilters.filter((id) => id !== optionId);
45231
45654
  }
45232
- const newFilters = __spreadProps$7(__spreadValues$9({}, prev), {
45655
+ const newFilters = __spreadProps$8(__spreadValues$a({}, prev), {
45233
45656
  [groupId]: newGroupFilters
45234
45657
  });
45235
45658
  if (onFilterChange) {
@@ -45239,7 +45662,7 @@ function FiltersContent({
45239
45662
  });
45240
45663
  };
45241
45664
  const handleSearchChange = (groupId, query2) => {
45242
- setSearchQueries((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
45665
+ setSearchQueries((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45243
45666
  [groupId]: query2
45244
45667
  }));
45245
45668
  };
@@ -45257,7 +45680,7 @@ function FiltersContent({
45257
45680
  };
45258
45681
  const clearGroupFilters = (groupId) => {
45259
45682
  setSelectedFilters((prev) => {
45260
- const newFilters = __spreadProps$7(__spreadValues$9({}, prev), { [groupId]: [] });
45683
+ const newFilters = __spreadProps$8(__spreadValues$a({}, prev), { [groupId]: [] });
45261
45684
  if (onFilterChange) {
45262
45685
  onFilterChange(newFilters);
45263
45686
  }
@@ -45419,7 +45842,7 @@ function FiltersContent({
45419
45842
  "Content-Type": "application/json"
45420
45843
  },
45421
45844
  body: JSON.stringify({
45422
- config: __spreadProps$7(__spreadValues$9({}, widget.config), {
45845
+ config: __spreadProps$8(__spreadValues$a({}, widget.config), {
45423
45846
  filters: filtersWithLabels
45424
45847
  })
45425
45848
  })
@@ -45499,7 +45922,7 @@ function CopilotKitFilters({
45499
45922
  if (apiCallCount >= 30) {
45500
45923
  console.log("API call limit reached for widget:", widget.id);
45501
45924
  setHasTimeoutError(true);
45502
- setFilterState((prevState) => __spreadProps$7(__spreadValues$9({}, prevState), {
45925
+ setFilterState((prevState) => __spreadProps$8(__spreadValues$a({}, prevState), {
45503
45926
  agent_message: "Timeout: Unable to load filter data after multiple attempts. Please try refreshing the widget."
45504
45927
  }));
45505
45928
  return;
@@ -45640,7 +46063,7 @@ function CopilotKitFilters({
45640
46063
  startLoadingTimeout();
45641
46064
  }, [filterState.filter_columns, filterState.ambiguous_columns, (_f = widget.config) == null ? void 0 : _f.query, datasetId, appendMessage, setFilterState, setAgentState, startLoadingTimeout, setApiCallCount, setHasTimeoutError]);
45642
46065
  const handleCancelConfirmation = useCallback(() => {
45643
- setFilterState((prev) => __spreadProps$7(__spreadValues$9({}, prev), {
46066
+ setFilterState((prev) => __spreadProps$8(__spreadValues$a({}, prev), {
45644
46067
  status: void 0,
45645
46068
  ambiguous_columns: void 0,
45646
46069
  message: void 0
@@ -45734,27 +46157,27 @@ function FiltersWidget({
45734
46157
  );
45735
46158
  }
45736
46159
 
45737
- var __defProp$8 = Object.defineProperty;
45738
- var __defProps$6 = Object.defineProperties;
45739
- var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
45740
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
45741
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
45742
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
45743
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
45744
- var __spreadValues$8 = (a, b) => {
46160
+ var __defProp$9 = Object.defineProperty;
46161
+ var __defProps$7 = Object.defineProperties;
46162
+ var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
46163
+ var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
46164
+ var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
46165
+ var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
46166
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46167
+ var __spreadValues$9 = (a, b) => {
45745
46168
  for (var prop in b || (b = {}))
45746
- if (__hasOwnProp$8.call(b, prop))
45747
- __defNormalProp$8(a, prop, b[prop]);
45748
- if (__getOwnPropSymbols$8)
45749
- for (var prop of __getOwnPropSymbols$8(b)) {
45750
- if (__propIsEnum$8.call(b, prop))
45751
- __defNormalProp$8(a, prop, b[prop]);
46169
+ if (__hasOwnProp$9.call(b, prop))
46170
+ __defNormalProp$9(a, prop, b[prop]);
46171
+ if (__getOwnPropSymbols$9)
46172
+ for (var prop of __getOwnPropSymbols$9(b)) {
46173
+ if (__propIsEnum$9.call(b, prop))
46174
+ __defNormalProp$9(a, prop, b[prop]);
45752
46175
  }
45753
46176
  return a;
45754
46177
  };
45755
- var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
46178
+ var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
45756
46179
  const CHART_REFRESH_TIMEOUT$3 = 3e3;
45757
- const DEFAULT_COLORS$2 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
46180
+ const DEFAULT_COLORS$3 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
45758
46181
  const clearChat$3 = async (widgetBackendUrl, widgetId) => {
45759
46182
  if (!widgetBackendUrl || !widgetId) return;
45760
46183
  console.log("clearChat called for widgetId:", widgetId);
@@ -45828,7 +46251,7 @@ const parseAndUpdateChartState$3 = (apiResponse, setChartState) => {
45828
46251
  if (parsedState.state) {
45829
46252
  const chartData = parsedState.state;
45830
46253
  setChartState((prevState) => {
45831
- const newChartState = __spreadValues$8({}, prevState);
46254
+ const newChartState = __spreadValues$9({}, prevState);
45832
46255
  if (chartData.pie_chart_data) {
45833
46256
  newChartState.pie_chart_data = chartData.pie_chart_data;
45834
46257
  }
@@ -45877,9 +46300,11 @@ function PieChartComponent({
45877
46300
  startLoadingTimeout,
45878
46301
  clearLoadingTimeout,
45879
46302
  content,
45880
- hasWidgetData
46303
+ hasWidgetData,
46304
+ chartSettings,
46305
+ onConfigUpdate
45881
46306
  }) {
45882
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
46307
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
45883
46308
  const hasCalledRef = useRef(false);
45884
46309
  const labels = ((_b = (_a = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) || [];
45885
46310
  const values = ((_d = (_c = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.values) || [];
@@ -45887,6 +46312,10 @@ function PieChartComponent({
45887
46312
  const chartTitle = ((_g = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _g.title) || "";
45888
46313
  const units = ((_h = pieChartState == null ? void 0 : pieChartState.pie_chart_data) == null ? void 0 : _h.units) || "";
45889
46314
  const isEmpty = labels.length === 0 || values.length === 0;
46315
+ useEffect(() => {
46316
+ console.log("[PieChartComponent] chartSettings:", chartSettings);
46317
+ console.log("[PieChartComponent] seriesColors:", chartSettings == null ? void 0 : chartSettings.seriesColors);
46318
+ }, [chartSettings]);
45890
46319
  const handleRefresh = async () => {
45891
46320
  if (query) {
45892
46321
  await clearChat$3(widgetBackendUrl, widgetId);
@@ -45916,24 +46345,49 @@ function PieChartComponent({
45916
46345
  }
45917
46346
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout, pieChartState]);
45918
46347
  const backgroundColors = useMemo(() => {
45919
- return shuffleColors(DEFAULT_COLORS$2, labels.length);
46348
+ return shuffleColors(DEFAULT_COLORS$3, labels.length);
45920
46349
  }, [labels.length]);
46350
+ const sortedIndices = useMemo(() => {
46351
+ return labels.map((label, index) => ({ label, index, value: values[index] })).sort((a, b) => a.label.localeCompare(b.label)).map((item) => item.index);
46352
+ }, [labels, values]);
46353
+ const sortedLabels = useMemo(() => {
46354
+ return sortedIndices.map((i) => labels[i]);
46355
+ }, [sortedIndices, labels]);
46356
+ const sortedValues = useMemo(() => {
46357
+ return sortedIndices.map((i) => values[i]);
46358
+ }, [sortedIndices, values]);
46359
+ const colors = useMemo(() => {
46360
+ var _a2, _b2;
46361
+ if ((chartSettings == null ? void 0 : chartSettings.seriesColors) && chartSettings.seriesColors.length > 0) {
46362
+ return chartSettings.seriesColors.slice(0, sortedLabels.length);
46363
+ }
46364
+ 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]);
46365
+ }, [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]);
46366
+ useEffect(() => {
46367
+ var _a2;
46368
+ if (!isEmpty && colors.length > 0 && !((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2.length) && onConfigUpdate && widgetId) {
46369
+ onConfigUpdate(widgetId, {
46370
+ chartSettings: __spreadProps$7(__spreadValues$9({}, chartSettings), {
46371
+ seriesColors: colors
46372
+ })
46373
+ });
46374
+ }
46375
+ }, [sortedLabels.length, (_k = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _k.length, onConfigUpdate, widgetId, isEmpty]);
45921
46376
  if (isEmpty) {
45922
46377
  return createLoadingComponent$3();
45923
46378
  }
45924
- 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]);
45925
46379
  const transformedData = {
45926
- labels,
46380
+ labels: sortedLabels,
45927
46381
  datasets: [
45928
46382
  {
45929
46383
  label: chartTitle || "Data",
45930
- data: values,
46384
+ data: sortedValues,
45931
46385
  backgroundColor: colors,
45932
46386
  borderWidth: 0
45933
46387
  }
45934
46388
  ]
45935
46389
  };
45936
- return /* @__PURE__ */ jsxRuntimeExports.jsx(PieChart, { title: chartTitle, data: transformedData, units, content });
46390
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(PieChart, { title: chartTitle, data: transformedData, units, content, chartSettings });
45937
46391
  }
45938
46392
  function CopilotKitPieChart({
45939
46393
  widget,
@@ -45942,9 +46396,10 @@ function CopilotKitPieChart({
45942
46396
  onResetReady,
45943
46397
  widgetBackendUrl,
45944
46398
  datasetId,
45945
- widgetData
46399
+ widgetData,
46400
+ onConfigUpdate
45946
46401
  }) {
45947
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
46402
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
45948
46403
  const isFirstLoad = (_a = widget.config) == null ? void 0 : _a.isFirstLoad;
45949
46404
  const content = (_b = widget.config) == null ? void 0 : _b.content;
45950
46405
  const widget_data = (_c = widget.widget_data) == null ? void 0 : _c.pie_chart_data;
@@ -45984,7 +46439,7 @@ function CopilotKitPieChart({
45984
46439
  if (apiCallCount >= 30) {
45985
46440
  console.log("API call limit reached for widget:", widget.id);
45986
46441
  setHasTimeoutError(true);
45987
- setChartState((prevState) => __spreadProps$6(__spreadValues$8({}, prevState), {
46442
+ setChartState((prevState) => __spreadProps$7(__spreadValues$9({}, prevState), {
45988
46443
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
45989
46444
  }));
45990
46445
  return;
@@ -46084,7 +46539,9 @@ function CopilotKitPieChart({
46084
46539
  widgetId: widget.id,
46085
46540
  startLoadingTimeout,
46086
46541
  clearLoadingTimeout,
46087
- 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))
46542
+ 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)),
46543
+ chartSettings: (_r = widget.config) == null ? void 0 : _r.chartSettings,
46544
+ onConfigUpdate
46088
46545
  }
46089
46546
  ) })
46090
46547
  ] });
@@ -46096,7 +46553,8 @@ function PieChartWidget({
46096
46553
  onResetReady,
46097
46554
  widgetIds,
46098
46555
  datasetId,
46099
- widgetData
46556
+ widgetData,
46557
+ onConfigUpdate
46100
46558
  }) {
46101
46559
  var _a, _b;
46102
46560
  const styles = getStyleValues$3((_a = widget.config) == null ? void 0 : _a.styles);
@@ -46120,34 +46578,35 @@ function PieChartWidget({
46120
46578
  styles,
46121
46579
  onResetReady,
46122
46580
  widgetBackendUrl,
46123
- datasetId
46581
+ datasetId,
46582
+ onConfigUpdate
46124
46583
  }
46125
46584
  )
46126
46585
  }
46127
46586
  );
46128
46587
  }
46129
46588
 
46130
- var __defProp$7 = Object.defineProperty;
46131
- var __defProps$5 = Object.defineProperties;
46132
- var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
46133
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
46134
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
46135
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
46136
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46137
- var __spreadValues$7 = (a, b) => {
46589
+ var __defProp$8 = Object.defineProperty;
46590
+ var __defProps$6 = Object.defineProperties;
46591
+ var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
46592
+ var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
46593
+ var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
46594
+ var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
46595
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46596
+ var __spreadValues$8 = (a, b) => {
46138
46597
  for (var prop in b || (b = {}))
46139
- if (__hasOwnProp$7.call(b, prop))
46140
- __defNormalProp$7(a, prop, b[prop]);
46141
- if (__getOwnPropSymbols$7)
46142
- for (var prop of __getOwnPropSymbols$7(b)) {
46143
- if (__propIsEnum$7.call(b, prop))
46144
- __defNormalProp$7(a, prop, b[prop]);
46598
+ if (__hasOwnProp$8.call(b, prop))
46599
+ __defNormalProp$8(a, prop, b[prop]);
46600
+ if (__getOwnPropSymbols$8)
46601
+ for (var prop of __getOwnPropSymbols$8(b)) {
46602
+ if (__propIsEnum$8.call(b, prop))
46603
+ __defNormalProp$8(a, prop, b[prop]);
46145
46604
  }
46146
46605
  return a;
46147
46606
  };
46148
- var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
46607
+ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
46149
46608
  const CHART_REFRESH_TIMEOUT$2 = 3e3;
46150
- const DEFAULT_COLORS$1 = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
46609
+ const DEFAULT_COLORS$2 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
46151
46610
  const clearChat$2 = async (widgetBackendUrl, widgetId) => {
46152
46611
  if (!widgetBackendUrl || !widgetId) return;
46153
46612
  console.log("clearChat called for widgetId:", widgetId);
@@ -46242,7 +46701,7 @@ const parseAndUpdateChartState$2 = (apiResponse, setChartState) => {
46242
46701
  if (parsedState.state) {
46243
46702
  const chartData = parsedState.state;
46244
46703
  setChartState((prevState) => {
46245
- const newChartState = __spreadValues$7({}, prevState);
46704
+ const newChartState = __spreadValues$8({}, prevState);
46246
46705
  if (chartData.series_bar_chart_data) {
46247
46706
  newChartState.series_bar_chart_data = chartData.series_bar_chart_data;
46248
46707
  }
@@ -46292,9 +46751,11 @@ function SeriesBarChartComponent$1({
46292
46751
  startLoadingTimeout,
46293
46752
  clearLoadingTimeout,
46294
46753
  content,
46295
- hasWidgetData
46754
+ hasWidgetData,
46755
+ chartSettings,
46756
+ onConfigUpdate
46296
46757
  }) {
46297
- var _a, _b, _c, _d, _e, _f, _g, _h;
46758
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
46298
46759
  const hasCalledRef = useRef(false);
46299
46760
  const labels = ((_b = (_a = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) || [];
46300
46761
  const series = ((_d = (_c = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.series) || [];
@@ -46332,18 +46793,40 @@ function SeriesBarChartComponent$1({
46332
46793
  }
46333
46794
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout, seriesBarChartState]);
46334
46795
  const finalColors = useMemo(() => {
46335
- return shuffleColors(DEFAULT_COLORS$1, series.length);
46796
+ return shuffleColors(DEFAULT_COLORS$2, series.length);
46336
46797
  }, [series.length]);
46798
+ const sortedSeries = useMemo(() => {
46799
+ return [...series].sort(
46800
+ (a, b) => (a.name || "").localeCompare(b.name || "")
46801
+ );
46802
+ }, [series]);
46803
+ const colors = useMemo(() => {
46804
+ return sortedSeries.map((_, index) => finalColors[index % finalColors.length]);
46805
+ }, [sortedSeries, finalColors]);
46806
+ useEffect(() => {
46807
+ var _a2;
46808
+ if (!isEmpty && colors.length > 0 && !((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2.length) && onConfigUpdate && widgetId) {
46809
+ onConfigUpdate(widgetId, {
46810
+ chartSettings: __spreadProps$6(__spreadValues$8({}, chartSettings), {
46811
+ seriesColors: colors
46812
+ })
46813
+ });
46814
+ }
46815
+ }, [series.length, (_i = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _i.length, onConfigUpdate, widgetId, isEmpty]);
46337
46816
  if (isEmpty) {
46338
46817
  return createLoadingComponent$2();
46339
46818
  }
46340
46819
  const transformedData = {
46341
46820
  labels,
46342
- datasets: series.map((seriesItem, index) => ({
46343
- label: seriesItem.name,
46344
- data: seriesItem.values,
46345
- backgroundColor: (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length]
46346
- }))
46821
+ datasets: sortedSeries.map((seriesItem, index) => {
46822
+ var _a2;
46823
+ 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];
46824
+ return {
46825
+ label: seriesItem.name,
46826
+ data: seriesItem.values,
46827
+ backgroundColor: color
46828
+ };
46829
+ })
46347
46830
  };
46348
46831
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
46349
46832
  SeriesChart,
@@ -46354,7 +46837,8 @@ function SeriesBarChartComponent$1({
46354
46837
  units,
46355
46838
  content,
46356
46839
  x_axis_title,
46357
- y_axis_title
46840
+ y_axis_title,
46841
+ chartSettings
46358
46842
  }
46359
46843
  );
46360
46844
  }
@@ -46365,9 +46849,10 @@ function CopilotKitSeriesBarChart$1({
46365
46849
  onResetReady,
46366
46850
  widgetBackendUrl,
46367
46851
  datasetId,
46368
- widgetData
46852
+ widgetData,
46853
+ onConfigUpdate
46369
46854
  }) {
46370
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
46855
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
46371
46856
  const orientation = ((_a = widget.config) == null ? void 0 : _a.orientation) || "vertical";
46372
46857
  const isFirstLoad = (_b = widget.config) == null ? void 0 : _b.isFirstLoad;
46373
46858
  const content = (_c = widget.config) == null ? void 0 : _c.content;
@@ -46408,7 +46893,7 @@ function CopilotKitSeriesBarChart$1({
46408
46893
  if (apiCallCount >= 30) {
46409
46894
  console.log("API call limit reached for widget:", widget.id);
46410
46895
  setHasTimeoutError(true);
46411
- setChartState((prevState) => __spreadProps$5(__spreadValues$7({}, prevState), {
46896
+ setChartState((prevState) => __spreadProps$6(__spreadValues$8({}, prevState), {
46412
46897
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
46413
46898
  }));
46414
46899
  return;
@@ -46509,7 +46994,9 @@ function CopilotKitSeriesBarChart$1({
46509
46994
  widgetId: widget.id,
46510
46995
  startLoadingTimeout,
46511
46996
  clearLoadingTimeout,
46512
- 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))
46997
+ 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)),
46998
+ chartSettings: (_s = widget.config) == null ? void 0 : _s.chartSettings,
46999
+ onConfigUpdate
46513
47000
  }
46514
47001
  ) })
46515
47002
  ] });
@@ -46521,7 +47008,8 @@ function SeriesBarChartWidget({
46521
47008
  onResetReady,
46522
47009
  widgetIds,
46523
47010
  datasetId,
46524
- widgetData
47011
+ widgetData,
47012
+ onConfigUpdate
46525
47013
  }) {
46526
47014
  var _a, _b;
46527
47015
  const styles = getStyleValues$2((_a = widget.config) == null ? void 0 : _a.styles);
@@ -46545,34 +47033,35 @@ function SeriesBarChartWidget({
46545
47033
  styles,
46546
47034
  onResetReady,
46547
47035
  widgetBackendUrl,
46548
- datasetId
47036
+ datasetId,
47037
+ onConfigUpdate
46549
47038
  }
46550
47039
  )
46551
47040
  }
46552
47041
  );
46553
47042
  }
46554
47043
 
46555
- var __defProp$6 = Object.defineProperty;
46556
- var __defProps$4 = Object.defineProperties;
46557
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
46558
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
46559
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
46560
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
46561
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46562
- var __spreadValues$6 = (a, b) => {
47044
+ var __defProp$7 = Object.defineProperty;
47045
+ var __defProps$5 = Object.defineProperties;
47046
+ var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
47047
+ var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
47048
+ var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
47049
+ var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
47050
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47051
+ var __spreadValues$7 = (a, b) => {
46563
47052
  for (var prop in b || (b = {}))
46564
- if (__hasOwnProp$6.call(b, prop))
46565
- __defNormalProp$6(a, prop, b[prop]);
46566
- if (__getOwnPropSymbols$6)
46567
- for (var prop of __getOwnPropSymbols$6(b)) {
46568
- if (__propIsEnum$6.call(b, prop))
46569
- __defNormalProp$6(a, prop, b[prop]);
47053
+ if (__hasOwnProp$7.call(b, prop))
47054
+ __defNormalProp$7(a, prop, b[prop]);
47055
+ if (__getOwnPropSymbols$7)
47056
+ for (var prop of __getOwnPropSymbols$7(b)) {
47057
+ if (__propIsEnum$7.call(b, prop))
47058
+ __defNormalProp$7(a, prop, b[prop]);
46570
47059
  }
46571
47060
  return a;
46572
47061
  };
46573
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
47062
+ var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
46574
47063
  const CHART_REFRESH_TIMEOUT$1 = 3e3;
46575
- const DEFAULT_COLORS = ["#E4DCB8", "#DAC46C", "#808080", "#582809", "#A3ADD0", "#398E6F", "#AF123D", "#8C99C4", "#5290AC", "#601B07", "#50649D", "#B4A8A0", "#6F2587"];
47064
+ const DEFAULT_COLORS$1 = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
46576
47065
  const clearChat$1 = async (widgetBackendUrl, widgetId) => {
46577
47066
  if (!widgetBackendUrl || !widgetId) return;
46578
47067
  console.log("clearChat called for widgetId:", widgetId);
@@ -46667,7 +47156,7 @@ const parseAndUpdateChartState$1 = (apiResponse, setChartState) => {
46667
47156
  if (parsedState.state) {
46668
47157
  const chartData = parsedState.state;
46669
47158
  setChartState((prevState) => {
46670
- const newChartState = __spreadValues$6({}, prevState);
47159
+ const newChartState = __spreadValues$7({}, prevState);
46671
47160
  if (chartData.series_bar_chart_data) {
46672
47161
  newChartState.series_bar_chart_data = chartData.series_bar_chart_data;
46673
47162
  }
@@ -46717,9 +47206,11 @@ function SeriesBarChartComponent({
46717
47206
  startLoadingTimeout,
46718
47207
  clearLoadingTimeout,
46719
47208
  content,
46720
- hasWidgetData
47209
+ hasWidgetData,
47210
+ chartSettings,
47211
+ onConfigUpdate
46721
47212
  }) {
46722
- var _a, _b, _c, _d, _e, _f, _g, _h;
47213
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
46723
47214
  const hasCalledRef = useRef(false);
46724
47215
  const labels = ((_b = (_a = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _a.data) == null ? void 0 : _b.labels) || [];
46725
47216
  const series = ((_d = (_c = seriesBarChartState == null ? void 0 : seriesBarChartState.series_bar_chart_data) == null ? void 0 : _c.data) == null ? void 0 : _d.series) || [];
@@ -46757,18 +47248,49 @@ function SeriesBarChartComponent({
46757
47248
  }
46758
47249
  }, [isEmpty, startLoadingTimeout, clearLoadingTimeout, seriesBarChartState]);
46759
47250
  const finalColors = useMemo(() => {
46760
- return shuffleColors(DEFAULT_COLORS, series.length);
47251
+ return shuffleColors(DEFAULT_COLORS$1, series.length);
46761
47252
  }, [series.length]);
47253
+ const sortedSeries = useMemo(() => {
47254
+ return [...series].sort(
47255
+ (a, b) => (a.name || "").localeCompare(b.name || "")
47256
+ );
47257
+ }, [series]);
47258
+ const colors = useMemo(() => {
47259
+ return sortedSeries.map((_, index) => finalColors[index % finalColors.length]);
47260
+ }, [sortedSeries, finalColors]);
47261
+ useEffect(() => {
47262
+ var _a2;
47263
+ if (!isEmpty && colors.length > 0 && !((_a2 = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _a2.length) && onConfigUpdate && widgetId) {
47264
+ onConfigUpdate(widgetId, {
47265
+ chartSettings: __spreadProps$5(__spreadValues$7({}, chartSettings), {
47266
+ seriesColors: colors
47267
+ })
47268
+ });
47269
+ }
47270
+ }, [series.length, (_i = chartSettings == null ? void 0 : chartSettings.seriesColors) == null ? void 0 : _i.length, onConfigUpdate, widgetId, isEmpty]);
46762
47271
  if (isEmpty) {
46763
47272
  return createLoadingComponent$1();
46764
47273
  }
46765
47274
  const transformedData = {
46766
47275
  labels,
46767
- datasets: series.map((seriesItem, index) => ({
46768
- label: seriesItem.name,
46769
- data: seriesItem.values,
46770
- backgroundColor: (seriesItem == null ? void 0 : seriesItem.colors) || (seriesItem == null ? void 0 : seriesItem.color) || finalColors[index % finalColors.length]
46771
- }))
47276
+ datasets: sortedSeries.map((seriesItem, index) => {
47277
+ var _a2, _b2, _c2;
47278
+ 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];
47279
+ return {
47280
+ label: seriesItem.name,
47281
+ data: seriesItem.values,
47282
+ borderColor: color,
47283
+ backgroundColor: color + "26",
47284
+ // 15% opacity for subtle fill under curve
47285
+ borderWidth: (_b2 = chartSettings == null ? void 0 : chartSettings.lineWidth) != null ? _b2 : 2.5,
47286
+ fill: false,
47287
+ pointRadius: (_c2 = chartSettings == null ? void 0 : chartSettings.pointRadius) != null ? _c2 : 4,
47288
+ pointHoverRadius: 6,
47289
+ pointBackgroundColor: color,
47290
+ pointBorderColor: "#ffffff",
47291
+ pointBorderWidth: 2
47292
+ };
47293
+ })
46772
47294
  };
46773
47295
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
46774
47296
  SeriesLineChart,
@@ -46779,7 +47301,8 @@ function SeriesBarChartComponent({
46779
47301
  units,
46780
47302
  content,
46781
47303
  x_axis_title,
46782
- y_axis_title
47304
+ y_axis_title,
47305
+ chartSettings
46783
47306
  }
46784
47307
  );
46785
47308
  }
@@ -46790,9 +47313,10 @@ function CopilotKitSeriesBarChart({
46790
47313
  onResetReady,
46791
47314
  widgetBackendUrl,
46792
47315
  datasetId,
46793
- widgetData
47316
+ widgetData,
47317
+ onConfigUpdate
46794
47318
  }) {
46795
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
47319
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
46796
47320
  const orientation = ((_a = widget.config) == null ? void 0 : _a.orientation) || "vertical";
46797
47321
  const isFirstLoad = (_b = widget.config) == null ? void 0 : _b.isFirstLoad;
46798
47322
  const content = (_c = widget.config) == null ? void 0 : _c.content;
@@ -46833,7 +47357,7 @@ function CopilotKitSeriesBarChart({
46833
47357
  if (apiCallCount >= 30) {
46834
47358
  console.log("API call limit reached for widget:", widget.id);
46835
47359
  setHasTimeoutError(true);
46836
- setChartState((prevState) => __spreadProps$4(__spreadValues$6({}, prevState), {
47360
+ setChartState((prevState) => __spreadProps$5(__spreadValues$7({}, prevState), {
46837
47361
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
46838
47362
  }));
46839
47363
  return;
@@ -46934,7 +47458,9 @@ function CopilotKitSeriesBarChart({
46934
47458
  widgetId: widget.id,
46935
47459
  startLoadingTimeout,
46936
47460
  clearLoadingTimeout,
46937
- 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))
47461
+ 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)),
47462
+ chartSettings: (_s = widget.config) == null ? void 0 : _s.chartSettings,
47463
+ onConfigUpdate
46938
47464
  }
46939
47465
  ) })
46940
47466
  ] });
@@ -46946,7 +47472,8 @@ function SeriesLineChartWidget({
46946
47472
  onResetReady,
46947
47473
  widgetIds,
46948
47474
  datasetId,
46949
- widgetData
47475
+ widgetData,
47476
+ onConfigUpdate
46950
47477
  }) {
46951
47478
  var _a, _b;
46952
47479
  const styles = getStyleValues$1((_a = widget.config) == null ? void 0 : _a.styles);
@@ -46970,32 +47497,33 @@ function SeriesLineChartWidget({
46970
47497
  styles,
46971
47498
  onResetReady,
46972
47499
  widgetBackendUrl,
46973
- datasetId
47500
+ datasetId,
47501
+ onConfigUpdate
46974
47502
  }
46975
47503
  )
46976
47504
  }
46977
47505
  );
46978
47506
  }
46979
47507
 
46980
- var __defProp$5 = Object.defineProperty;
46981
- var __defProps$3 = Object.defineProperties;
46982
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
46983
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
46984
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
46985
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
46986
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
46987
- var __spreadValues$5 = (a, b) => {
47508
+ var __defProp$6 = Object.defineProperty;
47509
+ var __defProps$4 = Object.defineProperties;
47510
+ var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
47511
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
47512
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
47513
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
47514
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47515
+ var __spreadValues$6 = (a, b) => {
46988
47516
  for (var prop in b || (b = {}))
46989
- if (__hasOwnProp$5.call(b, prop))
46990
- __defNormalProp$5(a, prop, b[prop]);
46991
- if (__getOwnPropSymbols$5)
46992
- for (var prop of __getOwnPropSymbols$5(b)) {
46993
- if (__propIsEnum$5.call(b, prop))
46994
- __defNormalProp$5(a, prop, b[prop]);
47517
+ if (__hasOwnProp$6.call(b, prop))
47518
+ __defNormalProp$6(a, prop, b[prop]);
47519
+ if (__getOwnPropSymbols$6)
47520
+ for (var prop of __getOwnPropSymbols$6(b)) {
47521
+ if (__propIsEnum$6.call(b, prop))
47522
+ __defNormalProp$6(a, prop, b[prop]);
46995
47523
  }
46996
47524
  return a;
46997
47525
  };
46998
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
47526
+ var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
46999
47527
  const CHART_REFRESH_TIMEOUT = 3e3;
47000
47528
  const clearChat = async (widgetBackendUrl, widgetId) => {
47001
47529
  if (!widgetBackendUrl || !widgetId) return;
@@ -47082,7 +47610,7 @@ const parseAndUpdateChartState = (apiResponse, setChartState) => {
47082
47610
  if (parsedState.state) {
47083
47611
  const chartData = parsedState.state;
47084
47612
  setChartState((prevState) => {
47085
- const newChartState = __spreadValues$5({}, prevState);
47613
+ const newChartState = __spreadValues$6({}, prevState);
47086
47614
  if (chartData.matrix_grid_data) {
47087
47615
  newChartState.matrix_grid_data = chartData.matrix_grid_data;
47088
47616
  }
@@ -47229,7 +47757,7 @@ function CopilotKitDataGrid({
47229
47757
  if (apiCallCount >= 30) {
47230
47758
  console.log("API call limit reached for widget:", widget.id);
47231
47759
  setHasTimeoutError(true);
47232
- setChartState((prevState) => __spreadProps$3(__spreadValues$5({}, prevState), {
47760
+ setChartState((prevState) => __spreadProps$4(__spreadValues$6({}, prevState), {
47233
47761
  agent_message: "Timeout: Unable to load data after multiple attempts. Please try refreshing the widget."
47234
47762
  }));
47235
47763
  return;
@@ -47383,7 +47911,9 @@ function WidgetRenderer({
47383
47911
  pageId,
47384
47912
  onApplyFilters,
47385
47913
  isEditing = false,
47386
- dashboardName
47914
+ dashboardName,
47915
+ onClearChat,
47916
+ isClearing
47387
47917
  }) {
47388
47918
  const handleConfigUpdate = (config) => {
47389
47919
  if (onConfigUpdate) {
@@ -47415,7 +47945,7 @@ function WidgetRenderer({
47415
47945
  }
47416
47946
  );
47417
47947
  case "chatbot":
47418
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ChatbotWidget, { widget, showHeader: false, widgetBackendUrl, onResetReady, widgetIds, datasetId, dashboardName });
47948
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ChatbotWidget, { widget, showHeader: false, widgetBackendUrl, onResetReady, widgetIds, datasetId, dashboardName, onClearChat: onClearChat ? () => onClearChat(widget.id) : void 0, isClearing: isClearing === widget.id });
47419
47949
  case "filters":
47420
47950
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
47421
47951
  FiltersWidget,
@@ -47439,7 +47969,8 @@ function WidgetRenderer({
47439
47969
  widgetBackendUrl,
47440
47970
  onResetReady,
47441
47971
  widgetIds,
47442
- datasetId
47972
+ datasetId,
47973
+ onConfigUpdate
47443
47974
  }
47444
47975
  ) : widget.config.agentType === "Series Bar Chart Agent" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
47445
47976
  SeriesBarChartWidget,
@@ -47449,7 +47980,8 @@ function WidgetRenderer({
47449
47980
  widgetBackendUrl,
47450
47981
  onResetReady,
47451
47982
  widgetIds,
47452
- datasetId
47983
+ datasetId,
47984
+ onConfigUpdate
47453
47985
  }
47454
47986
  ) : widget.config.agentType === "Series Line Chart Agent" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
47455
47987
  SeriesLineChartWidget,
@@ -47459,7 +47991,8 @@ function WidgetRenderer({
47459
47991
  widgetBackendUrl,
47460
47992
  onResetReady,
47461
47993
  widgetIds,
47462
- datasetId
47994
+ datasetId,
47995
+ onConfigUpdate
47463
47996
  }
47464
47997
  ) : widget.config.agentType === "Data Grid Agent" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
47465
47998
  DatagridWidget,
@@ -47492,39 +48025,39 @@ function WidgetRenderer({
47492
48025
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${(widget == null ? void 0 : widget.type) === "text" ? "" : "h-full"}`, children: renderWidget() });
47493
48026
  }
47494
48027
 
47495
- var __defProp$4 = Object.defineProperty;
47496
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
47497
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
47498
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
47499
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
47500
- var __spreadValues$4 = (a, b) => {
48028
+ var __defProp$5 = Object.defineProperty;
48029
+ var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
48030
+ var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
48031
+ var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
48032
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
48033
+ var __spreadValues$5 = (a, b) => {
47501
48034
  for (var prop in b || (b = {}))
47502
- if (__hasOwnProp$4.call(b, prop))
47503
- __defNormalProp$4(a, prop, b[prop]);
47504
- if (__getOwnPropSymbols$4)
47505
- for (var prop of __getOwnPropSymbols$4(b)) {
47506
- if (__propIsEnum$4.call(b, prop))
47507
- __defNormalProp$4(a, prop, b[prop]);
48035
+ if (__hasOwnProp$5.call(b, prop))
48036
+ __defNormalProp$5(a, prop, b[prop]);
48037
+ if (__getOwnPropSymbols$5)
48038
+ for (var prop of __getOwnPropSymbols$5(b)) {
48039
+ if (__propIsEnum$5.call(b, prop))
48040
+ __defNormalProp$5(a, prop, b[prop]);
47508
48041
  }
47509
48042
  return a;
47510
48043
  };
47511
- var __objRest$1 = (source, exclude) => {
48044
+ var __objRest$2 = (source, exclude) => {
47512
48045
  var target = {};
47513
48046
  for (var prop in source)
47514
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
48047
+ if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
47515
48048
  target[prop] = source[prop];
47516
- if (source != null && __getOwnPropSymbols$4)
47517
- for (var prop of __getOwnPropSymbols$4(source)) {
47518
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
48049
+ if (source != null && __getOwnPropSymbols$5)
48050
+ for (var prop of __getOwnPropSymbols$5(source)) {
48051
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
47519
48052
  target[prop] = source[prop];
47520
48053
  }
47521
48054
  return target;
47522
48055
  };
47523
48056
  const Textarea = React.forwardRef((_a, ref) => {
47524
- var _b = _a, { className } = _b, props = __objRest$1(_b, ["className"]);
48057
+ var _b = _a, { className } = _b, props = __objRest$2(_b, ["className"]);
47525
48058
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
47526
48059
  "textarea",
47527
- __spreadValues$4({
48060
+ __spreadValues$5({
47528
48061
  className: cn(
47529
48062
  "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",
47530
48063
  className
@@ -47645,6 +48178,57 @@ function Modal({
47645
48178
  );
47646
48179
  }
47647
48180
 
48181
+ var __defProp$4 = Object.defineProperty;
48182
+ var __defProps$3 = Object.defineProperties;
48183
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
48184
+ var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
48185
+ var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
48186
+ var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
48187
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
48188
+ var __spreadValues$4 = (a, b) => {
48189
+ for (var prop in b || (b = {}))
48190
+ if (__hasOwnProp$4.call(b, prop))
48191
+ __defNormalProp$4(a, prop, b[prop]);
48192
+ if (__getOwnPropSymbols$4)
48193
+ for (var prop of __getOwnPropSymbols$4(b)) {
48194
+ if (__propIsEnum$4.call(b, prop))
48195
+ __defNormalProp$4(a, prop, b[prop]);
48196
+ }
48197
+ return a;
48198
+ };
48199
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
48200
+ var __objRest$1 = (source, exclude) => {
48201
+ var target = {};
48202
+ for (var prop in source)
48203
+ if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
48204
+ target[prop] = source[prop];
48205
+ if (source != null && __getOwnPropSymbols$4)
48206
+ for (var prop of __getOwnPropSymbols$4(source)) {
48207
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
48208
+ target[prop] = source[prop];
48209
+ }
48210
+ return target;
48211
+ };
48212
+ const Slider = React.forwardRef((_a, ref) => {
48213
+ var _b = _a, { className } = _b, props = __objRest$1(_b, ["className"]);
48214
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
48215
+ SliderPrimitive.Root,
48216
+ __spreadProps$3(__spreadValues$4({
48217
+ ref,
48218
+ className: cn(
48219
+ "relative flex w-full touch-none select-none items-center",
48220
+ className
48221
+ )
48222
+ }, props), {
48223
+ children: [
48224
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SliderPrimitive.Track, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SliderPrimitive.Range, { className: "absolute h-full bg-primary" }) }),
48225
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SliderPrimitive.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" })
48226
+ ]
48227
+ })
48228
+ );
48229
+ });
48230
+ Slider.displayName = SliderPrimitive.Root.displayName;
48231
+
47648
48232
  var __defProp$3 = Object.defineProperty;
47649
48233
  var __defProps$2 = Object.defineProperties;
47650
48234
  var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
@@ -47664,9 +48248,63 @@ var __spreadValues$3 = (a, b) => {
47664
48248
  return a;
47665
48249
  };
47666
48250
  var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
48251
+ const isChartWidget = (agentType) => {
48252
+ if (!agentType) return false;
48253
+ return agentType === "Pie Chart Agent" || agentType === "Line Chart Agent" || agentType === "Series Line Chart Agent" || agentType === "Bar Chart Agent" || agentType === "Series Bar Chart Agent";
48254
+ };
48255
+ const isLineChart = (agentType) => {
48256
+ if (!agentType) return false;
48257
+ return agentType === "Line Chart Agent" || agentType === "Series Line Chart Agent";
48258
+ };
48259
+ const DEFAULT_COLORS = ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#06B6D4", "#F97316", "#EC4899", "#14B8A6", "#6366F1", "#84CC16", "#FB7185", "#A78BFA", "#34D399", "#FBBF24"];
48260
+ const getSeriesNames = (widget) => {
48261
+ var _a, _b, _c, _d;
48262
+ const data = widget == null ? void 0 : widget.widget_data;
48263
+ if (!data) return [];
48264
+ 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)) {
48265
+ return data.pie_chart_data.data.labels.sort();
48266
+ }
48267
+ 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)) {
48268
+ return data.series_bar_chart_data.data.series.map((item) => item.name || item.label || "").filter((name) => name !== "").sort();
48269
+ }
48270
+ if (Array.isArray(data)) {
48271
+ const names = /* @__PURE__ */ new Set();
48272
+ data.forEach((item) => {
48273
+ if (item.series_name) names.add(item.series_name);
48274
+ if (item.label) names.add(item.label);
48275
+ });
48276
+ return Array.from(names).sort();
48277
+ }
48278
+ return [];
48279
+ };
48280
+ const getDefaultSeriesColors = (widget) => {
48281
+ var _a, _b, _c, _d;
48282
+ const data = widget == null ? void 0 : widget.widget_data;
48283
+ if (!data) return [];
48284
+ 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)) {
48285
+ const labels = data.pie_chart_data.data.labels;
48286
+ return shuffleColors(DEFAULT_COLORS, labels.length);
48287
+ }
48288
+ 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)) {
48289
+ const series = data.series_bar_chart_data.data.series;
48290
+ return shuffleColors(DEFAULT_COLORS, series.length);
48291
+ }
48292
+ if (Array.isArray(data)) {
48293
+ const series = /* @__PURE__ */ new Set();
48294
+ data.forEach((item) => {
48295
+ if (item.series_name) series.add(item.series_name);
48296
+ if (item.label) series.add(item.label);
48297
+ });
48298
+ const seriesArray = Array.from(series).sort();
48299
+ return shuffleColors(DEFAULT_COLORS, seriesArray.length);
48300
+ }
48301
+ return [];
48302
+ };
47667
48303
  function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onClose, onSubmit }) {
47668
- var _a;
48304
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
47669
48305
  const agentType = (_a = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _a.agentType;
48306
+ const isChart = isChartWidget(agentType);
48307
+ const isLine = isLineChart(agentType);
47670
48308
  const [query, setQuery] = useState("");
47671
48309
  const [displayText, setDisplayText] = useState("");
47672
48310
  const [blockType, setBlockType] = useState("");
@@ -47674,13 +48312,42 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
47674
48312
  const [divider, setDivider] = useState("no");
47675
48313
  const [showLabels, setShowLabels] = useState(false);
47676
48314
  const [styles, setStyles] = useState("");
48315
+ const [chartSettings, setChartSettings] = useState({
48316
+ showLegend: true,
48317
+ legendBoxSize: 16,
48318
+ legendFontSize: 13,
48319
+ lineWidth: 2.5,
48320
+ lineTension: 0.3,
48321
+ pointRadius: 4,
48322
+ showLabels: false,
48323
+ seriesColors: [],
48324
+ dataLabelsFontSize: 12,
48325
+ showTitle: true,
48326
+ titleText: "",
48327
+ titleFontSize: 16,
48328
+ xAxisTitleFontSize: 13,
48329
+ yAxisTitleFontSize: 13,
48330
+ xAxisTickFontSize: 12,
48331
+ yAxisTickFontSize: 12,
48332
+ tooltipFontSize: 12
48333
+ });
48334
+ const seriesNames = getSeriesNames(editingWidget);
48335
+ const defaultSeriesColors = getDefaultSeriesColors(editingWidget);
48336
+ const colorCount = seriesNames.length || ((_b = chartSettings.seriesColors) == null ? void 0 : _b.length) || defaultSeriesColors.length || 0;
48337
+ const displaySeriesNames = seriesNames.length > 0 ? seriesNames : Array.from({ length: colorCount }, (_, i) => `Series ${i + 1}`);
48338
+ useEffect(() => {
48339
+ console.log("[EditWidgetDialog] Series names:", seriesNames);
48340
+ console.log("[EditWidgetDialog] Default colors:", defaultSeriesColors);
48341
+ console.log("[EditWidgetDialog] Display series names:", displaySeriesNames);
48342
+ }, [seriesNames, defaultSeriesColors, displaySeriesNames]);
47677
48343
  useEffect(() => {
47678
48344
  setQuery(initialText);
47679
48345
  }, [initialText]);
47680
48346
  useEffect(() => {
47681
- var _a2, _b;
48347
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q, _r, _s, _t;
47682
48348
  const content = (_a2 = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _a2.content;
47683
- const cssStyles = (_b = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _b.styles;
48349
+ const cssStyles = (_b2 = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _b2.styles;
48350
+ const savedChartSettings = (_c2 = editingWidget == null ? void 0 : editingWidget.config) == null ? void 0 : _c2.chartSettings;
47684
48351
  const text = content == null ? void 0 : content.displayText;
47685
48352
  if (text == null ? void 0 : text.length) {
47686
48353
  setDisplayText(text);
@@ -47701,63 +48368,114 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
47701
48368
  if (hasShowLabel !== void 0) {
47702
48369
  setShowLabels(hasShowLabel);
47703
48370
  }
48371
+ if (savedChartSettings) {
48372
+ setChartSettings({
48373
+ showLegend: (_d2 = savedChartSettings.showLegend) != null ? _d2 : true,
48374
+ legendBoxSize: (_e2 = savedChartSettings.legendBoxSize) != null ? _e2 : 16,
48375
+ legendFontSize: (_f2 = savedChartSettings.legendFontSize) != null ? _f2 : 13,
48376
+ lineWidth: (_g2 = savedChartSettings.lineWidth) != null ? _g2 : 2.5,
48377
+ lineTension: (_h2 = savedChartSettings.lineTension) != null ? _h2 : 0.3,
48378
+ pointRadius: (_i2 = savedChartSettings.pointRadius) != null ? _i2 : 4,
48379
+ showLabels: (_j2 = savedChartSettings.showLabels) != null ? _j2 : false,
48380
+ seriesColors: (_k2 = savedChartSettings.seriesColors) != null ? _k2 : defaultSeriesColors,
48381
+ dataLabelsFontSize: (_l2 = savedChartSettings.dataLabelsFontSize) != null ? _l2 : 12,
48382
+ showTitle: (_m2 = savedChartSettings.showTitle) != null ? _m2 : true,
48383
+ titleText: (_n2 = savedChartSettings.titleText) != null ? _n2 : "",
48384
+ titleFontSize: (_o2 = savedChartSettings.titleFontSize) != null ? _o2 : 16,
48385
+ xAxisTitleFontSize: (_p2 = savedChartSettings.xAxisTitleFontSize) != null ? _p2 : 13,
48386
+ yAxisTitleFontSize: (_q = savedChartSettings.yAxisTitleFontSize) != null ? _q : 13,
48387
+ xAxisTickFontSize: (_r = savedChartSettings.xAxisTickFontSize) != null ? _r : 12,
48388
+ yAxisTickFontSize: (_s = savedChartSettings.yAxisTickFontSize) != null ? _s : 12,
48389
+ tooltipFontSize: (_t = savedChartSettings.tooltipFontSize) != null ? _t : 12
48390
+ });
48391
+ } else {
48392
+ setChartSettings({
48393
+ showLegend: true,
48394
+ legendBoxSize: 16,
48395
+ legendFontSize: 13,
48396
+ lineWidth: 2.5,
48397
+ lineTension: 0.3,
48398
+ pointRadius: 4,
48399
+ showLabels: hasShowLabel != null ? hasShowLabel : false,
48400
+ seriesColors: defaultSeriesColors,
48401
+ dataLabelsFontSize: 12,
48402
+ showTitle: true,
48403
+ titleText: "",
48404
+ titleFontSize: 16,
48405
+ xAxisTitleFontSize: 13,
48406
+ yAxisTitleFontSize: 13,
48407
+ xAxisTickFontSize: 12,
48408
+ yAxisTickFontSize: 12,
48409
+ tooltipFontSize: 12
48410
+ });
48411
+ }
47704
48412
  }, [editingWidget]);
47705
48413
  const handleSubmit = () => {
48414
+ var _a2;
47706
48415
  if (onSubmit && query.trim()) {
47707
- onSubmit(query, showLabels);
48416
+ if (isChart) {
48417
+ onSubmit(query, (_a2 = chartSettings.showLabels) != null ? _a2 : false, chartSettings);
48418
+ } else {
48419
+ onSubmit(query, showLabels);
48420
+ }
47708
48421
  }
47709
48422
  if (editingWidget.type === "text") {
47710
48423
  const widgetId = editingWidget == null ? void 0 : editingWidget.id;
47711
- setWidgets && setWidgets((prev) => prev.map((w) => {
47712
- if (w.id === widgetId) {
47713
- return __spreadProps$2(__spreadValues$3({}, w), {
47714
- config: __spreadProps$2(__spreadValues$3({}, w.config), {
47715
- content: __spreadProps$2(__spreadValues$3({}, w.config.content), {
47716
- displayText,
47717
- blockType,
47718
- divider
47719
- }),
47720
- styles: __spreadValues$3(__spreadValues$3({}, w.config.styles), alignment && alignment.length > 0 ? { textAlign: alignment } : {})
47721
- })
47722
- });
47723
- }
47724
- return w;
47725
- }));
48424
+ setWidgets && setWidgets(
48425
+ (prev) => prev.map((w) => {
48426
+ if (w.id === widgetId) {
48427
+ return __spreadProps$2(__spreadValues$3({}, w), {
48428
+ config: __spreadProps$2(__spreadValues$3({}, w.config), {
48429
+ content: __spreadProps$2(__spreadValues$3({}, w.config.content), {
48430
+ displayText,
48431
+ blockType,
48432
+ divider
48433
+ }),
48434
+ styles: __spreadValues$3(__spreadValues$3({}, w.config.styles), alignment && alignment.length > 0 ? { textAlign: alignment } : {})
48435
+ })
48436
+ });
48437
+ }
48438
+ return w;
48439
+ })
48440
+ );
47726
48441
  onClose && onClose();
47727
48442
  }
47728
48443
  };
47729
48444
  if (!isOpen) return null;
47730
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
48445
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
47731
48446
  Modal,
47732
48447
  {
47733
48448
  isOpen,
47734
48449
  onClose,
47735
48450
  title: "Edit Widget",
47736
- size: "lg",
48451
+ size: "xl",
47737
48452
  noOverflowHidden: true,
47738
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
47739
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-gray-700", children: "Customize the widget\u2019s appearance" }),
47740
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "pt-7", children: [
47741
- (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: [
47742
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Data Labels:" }),
47743
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47744
- Select,
47745
- {
47746
- value: showLabels ? "yes" : "no",
47747
- onValueChange: (value) => setShowLabels(value === "yes"),
47748
- children: [
47749
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Visible data labels?" }) }),
47750
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47751
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
47752
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
47753
- ] })
47754
- ]
47755
- }
47756
- )
47757
- ] }),
47758
- (editingWidget == null ? void 0 : editingWidget.type) === "text" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-5", children: [
47759
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47760
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Display text:" }),
48453
+ children: [
48454
+ /* @__PURE__ */ jsxRuntimeExports.jsx("style", { children: `
48455
+ .dialog-scrollable::-webkit-scrollbar {
48456
+ width: 6px;
48457
+ }
48458
+ .dialog-scrollable::-webkit-scrollbar-track {
48459
+ background: #f1f5f9;
48460
+ border-radius: 3px;
48461
+ }
48462
+ .dialog-scrollable::-webkit-scrollbar-thumb {
48463
+ background: #cbd5e1;
48464
+ border-radius: 3px;
48465
+ }
48466
+ .dialog-scrollable::-webkit-scrollbar-thumb:hover {
48467
+ background: #94a3b8;
48468
+ }
48469
+ .dialog-scrollable {
48470
+ scrollbar-width: thin;
48471
+ scrollbar-color: #cbd5e1 #f1f5f9;
48472
+ }
48473
+ ` }),
48474
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col h-[calc(100vh-260px)] bg-white rounded-lg", children: [
48475
+ /* @__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" }) }),
48476
+ /* @__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: [
48477
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48478
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Display text" }),
47761
48479
  /* @__PURE__ */ jsxRuntimeExports.jsx(
47762
48480
  Input,
47763
48481
  {
@@ -47767,88 +48485,463 @@ function EditWidgetDialog({ editingWidget, setWidgets, initialText, isOpen, onCl
47767
48485
  }
47768
48486
  )
47769
48487
  ] }),
47770
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47771
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Block type:" }),
47772
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47773
- Select,
47774
- {
47775
- value: blockType,
47776
- onValueChange: (value) => setBlockType(value),
47777
- children: [
47778
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }),
47779
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47780
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-1", children: "Heading 1" }),
47781
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-2", children: "Heading 2" }),
47782
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-3", children: "Heading 3" }),
47783
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "paragraph", children: "Paragraph" })
47784
- ] })
47785
- ]
47786
- }
47787
- )
48488
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48489
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Block type" }),
48490
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: blockType, onValueChange: (value) => setBlockType(value), children: [
48491
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }),
48492
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48493
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-1", children: "Heading 1" }),
48494
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-2", children: "Heading 2" }),
48495
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "heading-3", children: "Heading 3" }),
48496
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "paragraph", children: "Paragraph" })
48497
+ ] })
48498
+ ] })
47788
48499
  ] }),
47789
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47790
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Align:" }),
47791
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47792
- Select,
47793
- {
47794
- value: alignment,
47795
- onValueChange: (value) => setAlignment(value),
47796
- children: [
47797
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select block type" }) }),
47798
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47799
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "left", children: "Left" }),
47800
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "center", children: "Center" }),
47801
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "right", children: "Right" }),
47802
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "justify", children: "Justify" })
47803
- ] })
47804
- ]
47805
- }
47806
- )
48500
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48501
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Alignment" }),
48502
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: alignment, onValueChange: (value) => setAlignment(value), children: [
48503
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select alignment" }) }),
48504
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48505
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "left", children: "Left" }),
48506
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "center", children: "Center" }),
48507
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "right", children: "Right" }),
48508
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "justify", children: "Justify" })
48509
+ ] })
48510
+ ] })
47807
48511
  ] }),
47808
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47809
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Divider:" }),
47810
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
47811
- Select,
48512
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48513
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Divider" }),
48514
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: divider, onValueChange: (value) => setDivider(value), children: [
48515
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "No" }) }),
48516
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48517
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" }),
48518
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" })
48519
+ ] })
48520
+ ] })
48521
+ ] })
48522
+ ] }) : isChart ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6", children: [
48523
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48524
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Query" }),
48525
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
48526
+ Textarea,
47812
48527
  {
47813
- value: divider,
47814
- onValueChange: (value) => setDivider(value),
47815
- children: [
47816
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "No" }) }),
47817
- /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
47818
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" }),
47819
- /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" })
47820
- ] })
47821
- ]
48528
+ className: "w-full p-2 min-h-[120px]",
48529
+ value: query,
48530
+ onChange: (e) => {
48531
+ var _a2;
48532
+ return setQuery((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value);
48533
+ }
47822
48534
  }
47823
- )
47824
- ] }),
47825
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47826
- "button",
47827
- {
47828
- onClick: handleSubmit,
47829
- 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",
47830
- children: "Submit"
47831
- }
47832
- ) })
47833
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
47834
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
47835
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-semibold", children: "Query:" }),
47836
- /* @__PURE__ */ jsxRuntimeExports.jsx(Textarea, { className: "w-full p-2", value: query, onChange: (e) => {
47837
- var _a2;
47838
- return setQuery((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value);
47839
- } })
48535
+ ) })
47840
48536
  ] }),
47841
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end pt-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
47842
- "button",
48537
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-6", children: [
48538
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48539
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Legend" }),
48540
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48541
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48542
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Show Legend" }) }),
48543
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
48544
+ Select,
48545
+ {
48546
+ value: chartSettings.showLegend !== false ? "yes" : "no",
48547
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48548
+ showLegend: value === "yes"
48549
+ })),
48550
+ children: [
48551
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Show legend?" }) }),
48552
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48553
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
48554
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
48555
+ ] })
48556
+ ]
48557
+ }
48558
+ )
48559
+ ] }),
48560
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48561
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48562
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Box Size" }),
48563
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48564
+ chartSettings.legendBoxSize,
48565
+ "px"
48566
+ ] })
48567
+ ] }),
48568
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48569
+ Slider,
48570
+ {
48571
+ min: 8,
48572
+ max: 32,
48573
+ step: 1,
48574
+ value: [(_c = chartSettings.legendBoxSize) != null ? _c : 16],
48575
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48576
+ legendBoxSize: value[0]
48577
+ })),
48578
+ className: "w-full"
48579
+ }
48580
+ )
48581
+ ] }),
48582
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48583
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48584
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48585
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48586
+ chartSettings.legendFontSize,
48587
+ "px"
48588
+ ] })
48589
+ ] }),
48590
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48591
+ Slider,
48592
+ {
48593
+ min: 10,
48594
+ max: 18,
48595
+ step: 1,
48596
+ value: [(_d = chartSettings.legendFontSize) != null ? _d : 13],
48597
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48598
+ legendFontSize: value[0]
48599
+ })),
48600
+ className: "w-full"
48601
+ }
48602
+ )
48603
+ ] })
48604
+ ] })
48605
+ ] }),
48606
+ displaySeriesNames.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48607
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Series Colors" }),
48608
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-3", children: displaySeriesNames.map((seriesName, index) => {
48609
+ var _a2;
48610
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-3", children: [
48611
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium flex-1 truncate", children: seriesName }),
48612
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48613
+ "input",
48614
+ {
48615
+ type: "color",
48616
+ value: ((_a2 = chartSettings.seriesColors) == null ? void 0 : _a2[index]) || defaultSeriesColors[index] || "#3B82F6",
48617
+ onChange: (e) => {
48618
+ const newColors = [...chartSettings.seriesColors || []];
48619
+ newColors[index] = e.target.value;
48620
+ setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48621
+ seriesColors: newColors
48622
+ }));
48623
+ },
48624
+ className: "w-10 h-10 rounded cursor-pointer border border-gray-300"
48625
+ }
48626
+ )
48627
+ ] }, index);
48628
+ }) })
48629
+ ] }),
48630
+ isLine && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48631
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Line Style" }),
48632
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48633
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48634
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48635
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Line Width" }),
48636
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-600", children: chartSettings.lineWidth })
48637
+ ] }),
48638
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48639
+ Slider,
48640
+ {
48641
+ min: 1,
48642
+ max: 5,
48643
+ step: 0.5,
48644
+ value: [(_e = chartSettings.lineWidth) != null ? _e : 2.5],
48645
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48646
+ lineWidth: value[0]
48647
+ })),
48648
+ className: "w-full"
48649
+ }
48650
+ )
48651
+ ] }),
48652
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48653
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48654
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Tension" }),
48655
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-600", children: ((_f = chartSettings.lineTension) != null ? _f : 0.3).toFixed(2) })
48656
+ ] }),
48657
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48658
+ Slider,
48659
+ {
48660
+ min: 0,
48661
+ max: 0.8,
48662
+ step: 0.05,
48663
+ value: [(_g = chartSettings.lineTension) != null ? _g : 0.3],
48664
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48665
+ lineTension: value[0]
48666
+ })),
48667
+ className: "w-full"
48668
+ }
48669
+ )
48670
+ ] }),
48671
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48672
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48673
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Point Size" }),
48674
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48675
+ chartSettings.pointRadius,
48676
+ "px"
48677
+ ] })
48678
+ ] }),
48679
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48680
+ Slider,
48681
+ {
48682
+ min: 0,
48683
+ max: 8,
48684
+ step: 0.5,
48685
+ value: [(_h = chartSettings.pointRadius) != null ? _h : 4],
48686
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48687
+ pointRadius: value[0]
48688
+ })),
48689
+ className: "w-full"
48690
+ }
48691
+ )
48692
+ ] })
48693
+ ] })
48694
+ ] }),
48695
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48696
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Chart Title" }),
48697
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48698
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48699
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Show Title" }) }),
48700
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
48701
+ Select,
48702
+ {
48703
+ value: chartSettings.showTitle !== false ? "yes" : "no",
48704
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48705
+ showTitle: value === "yes"
48706
+ })),
48707
+ children: [
48708
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Show title?" }) }),
48709
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48710
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
48711
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
48712
+ ] })
48713
+ ]
48714
+ }
48715
+ )
48716
+ ] }),
48717
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48718
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Title Text" }) }),
48719
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48720
+ "input",
48721
+ {
48722
+ type: "text",
48723
+ placeholder: "Enter custom title (optional)",
48724
+ value: (_i = chartSettings.titleText) != null ? _i : "",
48725
+ onChange: (e) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48726
+ titleText: e.target.value
48727
+ })),
48728
+ 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"
48729
+ }
48730
+ )
48731
+ ] }),
48732
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48733
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48734
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48735
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48736
+ chartSettings.titleFontSize,
48737
+ "px"
48738
+ ] })
48739
+ ] }),
48740
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48741
+ Slider,
48742
+ {
48743
+ min: 12,
48744
+ max: 28,
48745
+ step: 1,
48746
+ value: [(_j = chartSettings.titleFontSize) != null ? _j : 16],
48747
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48748
+ titleFontSize: value[0]
48749
+ })),
48750
+ className: "w-full"
48751
+ }
48752
+ )
48753
+ ] })
48754
+ ] })
48755
+ ] }),
48756
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4 pb-4 border-b", children: [
48757
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Data Labels" }),
48758
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48759
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48760
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Show Labels" }) }),
48761
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
48762
+ Select,
48763
+ {
48764
+ value: chartSettings.showLabels ? "yes" : "no",
48765
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48766
+ showLabels: value === "yes"
48767
+ })),
48768
+ children: [
48769
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "h-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Show data labels?" }) }),
48770
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
48771
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "no", children: "No" }),
48772
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "yes", children: "Yes" })
48773
+ ] })
48774
+ ]
48775
+ }
48776
+ )
48777
+ ] }),
48778
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48779
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48780
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48781
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48782
+ chartSettings.dataLabelsFontSize,
48783
+ "px"
48784
+ ] })
48785
+ ] }),
48786
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48787
+ Slider,
48788
+ {
48789
+ min: 10,
48790
+ max: 18,
48791
+ step: 1,
48792
+ value: [(_k = chartSettings.dataLabelsFontSize) != null ? _k : 12],
48793
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48794
+ dataLabelsFontSize: value[0]
48795
+ })),
48796
+ className: "w-full"
48797
+ }
48798
+ )
48799
+ ] })
48800
+ ] })
48801
+ ] }),
48802
+ (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: [
48803
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Axes" }),
48804
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
48805
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48806
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48807
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "X-Axis Title Font Size" }),
48808
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48809
+ chartSettings.xAxisTitleFontSize,
48810
+ "px"
48811
+ ] })
48812
+ ] }),
48813
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48814
+ Slider,
48815
+ {
48816
+ min: 10,
48817
+ max: 18,
48818
+ step: 1,
48819
+ value: [(_l = chartSettings.xAxisTitleFontSize) != null ? _l : 13],
48820
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48821
+ xAxisTitleFontSize: value[0]
48822
+ })),
48823
+ className: "w-full"
48824
+ }
48825
+ )
48826
+ ] }),
48827
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48828
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48829
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "X-Axis Tick Font Size" }),
48830
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48831
+ chartSettings.xAxisTickFontSize,
48832
+ "px"
48833
+ ] })
48834
+ ] }),
48835
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48836
+ Slider,
48837
+ {
48838
+ min: 10,
48839
+ max: 14,
48840
+ step: 1,
48841
+ value: [(_m = chartSettings.xAxisTickFontSize) != null ? _m : 12],
48842
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48843
+ xAxisTickFontSize: value[0]
48844
+ })),
48845
+ className: "w-full"
48846
+ }
48847
+ )
48848
+ ] }),
48849
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48850
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48851
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Y-Axis Title Font Size" }),
48852
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48853
+ chartSettings.yAxisTitleFontSize,
48854
+ "px"
48855
+ ] })
48856
+ ] }),
48857
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48858
+ Slider,
48859
+ {
48860
+ min: 10,
48861
+ max: 18,
48862
+ step: 1,
48863
+ value: [(_n = chartSettings.yAxisTitleFontSize) != null ? _n : 13],
48864
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48865
+ yAxisTitleFontSize: value[0]
48866
+ })),
48867
+ className: "w-full"
48868
+ }
48869
+ )
48870
+ ] }),
48871
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48872
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48873
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Y-Axis Tick Font Size" }),
48874
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48875
+ chartSettings.yAxisTickFontSize,
48876
+ "px"
48877
+ ] })
48878
+ ] }),
48879
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48880
+ Slider,
48881
+ {
48882
+ min: 10,
48883
+ max: 14,
48884
+ step: 1,
48885
+ value: [(_o = chartSettings.yAxisTickFontSize) != null ? _o : 12],
48886
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48887
+ yAxisTickFontSize: value[0]
48888
+ })),
48889
+ className: "w-full"
48890
+ }
48891
+ )
48892
+ ] })
48893
+ ] })
48894
+ ] }),
48895
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
48896
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide", children: "Tooltip" }),
48897
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-3", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
48898
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex justify-between mb-2", children: [
48899
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "text-sm font-medium", children: "Font Size" }),
48900
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-sm text-gray-600", children: [
48901
+ chartSettings.tooltipFontSize,
48902
+ "px"
48903
+ ] })
48904
+ ] }),
48905
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48906
+ Slider,
48907
+ {
48908
+ min: 10,
48909
+ max: 16,
48910
+ step: 1,
48911
+ value: [(_p = chartSettings.tooltipFontSize) != null ? _p : 12],
48912
+ onValueChange: (value) => setChartSettings(__spreadProps$2(__spreadValues$3({}, chartSettings), {
48913
+ tooltipFontSize: value[0]
48914
+ })),
48915
+ className: "w-full"
48916
+ }
48917
+ )
48918
+ ] }) })
48919
+ ] })
48920
+ ] })
48921
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
48922
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { className: "font-semibold text-sm", children: "Query" }),
48923
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
48924
+ Textarea,
47843
48925
  {
47844
- onClick: handleSubmit,
47845
- 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",
47846
- children: "Submit"
48926
+ className: "w-full p-2 min-h-[120px]",
48927
+ value: query,
48928
+ onChange: (e) => {
48929
+ var _a2;
48930
+ return setQuery((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value);
48931
+ }
47847
48932
  }
47848
- ) })
47849
- ] })
48933
+ )
48934
+ ] }) }) }) }),
48935
+ /* @__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(
48936
+ "button",
48937
+ {
48938
+ onClick: handleSubmit,
48939
+ 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",
48940
+ children: "Submit"
48941
+ }
48942
+ ) })
47850
48943
  ] })
47851
- ] })
48944
+ ]
47852
48945
  }
47853
48946
  );
47854
48947
  }
@@ -48295,11 +49388,11 @@ function WidgetDashboard({
48295
49388
  const [internalSelectedWidget, setInternalSelectedWidget] = useState(selectedWidget);
48296
49389
  const [currentLayouts, setCurrentLayouts] = useState(defaultLayouts);
48297
49390
  const [draftLayouts, setDraftLayouts] = useState(defaultLayouts);
48298
- const [visibleClearButton, setVisibleClearButton] = useState("");
48299
49391
  const [showEditModal, setShowEditModal] = useState(false);
48300
49392
  const [editInitialQuery, setEditInitialQuery] = useState("");
48301
49393
  const [editingWidget, setEditingWidget] = useState(null);
48302
49394
  const [widgetResetFunctions, setWidgetResetFunctions] = useState(/* @__PURE__ */ new Map());
49395
+ const [clearingChatWidget, setClearingChatWidget] = useState("");
48303
49396
  const displayWidgets = React__default.useMemo(() => {
48304
49397
  if (focusWidgetId) {
48305
49398
  return widgets.filter((w) => w.id === focusWidgetId);
@@ -48352,20 +49445,52 @@ function WidgetDashboard({
48352
49445
  };
48353
49446
  const onClickSettings = (widget) => {
48354
49447
  var _a;
49448
+ const currentWidget = widgets.find((w) => w.id === widget.id) || widget;
48355
49449
  setShowEditModal(true);
48356
- setEditingWidget(widget);
48357
- let query = (_a = widget == null ? void 0 : widget.config) == null ? void 0 : _a.query;
49450
+ setEditingWidget(currentWidget);
49451
+ let query = (_a = currentWidget == null ? void 0 : currentWidget.config) == null ? void 0 : _a.query;
48358
49452
  if (query) {
48359
49453
  setEditInitialQuery(query);
48360
49454
  } else {
48361
49455
  setEditInitialQuery("");
48362
49456
  }
48363
49457
  };
48364
- const handleEditSubmit = async (newQuery, showLabels) => {
49458
+ const saveWidgetConfigToBackend = useCallback(
49459
+ debounce$1(async (widget) => {
49460
+ try {
49461
+ const widgetService = new WidgetService();
49462
+ await widgetService.saveWidget(widget);
49463
+ console.log(`[WidgetDashboard] Widget ${widget.id} config saved to backend`);
49464
+ } catch (error) {
49465
+ console.error(`[WidgetDashboard] Failed to save widget config:`, error);
49466
+ }
49467
+ }, 1e3),
49468
+ []
49469
+ );
49470
+ const handleConfigUpdate = (widgetId, config) => {
49471
+ setWidgets((prevWidgets) => {
49472
+ const updatedWidgets = prevWidgets.map(
49473
+ (w) => w.id === widgetId ? __spreadProps$1(__spreadValues$1({}, w), {
49474
+ config: __spreadValues$1(__spreadValues$1({}, w.config), config)
49475
+ }) : w
49476
+ );
49477
+ const updatedWidget = updatedWidgets.find((w) => w.id === widgetId);
49478
+ if (updatedWidget) {
49479
+ saveWidgetConfigToBackend(updatedWidget);
49480
+ }
49481
+ return updatedWidgets;
49482
+ });
49483
+ };
49484
+ const handleEditSubmit = async (newQuery, showLabels, chartSettings) => {
48365
49485
  var _a, _b;
48366
49486
  if (!editingWidget) return;
48367
49487
  const updatedWidgets = widgets.map(
48368
- (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
49488
+ (w) => w.id === editingWidget.id ? __spreadProps$1(__spreadValues$1({}, w), {
49489
+ config: __spreadValues$1(__spreadProps$1(__spreadValues$1({}, w.config), {
49490
+ query: newQuery,
49491
+ content: __spreadProps$1(__spreadValues$1({}, w.config.content), { showLabels })
49492
+ }), chartSettings && { chartSettings })
49493
+ }) : w
48369
49494
  );
48370
49495
  setWidgets(updatedWidgets);
48371
49496
  setShowEditModal(false);
@@ -48455,6 +49580,11 @@ function WidgetDashboard({
48455
49580
  setTimeout(() => pollForSqlQuery(), 2e3);
48456
49581
  }
48457
49582
  }
49583
+ try {
49584
+ await stableSaveLayout();
49585
+ } catch (error) {
49586
+ console.error("Failed to save widget configuration:", error);
49587
+ }
48458
49588
  };
48459
49589
  const handleResetReady = useCallback((widgetId, resetFn) => {
48460
49590
  setWidgetResetFunctions((prev) => {
@@ -48465,6 +49595,7 @@ function WidgetDashboard({
48465
49595
  }, []);
48466
49596
  const handleClearChat = async (widgetId) => {
48467
49597
  try {
49598
+ setClearingChatWidget(widgetId);
48468
49599
  const response = await fetch(getApiUrl("/api/clear-chat"), {
48469
49600
  method: "POST",
48470
49601
  headers: {
@@ -48486,9 +49617,12 @@ function WidgetDashboard({
48486
49617
  }
48487
49618
  } catch (error) {
48488
49619
  console.error("Error clearing chat:", error);
49620
+ } finally {
49621
+ setClearingChatWidget("");
48489
49622
  }
48490
49623
  };
48491
49624
  const loadData = useCallback(async () => {
49625
+ var _a;
48492
49626
  if (!pageId) {
48493
49627
  setIsLoading(false);
48494
49628
  return;
@@ -48509,6 +49643,12 @@ function WidgetDashboard({
48509
49643
  setPageData(data);
48510
49644
  setWidgets(data.widgets || []);
48511
49645
  setDatasetId(data == null ? void 0 : data.dataset_id);
49646
+ (_a = data.widgets) == null ? void 0 : _a.forEach((w) => {
49647
+ var _a2;
49648
+ if ((_a2 = w.config) == null ? void 0 : _a2.chartSettings) {
49649
+ console.log(`[WidgetDashboard] Widget ${w.id} has chartSettings:`, w.config.chartSettings);
49650
+ }
49651
+ });
48512
49652
  } catch (err) {
48513
49653
  console.error("Error loading page data:", err);
48514
49654
  } finally {
@@ -48554,6 +49694,23 @@ function WidgetDashboard({
48554
49694
  const newAgentWidgetIds = widgets.filter((w) => w.type === "agent" && !originalWidgetIdsRef.current.has(w.id)).map((w) => w.id);
48555
49695
  const hasFilterWidget = widgets.some((w) => w.type === "filters");
48556
49696
  try {
49697
+ const widgetsToSave = widgets.map((widget) => __spreadProps$1(__spreadValues$1({}, widget), {
49698
+ config: __spreadProps$1(__spreadValues$1({}, widget.config), {
49699
+ isFirstLoad: false
49700
+ }),
49701
+ position: {
49702
+ x: widget.position_x,
49703
+ y: widget.position_y,
49704
+ width: widget.width,
49705
+ height: widget.height
49706
+ }
49707
+ }));
49708
+ widgetsToSave.forEach((w) => {
49709
+ var _a;
49710
+ if ((_a = w.config) == null ? void 0 : _a.chartSettings) {
49711
+ console.log(`[WidgetDashboard] Saving widget ${w.id} with chartSettings:`, w.config.chartSettings);
49712
+ }
49713
+ });
48557
49714
  const response = await fetch(getApiUrl(`/api/pages/${pageId}`), {
48558
49715
  method: "PUT",
48559
49716
  headers: {
@@ -48562,17 +49719,7 @@ function WidgetDashboard({
48562
49719
  body: JSON.stringify(__spreadProps$1(__spreadValues$1({
48563
49720
  id: pageId
48564
49721
  }, pageData), {
48565
- widgets: widgets.map((widget) => __spreadProps$1(__spreadValues$1({}, widget), {
48566
- config: __spreadProps$1(__spreadValues$1({}, widget.config), {
48567
- isFirstLoad: false
48568
- }),
48569
- position: {
48570
- x: widget.position_x,
48571
- y: widget.position_y,
48572
- width: widget.width,
48573
- height: widget.height
48574
- }
48575
- }))
49722
+ widgets: widgetsToSave
48576
49723
  }))
48577
49724
  });
48578
49725
  if (!response.ok) {
@@ -49015,10 +50162,10 @@ function WidgetDashboard({
49015
50162
  const filterStatus = w.type === "agent" ? getWidgetFilterStatus(w.id) : null;
49016
50163
  const badgeInfo = filterStatus ? getFilterStatusBadge(filterStatus.status) : null;
49017
50164
  const isFocusMode = focusWidgetId && w.id === focusWidgetId;
49018
- const widgetBaseStyles = "rounded-xl border border-gray-200 !bg-white";
49019
- const widgetHoverStyles = isEditing ? "hover:border-primary-500 hover:shadow-lg transition-all duration-200" : "";
49020
- const widgetShadow = "shadow-[0_2px_8px_-2px_rgba(0,0,0,0.15)]";
49021
- 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: [
50165
+ const widgetBaseStyles = "rounded-xl border-2 border-gray-300 !bg-white";
50166
+ const widgetHoverStyles = isEditing ? "hover:border-primary-500 hover:shadow-lg transition-all duration-200 cursor-pointer" : "";
50167
+ const widgetShadow = "shadow-[0_4px_12px_-2px_rgba(0,0,0,0.2)]";
50168
+ 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: [
49022
50169
  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: [
49023
50170
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: badgeInfo.icon }),
49024
50171
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: badgeInfo.label })
@@ -49045,13 +50192,7 @@ function WidgetDashboard({
49045
50192
  w.type !== "spacer" && w.type !== "chatbot" && /* @__PURE__ */ jsxRuntimeExports.jsx(Edit, { onClick: () => onClickSettings && onClickSettings(w), className: "w-5 h-5 text-gray-600" })
49046
50193
  ] })
49047
50194
  ] }),
49048
- /* @__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: [
49049
- (w == null ? void 0 : w.type) === "chatbot" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative z-50", children: [
49050
- /* @__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(MessageCircleX, { className: "w-5 h-5" }) }),
49051
- /* @__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" })
49052
- ] }),
49053
- /* @__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) })
49054
- ] })
50195
+ /* @__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 }) })
49055
50196
  ] }, w.id);
49056
50197
  })
49057
50198
  }
@@ -49346,7 +50487,7 @@ function PresentationMode({
49346
50487
  }
49347
50488
  )
49348
50489
  ] }),
49349
- /* @__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(
50490
+ /* @__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(
49350
50491
  WidgetRenderer,
49351
50492
  {
49352
50493
  widget: currentFocusWidget,