@optifye/dashboard-core 4.3.4 → 4.3.6

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.js +562 -212
  2. package/dist/index.mjs +562 -212
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -24456,6 +24456,7 @@ var AIAgentView = () => {
24456
24456
  const entityConfig = useEntityConfig();
24457
24457
  const dateTimeConfig = useDateTimeConfig();
24458
24458
  const shiftConfig = useShiftConfig();
24459
+ const { formatNumber } = useFormatNumber();
24459
24460
  const [inputValue, setInputValue] = React14.useState("");
24460
24461
  const [loadingThreads, setLoadingThreads] = React14.useState(/* @__PURE__ */ new Set());
24461
24462
  const [lastError, setLastError] = React14.useState(null);
@@ -25086,17 +25087,49 @@ var AIAgentView = () => {
25086
25087
  chartElements.push(chartElement);
25087
25088
  } else {
25088
25089
  console.warn(`[DEBUG] Chart element was null for type: ${chartType}`);
25090
+ console.warn(`[DEBUG] Args were:`, args);
25091
+ chartElements.push(
25092
+ /* @__PURE__ */ jsxRuntime.jsxs(
25093
+ "div",
25094
+ {
25095
+ className: "text-red-500 text-sm border border-red-300 bg-red-50 p-3 rounded",
25096
+ children: [
25097
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Chart Rendering Error:" }),
25098
+ " Failed to render ",
25099
+ chartType,
25100
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
25101
+ /* @__PURE__ */ jsxRuntime.jsxs("small", { children: [
25102
+ "Check console for details. Args: ",
25103
+ JSON.stringify(args, null, 2)
25104
+ ] })
25105
+ ]
25106
+ },
25107
+ `error-${startIndex}`
25108
+ )
25109
+ );
25089
25110
  }
25090
25111
  } catch (error) {
25091
25112
  console.error(`Failed to parse chart ${chartType}:`, error);
25113
+ console.error(`Args string was:`, argsString);
25092
25114
  chartElements.push(
25093
25115
  /* @__PURE__ */ jsxRuntime.jsxs(
25094
25116
  "div",
25095
25117
  {
25096
- className: "text-red-500 text-sm",
25118
+ className: "text-red-500 text-sm border border-red-300 bg-red-50 p-3 rounded",
25097
25119
  children: [
25098
- "Error rendering chart: ",
25099
- match[0]
25120
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Chart Parsing Error:" }),
25121
+ " Failed to parse ",
25122
+ chartType,
25123
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
25124
+ /* @__PURE__ */ jsxRuntime.jsxs("small", { children: [
25125
+ "Error: ",
25126
+ error instanceof Error ? error.message : String(error)
25127
+ ] }),
25128
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
25129
+ /* @__PURE__ */ jsxRuntime.jsxs("small", { children: [
25130
+ "Original: ",
25131
+ match[0]
25132
+ ] })
25100
25133
  ]
25101
25134
  },
25102
25135
  `error-${startIndex}`
@@ -25127,111 +25160,265 @@ var AIAgentView = () => {
25127
25160
  return chartElements;
25128
25161
  };
25129
25162
  const parseChartArguments = (argsString) => {
25130
- const args = {};
25131
25163
  console.log("[DEBUG] Parsing chart arguments:", argsString);
25132
- const jsonParamRegex = /(\w+)\s*=\s*(\[[\s\S]*?\](?=\s*(?:,|\s*\)|\s*$))|\{[\s\S]*?\}(?=\s*(?:,|\s*\)|\s*$)))/g;
25133
- let jsonMatch;
25134
- while ((jsonMatch = jsonParamRegex.exec(argsString)) !== null) {
25135
- const paramName = jsonMatch[1];
25136
- const jsonValue = jsonMatch[2];
25137
- console.log(`[DEBUG] Found JSON parameter: ${paramName} = ${jsonValue}`);
25138
- try {
25139
- args[paramName] = JSON.parse(jsonValue);
25140
- console.log(`[DEBUG] Successfully parsed ${paramName}:`, args[paramName]);
25141
- argsString = argsString.replace(jsonMatch[0], "");
25142
- } catch (e) {
25143
- console.error(`Failed to parse ${paramName} JSON:`, e);
25144
- console.error(`JSON value that failed:`, jsonValue);
25145
- }
25146
- }
25147
- const argRegex = /(\w+)\s*=\s*("([^"]*)"|'([^']*)'|([^,\s\)]+))/g;
25148
- let argMatch;
25149
- while ((argMatch = argRegex.exec(argsString)) !== null) {
25150
- const key = argMatch[1];
25151
- const value = argMatch[3] || argMatch[4] || argMatch[5];
25152
- if (key === "data") continue;
25153
- if (value === "true" || value === "True") {
25154
- args[key] = true;
25155
- } else if (value === "false" || value === "False") {
25156
- args[key] = false;
25157
- } else if (value === "null" || value === "None") {
25158
- args[key] = null;
25159
- } else if (!isNaN(Number(value)) && value !== "") {
25160
- args[key] = Number(value);
25161
- } else {
25162
- args[key] = value;
25164
+ const extractParameters = (str) => {
25165
+ const params = {};
25166
+ let currentPos = 0;
25167
+ while (currentPos < str.length) {
25168
+ while (currentPos < str.length && /\s|,/.test(str[currentPos])) {
25169
+ currentPos++;
25170
+ }
25171
+ if (currentPos >= str.length) break;
25172
+ const paramMatch = str.substring(currentPos).match(/^(\w+)\s*=/);
25173
+ if (!paramMatch) {
25174
+ console.warn("[DEBUG] No parameter name found at position", currentPos);
25175
+ break;
25176
+ }
25177
+ const paramName = paramMatch[1];
25178
+ currentPos += paramMatch[0].length;
25179
+ while (currentPos < str.length && /\s/.test(str[currentPos])) {
25180
+ currentPos++;
25181
+ }
25182
+ if (currentPos >= str.length) break;
25183
+ let value;
25184
+ let valueEnd;
25185
+ if (str[currentPos] === "[") {
25186
+ let bracketCount = 0;
25187
+ let arrayStart = currentPos;
25188
+ valueEnd = str.length;
25189
+ for (let i = currentPos; i < str.length; i++) {
25190
+ if (str[i] === "[") bracketCount++;
25191
+ else if (str[i] === "]") bracketCount--;
25192
+ if (bracketCount === 0) {
25193
+ valueEnd = i + 1;
25194
+ break;
25195
+ }
25196
+ }
25197
+ if (bracketCount !== 0) {
25198
+ console.error("[DEBUG] Unmatched brackets in array value");
25199
+ break;
25200
+ }
25201
+ const arrayStr = str.substring(arrayStart, valueEnd);
25202
+ console.log(`[DEBUG] Found array parameter: ${paramName} = ${arrayStr}`);
25203
+ try {
25204
+ value = JSON.parse(arrayStr);
25205
+ console.log(`[DEBUG] Successfully parsed array ${paramName}:`, value);
25206
+ } catch (e) {
25207
+ console.error(`[DEBUG] Failed to parse array ${paramName}:`, e);
25208
+ console.error(`Array value that failed:`, arrayStr);
25209
+ value = arrayStr;
25210
+ }
25211
+ } else if (str[currentPos] === "{") {
25212
+ let braceCount = 0;
25213
+ let objectStart = currentPos;
25214
+ valueEnd = str.length;
25215
+ for (let i = currentPos; i < str.length; i++) {
25216
+ if (str[i] === "{") braceCount++;
25217
+ else if (str[i] === "}") braceCount--;
25218
+ if (braceCount === 0) {
25219
+ valueEnd = i + 1;
25220
+ break;
25221
+ }
25222
+ }
25223
+ if (braceCount !== 0) {
25224
+ console.error("[DEBUG] Unmatched braces in object value");
25225
+ break;
25226
+ }
25227
+ const objectStr = str.substring(objectStart, valueEnd);
25228
+ console.log(`[DEBUG] Found object parameter: ${paramName} = ${objectStr}`);
25229
+ try {
25230
+ value = JSON.parse(objectStr);
25231
+ console.log(`[DEBUG] Successfully parsed object ${paramName}:`, value);
25232
+ } catch (e) {
25233
+ console.error(`[DEBUG] Failed to parse object ${paramName}:`, e);
25234
+ console.error(`Object value that failed:`, objectStr);
25235
+ value = objectStr;
25236
+ }
25237
+ } else if (str[currentPos] === '"') {
25238
+ let stringStart = currentPos + 1;
25239
+ let stringEnd = stringStart;
25240
+ while (stringEnd < str.length) {
25241
+ if (str[stringEnd] === '"' && str[stringEnd - 1] !== "\\") {
25242
+ break;
25243
+ }
25244
+ stringEnd++;
25245
+ }
25246
+ if (stringEnd >= str.length) {
25247
+ console.error("[DEBUG] Unterminated string value");
25248
+ valueEnd = str.length;
25249
+ break;
25250
+ }
25251
+ value = str.substring(stringStart, stringEnd);
25252
+ valueEnd = stringEnd + 1;
25253
+ console.log(`[DEBUG] Found string parameter: ${paramName} = "${value}"`);
25254
+ } else {
25255
+ let valueStart = currentPos;
25256
+ let valueEndPos = valueStart;
25257
+ while (valueEndPos < str.length && str[valueEndPos] !== ",") {
25258
+ valueEndPos++;
25259
+ }
25260
+ const rawValue = str.substring(valueStart, valueEndPos).trim();
25261
+ valueEnd = valueEndPos;
25262
+ if (rawValue === "true" || rawValue === "True") {
25263
+ value = true;
25264
+ } else if (rawValue === "false" || rawValue === "False") {
25265
+ value = false;
25266
+ } else if (rawValue === "null" || rawValue === "None") {
25267
+ value = null;
25268
+ } else if (!isNaN(Number(rawValue)) && rawValue !== "") {
25269
+ value = Number(rawValue);
25270
+ } else {
25271
+ value = rawValue;
25272
+ }
25273
+ console.log(`[DEBUG] Found unquoted parameter: ${paramName} = ${rawValue} (parsed as ${typeof value})`);
25274
+ }
25275
+ params[paramName] = value;
25276
+ currentPos = valueEnd;
25163
25277
  }
25164
- }
25165
- console.log("[DEBUG] Final parsed arguments:", args);
25166
- return args;
25278
+ return params;
25279
+ };
25280
+ const result = extractParameters(argsString);
25281
+ console.log("[DEBUG] Final parsed arguments:", result);
25282
+ return result;
25167
25283
  };
25168
25284
  const renderChart = (chartType, args, key) => {
25169
25285
  console.log(`[DEBUG] Attempting to render chart type: ${chartType}`, args);
25286
+ const CHART_COLORS = {
25287
+ primary: "#3b82f6",
25288
+ // blue-500
25289
+ secondary: "#10b981",
25290
+ // green-500
25291
+ accent: "#f59e0b",
25292
+ // amber-500
25293
+ danger: "#ef4444",
25294
+ // red-500
25295
+ violet: "#8b5cf6",
25296
+ // violet-500
25297
+ cyan: "#06b6d4",
25298
+ // cyan-500
25299
+ orange: "#f97316",
25300
+ // orange-500
25301
+ indigo: "#6366f1"
25302
+ // indigo-500
25303
+ };
25304
+ const CHART_COLOR_PALETTE = Object.values(CHART_COLORS);
25305
+ const CHART_STYLES = {
25306
+ grid: {
25307
+ strokeDasharray: "3 3",
25308
+ stroke: "#e5e7eb"
25309
+ // gray-300
25310
+ },
25311
+ axis: {
25312
+ tick: { fontSize: 12, fill: "#4b5563" },
25313
+ // gray-600
25314
+ stroke: "#9ca3af"
25315
+ // gray-400
25316
+ },
25317
+ margin: { top: 10, right: 30, left: 20, bottom: 40 },
25318
+ barRadius: [4, 4, 0, 0]
25319
+ // Top corners rounded
25320
+ };
25321
+ const CustomTooltip = ({ active, payload, label }) => {
25322
+ if (active && payload && payload.length) {
25323
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white px-4 py-3 shadow-lg rounded-lg border border-gray-200", children: [
25324
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-gray-900 mb-1", children: label }),
25325
+ payload.map((entry, index) => /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-gray-600", style: { color: entry.color }, children: [
25326
+ entry.name,
25327
+ ": ",
25328
+ typeof entry.value === "number" ? formatNumber(entry.value) : entry.value,
25329
+ args.unit || ""
25330
+ ] }, index))
25331
+ ] });
25332
+ }
25333
+ return null;
25334
+ };
25335
+ const ChartWrapper = ({ children, title }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 bg-white rounded-xl shadow-sm border border-gray-200 p-6", children: [
25336
+ title && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base font-semibold text-gray-900 mb-4", children: title }),
25337
+ children
25338
+ ] });
25170
25339
  switch (chartType) {
25171
25340
  case "create_gauge_chart":
25172
25341
  console.log("[DEBUG] Rendering gauge chart");
25173
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-6 h-64 w-full flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
25342
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-64 w-full flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
25174
25343
  GaugeChart,
25175
25344
  {
25176
25345
  value: args.value || 0,
25177
25346
  min: args.min_value || 0,
25178
25347
  max: args.max_value || 100,
25179
25348
  target: args.target,
25180
- label: args.title || "",
25349
+ label: args.label || "",
25181
25350
  unit: args.unit || "",
25182
25351
  thresholds: args.thresholds,
25183
25352
  className: "w-full max-w-sm"
25184
25353
  }
25185
- ) }, `gauge-${key}`);
25354
+ ) }) }, `gauge-${key}`);
25186
25355
  case "create_bar_chart":
