@mastra/playground-ui 37.0.0-alpha.4 → 37.0.0-alpha.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 (76) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/components/RuleBuilder.cjs.js +10 -0
  3. package/dist/components/RuleBuilder.cjs.js.map +1 -0
  4. package/dist/components/RuleBuilder.d.ts +2 -0
  5. package/dist/components/RuleBuilder.es.js +2 -0
  6. package/dist/components/RuleBuilder.es.js.map +1 -0
  7. package/dist/index.cjs.js +64 -907
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.es.js +17 -841
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/rule-builder-Zs6Ywp5-.js +563 -0
  12. package/dist/rule-builder-Zs6Ywp5-.js.map +1 -0
  13. package/dist/rule-builder-vwKEUlZU.cjs +594 -0
  14. package/dist/rule-builder-vwKEUlZU.cjs.map +1 -0
  15. package/dist/src/ds/components/RuleBuilder/index.d.ts +2 -0
  16. package/dist/src/utils/colors.d.ts +1 -0
  17. package/dist/src/utils/errors.d.ts +2 -0
  18. package/dist/src/utils/file.d.ts +1 -0
  19. package/dist/src/utils/formatting.d.ts +1 -0
  20. package/dist/src/utils/json-schema.d.ts +1 -0
  21. package/dist/src/utils/number.d.ts +1 -0
  22. package/dist/src/utils/query-utils.d.ts +1 -0
  23. package/dist/src/utils/rule-engine.d.ts +2 -0
  24. package/dist/src/utils/string.d.ts +1 -0
  25. package/dist/src/utils/truncate-string.d.ts +1 -0
  26. package/dist/utils/colors.cjs.js +15 -0
  27. package/dist/utils/colors.cjs.js.map +1 -0
  28. package/dist/utils/colors.d.ts +2 -0
  29. package/dist/utils/colors.es.js +11 -0
  30. package/dist/utils/colors.es.js.map +1 -0
  31. package/dist/utils/errors.cjs.js +33 -0
  32. package/dist/utils/errors.cjs.js.map +1 -0
  33. package/dist/utils/errors.d.ts +2 -0
  34. package/dist/utils/errors.es.js +22 -0
  35. package/dist/utils/errors.es.js.map +1 -0
  36. package/dist/utils/file.cjs.js +113 -0
  37. package/dist/utils/file.cjs.js.map +1 -0
  38. package/dist/utils/file.d.ts +2 -0
  39. package/dist/utils/file.es.js +100 -0
  40. package/dist/utils/file.es.js.map +1 -0
  41. package/dist/utils/formatting.cjs.js +47 -0
  42. package/dist/utils/formatting.cjs.js.map +1 -0
  43. package/dist/utils/formatting.d.ts +2 -0
  44. package/dist/utils/formatting.es.js +41 -0
  45. package/dist/utils/formatting.es.js.map +1 -0
  46. package/dist/utils/json-schema.cjs.js +3 -0
  47. package/dist/utils/json-schema.cjs.js.map +1 -0
  48. package/dist/utils/json-schema.d.ts +2 -0
  49. package/dist/utils/json-schema.es.js +2 -0
  50. package/dist/utils/json-schema.es.js.map +1 -0
  51. package/dist/utils/number.cjs.js +10 -0
  52. package/dist/utils/number.cjs.js.map +1 -0
  53. package/dist/utils/number.d.ts +2 -0
  54. package/dist/utils/number.es.js +6 -0
  55. package/dist/utils/number.es.js.map +1 -0
  56. package/dist/utils/query-utils.cjs.js +98 -0
  57. package/dist/utils/query-utils.cjs.js.map +1 -0
  58. package/dist/utils/query-utils.d.ts +2 -0
  59. package/dist/utils/query-utils.es.js +88 -0
  60. package/dist/utils/query-utils.es.js.map +1 -0
  61. package/dist/utils/rule-engine.cjs.js +29 -0
  62. package/dist/utils/rule-engine.cjs.js.map +1 -0
  63. package/dist/utils/rule-engine.d.ts +2 -0
  64. package/dist/utils/rule-engine.es.js +21 -0
  65. package/dist/utils/rule-engine.es.js.map +1 -0
  66. package/dist/utils/string.cjs.js +11 -0
  67. package/dist/utils/string.cjs.js.map +1 -0
  68. package/dist/utils/string.d.ts +2 -0
  69. package/dist/utils/string.es.js +7 -0
  70. package/dist/utils/string.es.js.map +1 -0
  71. package/dist/utils/truncate-string.cjs.js +11 -0
  72. package/dist/utils/truncate-string.cjs.js.map +1 -0
  73. package/dist/utils/truncate-string.d.ts +2 -0
  74. package/dist/utils/truncate-string.es.js +7 -0
  75. package/dist/utils/truncate-string.es.js.map +1 -0
  76. package/package.json +7 -7
package/dist/index.cjs.js CHANGED
@@ -121,6 +121,13 @@ const hooks_useIsMobile = require('./hooks/use-is-mobile.cjs.js');
121
121
  const hooks_useKeyboardShortcutLabel = require('./hooks/use-keyboard-shortcut-label.cjs.js');
122
122
  const hooks_useEnvironmentVariablesEditor = require('./hooks/use-environment-variables-editor.cjs.js');
123
123
  const utils_cn = require('./cn-vA5sWo9W.cjs');
124
+ const utils_string = require('./utils/string.cjs.js');
125
+ const utils_number = require('./utils/number.cjs.js');
126
+ const utils_formatting = require('./utils/formatting.cjs.js');
127
+ const utils_colors = require('./utils/colors.cjs.js');
128
+ const utils_truncateString = require('./utils/truncate-string.cjs.js');
129
+ const utils_errors = require('./utils/errors.cjs.js');
130
+ const utils_queryUtils = require('./utils/query-utils.cjs.js');
124
131
  const toast = require('./toast-Bh4WQDyj.cjs');
125
132
  const jsxRuntime = require('react/jsx-runtime');
126
133
  const lucideReact = require('lucide-react');
@@ -138,6 +145,7 @@ const icons_AnthropicChatIcon = require('./icons/AnthropicChatIcon.cjs.js');
138
145
  const icons_AnthropicMessagesIcon = require('./icons/AnthropicMessagesIcon.cjs.js');
139
146
  const icons_ApiIcon = require('./icons/ApiIcon.cjs.js');
140
147
  const icons_AzureIcon = require('./icons/AzureIcon.cjs.js');
148
+ const utils_file = require('./utils/file.cjs.js');
141
149
  const icons_BranchIcon = require('./icons/BranchIcon.cjs.js');
142
150
  const icons_CheckIcon = require('./icons/CheckIcon.cjs.js');
143
151
  const icons_ChevronIcon = require('./icons/ChevronIcon.cjs.js');
@@ -176,6 +184,7 @@ const icons_MemoryIcon = require('./icons/MemoryIcon.cjs.js');
176
184
  const icons_MetricsIcon = require('./icons/MetricsIcon.cjs.js');
177
185
  const icons_MistralIcon = require('./icons/MistralIcon.cjs.js');
178
186
  const icons_NetlifyIcon = require('./icons/NetlifyIcon.cjs.js');
187
+ const ruleBuilder = require('./rule-builder-vwKEUlZU.cjs');
179
188
  const icons_OpenAIIcon = require('./icons/OpenAIIcon.cjs.js');
180
189
  const icons_OpenaiChatIcon = require('./icons/OpenaiChatIcon.cjs.js');
181
190
  const icons_ProcessorIcon = require('./icons/ProcessorIcon.cjs.js');
@@ -198,766 +207,12 @@ const icons_VariablesIcon = require('./icons/VariablesIcon.cjs.js');
198
207
  const icons_WorkflowCoinIcon = require('./icons/WorkflowCoinIcon.cjs.js');
199
208
  const icons_WorkspacesIcon = require('./icons/WorkspacesIcon.cjs.js');
200
209
  const icons_XGroqIcon = require('./icons/XGroqIcon.cjs.js');