25187
25356
  console.log("[DEBUG] Rendering bar chart");
25188
25357
  if (!args.data || !args.x_field || !args.y_field) {
25189
25358
  console.error("Bar chart missing required parameters:", { data: !!args.data, x_field: !!args.x_field, y_field: !!args.y_field });
25190
25359
  return null;
25191
25360
  }
25192
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", style: { maxWidth: args.max_width || "100%" }, children: [
25361
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-64", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: args.data, margin: CHART_STYLES.margin, children: [
25362
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { ...CHART_STYLES.grid }),
25193
25363
  /* @__PURE__ */ jsxRuntime.jsx(
25194
- BarChart,
25364
+ recharts.XAxis,
25195
25365
  {
25196
- data: args.data,
25197
- bars: [{
25198
- dataKey: args.y_field,
25199
- fill: args.color || "#3b82f6",
25200
- labelList: args.show_values
25201
- }],
25202
- xAxisDataKey: args.x_field,
25203
- className: "h-64",
25204
- showLegend: false
25366
+ dataKey: args.x_field,
25367
+ ...CHART_STYLES.axis
25205
25368
  }
25206
25369
  ),
25207
- args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25208
- ] }, `bar-${key}`);
25370
+ /* @__PURE__ */ jsxRuntime.jsx(
25371
+ recharts.YAxis,
25372
+ {
25373
+ ...CHART_STYLES.axis,
25374
+ tickFormatter: (value) => formatNumber(value)
25375
+ }
25376
+ ),
25377
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
25378
+ /* @__PURE__ */ jsxRuntime.jsx(
25379
+ recharts.Bar,
25380
+ {
25381
+ dataKey: args.y_field,
25382
+ fill: args.color || CHART_COLORS.primary,
25383
+ radius: CHART_STYLES.barRadius
25384
+ }
25385
+ )
25386
+ ] }) }) }) }, `bar-${key}`);
25209
25387
  case "create_line_chart":