201
-
202
- function _interopNamespaceDefault(e) {
203
- const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
204
- if (e) {
205
- for (const k in e) {
206
- if (k !== 'default') {
207
- const d = Object.getOwnPropertyDescriptor(e, k);
208
- Object.defineProperty(n, k, d.get ? d : {
209
- enumerable: true,
210
- get: () => e[k]
211
- });
212
- }
213
- }
214
- }
215
- n.default = e;
216
- return Object.freeze(n);
217
- }
218
-
219
- const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
220
-
221
- const lodashTitleCase = (str) => {
222
- const camelCased = str.replace(/[-_\s]+(.)?/g, (_, char) => char ? char.toUpperCase() : "").replace(/^(.)/, (char) => char.toLowerCase());
223
- return camelCased.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).trim();
224
- };
225
-
226
- const toSigFigs = (num, sigFigs) => {
227
- return Number(num.toPrecision(sigFigs));
228
- };
210
+ const utils_ruleEngine = require('./utils/rule-engine.cjs.js');
229
211
 
230
212
  const isObjectEmpty = (objectName) => {
231
213
  return objectName && Object.keys(objectName).length === 0 && objectName.constructor === Object;
232
214
  };
233
215
 
234
- let prettierModules;
235
- const loadPrettier = () => prettierModules ??= Promise.all([
236
- import('prettier/standalone'),
237
- import('prettier/plugins/babel'),
238
- import('prettier/plugins/estree')
239
- ]).catch((error) => {
240
- prettierModules = void 0;
241
- throw error;
242
- });
243
- const formatJSON = async (code) => {
244
- const [prettier, prettierPluginBabel, prettierPluginEstree] = await loadPrettier();
245
- const formatted = await prettier.format(code, {
246
- semi: false,
247
- parser: "json",
248
- printWidth: 80,
249
- tabWidth: 2,
250
- plugins: [prettierPluginBabel, prettierPluginEstree]
251
- });
252
- return formatted;
253
- };
254
- const formatTypeScript = async (code) => {
255
- const [prettier, prettierPluginBabel, prettierPluginEstree] = await loadPrettier();
256
- const formatted = await prettier.format(code, {
257
- parser: "babel-ts",
258
- printWidth: 80,
259
- tabWidth: 2,
260
- plugins: [prettierPluginBabel, prettierPluginEstree]
261
- });
262
- return formatted;
263
- };
264
- const isValidJson = (str) => {
265
- try {
266
- const obj = JSON.parse(str);
267
- return !!obj && typeof obj === "object";
268
- } catch {
269
- return false;
270
- }
271
- };
272
-
273
- const stringToColor = (str, lightness = 90, saturation = 100) => {
274
- let hash = 0;
275
- for (let i = 0; i < str.length; i++) {
276
- hash = str.charCodeAt(i) + ((hash << 5) - hash);
277
- hash = hash & hash;
278
- }
279
- return `hsl(${hash % 360}, ${saturation}%, ${lightness}%)`;
280
- };
281
-
282
- function truncateString(str, maxLength) {
283
- if (str.length <= maxLength) return str;
284
- return str.slice(0, maxLength) + "…";
285
- }
286
-
287
- const errorFallback = "Something went wrong while fetching the data.";
288
- const parseError = (error) => {
289
- try {
290
- const httpErrorPattern = /^HTTP error! status:\s*\d+\s*- \s*/;
291
- const errorMessage = error?.message.replace(httpErrorPattern, "");
292
- const jsonError = JSON.parse(errorMessage || "{}");
293
- return {
294
- error: jsonError?.error || errorFallback,
295
- stack: jsonError?.stack || error?.stack
296
- };
297
- } catch {
298
- return {
299
- error: error?.message || errorFallback,
300
- stack: void 0
301
- };
302
- }
303
- };
304
-
305
- const HTTP_NO_RETRY_STATUSES = [400, 401, 403, 404];
306
- function is401UnauthorizedError(error) {
307
- if (!error || typeof error !== "object") return false;
308
- if ("status" in error && error.status === 401) {
309
- return true;
310
- }
311
- if ("statusCode" in error && error.statusCode === 401) {
312
- return true;
313
- }
314
- if ("message" in error) {
315
- const message = error.message;
316
- if (typeof message === "string") {
317
- return /\bstatus:\s*401\b/.test(message);
318
- }
319
- }
320
- return false;
321
- }
322
- function is403ForbiddenError(error) {
323
- if (!error || typeof error !== "object") return false;
324
- if ("status" in error && error.status === 403) {
325
- return true;
326
- }
327
- if ("statusCode" in error && error.statusCode === 403) {
328
- return true;
329
- }
330
- if ("message" in error) {
331
- const message = error.message;
332
- if (typeof message === "string") {
333
- return /\bstatus:\s*403\b/.test(message);
334
- }
335
- }
336
- return false;
337
- }
338
- function is404NotFoundError(error) {
339
- if (!error || typeof error !== "object") return false;
340
- if ("status" in error && error.status === 404) {
341
- return true;
342
- }
343
- if ("statusCode" in error && error.statusCode === 404) {
344
- return true;
345
- }
346
- if ("message" in error) {
347
- const message = error.message;
348
- if (typeof message === "string") {
349
- return /\bstatus:\s*404\b/.test(message);
350
- }
351
- }
352
- return false;
353
- }
354
- function isBranchesNotSupportedError(error) {
355
- if (!error || typeof error !== "object" || !("message" in error)) return false;
356
- const message = error.message;
357
- if (typeof message !== "string") return false;
358
- return message.includes("does not support listing trace branches");
359
- }
360
- function isUnsupportedObservabilityOperationError(error, operation) {
361
- if (!error || typeof error !== "object" || !("message" in error)) return false;
362
- const message = error.message;
363
- if (typeof message !== "string") return false;
364
- return message.includes(`does not support listing ${operation}`);
365
- }
366
- function isNonRetryableError(error) {
367
- if (!error || typeof error !== "object") return false;
368
- if ("status" in error) {
369
- const status = error.status;
370
- return HTTP_NO_RETRY_STATUSES.includes(status);
371
- }
372
- if ("statusCode" in error) {
373
- const statusCode = error.statusCode;
374
- return HTTP_NO_RETRY_STATUSES.includes(statusCode);
375
- }
376
- if ("message" in error) {
377
- const message = error.message;
378
- if (typeof message === "string") {
379
- return HTTP_NO_RETRY_STATUSES.some((code) => new RegExp(`\\bstatus:\\s*${code}\\b`).test(message));
380
- }
381
- }
382
- return false;
383
- }
384
- function shouldRetryQuery(failureCount, error) {
385
- if (isNonRetryableError(error)) {
386
- return false;
387
- }
388
- return failureCount < 3;
389
- }
390
-
391
- const isRule = (condition) => "field" in condition;
392
- const isRuleGroup = (condition) => "conditions" in condition;
393
- const countLeafRules = (group) => {
394
- if (!group) return 0;
395
- return group.conditions.reduce((count, condition) => {
396
- if (isRule(condition)) return count + 1;
397
- return count + countLeafRules(condition);
398
- }, 0);
399
- };
400
- const createDefaultRule = () => ({
401
- field: "",
402
- operator: "equals",
403
- value: ""
404
- });
405
- const createDefaultRuleGroup = (operator = "AND") => ({
406
- operator,
407
- conditions: [createDefaultRule()]
408
- });
409
-
410
- const getPropertyType = (property) => {
411
- if (Array.isArray(property.type)) {
412
- return property.type.find((t) => t !== "null") || "string";
413
- }
414
- return property.type || "string";
415
- };
416
- const hasNestedChildren = (property) => {
417
- const type = getPropertyType(property);
418
- if (type === "object" && property.properties) {
419
- return Object.keys(property.properties).length > 0;
420
- }
421
- if (type === "array" && property.items) {
422
- const itemType = getPropertyType(property.items);
423
- return itemType === "object" && !!property.items.properties;
424
- }
425
- return false;
426
- };
427
- const getFieldOptionsFromProperties = (properties, parentPath = "") => {
428
- if (!properties) return [];
429
- return Object.entries(properties).map(([key, property]) => {
430
- const path = parentPath ? `${parentPath}.${key}` : key;
431
- const type = getPropertyType(property);
432
- const hasChildren = hasNestedChildren(property);
433
- return {
434
- path,
435
- label: property.title || key,
436
- type,
437
- hasChildren,
438
- children: type === "object" ? property.properties : void 0,
439
- items: type === "array" ? property.items : void 0
440
- };
441
- });
442
- };
443
- const getFieldOptionsFromSchema = (schema) => {
444
- return getFieldOptionsFromProperties(schema.properties);
445
- };
446
- const getChildFieldOptions = (fieldOption, currentPath) => {
447
- if (fieldOption.type === "object" && fieldOption.children) {
448
- return getFieldOptionsFromProperties(fieldOption.children, currentPath);
449
- }
450
- if (fieldOption.type === "array" && fieldOption.items) {
451
- const itemType = getPropertyType(fieldOption.items);
452
- if (itemType === "object" && fieldOption.items.properties) {
453
- return getFieldOptionsFromProperties(fieldOption.items.properties, currentPath);
454
- }
455
- }
456
- return [];
457
- };
458
- const parseFieldPath = (path) => {
459
- return path.split(".").filter(Boolean);
460
- };
461
- const getFieldOptionAtPath = (schema, path) => {
462
- const segments = parseFieldPath(path);
463
- if (segments.length === 0) return void 0;
464
- let currentProperties = schema.properties;
465
- let currentPath = "";
466
- let result;
467
- for (let i = 0; i < segments.length; i++) {
468
- const segment = segments[i];
469
- if (!currentProperties || !currentProperties[segment]) {
470
- return void 0;
471
- }
472
- const property = currentProperties[segment];
473
- currentPath = currentPath ? `${currentPath}.${segment}` : segment;
474
- const type = getPropertyType(property);
475
- const hasChildren = hasNestedChildren(property);
476
- result = {
477
- path: currentPath,
478
- label: property.title || segment,
479
- type,
480
- hasChildren,
481
- children: type === "object" ? property.properties : void 0,
482
- items: type === "array" ? property.items : void 0
483
- };
484
- if (type === "object" && property.properties) {
485
- currentProperties = property.properties;
486
- } else if (type === "array" && property.items?.properties) {
487
- currentProperties = property.items.properties;
488
- } else {
489
- currentProperties = void 0;
490
- }
491
- }
492
- return result;
493
- };
494
-
495
- const getFieldTypeIcon = (type) => {
496
- switch (type) {
497
- case "object":
498
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Braces, {});
499
- case "array":
500
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, {});
501
- case "number":
502
- case "integer":
503
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Hash, {});
504
- case "boolean":
505
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ToggleLeft, {});
506
- case "string":
507
- default:
508
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, {});
509
- }
510
- };
511
- const FieldLevelSelect = ({
512
- options,
513
- value,
514
- onChange,
515
- placeholder = "Select field",
516
- className
517
- }) => {
518
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn("relative", className), children: /* @__PURE__ */ jsxRuntime.jsxs(select.Select, { value, onValueChange: onChange, children: [
519
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectTrigger, { className: "min-w-[140px] text-neutral6 bg-surface4", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(select.SelectValue, { placeholder }) }),
520
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectContent, { children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(select.SelectItem, { value: option.path, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
521
- /* @__PURE__ */ jsxRuntime.jsx(icons_Icon.Icon, { size: "sm", className: "text-neutral3", children: getFieldTypeIcon(option.type) }),
522
- option.label,
523
- option.hasChildren && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-neutral3", children: "..." })
524
- ] }) }, option.path)) })
525
- ] }) });
526
- };
527
- const RuleFieldSelect = ({ schema, value, onChange, className }) => {
528
- const pathSegments = React__namespace.useMemo(() => parseFieldPath(value), [value]);
529
- const selectors = React__namespace.useMemo(() => {
530
- const result = [];
531
- const rootOptions = getFieldOptionsFromSchema(schema);
532
- if (rootOptions.length === 0) return result;
533
- result.push({
534
- options: rootOptions,
535
- value: pathSegments[0] || "",
536
- basePath: ""
537
- });
538
- let currentPath = "";
539
- for (let i = 0; i < pathSegments.length; i++) {
540
- const segment = pathSegments[i];
541
- currentPath = currentPath ? `${currentPath}.${segment}` : segment;
542
- const fieldOption = getFieldOptionAtPath(schema, currentPath);
543
- if (!fieldOption || !fieldOption.hasChildren) break;
544
- const childOptions = getChildFieldOptions(fieldOption, currentPath);
545
- if (childOptions.length === 0) break;
546
- const nextSegment = pathSegments[i + 1];
547
- const nextPath = nextSegment ? `${currentPath}.${nextSegment}` : "";
548
- result.push({
549
- options: childOptions,
550
- value: nextPath,
551
- basePath: currentPath
552
- });
553
- }
554
- return result;
555
- }, [schema, pathSegments]);
556
- const handleChange = React__namespace.useCallback(
557
- (levelIndex, newValue) => {
558
- onChange(newValue);
559
- },
560
- [onChange]
561
- );
562
- if (selectors.length === 0) {
563
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn("text-sm text-neutral3", className), children: "No fields available" });
564
- }
565
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn("flex items-center gap-1", className), children: selectors.map((selector, index) => /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Fragment, { children: [
566
- index > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-neutral3", children: "." }),
567
- /* @__PURE__ */ jsxRuntime.jsx(
568
- FieldLevelSelect,
569
- {
570
- options: selector.options,
571
- value: selector.value,
572
- onChange: (newValue) => handleChange(index, newValue),
573
- placeholder: index === 0 ? "Select field" : "Select property"
574
- }
575
- )
576
- ] }, `${selector.basePath}-${index}`)) });
577
- };
578
-
579
- const OPERATOR_LABELS = {
580
- equals: "equals",
581
- not_equals: "not equals",
582
- contains: "contains",
583
- not_contains: "not contains",
584
- greater_than: "greater than",
585
- less_than: "less than",
586
- greater_than_or_equal: "greater than or equal",
587
- less_than_or_equal: "less than or equal",
588
- in: "in",
589
- not_in: "not in",
590
- exists: "exists",
591
- not_exists: "not exists"
592
- };
593
- const OPERATORS = [
594
- "equals",
595
- "not_equals",
596
- "contains",
597
- "not_contains",
598
- "greater_than",
599
- "less_than",
600
- "greater_than_or_equal",
601
- "less_than_or_equal",
602
- "in",
603
- "not_in",
604
- "exists",
605
- "not_exists"
606
- ];
607
-
608
- const OPERATOR_ICONS = {
609
- equals: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Equal, {}),
610
- not_equals: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EqualNot, {}),
611
- contains: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.TextSearch, {}),
612
- not_contains: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Text, {}),
613
- greater_than: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, {}),
614
- less_than: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, {}),
615
- greater_than_or_equal: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsRight, {}),
616
- less_than_or_equal: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsLeft, {}),
617
- in: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, {}),
618
- not_in: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListX, {}),
619
- exists: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, {}),
620
- not_exists: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Ban, {})
621
- };
622
- const RuleOperatorSelect = ({ value, onChange, operators, className }) => {
623
- const operatorList = operators ?? OPERATORS;
624
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn("relative", className), children: /* @__PURE__ */ jsxRuntime.jsxs(select.Select, { value, onValueChange: onChange, children: [
625
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectTrigger, { className: "min-w-[150px] text-neutral6 bg-surface4", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(select.SelectValue, { placeholder: "Select operator" }) }),
626
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectContent, { children: operatorList.map((operator) => /* @__PURE__ */ jsxRuntime.jsx(select.SelectItem, { value: operator, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
627
- /* @__PURE__ */ jsxRuntime.jsx(icons_Icon.Icon, { size: "sm", className: "text-neutral3", children: OPERATOR_ICONS[operator] }),
628
- OPERATOR_LABELS[operator]
629
- ] }) }, operator)) })
630
- ] }) });
631
- };
632
-
633
- const parseValue = (stringValue) => {
634
- const trimmed = stringValue.trim();
635
- if (trimmed === "") return "";
636
- if (trimmed === "true") return true;
637
- if (trimmed === "false") return false;
638
- if (trimmed === "null") return null;
639
- const lowerTrimmed = trimmed.toLowerCase();
640
- if (lowerTrimmed === "infinity" || lowerTrimmed === "-infinity" || lowerTrimmed === "nan") {
641
- return trimmed;
642
- }
643
- const num = Number(trimmed);
644
- if (!Number.isNaN(num)) return num;
645
- return stringValue;
646
- };
647
- const parseArrayValue = (stringValue) => {
648
- if (stringValue.trim() === "") return [];
649
- return stringValue.split(",").map((item) => parseValue(item.trim()));
650
- };
651
- const valueToString = (value) => {
652
- if (value === null) return "null";
653
- if (value === void 0) return "";
654
- if (Array.isArray(value)) return value.map(valueToString).join(", ");
655
- return String(value);
656
- };
657
- const booleanToString = (value) => {
658
- if (value === true) return "true";
659
- if (value === false) return "false";
660
- return "";
661
- };
662
- const BooleanValueInput = ({ value, onChange, className }) => {
663
- const stringValue = booleanToString(value);
664
- const handleChange = React__namespace.useCallback(
665
- (newValue) => {
666
- onChange(newValue === "true");
667
- },
668
- [onChange]
669
- );
670
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils_cn.cn("relative", className), children: [
671
- /* @__PURE__ */ jsxRuntime.jsx(icons_Icon.Icon, { size: "sm", className: "absolute left-2 top-1/2 -translate-y-1/2 text-neutral3 pointer-events-none z-10", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ToggleLeft, {}) }),
672
- /* @__PURE__ */ jsxRuntime.jsxs(select.Select, { value: stringValue, onValueChange: handleChange, children: [
673
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectTrigger, { className: "min-w-[140px] bg-surface4 pl-7", size: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(select.SelectValue, { placeholder: "Select value" }) }),
674
- /* @__PURE__ */ jsxRuntime.jsxs(select.SelectContent, { children: [
675
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectItem, { value: "true", children: "true" }),
676
- /* @__PURE__ */ jsxRuntime.jsx(select.SelectItem, { value: "false", children: "false" })
677
- ] })
678
- ] })
679
- ] });
680
- };
681
- const NumberValueInput = ({ value, onChange, placeholder, className }) => {
682
- const displayValue = value === void 0 || value === "" ? "" : String(value);
683
- const handleChange = React__namespace.useCallback(
684
- (e) => {
685
- const inputValue = e.target.value;
686
- if (inputValue === "") {
687
- onChange("");
688
- } else {
689
- const num = Number(inputValue);
690
- onChange(Number.isNaN(num) ? inputValue : num);
691
- }
692
- },
693
- [onChange]
694
- );
695
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils_cn.cn("relative", className), children: [
696
- /* @__PURE__ */ jsxRuntime.jsx(icons_Icon.Icon, { size: "sm", className: "absolute left-2 top-1/2 -translate-y-1/2 text-neutral3 pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Hash, {}) }),
697
- /* @__PURE__ */ jsxRuntime.jsx(
698
- input.Input,
699
- {
700
- type: "number",
701
- value: displayValue,
702
- onChange: handleChange,
703
- placeholder: placeholder || "Enter number",
704
- className: "min-w-[140px] bg-surface4 pl-7",
705
- size: "sm"
706
- }
707
- )
708
- ] });
709
- };
710
- const TextValueInput = ({ value, onChange, placeholder, className }) => {
711
- const displayValue = valueToString(value);
712
- const handleChange = React__namespace.useCallback(
713
- (e) => {
714
- onChange(parseValue(e.target.value));
715
- },
716
- [onChange]
717
- );
718
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils_cn.cn("relative", className), children: [
719
- /* @__PURE__ */ jsxRuntime.jsx(icons_Icon.Icon, { size: "sm", className: "absolute left-2 top-1/2 -translate-y-1/2 text-neutral3 pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, {}) }),
720
- /* @__PURE__ */ jsxRuntime.jsx(
721
- input.Input,
722
- {
723
- value: displayValue,
724
- onChange: handleChange,
725
- placeholder: placeholder || "Enter value",
726
- className: "min-w-[140px] bg-surface4 pl-7",
727
- size: "sm"
728
- }
729
- )
730
- ] });
731
- };
732
- const ArrayValueInput = ({ value, onChange, placeholder, className }) => {
733
- const displayValue = React__namespace.useMemo(() => {
734
- if (Array.isArray(value)) {
735
- return value.map(valueToString).join(", ");
736
- }
737
- return valueToString(value);
738
- }, [value]);
739
- const handleChange = React__namespace.useCallback(
740
- (e) => {
741
- onChange(parseArrayValue(e.target.value));
742
- },
743
- [onChange]
744
- );
745
- return /* @__PURE__ */ jsxRuntime.jsx(
746
- input.Input,
747
- {
748
- value: displayValue,
749
- onChange: handleChange,
750
- placeholder: placeholder || "Enter values (comma-separated)",
751
- className: utils_cn.cn("min-w-[160px] bg-surface4", className),
752
- size: "sm"
753
- }
754
- );
755
- };
756
- const RuleValueInput = ({
757
- value,
758
- onChange,
759
- operator,
760
- fieldType,
761
- placeholder,
762
- className
763
- }) => {
764
- const isArrayOperator = operator === "in" || operator === "not_in";
765
- if (isArrayOperator) {
766
- return /* @__PURE__ */ jsxRuntime.jsx(ArrayValueInput, { value, onChange, placeholder, className });
767
- }
768
- if (fieldType === "boolean") {
769
- return /* @__PURE__ */ jsxRuntime.jsx(BooleanValueInput, { value, onChange, placeholder, className });
770
- }
771
- if (fieldType === "number" || fieldType === "integer") {
772
- return /* @__PURE__ */ jsxRuntime.jsx(NumberValueInput, { value, onChange, placeholder, className });
773
- }
774
- return /* @__PURE__ */ jsxRuntime.jsx(TextValueInput, { value, onChange, placeholder, className });
775
- };
776
-
777
- const PRIMITIVE_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "integer"]);
778
- const RuleRow = ({ schema, rule, onChange, onRemove, className }) => {
779
- const fieldType = React__namespace.useMemo(() => {
780
- return getFieldOptionAtPath(schema, rule.field)?.type;
781
- }, [schema, rule.field]);
782
- const isPrimitive = fieldType !== void 0 && PRIMITIVE_TYPES.has(fieldType);
783
- const isArray = fieldType === "array";
784
- const isArrayOperator = rule.operator === "in" || rule.operator === "not_in";
785
- const isExistenceOperator = rule.operator === "exists" || rule.operator === "not_exists";
786
- const showComparator = isPrimitive || isArray;
787
- const showValueInput = !isExistenceOperator && (isPrimitive || isArray && isArrayOperator);
788
- const handleFieldChange = React__namespace.useCallback(
789
- (field) => {
790
- onChange({ ...rule, field });
791
- },
792
- [rule, onChange]
793
- );
794
- const handleOperatorChange = React__namespace.useCallback(
795
- (operator) => {
796
- const isNewExistence = operator === "exists" || operator === "not_exists";
797
- if (isNewExistence) {
798
- onChange({ ...rule, operator, value: void 0 });
799
- return;
800
- }
801
- const isArrayOperator2 = operator === "in" || operator === "not_in";
802
- const wasArrayOperator = rule.operator === "in" || rule.operator === "not_in";
803
- let newValue = rule.value;
804
- if (isArrayOperator2 && !wasArrayOperator) {
805
- newValue = rule.value !== void 0 ? [rule.value] : [];
806
- } else if (!isArrayOperator2 && wasArrayOperator) {
807
- newValue = Array.isArray(rule.value) ? rule.value[0] : rule.value;
808
- }
809
- onChange({ ...rule, operator, value: newValue });
810
- },
811
- [rule, onChange]
812
- );
813
- const handleValueChange = React__namespace.useCallback(
814
- (value) => {
815
- onChange({ ...rule, value });
816
- },
817
- [rule, onChange]
818
- );
819
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between gap-2", children: [
820
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils_cn.cn("flex flex-wrap items-center gap-2", className), children: [
821
- /* @__PURE__ */ jsxRuntime.jsx(RuleFieldSelect, { schema, value: rule.field, onChange: handleFieldChange }),
822
- showComparator && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
823
- /* @__PURE__ */ jsxRuntime.jsx(
824
- RuleOperatorSelect,
825
- {
826
- value: rule.operator,
827
- onChange: handleOperatorChange,
828
- operators: isArray ? ["in", "not_in"] : void 0
829
- }
830
- ),
831
- showValueInput && /* @__PURE__ */ jsxRuntime.jsx(
832
- RuleValueInput,
833
- {
834
- value: rule.value,
835
- onChange: handleValueChange,
836
- operator: rule.operator,
837
- fieldType
838
- }
839
- )
840
- ] })
841
- ] }),
842
- /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { type: "button", onClick: onRemove, tooltip: "Remove rule", size: "icon-sm", variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}) })
843
- ] });
844
- };
845
-
846
- const DEFAULT_MAX_DEPTH = 3;
847
- const RuleGroupView = ({ schema, group, onChange, onRemove, depth, maxDepth }) => {
848
- const isRoot = depth === 0;
849
- const handleToggleOperator = () => {
850
- onChange({ ...group, operator: group.operator === "AND" ? "OR" : "AND" });
851
- };
852
- const handleConditionChange = (index, condition) => {
853
- onChange({
854
- ...group,
855
- conditions: group.conditions.map((c, i) => i === index ? condition : c)
856
- });
857
- };
858
- const handleRemoveCondition = (index) => {
859
- const newConditions = group.conditions.filter((_, i) => i !== index);
860
- if (newConditions.length === 0 && onRemove) {
861
- onRemove();
862
- } else {
863
- onChange({ ...group, conditions: newConditions });
864
- }
865
- };
866
- const handleAddRule = () => {
867
- onChange({ ...group, conditions: [...group.conditions, createDefaultRule()] });
868
- };
869
- const handleAddGroup = () => {
870
- onChange({
871
- ...group,
872
- conditions: [
873
- ...group.conditions,
874
- createDefaultRuleGroup(group.operator === "AND" ? "OR" : "AND")
875
- ]
876
- });
877
- };
878
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils_cn.cn(isRoot ? "bg-surface2" : "pl-6 bg-surface3"), children: [
879
- !isRoot && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between pl-3 pr-4 py-1.5 border-b border-border1 border-dashed", children: [
880
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ui-xs text-neutral3", children: "Group" }),
881
- onRemove && /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { type: "button", onClick: onRemove, tooltip: "Remove group", size: "icon-sm", variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}) })
882
- ] }),
883
- group.conditions.map((condition, index) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-border1 border-dashed last:border-b-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils_cn.cn("relative", isRule(condition) && "p-4 border-l-4 border-border1"), children: [
884
- index > 0 && /* @__PURE__ */ jsxRuntime.jsx(
885
- "button",
886
- {
887
- type: "button",
888
- onClick: handleToggleOperator,
889
- className: utils_cn.cn(
890
- "absolute left-1/2 -translate-x-1/2 z-10 -translate-y-1/2 top-0 text-ui-xs px-3 py-0.5 rounded-full cursor-pointer",
891
- group.operator === "OR" ? "bg-accent6Dark text-accent6 hover:bg-accent6Dark/70" : "bg-accent3Dark text-accent3 hover:bg-accent3Dark/70"
892
- ),
893
- children: group.operator.toLowerCase()
894
- }
895
- ),
896
- isRule(condition) ? /* @__PURE__ */ jsxRuntime.jsx(
897
- RuleRow,
898
- {
899
- schema,
900
- rule: condition,
901
- onChange: (updatedRule) => handleConditionChange(index, updatedRule),
902
- onRemove: () => handleRemoveCondition(index)
903
- }
904
- ) : /* @__PURE__ */ jsxRuntime.jsx(
905
- RuleGroupView,
906
- {
907
- schema,
908
- group: condition,
909
- onChange: (updatedGroup) => handleConditionChange(index, updatedGroup),
910
- onRemove: () => handleRemoveCondition(index),
911
- depth: depth + 1,
912
- maxDepth
913
- }
914
- )
915
- ] }) }, index)),
916
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-2 flex gap-1", children: [
917
- /* @__PURE__ */ jsxRuntime.jsxs(Button.Button, { type: "button", onClick: handleAddRule, variant: "ghost", size: "sm", children: [
918
- /* @__PURE__ */ jsxRuntime.jsx(icons_Icon.Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {}) }),
919
- "Add rule"
920
- ] }),
921
- depth < maxDepth - 1 && /* @__PURE__ */ jsxRuntime.jsxs(Button.Button, { type: "button", onClick: handleAddGroup, variant: "ghost", size: "sm", children: [
922
- /* @__PURE__ */ jsxRuntime.jsx(icons_Icon.Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Component, {}) }),
923
- "Add group"
924
- ] })
925
- ] })
926
- ] });
927
- };
928
- const RuleBuilder = ({
929
- schema,
930
- ruleGroup,
931
- onChange,
932
- maxDepth = DEFAULT_MAX_DEPTH,
933
- className
934
- }) => {
935
- const handleGroupChange = React__namespace.useCallback(
936
- (group) => {
937
- onChange(group);
938
- },
939
- [onChange]
940
- );
941
- const handleAddFirstRule = React__namespace.useCallback(() => {
942
- onChange({ operator: "AND", conditions: [createDefaultRule()] });
943
- }, [onChange]);
944
- if (!ruleGroup) {
945
- return /* @__PURE__ */ jsxRuntime.jsxs(
946
- "button",
947
- {
948
- type: "button",
949
- onClick: handleAddFirstRule,
950
- className: "flex items-center justify-center gap-2 text-ui-sm text-neutral3 hover:text-neutral6 w-full border border-dashed border-border1 p-2 rounded-md",
951
- children: [
952
- /* @__PURE__ */ jsxRuntime.jsx(icons_Icon.Icon, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, {}) }),
953
- "Add conditional rule"
954
- ]
955
- }
956
- );
957
- }
958
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx(RuleGroupView, { schema, group: ruleGroup, onChange: handleGroupChange, depth: 0, maxDepth }) });
959
- };
960
-
961
216
  const PanelEdgeIcon = ({ side }) => /* @__PURE__ */ jsxRuntime.jsxs(
962
217
  "svg",
963
218
  {
@@ -1326,104 +581,6 @@ const PanelDrawer = ({ direction, label, children }) => {
1326
581
  ] });
1327
582
  };
1328
583
 
1329
- const EXTENSION_TO_MIME = {
1330
- jpg: "image/jpg",
1331
- jpeg: "image/jpeg",
1332
- png: "image/png",
1333
- gif: "image/gif",
1334
- webp: "image/webp",
1335
- svg: "image/svg+xml",
1336
- bmp: "image/bmp",
1337
- ico: "image/x-icon",
1338
- pdf: "application/pdf",
1339
- // Video
1340
- mp4: "video/mp4",
1341
- mov: "video/quicktime",
1342
- webm: "video/webm",
1343
- mkv: "video/x-matroska",
1344
- avi: "video/x-msvideo",
1345
- mpeg: "video/mpeg",
1346
- mpg: "video/mpeg",
1347
- // Audio
1348
- mp3: "audio/mpeg",
1349
- wav: "audio/wav",
1350
- ogg: "audio/ogg",
1351
- oga: "audio/ogg",
1352
- m4a: "audio/mp4",
1353
- aac: "audio/aac",
1354
- flac: "audio/flac"
1355
- };
1356
-
1357
- const BROWSER_FETCHABLE_SCHEMES = ["https://", "http://"];
1358
- const NON_FETCHABLE_REMOTE_SCHEMES = ["gs://", "s3://"];
1359
- const REMOTE_URL_SCHEMES = [...BROWSER_FETCHABLE_SCHEMES, ...NON_FETCHABLE_REMOTE_SCHEMES];
1360
- const isRemoteUrl = (value) => REMOTE_URL_SCHEMES.some((scheme) => value.startsWith(scheme));
1361
- const isBrowserFetchableUrl = (value) => BROWSER_FETCHABLE_SCHEMES.some((scheme) => value.startsWith(scheme));
1362
- const isNonFetchableRemoteUrl = (value) => NON_FETCHABLE_REMOTE_SCHEMES.some((scheme) => value.startsWith(scheme));
1363
-
1364
- const contentTypeFromExtension = (url) => {
1365
- try {
1366
- const { pathname } = new URL(url);
1367
- const extension = pathname.split(".").pop();
1368
- if (!extension) return void 0;
1369
- return EXTENSION_TO_MIME[extension.toLowerCase()];
1370
- } catch {
1371
- const extension = url.split(".").pop()?.split(/[?#]/)[0];
1372
- if (!extension) return void 0;
1373
- return EXTENSION_TO_MIME[extension.toLowerCase()];
1374
- }
1375
- };
1376
- const getFileContentType = async (url) => {
1377
- if (NON_FETCHABLE_REMOTE_SCHEMES.some((scheme) => url.startsWith(scheme))) {
1378
- return contentTypeFromExtension(url);
1379
- }
1380
- try {
1381
- const response = await fetch(url, {
1382
- method: "HEAD"
1383
- });
1384
- if (!response.ok) {
1385
- throw new Error("Failed to get file content type");
1386
- }
1387
- const contentType = response.headers.get("content-type");
1388
- if (!contentType) {
1389
- throw new Error("Failed to get file content type");
1390
- }
1391
- return contentType;
1392
- } catch {
1393
- return contentTypeFromExtension(url);
1394
- }
1395
- };
1396
-
1397
- const downloadJson = (filename, data) => {
1398
- const blob = new Blob([JSON.stringify(data, null, 2)], { type: "application/json" });
1399
- const url = URL.createObjectURL(blob);
1400
- const anchor = document.createElement("a");
1401
- anchor.href = url;
1402
- anchor.download = filename;
1403
- document.body.appendChild(anchor);
1404
- anchor.click();
1405
- anchor.remove();
1406
- URL.revokeObjectURL(url);
1407
- };
1408
-
1409
- const fileToBase64 = async (file) => {
1410
- return new Promise((resolve, reject) => {
1411
- const reader = new FileReader();
1412
- reader.onload = () => {
1413
- const result = reader.result;
1414
- if (typeof result === "string") {
1415
- resolve(result);
1416
- } else {
1417
- reject(new Error("Failed to convert file to base64."));
1418
- }
1419
- };
1420
- reader.onerror = (error) => {
1421
- reject(error);
1422
- };
1423
- reader.readAsDataURL(file);
1424
- });
1425
- };
1426
-
1427
584
  const MAX_DEPTH = 10;
1428
585
  function generatePropertyDefault(property, depth) {
1429
586
  if (property.default !== void 0) {
@@ -4892,7 +4049,7 @@ function useDownloadTraceJson() {
4892
4049
  const download = (traceId) => {
4893
4050
  if (isPending) return;
4894
4051
  setIsPending(true);
4895
- const task = client.getTrace(traceId).then((trace) => downloadJson(`trace-${traceId}.json`, trace)).finally(() => setIsPending(false));
4052
+ const task = client.getTrace(traceId).then((trace) => utils_file.downloadJson(`trace-${traceId}.json`, trace)).finally(() => setIsPending(false));
4896
4053
  toast.toast.promise({
4897
4054
  myPromise: task,
4898
4055
  loadingMessage: "Preparing trace download…",
@@ -4989,7 +4146,7 @@ function TraceDataPanelView({
4989
4146
  "Trace ",
4990
4147
  /* @__PURE__ */ jsxRuntime.jsxs("b", { children: [
4991
4148
  "# ",
4992
- truncateString(traceId, 12)
4149
+ utils_truncateString.truncateString(traceId, 12)
4993
4150
  ] })
4994
4151
  ] }),
4995
4152
  /* @__PURE__ */ jsxRuntime.jsxs(buttonsGroup.ButtonsGroup, { className: "ml-auto shrink-0", children: [
@@ -5639,9 +4796,9 @@ function TracesListModeToggle({ value, onChange, disabled }) {
5639
4796
  }
5640
4797
 
5641
4798
  function TracesErrorContent({ error, resource, errorTitle }) {
5642
- if (is401UnauthorizedError(error)) return /* @__PURE__ */ jsxRuntime.jsx(SessionExpired.SessionExpired, {});
5643
- if (is403ForbiddenError(error)) return /* @__PURE__ */ jsxRuntime.jsx(PermissionDenied.PermissionDenied, { resource });
5644
- const parsed = error instanceof Error ? parseError(error) : void 0;
4799
+ if (utils_queryUtils.is401UnauthorizedError(error)) return /* @__PURE__ */ jsxRuntime.jsx(SessionExpired.SessionExpired, {});
4800
+ if (utils_queryUtils.is403ForbiddenError(error)) return /* @__PURE__ */ jsxRuntime.jsx(PermissionDenied.PermissionDenied, { resource });
4801
+ const parsed = error instanceof Error ? utils_errors.parseError(error) : void 0;
5645
4802
  return /* @__PURE__ */ jsxRuntime.jsx(ErrorState.ErrorState, { title: errorTitle, message: parsed?.error ?? "Unknown error" });
5646
4803
  }
5647
4804
 
@@ -5975,7 +5132,7 @@ const useTraces = ({
5975
5132
  // Disable polling on 403 to prevent flickering.
5976
5133
  // Fall back to page-mode polling only when delta isn't running.
5977
5134
  refetchInterval: (q) => {
5978
- if (is403ForbiddenError(q.state.error)) return false;
5135
+ if (utils_queryUtils.is403ForbiddenError(q.state.error)) return false;
5979
5136
  if (!autoRefetch) return false;
5980
5137
  return deltaUnsupported ? pageModeRefetchIntervalMs : false;
5981
5138
  }
@@ -6697,9 +5854,9 @@ function LogDetailsView({
6697
5854
  }
6698
5855
 
6699
5856
  function LogsErrorContent({ error, resource, errorTitle }) {
6700
- if (is401UnauthorizedError(error)) return /* @__PURE__ */ jsxRuntime.jsx(SessionExpired.SessionExpired, {});
6701
- if (is403ForbiddenError(error)) return /* @__PURE__ */ jsxRuntime.jsx(PermissionDenied.PermissionDenied, { resource });
6702
- if (isUnsupportedObservabilityOperationError(error, "logs")) {
5857
+ if (utils_queryUtils.is401UnauthorizedError(error)) return /* @__PURE__ */ jsxRuntime.jsx(SessionExpired.SessionExpired, {});
5858
+ if (utils_queryUtils.is403ForbiddenError(error)) return /* @__PURE__ */ jsxRuntime.jsx(PermissionDenied.PermissionDenied, { resource });
5859
+ if (utils_queryUtils.isUnsupportedObservabilityOperationError(error, "logs")) {
6703
5860
  return /* @__PURE__ */ jsxRuntime.jsx(
6704
5861
  EmptyState.EmptyState,
6705
5862
  {
@@ -6957,7 +6114,7 @@ function selectLogs(data) {
6957
6114
  return result;
6958
6115
  }
6959
6116
  function getLogsRefetchInterval(query) {
6960
- if (isUnsupportedObservabilityOperationError(query.state.error, "logs")) {
6117
+ if (utils_queryUtils.isUnsupportedObservabilityOperationError(query.state.error, "logs")) {
6961
6118
  return false;
6962
6119
  }
6963
6120
  return LOGS_REFETCH_INTERVAL_MS;
@@ -8539,7 +7696,7 @@ function getSignalChartData(clusters) {
8539
7696
  cluster: path.label,
8540
7697
  duration: Math.max(0, Math.round(path.duration + offset * 8 + durationJitter + durationScatter)),
8541
7698
  spans: Math.max(1, path.spans + spanJitter),
8542
- color: stringToColor(`${cluster.name}-${path.label}`)
7699
+ color: utils_colors.stringToColor(`${cluster.name}-${path.label}`)
8543
7700
  };
8544
7701
  })
8545
7702
  )
@@ -8774,7 +7931,7 @@ function SignalClusterSidebar({
8774
7931
  "span",
8775
7932
  {
8776
7933
  className: utils_cn.cn("mt-1.5 h-2 w-2 shrink-0 rounded-full", multiple && !selected && "invisible"),
8777
- style: { backgroundColor: stringToColor(cluster.name) }
7934
+ style: { backgroundColor: utils_colors.stringToColor(cluster.name) }
8778
7935
  }
8779
7936
  ),
8780
7937
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 space-y-1", children: [
@@ -8965,7 +8122,7 @@ function SignalClusterCard({ cluster, totalTraceCount }) {
8965
8122
  const traceCount = cluster.traceSummaries.length;
8966
8123
  const traceShare = getTraceShare(traceCount, totalTraceCount);
8967
8124
  const traceLabel = traceCount === 1 ? "trace" : "traces";
8968
- const clusterColor = stringToColor(cluster.name);
8125
+ const clusterColor = utils_colors.stringToColor(cluster.name);
8969
8126
  return /* @__PURE__ */ jsxRuntime.jsx("article", { className: "rounded-2xl border border-border1/70 bg-surface2 p-5 shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full min-w-0 flex-col", children: [
8970
8127
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-start gap-2", children: [
8971
8128
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mt-2 h-2.5 w-2.5 shrink-0 rounded-full", style: { backgroundColor: clusterColor } }),
@@ -9344,6 +8501,21 @@ exports.useKeyboardShortcutLabel = hooks_useKeyboardShortcutLabel.useKeyboardSho
9344
8501
  exports.useCustomEnvironmentVariablesEditor = hooks_useEnvironmentVariablesEditor.useCustomEnvironmentVariablesEditor;
9345
8502
  exports.useEnvironmentVariablesEditor = hooks_useEnvironmentVariablesEditor.useEnvironmentVariablesEditor;
9346
8503
  exports.cn = utils_cn.cn;
8504
+ exports.lodashTitleCase = utils_string.lodashTitleCase;
8505
+ exports.toSigFigs = utils_number.toSigFigs;
8506
+ exports.formatJSON = utils_formatting.formatJSON;
8507
+ exports.formatTypeScript = utils_formatting.formatTypeScript;
8508
+ exports.isValidJson = utils_formatting.isValidJson;
8509
+ exports.stringToColor = utils_colors.stringToColor;
8510
+ exports.truncateString = utils_truncateString.truncateString;
8511
+ exports.parseError = utils_errors.parseError;
8512
+ exports.is401UnauthorizedError = utils_queryUtils.is401UnauthorizedError;
8513
+ exports.is403ForbiddenError = utils_queryUtils.is403ForbiddenError;
8514
+ exports.is404NotFoundError = utils_queryUtils.is404NotFoundError;
8515
+ exports.isBranchesNotSupportedError = utils_queryUtils.isBranchesNotSupportedError;
8516
+ exports.isNonRetryableError = utils_queryUtils.isNonRetryableError;
8517
+ exports.isUnsupportedObservabilityOperationError = utils_queryUtils.isUnsupportedObservabilityOperationError;
8518
+ exports.shouldRetryQuery = utils_queryUtils.shouldRetryQuery;
9347
8519
  exports.Toaster = toast.Toaster;
9348
8520
  exports.toast = toast.toast;
9349
8521
  exports.Icon = icons_Icon.Icon;
@@ -9356,6 +8528,16 @@ exports.AnthropicChatIcon = icons_AnthropicChatIcon.AnthropicChatIcon;
9356
8528
  exports.AnthropicMessagesIcon = icons_AnthropicMessagesIcon.AnthropicMessagesIcon;
9357
8529
  exports.ApiIcon = icons_ApiIcon.ApiIcon;
9358
8530
  exports.AzureIcon = icons_AzureIcon.AzureIcon;
8531
+ exports.BROWSER_FETCHABLE_SCHEMES = utils_file.BROWSER_FETCHABLE_SCHEMES;
8532
+ exports.EXTENSION_TO_MIME = utils_file.EXTENSION_TO_MIME;
8533
+ exports.NON_FETCHABLE_REMOTE_SCHEMES = utils_file.NON_FETCHABLE_REMOTE_SCHEMES;
8534
+ exports.REMOTE_URL_SCHEMES = utils_file.REMOTE_URL_SCHEMES;
8535
+ exports.downloadJson = utils_file.downloadJson;
8536
+ exports.fileToBase64 = utils_file.fileToBase64;
8537
+ exports.getFileContentType = utils_file.getFileContentType;
8538
+ exports.isBrowserFetchableUrl = utils_file.isBrowserFetchableUrl;
8539
+ exports.isNonFetchableRemoteUrl = utils_file.isNonFetchableRemoteUrl;
8540
+ exports.isRemoteUrl = utils_file.isRemoteUrl;
9359
8541
  exports.BranchIcon = icons_BranchIcon.BranchIcon;
9360
8542
  exports.CheckIcon = icons_CheckIcon.CheckIcon;
9361
8543
  exports.ChevronIcon = icons_ChevronIcon.ChevronIcon;
@@ -9398,6 +8580,17 @@ exports.MemoryIcon = icons_MemoryIcon.MemoryIcon;
9398
8580
  exports.MetricsIcon = icons_MetricsIcon.MetricsIcon;
9399
8581
  exports.MistralIcon = icons_MistralIcon.MistralIcon;
9400
8582
  exports.NetlifyIcon = icons_NetlifyIcon.NetlifyIcon;
8583
+ exports.OPERATORS = ruleBuilder.OPERATORS;
8584
+ exports.OPERATOR_LABELS = ruleBuilder.OPERATOR_LABELS;
8585
+ exports.RuleBuilder = ruleBuilder.RuleBuilder;
8586
+ exports.RuleFieldSelect = ruleBuilder.RuleFieldSelect;
8587
+ exports.RuleOperatorSelect = ruleBuilder.RuleOperatorSelect;
8588
+ exports.RuleRow = ruleBuilder.RuleRow;
8589
+ exports.RuleValueInput = ruleBuilder.RuleValueInput;
8590
+ exports.getChildFieldOptions = ruleBuilder.getChildFieldOptions;
8591
+ exports.getFieldOptionAtPath = ruleBuilder.getFieldOptionAtPath;
8592
+ exports.getFieldOptionsFromSchema = ruleBuilder.getFieldOptionsFromSchema;
8593
+ exports.parseFieldPath = ruleBuilder.parseFieldPath;
9401
8594
  exports.OpenAIIcon = icons_OpenAIIcon.OpenAIIcon;
9402
8595
  exports.OpenaiChatIcon = icons_OpenaiChatIcon.OpenaiChatIcon;
9403
8596
  exports.ProcessorIcon = icons_ProcessorIcon.ProcessorIcon;
@@ -9417,7 +8610,11 @@ exports.VariablesIcon = icons_VariablesIcon.VariablesIcon;
9417
8610
  exports.WorkflowCoinIcon = icons_WorkflowCoinIcon.WorkflowCoinIcon;
9418
8611
  exports.WorkspacesIcon = icons_WorkspacesIcon.WorkspacesIcon;
9419
8612
  exports.XGroqIcon = icons_XGroqIcon.XGroqIcon;
9420
- exports.BROWSER_FETCHABLE_SCHEMES = BROWSER_FETCHABLE_SCHEMES;
8613
+ exports.countLeafRules = utils_ruleEngine.countLeafRules;
8614
+ exports.createDefaultRule = utils_ruleEngine.createDefaultRule;
8615
+ exports.createDefaultRuleGroup = utils_ruleEngine.createDefaultRuleGroup;
8616
+ exports.isRule = utils_ruleEngine.isRule;
8617
+ exports.isRuleGroup = utils_ruleEngine.isRuleGroup;
9421
8618
  exports.BarListContent = BarListContent;
9422
8619
  exports.CHART_COLORS = CHART_COLORS;
9423
8620
  exports.CONTEXT_FIELD_IDS = CONTEXT_FIELD_IDS;
@@ -9426,7 +8623,6 @@ exports.DATE_PRESETS = DATE_PRESETS;
9426
8623
  exports.DEFAULT_LOGS_FILTERS_STORAGE_KEY = DEFAULT_LOGS_FILTERS_STORAGE_KEY;
9427
8624
  exports.DEFAULT_TRACE_FILTERS_STORAGE_KEY = DEFAULT_TRACE_FILTERS_STORAGE_KEY;
9428
8625
  exports.DateRangeSelector = DateRangeSelector;
9429
- exports.EXTENSION_TO_MIME = EXTENSION_TO_MIME;
9430
8626
  exports.FlameGraph = FlameGraph;
9431
8627
  exports.KpiCardView = KpiCardView;
9432
8628
  exports.LOGS_DATE_FROM_PARAM = LOGS_DATE_FROM_PARAM;
@@ -9450,24 +8646,15 @@ exports.MemoryCardView = MemoryCardView;
9450
8646
  exports.MemoryStudioPanel = MemoryStudioPanel;
9451
8647
  exports.MetricsProvider = MetricsProvider;
9452
8648
  exports.ModelUsageCostCardView = ModelUsageCostCardView;
9453
- exports.NON_FETCHABLE_REMOTE_SCHEMES = NON_FETCHABLE_REMOTE_SCHEMES;
9454
8649
  exports.NoLogsInfo = NoLogsInfo;
9455
8650
  exports.NoTracesInfo = NoTracesInfo;
9456
- exports.OPERATORS = OPERATORS;
9457
- exports.OPERATOR_LABELS = OPERATOR_LABELS;
9458
8651
  exports.ObservationDetailView = ObservationDetailView;
9459
8652
  exports.OpenErrorsInLogsButton = OpenErrorsInLogsButton;
9460
8653
  exports.OpenInTracesButton = OpenInTracesButton;
9461
8654
  exports.PanelDrawer = PanelDrawer;
9462
8655
  exports.PanelSeparator = PanelSeparator;
9463
- exports.REMOTE_URL_SCHEMES = REMOTE_URL_SCHEMES;
9464
8656
  exports.ROOT_ENTITY_TYPES = ROOT_ENTITY_TYPES;
9465
8657
  exports.ROOT_ENTITY_TYPE_OPTIONS = ROOT_ENTITY_TYPE_OPTIONS;
9466
- exports.RuleBuilder = RuleBuilder;
9467
- exports.RuleFieldSelect = RuleFieldSelect;
9468
- exports.RuleOperatorSelect = RuleOperatorSelect;
9469
- exports.RuleRow = RuleRow;
9470
- exports.RuleValueInput = RuleValueInput;
9471
8658
  exports.ScoresCardView = ScoresCardView;
9472
8659
  exports.SignalChartTab = SignalChartTab;
9473
8660
  exports.SignalClusterCard = SignalClusterCard;
@@ -9530,26 +8717,15 @@ exports.buildTracesDrilldownUrl = buildTracesDrilldownUrl;
9530
8717
  exports.clearSavedLogsFilters = clearSavedLogsFilters;
9531
8718
  exports.clearSavedMetricsFilters = clearSavedMetricsFilters;
9532
8719
  exports.clearSavedTraceFilters = clearSavedTraceFilters;
9533
- exports.countLeafRules = countLeafRules;
9534
- exports.createDefaultRule = createDefaultRule;
9535
- exports.createDefaultRuleGroup = createDefaultRuleGroup;
9536
8720
  exports.createLogsPropertyFilterFields = createLogsPropertyFilterFields;
9537
8721
  exports.createMetricsPropertyFilterFields = createMetricsPropertyFilterFields;
9538
8722
  exports.createTracePropertyFilterFields = createTracePropertyFilterFields;
9539
- exports.downloadJson = downloadJson;
9540
- exports.fileToBase64 = fileToBase64;
9541
8723
  exports.filterTraceSummaries = filterTraceSummaries;
9542
8724
  exports.formatCompact = formatCompact;
9543
8725
  exports.formatCost = formatCost;
9544
8726
  exports.formatHierarchicalSpans = formatHierarchicalSpans;
9545
- exports.formatJSON = formatJSON;
9546
- exports.formatTypeScript = formatTypeScript;
9547
8727
  exports.generateDefaultValues = generateDefaultValues;
9548
8728
  exports.getAllSpanIds = getAllSpanIds;
9549
- exports.getChildFieldOptions = getChildFieldOptions;
9550
- exports.getFieldOptionAtPath = getFieldOptionAtPath;
9551
- exports.getFieldOptionsFromSchema = getFieldOptionsFromSchema;
9552
- exports.getFileContentType = getFileContentType;
9553
8729
  exports.getInputPreview = getInputPreview;
9554
8730
  exports.getLogsPropertyFilterTokens = getLogsPropertyFilterTokens;
9555
8731
  exports.getMetricsPropertyFilterTokens = getMetricsPropertyFilterTokens;
@@ -9569,43 +8745,24 @@ exports.getVisibleTraceSummaries = getVisibleTraceSummaries;
9569
8745
  exports.hasAnyLogsFilterParams = hasAnyLogsFilterParams;
9570
8746
  exports.hasAnyMetricsFilterParams = hasAnyMetricsFilterParams;
9571
8747
  exports.hasAnyTraceFilterParams = hasAnyTraceFilterParams;
9572
- exports.is401UnauthorizedError = is401UnauthorizedError;
9573
- exports.is403ForbiddenError = is403ForbiddenError;
9574
- exports.is404NotFoundError = is404NotFoundError;
9575
- exports.isBranchesNotSupportedError = isBranchesNotSupportedError;
9576
- exports.isBrowserFetchableUrl = isBrowserFetchableUrl;
9577
- exports.isNonFetchableRemoteUrl = isNonFetchableRemoteUrl;
9578
- exports.isNonRetryableError = isNonRetryableError;
9579
8748
  exports.isObjectEmpty = isObjectEmpty;
9580
- exports.isRemoteUrl = isRemoteUrl;
9581
- exports.isRule = isRule;
9582
- exports.isRuleGroup = isRuleGroup;
9583
8749
  exports.isTokenLimitExceeded = isTokenLimitExceeded;
9584
- exports.isUnsupportedObservabilityOperationError = isUnsupportedObservabilityOperationError;
9585
- exports.isValidJson = isValidJson;
9586
8750
  exports.isValidPreset = isValidPreset;
9587
8751
  exports.loadLogsFiltersFromStorage = loadLogsFiltersFromStorage;
9588
8752
  exports.loadMetricsFiltersFromStorage = loadMetricsFiltersFromStorage;
9589
8753
  exports.loadTraceFiltersFromStorage = loadTraceFiltersFromStorage;
9590
- exports.lodashTitleCase = lodashTitleCase;
9591
8754
  exports.memoryStatusQueryKey = memoryStatusQueryKey;
9592
8755
  exports.memoryThreadMessagesQueryKey = memoryThreadMessagesQueryKey;
9593
8756
  exports.narrowWindowToBucket = narrowWindowToBucket;
9594
8757
  exports.neutralizeFilterTokens = neutralizeFilterTokens;
9595
8758
  exports.neutralizeLogsFilterTokens = neutralizeLogsFilterTokens;
9596
8759
  exports.observationalMemoryQueryKey = observationalMemoryQueryKey;
9597
- exports.parseError = parseError;
9598
- exports.parseFieldPath = parseFieldPath;
9599
8760
  exports.saveLogsFiltersToStorage = saveLogsFiltersToStorage;
9600
8761
  exports.saveMetricsFiltersToStorage = saveMetricsFiltersToStorage;
9601
8762
  exports.saveTraceFiltersToStorage = saveTraceFiltersToStorage;
9602
- exports.shouldRetryQuery = shouldRetryQuery;
9603
8763
  exports.signals = signals;
9604
8764
  exports.sortTraceSummaries = sortTraceSummaries;
9605
8765
  exports.spanTypePrefixes = spanTypePrefixes;
9606
- exports.stringToColor = stringToColor;
9607
- exports.toSigFigs = toSigFigs;
9608
- exports.truncateString = truncateString;
9609
8766
  exports.useActiveResourcesKpiMetrics = useActiveResourcesKpiMetrics;
9610
8767
  exports.useActiveThreadsKpiMetrics = useActiveThreadsKpiMetrics;
9611
8768
  exports.useAgentRunsKpiMetrics = useAgentRunsKpiMetrics;