25210
25388
  console.log("[DEBUG] Rendering line chart");
25211
25389
  if (!args.data || !args.x_field || !args.y_field) {
25212
25390
  console.error("Line chart missing required parameters:", { data: !!args.data, x_field: !!args.x_field, y_field: !!args.y_field });
25213
25391
  return null;
25214
25392
  }
25215
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", style: {
25216
- height: args.height || 256,
25217
- width: args.width || "100%"
25218
- }, children: [
25393
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-64", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.LineChart, { data: args.data, margin: CHART_STYLES.margin, children: [
25394
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { ...CHART_STYLES.grid }),
25219
25395
  /* @__PURE__ */ jsxRuntime.jsx(
25220
- LineChart,
25396
+ recharts.XAxis,
25397
+ {
25398
+ dataKey: args.x_field,
25399
+ ...CHART_STYLES.axis
25400
+ }
25401
+ ),
25402
+ /* @__PURE__ */ jsxRuntime.jsx(
25403
+ recharts.YAxis,
25221
25404
  {
25222
- data: args.data,
25223
- lines: [{
25224
- dataKey: args.y_field,
25225
- stroke: "#3b82f6",
25226
- strokeWidth: 2
25227
- }],
25228
- xAxisDataKey: args.x_field,
25229
- className: "h-full",
25230
- showLegend: false
25405
+ ...CHART_STYLES.axis,
25406
+ tickFormatter: (value) => formatNumber(value)
25231
25407
  }
25232
25408
  ),
25233
- args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25234
- ] }, `line-${key}`);
25409
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(CustomTooltip, {}), cursor: { strokeDasharray: "3 3" } }),
25410
+ /* @__PURE__ */ jsxRuntime.jsx(
25411
+ recharts.Line,
25412
+ {
25413
+ type: "monotone",
25414
+ dataKey: args.y_field,
25415
+ stroke: CHART_COLORS.primary,
25416
+ strokeWidth: 2,
25417
+ dot: { r: 4, fill: CHART_COLORS.primary },
25418
+ activeDot: { r: 6 }
25419
+ }
25420
+ )
25421
+ ] }) }) }) }, `line-${key}`);
25235
25422
  case "create_pie_chart":
25236
25423
  console.log("[DEBUG] Rendering pie chart");
25237
25424
  if (!args.data || !args.label_field || !args.value_field) {
@@ -25244,16 +25431,14 @@ var AIAgentView = () => {
25244
25431
  value: item[args.value_field]
25245
25432
  }));
25246
25433
  console.log("[DEBUG] Pie chart data transformed:", pieData);
25247
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full flex flex-col items-center", children: [
25248
- args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-gray-700 mb-2", children: args.title }),
25249
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-64 w-full max-w-md", children: /* @__PURE__ */ jsxRuntime.jsx(
25250
- PieChart4,
25251
- {
25252
- data: pieData,
25253
- showPercentages: args.show_percentages || false
25254
- }
25255
- ) })
25256
- ] }, `pie-${key}`);
25434
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-64 w-full max-w-md mx-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
25435
+ PieChart4,
25436
+ {
25437
+ data: pieData,
25438
+ showPercentages: args.show_percentages || false,
25439
+ colors: CHART_COLOR_PALETTE
25440
+ }
25441
+ ) }) }, `pie-${key}`);
25257
25442
  case "create_comparison_table":
25258
25443
  console.log("[DEBUG] Rendering comparison table");
25259
25444
  if (!args.data) {
@@ -25270,27 +25455,24 @@ var AIAgentView = () => {
25270
25455
  return args.sort_descending === false ? comparison : -comparison;
25271
25456
  });
25272
25457
  }
25273
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full overflow-x-auto", children: [
25274
- args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-gray-700 mb-2", children: args.title }),
25275
- /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [
25276
- /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
25277
- "th",
25278
- {
25279
- className: `px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider ${col === args.highlight_column ? "bg-blue-50" : ""}`,
25280
- children: col
25281
- },
25282
- col
25283
- )) }) }),
25284
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: sortedData.map((row, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: rowIdx % 2 === 0 ? "bg-white" : "bg-gray-50", children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
25285
- "td",
25286
- {
25287
- className: `px-4 py-2 whitespace-nowrap text-sm ${col === args.highlight_column ? "font-medium text-blue-600 bg-blue-50" : "text-gray-900"}`,
25288
- children: row[col]
25289
- },
25290
- col
25291
- )) }, rowIdx)) })
25292
- ] })
25293
- ] }, `table-${key}`);
25458
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto rounded-lg border border-gray-200", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [
25459
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
25460
+ "th",
25461
+ {
25462
+ className: `px-6 py-3 text-left text-xs font-medium text-gray-600 uppercase tracking-wider ${col === args.highlight_column ? "bg-blue-50" : ""}`,
25463
+ children: col
25464
+ },
25465
+ col
25466
+ )) }) }),
25467
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: sortedData.map((row, rowIdx) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: rowIdx % 2 === 0 ? "bg-white" : "bg-gray-50", children: columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
25468
+ "td",
25469
+ {
25470
+ className: `px-6 py-4 whitespace-nowrap text-sm ${col === args.highlight_column ? "font-medium text-blue-600 bg-blue-50" : "text-gray-900"}`,
25471
+ children: typeof row[col] === "number" ? formatNumber(row[col]) : row[col]
25472
+ },
25473
+ col
25474
+ )) }, rowIdx)) })
25475
+ ] }) }) }, `table-${key}`);
25294
25476
  case "create_multi_line_chart":
25295
25477
  console.log("[DEBUG] Rendering multi-line chart");
25296
25478
  if (!args.data || !args.x_field || !args.y_fields || !args.legend) {
@@ -25302,30 +25484,44 @@ var AIAgentView = () => {
25302
25484
  });
25303
25485
  return null;
25304
25486
  }
25305
- const colors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
25306
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
25307
- /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.LineChart, { data: args.data, children: [
25308
- /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
25309
- /* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field }),
25310
- /* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, {}),
25311
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, {}),
25312
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
25313
- args.y_fields.map((field, index) => /* @__PURE__ */ jsxRuntime.jsx(
25314
- recharts.Line,
25315
- {
25316
- type: "monotone",
25317
- dataKey: field,
25318
- stroke: colors[index % colors.length],
25319
- strokeWidth: 2,
25320
- name: args.legend[index] || field,
25321
- dot: { r: 4 },
25322
- activeDot: { r: 6 }
25323
- },
25324
- field
25325
- ))
25326
- ] }) }),
25327
- args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25328
- ] }, `multi-line-${key}`);
25487
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.LineChart, { data: args.data, margin: CHART_STYLES.margin, children: [
25488
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { ...CHART_STYLES.grid }),
25489
+ /* @__PURE__ */ jsxRuntime.jsx(
25490
+ recharts.XAxis,
25491
+ {
25492
+ dataKey: args.x_field,
25493
+ ...CHART_STYLES.axis
25494
+ }
25495
+ ),
25496
+ /* @__PURE__ */ jsxRuntime.jsx(
25497
+ recharts.YAxis,
25498
+ {
25499
+ ...CHART_STYLES.axis,
25500
+ tickFormatter: (value) => formatNumber(value)
25501
+ }
25502
+ ),
25503
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(CustomTooltip, {}), cursor: { strokeDasharray: "3 3" } }),
25504
+ /* @__PURE__ */ jsxRuntime.jsx(
25505
+ recharts.Legend,
25506
+ {
25507
+ wrapperStyle: { paddingTop: "20px" },
25508
+ formatter: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: value })
25509
+ }
25510
+ ),
25511
+ args.y_fields.map((field, index) => /* @__PURE__ */ jsxRuntime.jsx(
25512
+ recharts.Line,
25513
+ {
25514
+ type: "monotone",
25515
+ dataKey: field,
25516
+ stroke: CHART_COLOR_PALETTE[index % CHART_COLOR_PALETTE.length],
25517
+ strokeWidth: 2,
25518
+ name: args.legend[index] || field,
25519
+ dot: { r: 4 },
25520
+ activeDot: { r: 6 }
25521
+ },
25522
+ field
25523
+ ))
25524
+ ] }) }) }) }, `multi-line-${key}`);
25329
25525
  case "create_stacked_bar_chart":
25330
25526
  console.log("[DEBUG] Rendering stacked bar chart");
25331
25527
  if (!args.data || !args.x_field || !args.stack_fields) {
@@ -25336,27 +25532,42 @@ var AIAgentView = () => {
25336
25532
  });
25337
25533
  return null;
25338
25534
  }
25339
- const stackColors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
25340
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
25341
- /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: args.data, children: [
25342
- /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
25343
- /* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field }),
25344
- /* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, {}),
25345
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, {}),
25346
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
25347
- args.stack_fields.map((field, index) => /* @__PURE__ */ jsxRuntime.jsx(
25348
- recharts.Bar,
25349
- {
25350
- dataKey: field,
25351
- stackId: "stack",
25352
- fill: stackColors[index % stackColors.length],
25353
- name: field
25354
- },
25355
- field
25356
- ))
25357
- ] }) }),
25358
- args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25359
- ] }, `stacked-bar-${key}`);
25535
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.BarChart, { data: args.data, margin: CHART_STYLES.margin, children: [
25536
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { ...CHART_STYLES.grid }),
25537
+ /* @__PURE__ */ jsxRuntime.jsx(
25538
+ recharts.XAxis,
25539
+ {
25540
+ dataKey: args.x_field,
25541
+ ...CHART_STYLES.axis
25542
+ }
25543
+ ),
25544
+ /* @__PURE__ */ jsxRuntime.jsx(
25545
+ recharts.YAxis,
25546
+ {
25547
+ ...CHART_STYLES.axis,
25548
+ tickFormatter: (value) => formatNumber(value)
25549
+ }
25550
+ ),
25551
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
25552
+ /* @__PURE__ */ jsxRuntime.jsx(
25553
+ recharts.Legend,
25554
+ {
25555
+ wrapperStyle: { paddingTop: "20px" },
25556
+ formatter: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: value })
25557
+ }
25558
+ ),
25559
+ args.stack_fields.map((field, index) => /* @__PURE__ */ jsxRuntime.jsx(
25560
+ recharts.Bar,
25561
+ {
25562
+ dataKey: field,
25563
+ stackId: "stack",
25564
+ fill: CHART_COLOR_PALETTE[index % CHART_COLOR_PALETTE.length],
25565
+ name: field,
25566
+ radius: index === args.stack_fields.length - 1 ? CHART_STYLES.barRadius : void 0
25567
+ },
25568
+ field
25569
+ ))
25570
+ ] }) }) }) }, `stacked-bar-${key}`);
25360
25571
  case "create_dual_axis_chart":
25361
25572
  console.log("[DEBUG] Rendering dual-axis chart");
25362
25573
  if (!args.data || !args.x_field || !args.left_y_field || !args.right_y_field) {
@@ -25368,19 +25579,67 @@ var AIAgentView = () => {
25368
25579
  });
25369
25580
  return null;
25370
25581
  }
25371
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
25372
- /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ComposedChart, { data: args.data, children: [
25373
- /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
25374
- /* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field }),
25375
- /* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { yAxisId: "left", orientation: "left", label: { value: args.left_label || "", angle: -90, position: "insideLeft" } }),
25376
- /* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { yAxisId: "right", orientation: "right", label: { value: args.right_label || "", angle: 90, position: "insideRight" } }),
25377
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, {}),
25378
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
25379
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Bar, { yAxisId: "left", dataKey: args.left_y_field, fill: "#3b82f6", name: args.left_label || args.left_y_field }),
25380
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Line, { yAxisId: "right", type: "monotone", dataKey: args.right_y_field, stroke: "#ef4444", strokeWidth: 2, name: args.right_label || args.right_y_field })
25381
- ] }) }),
25382
- args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25383
- ] }, `dual-axis-${key}`);
25582
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ComposedChart, { data: args.data, margin: CHART_STYLES.margin, children: [
25583
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { ...CHART_STYLES.grid }),
25584
+ /* @__PURE__ */ jsxRuntime.jsx(
25585
+ recharts.XAxis,
25586
+ {
25587
+ dataKey: args.x_field,
25588
+ ...CHART_STYLES.axis
25589
+ }
25590
+ ),
25591
+ /* @__PURE__ */ jsxRuntime.jsx(
25592
+ recharts.YAxis,
25593
+ {
25594
+ yAxisId: "left",
25595
+ orientation: "left",
25596
+ label: { value: args.left_label || "", angle: -90, position: "insideLeft" },
25597
+ ...CHART_STYLES.axis,
25598
+ tickFormatter: (value) => formatNumber(value)
25599
+ }
25600
+ ),
25601
+ /* @__PURE__ */ jsxRuntime.jsx(
25602
+ recharts.YAxis,
25603
+ {
25604
+ yAxisId: "right",
25605
+ orientation: "right",
25606
+ label: { value: args.right_label || "", angle: 90, position: "insideRight" },
25607
+ ...CHART_STYLES.axis,
25608
+ tickFormatter: (value) => formatNumber(value)
25609
+ }
25610
+ ),
25611
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
25612
+ /* @__PURE__ */ jsxRuntime.jsx(
25613
+ recharts.Legend,
25614
+ {
25615
+ wrapperStyle: { paddingTop: "20px" },
25616
+ formatter: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: value })
25617
+ }
25618
+ ),
25619
+ /* @__PURE__ */ jsxRuntime.jsx(
25620
+ recharts.Bar,
25621
+ {
25622
+ yAxisId: "left",
25623
+ dataKey: args.left_y_field,
25624
+ fill: CHART_COLORS.primary,
25625
+ name: args.left_label || args.left_y_field,
25626
+ radius: CHART_STYLES.barRadius
25627
+ }
25628
+ ),
25629
+ /* @__PURE__ */ jsxRuntime.jsx(
25630
+ recharts.Line,
25631
+ {
25632
+ yAxisId: "right",
25633
+ type: "monotone",
25634
+ dataKey: args.right_y_field,
25635
+ stroke: CHART_COLORS.danger,
25636
+ strokeWidth: 2,
25637
+ name: args.right_label || args.right_y_field,
25638
+ dot: { r: 4 },
25639
+ activeDot: { r: 6 }
25640
+ }
25641
+ )
25642
+ ] }) }) }) }, `dual-axis-${key}`);
25384
25643
  case "create_scatter_plot":
25385
25644
  console.log("[DEBUG] Rendering scatter plot");
25386
25645
  if (!args.data || !args.x_field || !args.y_field || !args.group_field) {
@@ -25400,26 +25659,50 @@ var AIAgentView = () => {
25400
25659
  acc[group].push(item);
25401
25660
  return acc;
25402
25661
  }, {});
25403
- const scatterColors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
25404
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
25405
- /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ScatterChart, { children: [
25406
- /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
25407
- /* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field, type: "number", name: args.x_field }),
25408
- /* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { dataKey: args.y_field, type: "number", name: args.y_field }),
25409
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { cursor: { strokeDasharray: "3 3" } }),
25410
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
25411
- Object.entries(groupedData).map(([group, data], index) => /* @__PURE__ */ jsxRuntime.jsx(
25412
- recharts.Scatter,
25413
- {
25414
- name: group,
25415
- data,
25416
- fill: scatterColors[index % scatterColors.length]
25417
- },
25418
- group
25419
- ))
25420
- ] }) }),
25421
- args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25422
- ] }, `scatter-${key}`);
25662
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ScatterChart, { margin: CHART_STYLES.margin, children: [
25663
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { ...CHART_STYLES.grid }),
25664
+ /* @__PURE__ */ jsxRuntime.jsx(
25665
+ recharts.XAxis,
25666
+ {
25667
+ dataKey: args.x_field,
25668
+ type: "number",
25669
+ name: args.x_field,
25670
+ ...CHART_STYLES.axis
25671
+ }
25672
+ ),
25673
+ /* @__PURE__ */ jsxRuntime.jsx(
25674
+ recharts.YAxis,
25675
+ {
25676
+ dataKey: args.y_field,
25677
+ type: "number",
25678
+ name: args.y_field,
25679
+ ...CHART_STYLES.axis
25680
+ }
25681
+ ),
25682
+ /* @__PURE__ */ jsxRuntime.jsx(
25683
+ recharts.Tooltip,
25684
+ {
25685
+ cursor: { strokeDasharray: "3 3" },
25686
+ content: /* @__PURE__ */ jsxRuntime.jsx(CustomTooltip, {})
25687
+ }
25688
+ ),
25689
+ /* @__PURE__ */ jsxRuntime.jsx(
25690
+ recharts.Legend,
25691
+ {
25692
+ wrapperStyle: { paddingTop: "20px" },
25693
+ formatter: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: value })
25694
+ }
25695
+ ),
25696
+ Object.entries(groupedData).map(([group, data], index) => /* @__PURE__ */ jsxRuntime.jsx(
25697
+ recharts.Scatter,
25698
+ {
25699
+ name: group,
25700
+ data,
25701
+ fill: CHART_COLOR_PALETTE[index % CHART_COLOR_PALETTE.length]
25702
+ },
25703
+ group
25704
+ ))
25705
+ ] }) }) }) }, `scatter-${key}`);
25423
25706
  case "create_combo_chart":
25424
25707
  console.log("[DEBUG] Rendering combo chart");
25425
25708
  if (!args.data || !args.x_field || !args.bar_field || !args.line_field) {
@@ -25431,19 +25714,65 @@ var AIAgentView = () => {
25431
25714
  });
25432
25715
  return null;
25433
25716
  }
25434
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
25435
- /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ComposedChart, { data: args.data, children: [
25436
- /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
25437
- /* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field }),
25438
- /* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { yAxisId: "left", orientation: "left" }),
25439
- /* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, { yAxisId: "right", orientation: "right" }),
25440
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, {}),
25441
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
25442
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Bar, { yAxisId: "left", dataKey: args.bar_field, fill: "#3b82f6", name: args.bar_field }),
25443
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Line, { yAxisId: "right", type: "monotone", dataKey: args.line_field, stroke: "#ef4444", strokeWidth: 2, name: args.line_field })
25444
- ] }) }),
25445
- args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25446
- ] }, `combo-${key}`);
25717
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ComposedChart, { data: args.data, margin: CHART_STYLES.margin, children: [
25718
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { ...CHART_STYLES.grid }),
25719
+ /* @__PURE__ */ jsxRuntime.jsx(
25720
+ recharts.XAxis,
25721
+ {
25722
+ dataKey: args.x_field,
25723
+ ...CHART_STYLES.axis
25724
+ }
25725
+ ),
25726
+ /* @__PURE__ */ jsxRuntime.jsx(
25727
+ recharts.YAxis,
25728
+ {
25729
+ yAxisId: "left",
25730
+ orientation: "left",
25731
+ ...CHART_STYLES.axis,
25732
+ tickFormatter: (value) => formatNumber(value)
25733
+ }
25734
+ ),
25735
+ /* @__PURE__ */ jsxRuntime.jsx(
25736
+ recharts.YAxis,
25737
+ {
25738
+ yAxisId: "right",
25739
+ orientation: "right",
25740
+ ...CHART_STYLES.axis,
25741
+ tickFormatter: (value) => formatNumber(value)
25742
+ }
25743
+ ),
25744
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(CustomTooltip, {}), cursor: { fill: "rgba(0, 0, 0, 0.05)" } }),
25745
+ /* @__PURE__ */ jsxRuntime.jsx(
25746
+ recharts.Legend,
25747
+ {
25748
+ wrapperStyle: { paddingTop: "20px" },
25749
+ formatter: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: value })
25750
+ }
25751
+ ),
25752
+ /* @__PURE__ */ jsxRuntime.jsx(
25753
+ recharts.Bar,
25754
+ {
25755
+ yAxisId: "left",
25756
+ dataKey: args.bar_field,
25757
+ fill: CHART_COLORS.primary,
25758
+ name: args.bar_field,
25759
+ radius: CHART_STYLES.barRadius
25760
+ }
25761
+ ),
25762
+ /* @__PURE__ */ jsxRuntime.jsx(
25763
+ recharts.Line,
25764
+ {
25765
+ yAxisId: "right",
25766
+ type: "monotone",
25767
+ dataKey: args.line_field,
25768
+ stroke: CHART_COLORS.danger,
25769
+ strokeWidth: 2,
25770
+ name: args.line_field,
25771
+ dot: { r: 4 },
25772
+ activeDot: { r: 6 }
25773
+ }
25774
+ )
25775
+ ] }) }) }) }, `combo-${key}`);
25447
25776
  case "create_area_chart":
25448
25777
  console.log("[DEBUG] Rendering area chart");
25449
25778
  if (!args.data || !args.x_field || !args.y_field) {
@@ -25454,27 +25783,48 @@ var AIAgentView = () => {
25454
25783
  });
25455
25784
  return null;
25456
25785
  }
25457
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "my-6 w-full", children: [
25458
- /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ComposedChart, { data: args.data, children: [
25459
- /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { strokeDasharray: "3 3" }),
25460
- /* @__PURE__ */ jsxRuntime.jsx(recharts.XAxis, { dataKey: args.x_field }),
25461
- /* @__PURE__ */ jsxRuntime.jsx(recharts.YAxis, {}),
25462
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, {}),
25463
- /* @__PURE__ */ jsxRuntime.jsx(recharts.Legend, {}),
25464
- /* @__PURE__ */ jsxRuntime.jsx(
25465
- recharts.Area,
25466
- {
25467
- type: "monotone",
25468
- dataKey: args.y_field,
25469
- stroke: "#3b82f6",
25470
- fill: args.fill ? "#3b82f6" : "none",
25471
- fillOpacity: args.fill ? 0.6 : 0,
25472
- name: args.y_field
25473
- }
25474
- )
25786
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { title: args.title, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-80", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ComposedChart, { data: args.data, margin: CHART_STYLES.margin, children: [
25787
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: "colorGradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
25788
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "5%", stopColor: CHART_COLORS.primary, stopOpacity: 0.8 }),
25789
+ /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "95%", stopColor: CHART_COLORS.primary, stopOpacity: 0.1 })
25475
25790
  ] }) }),
25476
- args.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
25477
- ] }, `area-${key}`);
25791
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { ...CHART_STYLES.grid }),
25792
+ /* @__PURE__ */ jsxRuntime.jsx(
25793
+ recharts.XAxis,
25794
+ {
25795
+ dataKey: args.x_field,
25796
+ ...CHART_STYLES.axis
25797
+ }
25798
+ ),
25799
+ /* @__PURE__ */ jsxRuntime.jsx(
25800
+ recharts.YAxis,
25801
+ {
25802
+ ...CHART_STYLES.axis,
25803
+ tickFormatter: (value) => formatNumber(value)
25804
+ }
25805
+ ),
25806
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.Tooltip, { content: /* @__PURE__ */ jsxRuntime.jsx(CustomTooltip, {}), cursor: { strokeDasharray: "3 3" } }),
25807
+ /* @__PURE__ */ jsxRuntime.jsx(
25808
+ recharts.Legend,
25809
+ {
25810
+ wrapperStyle: { paddingTop: "20px" },
25811
+ formatter: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: value })
25812
+ }
25813
+ ),
25814
+ /* @__PURE__ */ jsxRuntime.jsx(
25815
+ recharts.Area,
25816
+ {
25817
+ type: "monotone",
25818
+ dataKey: args.y_field,
25819
+ stroke: CHART_COLORS.primary,
25820
+ strokeWidth: 2,
25821
+ fill: args.fill !== false ? "url(#colorGradient)" : "none",
25822
+ name: args.y_field,
25823
+ dot: { r: 4, fill: CHART_COLORS.primary },
25824
+ activeDot: { r: 6 }
25825
+ }
25826
+ )
25827
+ ] }) }) }) }, `area-${key}`);
25478
25828
  default:
25479
25829
  console.warn(`Unknown chart type: ${chartType}`);
25480
25830
  return null;