import {
  $a093c7e1ec25a057$export$f78649fb9ca566b8,
  Tooltip,
  TooltipContent,
  TooltipProvider,
  TooltipTrigger
} from "/build/_shared/chunk-B7SHUSBW.js";
import {
  ScrollArea,
  require_numbro_min
} from "/build/_shared/chunk-EOIU3ZRJ.js";
import {
  Card,
  CardContent,
  CardHeader,
  CardTitle
} from "/build/_shared/chunk-WWUYM2PJ.js";
import {
  PrettyJson
} from "/build/_shared/chunk-2LVPY4YG.js";
import {
  $d7bdfb9eb0fdf311$export$6d08773d2e66f8f2,
  $d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9,
  $d7bdfb9eb0fdf311$export$c7109489551a4f4
} from "/build/_shared/chunk-JZ6W5YHO.js";
import {
  require_dayjs_min
} from "/build/_shared/chunk-HUUSILLY.js";
import {
  $f631663db3294ace$export$b39126d51d94e6f3
} from "/build/_shared/chunk-VO5VXZGS.js";
import {
  $71cd76cc60e0454e$export$6f32135080cb4c3,
  $8927f6f2acc4f386$export$250ffa63cdc0d034,
  $c512c27ab02ef895$export$50c7b4e9d9f19c1,
  $e42e1063c40fb3ef$export$b9ecd428b558ff10
} from "/build/_shared/chunk-7K73PJIB.js";
import {
  ArrowDownAZ,
  Bot,
  Braces,
  Coins,
  DollarSign,
  Download,
  GanttChart,
  Hammer,
  Info,
  Pencil,
  PlusCircle,
  Settings2,
  Timer,
  Upload,
  User
} from "/build/_shared/chunk-EJE2TVVM.js";
import {
  _extends,
  cn,
  cva
} from "/build/_shared/chunk-LGQ4GCFK.js";
import {
  useKey,
  useMount
} from "/build/_shared/chunk-B7TG3BDD.js";
import {
  require_dist
} from "/build/_shared/chunk-KQKP3VNY.js";
import {
  init_esm2 as init_esm,
  useSearchParams
} from "/build/_shared/chunk-ZC2TL3GZ.js";
import {
  require_jsx_dev_runtime
} from "/build/_shared/chunk-ED7KKCRB.js";
import {
  require_react
} from "/build/_shared/chunk-PECDPABK.js";
import {
  createHotContext,
  init_remix_hmr
} from "/build/_shared/chunk-G7KTOMTD.js";
import {
  __toESM
} from "/build/_shared/chunk-PNG5AS42.js";

// app/pages/traces/TraceIdContent.tsx
init_remix_hmr();
init_esm();
var import_react8 = __toESM(require_react(), 1);

// app/components/traces/LogView.tsx
init_remix_hmr();
var import_react3 = __toESM(require_react(), 1);

// app/components/ui/toggle-group.tsx
init_remix_hmr();

// ../../node_modules/@radix-ui/react-toggle-group/dist/index.mjs
var import_react2 = __toESM(require_react(), 1);

// ../../node_modules/@radix-ui/react-toggle/dist/index.mjs
var import_react = __toESM(require_react(), 1);
var $b3bbe2732c13b576$export$bea8ebba691c5813 = /* @__PURE__ */ (0, import_react.forwardRef)((props, forwardedRef) => {
  const { pressed: pressedProp, defaultPressed = false, onPressedChange, ...buttonProps } = props;
  const [pressed = false, setPressed] = $71cd76cc60e0454e$export$6f32135080cb4c3({
    prop: pressedProp,
    onChange: onPressedChange,
    defaultProp: defaultPressed
  });
  return /* @__PURE__ */ (0, import_react.createElement)($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
    type: "button",
    "aria-pressed": pressed,
    "data-state": pressed ? "on" : "off",
    "data-disabled": props.disabled ? "" : void 0
  }, buttonProps, {
    ref: forwardedRef,
    onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, () => {
      if (!props.disabled)
        setPressed(!pressed);
    })
  }));
});
var $b3bbe2732c13b576$export$be92b6f5f03c0fe9 = $b3bbe2732c13b576$export$bea8ebba691c5813;

// ../../node_modules/@radix-ui/react-toggle-group/dist/index.mjs
var $6c1fd9e6a8969628$var$TOGGLE_GROUP_NAME = "ToggleGroup";
var [$6c1fd9e6a8969628$var$createToggleGroupContext, $6c1fd9e6a8969628$export$d1c7c4bcd9f26dd4] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($6c1fd9e6a8969628$var$TOGGLE_GROUP_NAME, [
  $d7bdfb9eb0fdf311$export$c7109489551a4f4
]);
var $6c1fd9e6a8969628$var$useRovingFocusGroupScope = $d7bdfb9eb0fdf311$export$c7109489551a4f4();
var $6c1fd9e6a8969628$export$af3ec21f6cfb5e30 = /* @__PURE__ */ import_react2.default.forwardRef((props, forwardedRef) => {
  const { type, ...toggleGroupProps } = props;
  if (type === "single") {
    const singleProps = toggleGroupProps;
    return /* @__PURE__ */ import_react2.default.createElement($6c1fd9e6a8969628$var$ToggleGroupImplSingle, _extends({}, singleProps, {
      ref: forwardedRef
    }));
  }
  if (type === "multiple") {
    const multipleProps = toggleGroupProps;
    return /* @__PURE__ */ import_react2.default.createElement($6c1fd9e6a8969628$var$ToggleGroupImplMultiple, _extends({}, multipleProps, {
      ref: forwardedRef
    }));
  }
  throw new Error(`Missing prop \`type\` expected on \`${$6c1fd9e6a8969628$var$TOGGLE_GROUP_NAME}\``);
});
var [$6c1fd9e6a8969628$var$ToggleGroupValueProvider, $6c1fd9e6a8969628$var$useToggleGroupValueContext] = $6c1fd9e6a8969628$var$createToggleGroupContext($6c1fd9e6a8969628$var$TOGGLE_GROUP_NAME);
var $6c1fd9e6a8969628$var$ToggleGroupImplSingle = /* @__PURE__ */ import_react2.default.forwardRef((props, forwardedRef) => {
  const { value: valueProp, defaultValue, onValueChange = () => {
  }, ...toggleGroupSingleProps } = props;
  const [value, setValue] = $71cd76cc60e0454e$export$6f32135080cb4c3({
    prop: valueProp,
    defaultProp: defaultValue,
    onChange: onValueChange
  });
  return /* @__PURE__ */ import_react2.default.createElement($6c1fd9e6a8969628$var$ToggleGroupValueProvider, {
    scope: props.__scopeToggleGroup,
    type: "single",
    value: value ? [
      value
    ] : [],
    onItemActivate: setValue,
    onItemDeactivate: import_react2.default.useCallback(
      () => setValue(""),
      [
        setValue
      ]
    )
  }, /* @__PURE__ */ import_react2.default.createElement($6c1fd9e6a8969628$var$ToggleGroupImpl, _extends({}, toggleGroupSingleProps, {
    ref: forwardedRef
  })));
});
var $6c1fd9e6a8969628$var$ToggleGroupImplMultiple = /* @__PURE__ */ import_react2.default.forwardRef((props, forwardedRef) => {
  const { value: valueProp, defaultValue, onValueChange = () => {
  }, ...toggleGroupMultipleProps } = props;
  const [value1 = [], setValue] = $71cd76cc60e0454e$export$6f32135080cb4c3({
    prop: valueProp,
    defaultProp: defaultValue,
    onChange: onValueChange
  });
  const handleButtonActivate = import_react2.default.useCallback(
    (itemValue) => setValue(
      (prevValue = []) => [
        ...prevValue,
        itemValue
      ]
    ),
    [
      setValue
    ]
  );
  const handleButtonDeactivate = import_react2.default.useCallback(
    (itemValue) => setValue(
      (prevValue = []) => prevValue.filter(
        (value) => value !== itemValue
      )
    ),
    [
      setValue
    ]
  );
  return /* @__PURE__ */ import_react2.default.createElement($6c1fd9e6a8969628$var$ToggleGroupValueProvider, {
    scope: props.__scopeToggleGroup,
    type: "multiple",
    value: value1,
    onItemActivate: handleButtonActivate,
    onItemDeactivate: handleButtonDeactivate
  }, /* @__PURE__ */ import_react2.default.createElement($6c1fd9e6a8969628$var$ToggleGroupImpl, _extends({}, toggleGroupMultipleProps, {
    ref: forwardedRef
  })));
});
var [$6c1fd9e6a8969628$var$ToggleGroupContext, $6c1fd9e6a8969628$var$useToggleGroupContext] = $6c1fd9e6a8969628$var$createToggleGroupContext($6c1fd9e6a8969628$var$TOGGLE_GROUP_NAME);
var $6c1fd9e6a8969628$var$ToggleGroupImpl = /* @__PURE__ */ import_react2.default.forwardRef((props, forwardedRef) => {
  const { __scopeToggleGroup, disabled = false, rovingFocus = true, orientation, dir, loop = true, ...toggleGroupProps } = props;
  const rovingFocusGroupScope = $6c1fd9e6a8969628$var$useRovingFocusGroupScope(__scopeToggleGroup);
  const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
  const commonProps = {
    role: "group",
    dir: direction,
    ...toggleGroupProps
  };
  return /* @__PURE__ */ import_react2.default.createElement($6c1fd9e6a8969628$var$ToggleGroupContext, {
    scope: __scopeToggleGroup,
    rovingFocus,
    disabled
  }, rovingFocus ? /* @__PURE__ */ import_react2.default.createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends({
    asChild: true
  }, rovingFocusGroupScope, {
    orientation,
    dir: direction,
    loop
  }), /* @__PURE__ */ import_react2.default.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, commonProps, {
    ref: forwardedRef
  }))) : /* @__PURE__ */ import_react2.default.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, commonProps, {
    ref: forwardedRef
  })));
});
var $6c1fd9e6a8969628$var$ITEM_NAME = "ToggleGroupItem";
var $6c1fd9e6a8969628$export$b453109e13abe10b = /* @__PURE__ */ import_react2.default.forwardRef((props, forwardedRef) => {
  const valueContext = $6c1fd9e6a8969628$var$useToggleGroupValueContext($6c1fd9e6a8969628$var$ITEM_NAME, props.__scopeToggleGroup);
  const context = $6c1fd9e6a8969628$var$useToggleGroupContext($6c1fd9e6a8969628$var$ITEM_NAME, props.__scopeToggleGroup);
  const rovingFocusGroupScope = $6c1fd9e6a8969628$var$useRovingFocusGroupScope(props.__scopeToggleGroup);
  const pressed = valueContext.value.includes(props.value);
  const disabled = context.disabled || props.disabled;
  const commonProps = {
    ...props,
    pressed,
    disabled
  };
  const ref = import_react2.default.useRef(null);
  return context.rovingFocus ? /* @__PURE__ */ import_react2.default.createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends({
    asChild: true
  }, rovingFocusGroupScope, {
    focusable: !disabled,
    active: pressed,
    ref
  }), /* @__PURE__ */ import_react2.default.createElement($6c1fd9e6a8969628$var$ToggleGroupItemImpl, _extends({}, commonProps, {
    ref: forwardedRef
  }))) : /* @__PURE__ */ import_react2.default.createElement($6c1fd9e6a8969628$var$ToggleGroupItemImpl, _extends({}, commonProps, {
    ref: forwardedRef
  }));
});
var $6c1fd9e6a8969628$var$ToggleGroupItemImpl = /* @__PURE__ */ import_react2.default.forwardRef((props, forwardedRef) => {
  const { __scopeToggleGroup, value, ...itemProps } = props;
  const valueContext = $6c1fd9e6a8969628$var$useToggleGroupValueContext($6c1fd9e6a8969628$var$ITEM_NAME, __scopeToggleGroup);
  const singleProps = {
    role: "radio",
    "aria-checked": props.pressed,
    "aria-pressed": void 0
  };
  const typeProps = valueContext.type === "single" ? singleProps : void 0;
  return /* @__PURE__ */ import_react2.default.createElement($b3bbe2732c13b576$export$bea8ebba691c5813, _extends({}, typeProps, itemProps, {
    ref: forwardedRef,
    onPressedChange: (pressed) => {
      if (pressed)
        valueContext.onItemActivate(value);
      else
        valueContext.onItemDeactivate(value);
    }
  }));
});
var $6c1fd9e6a8969628$export$be92b6f5f03c0fe9 = $6c1fd9e6a8969628$export$af3ec21f6cfb5e30;
var $6c1fd9e6a8969628$export$6d08773d2e66f8f2 = $6c1fd9e6a8969628$export$b453109e13abe10b;

// app/components/ui/toggle-group.tsx
var React2 = __toESM(require_react(), 1);

// app/components/ui/toggle.tsx
init_remix_hmr();
var React = __toESM(require_react(), 1);
var import_jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/ui/toggle.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/ui/toggle.tsx"
  );
  import.meta.hot.lastModified = "1711663835543.54";
}
var toggleVariants = cva("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground", {
  variants: {
    variant: {
      default: "bg-transparent",
      outline: "border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"
    },
    size: {
      default: "h-9 px-3",
      sm: "h-8 px-2",
      lg: "h-10 px-3"
    }
  },
  defaultVariants: {
    variant: "default",
    size: "default"
  }
});
var Toggle = React.forwardRef(_c = ({
  className,
  variant,
  size,
  ...props
}, ref) => /* @__PURE__ */ (0, import_jsx_dev_runtime.jsxDEV)($b3bbe2732c13b576$export$be92b6f5f03c0fe9, { ref, className: cn(toggleVariants({
  variant,
  size,
  className
})), ...props }, void 0, false, {
  fileName: "app/components/ui/toggle.tsx",
  lineNumber: 48,
  columnNumber: 12
}, this));
_c2 = Toggle;
Toggle.displayName = $b3bbe2732c13b576$export$be92b6f5f03c0fe9.displayName;
var _c;
var _c2;
$RefreshReg$(_c, "Toggle$React.forwardRef");
$RefreshReg$(_c2, "Toggle");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/components/ui/toggle-group.tsx
var import_jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/ui/toggle-group.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/ui/toggle-group.tsx"
  );
  import.meta.hot.lastModified = "1711663835543.3877";
}
var ToggleGroupContext = React2.createContext({
  size: "default",
  variant: "default"
});
var ToggleGroup = React2.forwardRef(_c3 = ({
  className,
  variant,
  size,
  children,
  ...props
}, ref) => /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)($6c1fd9e6a8969628$export$be92b6f5f03c0fe9, { ref, className: cn("flex items-center justify-center gap-1", className), ...props, children: /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)(ToggleGroupContext.Provider, { value: {
  variant,
  size
}, children }, void 0, false, {
  fileName: "app/components/ui/toggle-group.tsx",
  lineNumber: 38,
  columnNumber: 5
}, this) }, void 0, false, {
  fileName: "app/components/ui/toggle-group.tsx",
  lineNumber: 37,
  columnNumber: 12
}, this));
_c22 = ToggleGroup;
ToggleGroup.displayName = $6c1fd9e6a8969628$export$be92b6f5f03c0fe9.displayName;
var ToggleGroupItem = _s(React2.forwardRef(_c32 = _s(({
  className,
  children,
  variant,
  size,
  ...props
}, ref) => {
  _s();
  const context = React2.useContext(ToggleGroupContext);
  return /* @__PURE__ */ (0, import_jsx_dev_runtime2.jsxDEV)($6c1fd9e6a8969628$export$6d08773d2e66f8f2, { ref, className: cn(toggleVariants({
    variant: context.variant || variant,
    size: context.size || size
  }), className), ...props, children }, void 0, false, {
    fileName: "app/components/ui/toggle-group.tsx",
    lineNumber: 54,
    columnNumber: 10
  }, this);
}, "b9L3QQ+jgeyIrH0NfHrJ8nn7VMU=")), "b9L3QQ+jgeyIrH0NfHrJ8nn7VMU=");
_c4 = ToggleGroupItem;
ToggleGroupItem.displayName = $6c1fd9e6a8969628$export$6d08773d2e66f8f2.displayName;
var _c3;
var _c22;
var _c32;
var _c4;
$RefreshReg$(_c3, "ToggleGroup$React.forwardRef");
$RefreshReg$(_c22, "ToggleGroup");
$RefreshReg$(_c32, "ToggleGroupItem$React.forwardRef");
$RefreshReg$(_c4, "ToggleGroupItem");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/components/traces/LogAnalytics/LogAnalytics.tsx
init_remix_hmr();

// app/components/traces/LogAnalytics/LogAnalytics.styles.tsx
init_remix_hmr();
var import_jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/traces/LogAnalytics/LogAnalytics.styles.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx"
  );
  import.meta.hot.lastModified = "1712092164858.4053";
}
var AnalyticsContainer = ({
  className,
  children
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)("div", { className: `bg-secondary dark:bg-secondary flex w-full divide-x overflow-hidden rounded-xl border ${className || ""}`, children }, void 0, false, {
    fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
    lineNumber: 27,
    columnNumber: 10
  }, this);
};
_c5 = AnalyticsContainer;
var AnalyticsCard = ({
  title,
  Icon,
  children,
  tooltip
}) => {
  const component = /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(Card, { className: "hover:bg-secondary flex flex-1 flex-grow flex-col rounded-none p-4", children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(CardHeader, { className: "p-0", children: /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(CardTitle, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)("div", { className: "text-muted-foreground flex justify-between text-sm font-medium", children: [
      title,
      Icon && /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(Icon, { size: 20, className: "text-muted-foreground" }, void 0, false, {
        fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
        lineNumber: 43,
        columnNumber: 22
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
      lineNumber: 41,
      columnNumber: 11
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
      lineNumber: 40,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
      lineNumber: 39,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(CardContent, { className: "mt-2 flex-grow p-0", children }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
      lineNumber: 47,
      columnNumber: 7
    }, this)
  ] }, void 0, true, {
    fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
    lineNumber: 38,
    columnNumber: 21
  }, this);
  return tooltip ? /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(TooltipProvider, { delayDuration: 350, children: /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(Tooltip, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(TooltipTrigger, { asChild: true, children: component }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
      lineNumber: 51,
      columnNumber: 9
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)(TooltipContent, { className: "bg-secondary flex min-w-32 flex-col gap-1 p-4", children: tooltip }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
      lineNumber: 52,
      columnNumber: 9
    }, this)
  ] }, void 0, true, {
    fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
    lineNumber: 50,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
    lineNumber: 49,
    columnNumber: 20
  }, this) : component;
};
_c23 = AnalyticsCard;
var AnalyticsMajorStat = ({
  children,
  className
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)("p", { className: className || `text-xl font-medium`, children }, void 0, false, {
    fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
    lineNumber: 61,
    columnNumber: 10
  }, this);
};
_c33 = AnalyticsMajorStat;
var AnalyticsMinorStat = ({
  children
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime3.jsxDEV)("p", { className: "text-muted-foreground [&>*:nth-child(1)]:text-primary-foreground flex items-center justify-between gap-2 text-xs [&>*:nth-child(1)]:font-bold", children }, void 0, false, {
    fileName: "app/components/traces/LogAnalytics/LogAnalytics.styles.tsx",
    lineNumber: 67,
    columnNumber: 10
  }, this);
};
_c42 = AnalyticsMinorStat;
var _c5;
var _c23;
var _c33;
var _c42;
$RefreshReg$(_c5, "AnalyticsContainer");
$RefreshReg$(_c23, "AnalyticsCard");
$RefreshReg$(_c33, "AnalyticsMajorStat");
$RefreshReg$(_c42, "AnalyticsMinorStat");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/components/traces/LogAnalytics/utils.ts
init_remix_hmr();
var import_dayjs = __toESM(require_dayjs_min(), 1);
var import_numbro = __toESM(require_numbro_min(), 1);
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/LogAnalytics/utils.ts"
  );
  import.meta.hot.lastModified = "1711676034228.9788";
}
var formatNumber = (num) => {
  return (0, import_numbro.default)(num).format({
    thousandSeparated: true
  });
};
var formatDate = (date) => {
  return (0, import_dayjs.default)(date).format("hh:mm:ss.SSS");
};

// app/components/traces/LogAnalytics/LogAnalytics.tsx
var import_jsx_dev_runtime4 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/traces/LogAnalytics/LogAnalytics.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/LogAnalytics/LogAnalytics.tsx"
  );
  import.meta.hot.lastModified = "1711987286108.683";
}
var LogAnalytics = ({
  log
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsContainer, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsCard, { title: "Model", Icon: Bot, children: /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsMajorStat, { className: "text-sm font-medium xl:text-xl", children: log.model || "\u2014" }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 29,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 28,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsCard, { title: "Cost", Icon: DollarSign, tooltip: /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(import_jsx_dev_runtime4.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: "Input" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 34,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: [
          "$",
          log.inputCost
        ] }, void 0, true, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 34,
          columnNumber: 34
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
        lineNumber: 33,
        columnNumber: 13
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: "Output" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 37,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: [
          "$",
          log.outputCost
        ] }, void 0, true, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 37,
          columnNumber: 35
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
        lineNumber: 36,
        columnNumber: 13
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 32,
      columnNumber: 62
    }, this), children: /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsMajorStat, { children: log.totalCost ? `$ ${log.totalCost}` : "\u2014" }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 40,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 32,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsCard, { title: "Tokens", Icon: Coins, tooltip: /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(import_jsx_dev_runtime4.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: "Input" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 45,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: log.inputTokens ? formatNumber(log.inputTokens) : "\u2014" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 45,
          columnNumber: 34
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
        lineNumber: 44,
        columnNumber: 13
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: "Output" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 48,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: log.outputTokens ? formatNumber(log.outputTokens) : "\u2014" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 48,
          columnNumber: 35
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
        lineNumber: 47,
        columnNumber: 13
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 43,
      columnNumber: 59
    }, this), children: /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsMajorStat, { children: log.totalTokens ? formatNumber(log.totalTokens) : "\u2014" }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 51,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 43,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsCard, { title: "Latency", Icon: Timer, tooltip: /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(import_jsx_dev_runtime4.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: "Start" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 56,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: log.startTime ? formatDate(log.startTime) : "\u2014" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 56,
          columnNumber: 34
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
        lineNumber: 55,
        columnNumber: 13
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: "End" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 59,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)("span", { children: log.endTime ? formatDate(log.endTime) : "\u2014" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
          lineNumber: 59,
          columnNumber: 32
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
        lineNumber: 58,
        columnNumber: 13
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 54,
      columnNumber: 60
    }, this), children: /* @__PURE__ */ (0, import_jsx_dev_runtime4.jsxDEV)(AnalyticsMajorStat, { children: log.duration ? `${log.duration}s` : "\u2014" }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 62,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
      lineNumber: 54,
      columnNumber: 7
    }, this)
  ] }, void 0, true, {
    fileName: "app/components/traces/LogAnalytics/LogAnalytics.tsx",
    lineNumber: 27,
    columnNumber: 10
  }, this);
};
_c6 = LogAnalytics;
var _c6;
$RefreshReg$(_c6, "LogAnalytics");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/components/traces/MessagesView/MessagesView.tsx
init_remix_hmr();

// app/components/traces/MessagesView/SourceToMessageMap.tsx
init_remix_hmr();
var import_browser_client = __toESM(require_dist(), 1);

// app/components/traces/MessagesView/CodeBlock.tsx
init_remix_hmr();
var import_jsx_dev_runtime5 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/traces/MessagesView/CodeBlock.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/MessagesView/CodeBlock.tsx"
  );
  import.meta.hot.lastModified = "1711234838350.7905";
}
var RawHTML = ({
  html
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime5.jsxDEV)("pre", { className: "bg-secondary whitespace-pre-wrap rounded-xl px-8 py-4 text-sm", dangerouslySetInnerHTML: {
    __html: html
  } }, void 0, false, {
    fileName: "app/components/traces/MessagesView/CodeBlock.tsx",
    lineNumber: 24,
    columnNumber: 10
  }, this);
};
_c7 = RawHTML;
var CodeBlock = ({
  value
}) => {
  function syntaxHighlight(json) {
    const nJson = json.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
    return nJson.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g, function(match) {
      let cls = "number";
      if (/^"/.test(match)) {
        if (/:$/.test(match)) {
          cls = "key";
        } else {
          cls = "string";
        }
      } else if (/true|false/.test(match)) {
        cls = "boolean";
      } else if (/null/.test(match)) {
        cls = "null";
      }
      return '<span class="' + cls + '">' + match + "</span>";
    });
  }
  const syntaxHighlightedHTML = syntaxHighlight(value);
  return /* @__PURE__ */ (0, import_jsx_dev_runtime5.jsxDEV)(RawHTML, { html: syntaxHighlightedHTML }, void 0, false, {
    fileName: "app/components/traces/MessagesView/CodeBlock.tsx",
    lineNumber: 51,
    columnNumber: 10
  }, this);
};
_c24 = CodeBlock;
var _c7;
var _c24;
$RefreshReg$(_c7, "RawHTML");
$RefreshReg$(_c24, "CodeBlock");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/components/traces/MessagesView/RoleHeaderMap.tsx
init_remix_hmr();

// app/components/traces/MessagesView/styles.tsx
init_remix_hmr();
var import_jsx_dev_runtime6 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/traces/MessagesView/styles.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/MessagesView/styles.tsx"
  );
  import.meta.hot.lastModified = "1712108608412.6572";
}
var Title = ({
  children
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime6.jsxDEV)("h1", { className: "flex flex-row items-center gap-2 text-xl", children }, void 0, false, {
    fileName: "app/components/traces/MessagesView/styles.tsx",
    lineNumber: 26,
    columnNumber: 10
  }, this);
};
_c8 = Title;
var Content = ({
  children
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime6.jsxDEV)("div", { className: "bg-secondary whitespace-pre-wrap rounded-xl px-8 py-4", children }, void 0, false, {
    fileName: "app/components/traces/MessagesView/styles.tsx",
    lineNumber: 32,
    columnNumber: 10
  }, this);
};
_c25 = Content;
var MessagesContainer = ({
  children,
  sortAscending
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime6.jsxDEV)("div", { className: `flex ${sortAscending ? "flex-col" : "flex-col-reverse"} gap-4`, children }, void 0, false, {
    fileName: "app/components/traces/MessagesView/styles.tsx",
    lineNumber: 39,
    columnNumber: 10
  }, this);
};
_c34 = MessagesContainer;
var Message = ({
  children
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime6.jsxDEV)("div", { className: "flex flex-col gap-1", children }, void 0, false, {
    fileName: "app/components/traces/MessagesView/styles.tsx",
    lineNumber: 45,
    columnNumber: 10
  }, this);
};
_c43 = Message;
var ToolCallsComponent = ({
  toolCalls
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime6.jsxDEV)("div", { className: "flex flex-col gap-2", children: toolCalls.map((toolCall, index) => {
    return /* @__PURE__ */ (0, import_jsx_dev_runtime6.jsxDEV)("div", { className: "bg-secondary flex flex-col rounded-xl px-3 py-2", children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime6.jsxDEV)("div", { className: "flex items-center gap-1 text-base", children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime6.jsxDEV)(Hammer, { size: 16 }, void 0, false, {
          fileName: "app/components/traces/MessagesView/styles.tsx",
          lineNumber: 55,
          columnNumber: 15
        }, this),
        " ",
        toolCall.name
      ] }, void 0, true, {
        fileName: "app/components/traces/MessagesView/styles.tsx",
        lineNumber: 54,
        columnNumber: 13
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime6.jsxDEV)("div", { className: "flex flex-row gap-1", children: /* @__PURE__ */ (0, import_jsx_dev_runtime6.jsxDEV)(PrettyJson, { data: toolCall.args, shouldTruncate: false }, void 0, false, {
        fileName: "app/components/traces/MessagesView/styles.tsx",
        lineNumber: 58,
        columnNumber: 15
      }, this) }, void 0, false, {
        fileName: "app/components/traces/MessagesView/styles.tsx",
        lineNumber: 57,
        columnNumber: 13
      }, this)
    ] }, index, true, {
      fileName: "app/components/traces/MessagesView/styles.tsx",
      lineNumber: 53,
      columnNumber: 14
    }, this);
  }) }, void 0, false, {
    fileName: "app/components/traces/MessagesView/styles.tsx",
    lineNumber: 51,
    columnNumber: 10
  }, this);
};
_c52 = ToolCallsComponent;
var _c8;
var _c25;
var _c34;
var _c43;
var _c52;
$RefreshReg$(_c8, "Title");
$RefreshReg$(_c25, "Content");
$RefreshReg$(_c34, "MessagesContainer");
$RefreshReg$(_c43, "Message");
$RefreshReg$(_c52, "ToolCallsComponent");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/components/traces/MessagesView/RoleHeaderMap.tsx
var import_jsx_dev_runtime7 = __toESM(require_jsx_dev_runtime(), 1);
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/MessagesView/RoleHeaderMap.tsx"
  );
  import.meta.hot.lastModified = "1712108397136.1401";
}
var RoleHeaderMap = {
  input: () => /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Title, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Download, { size: 20 }, void 0, false, {
      fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
      lineNumber: 22,
      columnNumber: 7
    }, this),
    "Input"
  ] }, void 0, true, {
    fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
    lineNumber: 21,
    columnNumber: 5
  }, this),
  output: () => /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Title, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Upload, { size: 20 }, void 0, false, {
      fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
      lineNumber: 28,
      columnNumber: 7
    }, this),
    "Output"
  ] }, void 0, true, {
    fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
    lineNumber: 27,
    columnNumber: 5
  }, this),
  system: () => /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Title, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Settings2, { size: 20 }, void 0, false, {
      fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
      lineNumber: 34,
      columnNumber: 7
    }, this),
    "System"
  ] }, void 0, true, {
    fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
    lineNumber: 33,
    columnNumber: 5
  }, this),
  user: () => /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Title, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(User, { size: 20 }, void 0, false, {
      fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
      lineNumber: 40,
      columnNumber: 7
    }, this),
    "User"
  ] }, void 0, true, {
    fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
    lineNumber: 39,
    columnNumber: 5
  }, this),
  assistant: () => /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Title, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Bot, { size: 20 }, void 0, false, {
      fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
      lineNumber: 46,
      columnNumber: 7
    }, this),
    "Assistant"
  ] }, void 0, true, {
    fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
    lineNumber: 45,
    columnNumber: 5
  }, this),
  tool: ({ toolName }) => /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Title, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Hammer, { size: 20 }, void 0, false, {
      fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
      lineNumber: 52,
      columnNumber: 7
    }, this),
    "Tool Response ",
    /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)("span", { className: "text-muted-foreground text-base", children: [
      "(",
      toolName,
      ")"
    ] }, void 0, true, {
      fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
      lineNumber: 53,
      columnNumber: 21
    }, this)
  ] }, void 0, true, {
    fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
    lineNumber: 51,
    columnNumber: 5
  }, this),
  function: () => /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Title, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime7.jsxDEV)(Hammer, { size: 20 }, void 0, false, {
      fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
      lineNumber: 58,
      columnNumber: 7
    }, this),
    "Function"
  ] }, void 0, true, {
    fileName: "app/components/traces/MessagesView/RoleHeaderMap.tsx",
    lineNumber: 57,
    columnNumber: 5
  }, this)
};

// app/components/traces/MessagesView/utils.ts
init_remix_hmr();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/MessagesView/utils.ts"
  );
  import.meta.hot.lastModified = "1712108037747.9265";
}
var formatToolCalls = (toolCalls) => {
  if (!toolCalls)
    return [];
  return toolCalls.map((toolCall) => ({
    name: toolCall.function.name,
    args: JSON.parse(toolCall.function.arguments)
  }));
};

// app/components/traces/MessagesView/SourceToMessageMap.tsx
var import_jsx_dev_runtime8 = __toESM(require_jsx_dev_runtime(), 1);
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/MessagesView/SourceToMessageMap.tsx"
  );
  import.meta.hot.lastModified = "1712108745958.6104";
}
var SourceToMessageMap = {
  [import_browser_client.LogDtoSourceEnum.Manual]: {
    InputComponent: ({ value, jsonView }) => {
      const RoleHeader = RoleHeaderMap.input;
      return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Message, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(RoleHeader, {}, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 36,
          columnNumber: 11
        }, this),
        jsonView ? /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(CodeBlock, { value: JSON.stringify(value || {}, void 0, 2) }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 38,
          columnNumber: 13
        }, this) : /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)("div", { className: "bg-secondary rounded-xl px-3 py-1", children: /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(PrettyJson, { data: value, shouldTruncate: false }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 41,
          columnNumber: 15
        }, this) }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 40,
          columnNumber: 13
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
        lineNumber: 35,
        columnNumber: 9
      }, this);
    },
    OutputComponent: ({ value, jsonView }) => {
      const RoleHeader = RoleHeaderMap.output;
      return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Message, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(RoleHeader, {}, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 51,
          columnNumber: 11
        }, this),
        jsonView ? /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(CodeBlock, { value: JSON.stringify(value || {}, void 0, 2) }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 53,
          columnNumber: 13
        }, this) : /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)("div", { className: "bg-secondary rounded-xl px-3 py-1", children: /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(PrettyJson, { data: value, shouldTruncate: false }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 56,
          columnNumber: 15
        }, this) }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 55,
          columnNumber: 13
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
        lineNumber: 50,
        columnNumber: 9
      }, this);
    }
  },
  [import_browser_client.LogDtoSourceEnum.Openai]: {
    InputComponent: ({ value, jsonView, sortAscending }) => {
      const typedValue = value;
      return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(MessagesContainer, { sortAscending, children: typedValue.messages.map((value2, index) => {
        const RoleHeader = RoleHeaderMap[value2.role];
        const toolName = value2.role === "tool" ? value2.name : null;
        const toolCalls = "tool_calls" in value2 && value2.tool_calls ? formatToolCalls(value2.tool_calls) : [];
        const CodeView = /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(CodeBlock, { value: JSON.stringify(typedValue, void 0, 2) }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 76,
          columnNumber: 30
        }, this);
        const PrettyContent = typeof value2.content === "string" && value2.content.length ? /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Content, { children: value2.content }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 79,
          columnNumber: 17
        }, this) : toolCalls?.length ? /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(ToolCallsComponent, { toolCalls }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 81,
          columnNumber: 17
        }, this) : CodeView;
        return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Message, { children: [
          /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(RoleHeader, { toolName }, void 0, false, {
            fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
            lineNumber: 88,
            columnNumber: 17
          }, this),
          jsonView ? CodeView : PrettyContent
        ] }, index, true, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 87,
          columnNumber: 15
        }, this);
      }) }, void 0, false, {
        fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
        lineNumber: 68,
        columnNumber: 9
      }, this);
    },
    OutputComponent: ({ value, jsonView }) => {
      const typedValue = value;
      const message = typedValue.choices[0].message;
      const RoleHeader = RoleHeaderMap[message.role];
      const isToolCall = !message.content && !!message.tool_calls?.length;
      const isFunctionCall = !message.content && !!message.function_call;
      const toolCalls = isToolCall ? formatToolCalls(message.tool_calls) : [];
      const getContent = () => {
        if (isToolCall) {
          return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(ToolCallsComponent, { toolCalls }, void 0, false, {
            fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
            lineNumber: 107,
            columnNumber: 18
          }, this);
        } else if (isFunctionCall) {
          return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(CodeBlock, { value: JSON.stringify(message.function_call, void 0, 2) }, void 0, false, {
            fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
            lineNumber: 109,
            columnNumber: 18
          }, this);
        }
        return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Content, { children: message.content }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 112,
          columnNumber: 16
        }, this);
      };
      const ContentRender = getContent();
      return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Message, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(RoleHeader, {}, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 118,
          columnNumber: 11
        }, this),
        jsonView ? /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(CodeBlock, { value: JSON.stringify(value, void 0, 2) }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 119,
          columnNumber: 23
        }, this) : ContentRender
      ] }, void 0, true, {
        fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
        lineNumber: 117,
        columnNumber: 9
      }, this);
    }
  },
  [import_browser_client.LogDtoSourceEnum.Mistral]: {
    InputComponent: ({ value, jsonView, sortAscending }) => /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(MessagesContainer, { sortAscending, children: value.messages.map(({ role, content }, index) => {
      const RoleHeader = RoleHeaderMap[role];
      const strContent = typeof content === "string" ? content : content.reduce((acc, content2) => acc + content2, "");
      return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Message, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(RoleHeader, {}, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 133,
          columnNumber: 16
        }, this),
        jsonView ? /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(CodeBlock, { value: JSON.stringify(value, void 0, 2) }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 134,
          columnNumber: 27
        }, this) : /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Content, { children: strContent }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 134,
          columnNumber: 87
        }, this)
      ] }, index, true, {
        fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
        lineNumber: 132,
        columnNumber: 13
      }, this);
    }) }, void 0, false, {
      fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
      lineNumber: 126,
      columnNumber: 7
    }, this),
    OutputComponent: ({ value, jsonView }) => {
      const typedValue = value;
      const message = typedValue.choices[0].message;
      const RoleHeader = RoleHeaderMap[message.role];
      const content = message.content;
      return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Message, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(RoleHeader, {}, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 148,
          columnNumber: 11
        }, this),
        jsonView ? /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(CodeBlock, { value: JSON.stringify(value, void 0, 2) }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 149,
          columnNumber: 23
        }, this) : /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Content, { children: content }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 149,
          columnNumber: 83
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
        lineNumber: 147,
        columnNumber: 9
      }, this);
    }
  },
  [import_browser_client.LogDtoSourceEnum.Anthropic]: {
    InputComponent: ({ value, jsonView, sortAscending }) => {
      const typedValue = value;
      return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(MessagesContainer, { sortAscending, children: typedValue.messages.map((value2, index) => {
        const RoleHeader = RoleHeaderMap[value2.role];
        const CodeView = /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(CodeBlock, { value: JSON.stringify(value2, void 0, 2) }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 163,
          columnNumber: 30
        }, this);
        const PrettyContent = typeof value2.content === "string" ? /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Content, { children: value2.content }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 164,
          columnNumber: 71
        }, this) : CodeView;
        return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Message, { children: [
          /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(RoleHeader, {}, void 0, false, {
            fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
            lineNumber: 168,
            columnNumber: 17
          }, this),
          jsonView ? CodeView : PrettyContent
        ] }, index, true, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 167,
          columnNumber: 15
        }, this);
      }) }, void 0, false, {
        fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
        lineNumber: 159,
        columnNumber: 9
      }, this);
    },
    OutputComponent: ({ value, jsonView }) => {
      const typedValue = value;
      const RoleHeader = RoleHeaderMap[typedValue.role];
      const stringOutput = typedValue.content.reduce((acc, content) => acc + content.text, "");
      return /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Message, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(RoleHeader, {}, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 183,
          columnNumber: 11
        }, this),
        jsonView ? /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(CodeBlock, { value: JSON.stringify(value, void 0, 2) }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 184,
          columnNumber: 23
        }, this) : /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)(Content, { children: stringOutput }, void 0, false, {
          fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
          lineNumber: 184,
          columnNumber: 83
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
        lineNumber: 182,
        columnNumber: 9
      }, this);
    }
  },
  [import_browser_client.LogDtoSourceEnum.Cohere]: {
    InputComponent: () => /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)("p", { children: "Unimplemented" }, void 0, false, {
      fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
      lineNumber: 190,
      columnNumber: 27
    }, this),
    OutputComponent: () => /* @__PURE__ */ (0, import_jsx_dev_runtime8.jsxDEV)("p", { children: "Unimplemented" }, void 0, false, {
      fileName: "app/components/traces/MessagesView/SourceToMessageMap.tsx",
      lineNumber: 191,
      columnNumber: 28
    }, this)
  }
};

// app/components/traces/MessagesView/MessagesView.tsx
var import_jsx_dev_runtime9 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/traces/MessagesView/MessagesView.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/MessagesView/MessagesView.tsx"
  );
  import.meta.hot.lastModified = "1711987286109.6262";
}
var MessagesView = ({
  input,
  output,
  extra,
  inputSource,
  outputSource,
  jsonView,
  sortAscending
}) => {
  const {
    InputComponent
  } = SourceToMessageMap[inputSource];
  const {
    OutputComponent
  } = SourceToMessageMap[outputSource];
  return /* @__PURE__ */ (0, import_jsx_dev_runtime9.jsxDEV)(MessagesContainer, { sortAscending, children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime9.jsxDEV)(InputComponent, { value: input, jsonView, sortAscending }, void 0, false, {
      fileName: "app/components/traces/MessagesView/MessagesView.tsx",
      lineNumber: 40,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime9.jsxDEV)(OutputComponent, { value: output, jsonView, sortAscending }, void 0, false, {
      fileName: "app/components/traces/MessagesView/MessagesView.tsx",
      lineNumber: 41,
      columnNumber: 7
    }, this),
    extra && /* @__PURE__ */ (0, import_jsx_dev_runtime9.jsxDEV)(Message, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime9.jsxDEV)(Title, { children: "Extra" }, void 0, false, {
        fileName: "app/components/traces/MessagesView/MessagesView.tsx",
        lineNumber: 44,
        columnNumber: 11
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime9.jsxDEV)(CodeBlock, { value: JSON.stringify(extra, void 0, 2) }, void 0, false, {
        fileName: "app/components/traces/MessagesView/MessagesView.tsx",
        lineNumber: 45,
        columnNumber: 11
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/MessagesView/MessagesView.tsx",
      lineNumber: 43,
      columnNumber: 17
    }, this)
  ] }, void 0, true, {
    fileName: "app/components/traces/MessagesView/MessagesView.tsx",
    lineNumber: 39,
    columnNumber: 10
  }, this);
};
_c9 = MessagesView;
var _c9;
$RefreshReg$(_c9, "MessagesView");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/components/traces/SourceToIconMap.tsx
init_remix_hmr();
var import_browser_client2 = __toESM(require_dist(), 1);
var import_jsx_dev_runtime10 = __toESM(require_jsx_dev_runtime(), 1);
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/SourceToIconMap.tsx"
  );
  import.meta.hot.lastModified = "1711987286110.156";
}
var SourceToIconMap = {
  [import_browser_client2.LogDtoSourceEnum.Manual]: /* @__PURE__ */ (0, import_jsx_dev_runtime10.jsxDEV)("div", { className: "h-6 w-6 rounded bg-slate-400 p-1 dark:bg-slate-600", children: /* @__PURE__ */ (0, import_jsx_dev_runtime10.jsxDEV)(Pencil, { className: "h-full w-full" }, void 0, false, {
    fileName: "app/components/traces/SourceToIconMap.tsx",
    lineNumber: 18,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/components/traces/SourceToIconMap.tsx",
    lineNumber: 17,
    columnNumber: 5
  }, this),
  [import_browser_client2.LogDtoSourceEnum.Openai]: /* @__PURE__ */ (0, import_jsx_dev_runtime10.jsxDEV)("div", { className: "h-6 w-6 rounded bg-green-700 p-1", children: /* @__PURE__ */ (0, import_jsx_dev_runtime10.jsxDEV)("img", { src: "/openai.svg", alt: "Openai Logo", className: "h-full w-full" }, void 0, false, {
    fileName: "app/components/traces/SourceToIconMap.tsx",
    lineNumber: 23,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/components/traces/SourceToIconMap.tsx",
    lineNumber: 22,
    columnNumber: 5
  }, this),
  [import_browser_client2.LogDtoSourceEnum.Mistral]: /* @__PURE__ */ (0, import_jsx_dev_runtime10.jsxDEV)("div", { className: "h-6 w-6 rounded bg-orange-400 p-1", children: /* @__PURE__ */ (0, import_jsx_dev_runtime10.jsxDEV)("img", { src: "/mistral.png", alt: "Mistral Logo", className: "h-full w-full" }, void 0, false, {
    fileName: "app/components/traces/SourceToIconMap.tsx",
    lineNumber: 28,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/components/traces/SourceToIconMap.tsx",
    lineNumber: 27,
    columnNumber: 5
  }, this),
  [import_browser_client2.LogDtoSourceEnum.Anthropic]: /* @__PURE__ */ (0, import_jsx_dev_runtime10.jsxDEV)("div", { className: "h-6 w-6 rounded bg-[#c6a083] p-1", children: /* @__PURE__ */ (0, import_jsx_dev_runtime10.jsxDEV)("img", { src: "/anthropic.png", alt: "Anthropic Logo", className: "h-full w-full" }, void 0, false, {
    fileName: "app/components/traces/SourceToIconMap.tsx",
    lineNumber: 33,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/components/traces/SourceToIconMap.tsx",
    lineNumber: 32,
    columnNumber: 5
  }, this),
  [import_browser_client2.LogDtoSourceEnum.Cohere]: /* @__PURE__ */ (0, import_jsx_dev_runtime10.jsxDEV)("div", { className: "h-6 w-6 rounded bg-orange-500 p-1", children: /* @__PURE__ */ (0, import_jsx_dev_runtime10.jsxDEV)("img", { src: "/openai.svg", alt: "Openai Logo", className: "h-full w-full" }, void 0, false, {
    fileName: "app/components/traces/SourceToIconMap.tsx",
    lineNumber: 38,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/components/traces/SourceToIconMap.tsx",
    lineNumber: 37,
    columnNumber: 5
  }, this)
};

// app/components/traces/LogView.tsx
var import_jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/traces/LogView.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s2 = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/LogView.tsx"
  );
  import.meta.hot.lastModified = "1712098424722.9146";
}
var TooltipWrapper = ({
  children,
  tooltip
}) => /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)($a093c7e1ec25a057$export$f78649fb9ca566b8, { delayDuration: 350, children: /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(Tooltip, { children: [
  /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)("div", { className: "px-2", children }, void 0, false, {
    fileName: "app/components/traces/LogView.tsx",
    lineNumber: 36,
    columnNumber: 9
  }, this) }, void 0, false, {
    fileName: "app/components/traces/LogView.tsx",
    lineNumber: 35,
    columnNumber: 7
  }, this),
  /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(TooltipContent, { className: "bg-secondary", children: tooltip }, void 0, false, {
    fileName: "app/components/traces/LogView.tsx",
    lineNumber: 38,
    columnNumber: 7
  }, this)
] }, void 0, true, {
  fileName: "app/components/traces/LogView.tsx",
  lineNumber: 34,
  columnNumber: 5
}, this) }, void 0, false, {
  fileName: "app/components/traces/LogView.tsx",
  lineNumber: 33,
  columnNumber: 7
}, this);
_c10 = TooltipWrapper;
var LogView = ({
  log
}) => {
  _s2();
  const [toggleValues, setToggleValues] = (0, import_react3.useState)(["sort"]);
  const jsonView = toggleValues.includes("json");
  const sortAscending = toggleValues.includes("sort");
  return /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)("div", { className: "ml-4", children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)("div", { className: "mb-2 flex justify-between", children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)("h1", { className: "flex items-center gap-2 text-xl", children: [
        SourceToIconMap[log.source],
        " ",
        log.name
      ] }, void 0, true, {
        fileName: "app/components/traces/LogView.tsx",
        lineNumber: 51,
        columnNumber: 9
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(ToggleGroup, { size: "sm", type: "multiple", variant: "outline", defaultChecked: true, value: toggleValues, onValueChange: setToggleValues, defaultValue: ["sort"], children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(ToggleGroupItem, { value: "sort", className: "p-0", children: /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(TooltipWrapper, { tooltip: sortAscending ? "Sort Descending" : "Sort Ascending", children: /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(ArrowDownAZ, { size: 14 }, void 0, false, {
          fileName: "app/components/traces/LogView.tsx",
          lineNumber: 58,
          columnNumber: 15
        }, this) }, void 0, false, {
          fileName: "app/components/traces/LogView.tsx",
          lineNumber: 57,
          columnNumber: 13
        }, this) }, void 0, false, {
          fileName: "app/components/traces/LogView.tsx",
          lineNumber: 56,
          columnNumber: 11
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(ToggleGroupItem, { value: "json", className: "p-0", children: /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(TooltipWrapper, { tooltip: jsonView ? "Pretty View" : "JSON View", children: /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(Braces, { size: 14 }, void 0, false, {
          fileName: "app/components/traces/LogView.tsx",
          lineNumber: 63,
          columnNumber: 15
        }, this) }, void 0, false, {
          fileName: "app/components/traces/LogView.tsx",
          lineNumber: 62,
          columnNumber: 13
        }, this) }, void 0, false, {
          fileName: "app/components/traces/LogView.tsx",
          lineNumber: 61,
          columnNumber: 11
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogView.tsx",
        lineNumber: 55,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/LogView.tsx",
      lineNumber: 50,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)("div", { className: "mb-4 flex flex-row gap-4 pb-1", children: /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(LogAnalytics, { log }, void 0, false, {
      fileName: "app/components/traces/LogView.tsx",
      lineNumber: 69,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogView.tsx",
      lineNumber: 68,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime11.jsxDEV)(MessagesView, { input: log.input, output: log.output, extra: log.extra, inputSource: log.source, outputSource: log.source, jsonView, sortAscending }, void 0, false, {
      fileName: "app/components/traces/LogView.tsx",
      lineNumber: 72,
      columnNumber: 7
    }, this)
  ] }, void 0, true, {
    fileName: "app/components/traces/LogView.tsx",
    lineNumber: 49,
    columnNumber: 10
  }, this);
};
_s2(LogView, "MFwDzvIOghNrFM7WBleDaMTrgbo=");
_c26 = LogView;
var _c10;
var _c26;
$RefreshReg$(_c10, "TooltipWrapper");
$RefreshReg$(_c26, "LogView");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/components/traces/LogsTreeView.tsx
init_remix_hmr();
var import_react4 = __toESM(require_react(), 1);

// app/components/traces/utils.ts
init_remix_hmr();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/utils.ts"
  );
  import.meta.hot.lastModified = "1712107774644.4832";
}
var buildTree = (logs) => {
  const calculateDepth = (log, currentLogs) => {
    let depth = 1;
    let current = log;
    while (current.parentLogId) {
      const parent = currentLogs.find((l) => l.id === current.parentLogId);
      if (parent) {
        depth++;
        current = parent;
      } else {
        break;
      }
    }
    return depth;
  };
  return logs.map((log) => ({
    ...log,
    depth: calculateDepth(log, logs)
  }));
};

// app/components/traces/LogsTreeView.tsx
var import_jsx_dev_runtime12 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/traces/LogsTreeView.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s3 = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/LogsTreeView.tsx"
  );
  import.meta.hot.lastModified = "1711987286109.4182";
}
var LogTreeNode = ({
  log,
  onSelect,
  selectedId,
  depth,
  Icon
}) => {
  const isNodeSelected = selectedId === log.id;
  const handleClick = () => {
    if (isNodeSelected) {
      return;
    }
    onSelect(log.id);
  };
  const moveRightBy = (depth + 1) * 14;
  return /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("div", { className: `
      hover:bg-secondary
      my-1
      cursor-pointer 
      rounded-xl
      px-4
      py-2
      ${isNodeSelected ? "bg-secondary" : ""} 
      `, style: {
    paddingLeft: depth ? `${moveRightBy}px` : ""
  }, onClick: handleClick, children: /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("div", { className: "flex items-center gap-2", children: [
    Icon || SourceToIconMap[log.source],
    /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("div", { className: `${log.duration ? "max-w-32" : "max-w-40"} overflow-hidden`, children: /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)(Tooltip, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("span", { className: "block truncate text-sm", children: log.name }, void 0, false, {
        fileName: "app/components/traces/LogsTreeView.tsx",
        lineNumber: 60,
        columnNumber: 17
      }, this) }, void 0, false, {
        fileName: "app/components/traces/LogsTreeView.tsx",
        lineNumber: 59,
        columnNumber: 15
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)(TooltipContent, { className: "relative z-10 bg-slate-500", children: /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("p", { children: log.name }, void 0, false, {
        fileName: "app/components/traces/LogsTreeView.tsx",
        lineNumber: 63,
        columnNumber: 17
      }, this) }, void 0, false, {
        fileName: "app/components/traces/LogsTreeView.tsx",
        lineNumber: 62,
        columnNumber: 15
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/LogsTreeView.tsx",
      lineNumber: 58,
      columnNumber: 13
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogsTreeView.tsx",
      lineNumber: 57,
      columnNumber: 11
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogsTreeView.tsx",
      lineNumber: 56,
      columnNumber: 9
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("span", { className: "text-muted-foreground text-xs", children: log.duration ? `${log.duration}s` : "" }, void 0, false, {
      fileName: "app/components/traces/LogsTreeView.tsx",
      lineNumber: 68,
      columnNumber: 9
    }, this)
  ] }, void 0, true, {
    fileName: "app/components/traces/LogsTreeView.tsx",
    lineNumber: 54,
    columnNumber: 7
  }, this) }, void 0, false, {
    fileName: "app/components/traces/LogsTreeView.tsx",
    lineNumber: 43,
    columnNumber: 10
  }, this);
};
_c11 = LogTreeNode;
var LogsTreeView = ({
  trace,
  selectedId,
  handleSelect
}) => {
  _s3();
  const logs = trace.logs;
  const treeLogs = buildTree(logs);
  const containerRef = (0, import_react4.useRef)(null);
  const [offsetTop, setOffsetTop] = (0, import_react4.useState)(0);
  (0, import_react4.useEffect)(() => {
    if (containerRef.current) {
      const rect = containerRef.current.getBoundingClientRect();
      setOffsetTop(rect.top);
    }
  }, []);
  return /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("div", { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("div", { className: "mb-2", children: /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("h1", { className: "text-xl", children: "Trace" }, void 0, false, {
      fileName: "app/components/traces/LogsTreeView.tsx",
      lineNumber: 94,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogsTreeView.tsx",
      lineNumber: 93,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)(ScrollArea, { children: /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("div", { ref: containerRef, style: {
      minHeight: `calc(100vh - ${offsetTop}px - 16px)`
    }, children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)(LogTreeNode, { log: trace, onSelect: handleSelect, selectedId, depth: 0, Icon: /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)("div", { className: "bg-primary h-6 w-6 rounded p-1", children: /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)(GanttChart, { className: "h-full w-full" }, void 0, false, {
        fileName: "app/components/traces/LogsTreeView.tsx",
        lineNumber: 101,
        columnNumber: 17
      }, this) }, void 0, false, {
        fileName: "app/components/traces/LogsTreeView.tsx",
        lineNumber: 100,
        columnNumber: 115
      }, this) }, trace.id, false, {
        fileName: "app/components/traces/LogsTreeView.tsx",
        lineNumber: 100,
        columnNumber: 11
      }, this),
      treeLogs.map((log) => /* @__PURE__ */ (0, import_jsx_dev_runtime12.jsxDEV)(LogTreeNode, { log, onSelect: handleSelect, selectedId, depth: log.depth }, log.id, false, {
        fileName: "app/components/traces/LogsTreeView.tsx",
        lineNumber: 103,
        columnNumber: 32
      }, this))
    ] }, void 0, true, {
      fileName: "app/components/traces/LogsTreeView.tsx",
      lineNumber: 97,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogsTreeView.tsx",
      lineNumber: 96,
      columnNumber: 7
    }, this)
  ] }, void 0, true, {
    fileName: "app/components/traces/LogsTreeView.tsx",
    lineNumber: 92,
    columnNumber: 10
  }, this);
};
_s3(LogsTreeView, "BlPcNNNRM3ueCzx2rcyvyfJfjIw=");
_c27 = LogsTreeView;
var _c11;
var _c27;
$RefreshReg$(_c11, "LogTreeNode");
$RefreshReg$(_c27, "LogsTreeView");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/components/traces/TraceView.tsx
init_remix_hmr();
var import_react5 = __toESM(require_react(), 1);

// app/components/traces/LogAnalytics/TraceAnalytics.tsx
init_remix_hmr();
var import_jsx_dev_runtime13 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/traces/LogAnalytics/TraceAnalytics.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/LogAnalytics/TraceAnalytics.tsx"
  );
  import.meta.hot.lastModified = "1711987286108.9268";
}
var TraceAnalytics = ({
  trace
}) => {
  return /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsContainer, { children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsCard, { title: "General", Icon: Info, children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: "UserID" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 30,
          columnNumber: 11
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: trace.userId || "None" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 31,
          columnNumber: 11
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
        lineNumber: 29,
        columnNumber: 9
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: "Tags" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 35,
          columnNumber: 11
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: trace.tags.length ? trace.tags.join(",") : "None" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 36,
          columnNumber: 11
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
        lineNumber: 34,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 28,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsCard, { title: "Cost", Icon: DollarSign, tooltip: /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(import_jsx_dev_runtime13.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: "Input" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 42,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: [
          "$",
          trace.inputCost
        ] }, void 0, true, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 42,
          columnNumber: 34
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
        lineNumber: 41,
        columnNumber: 13
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: "Output" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 45,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: [
          "$",
          trace.outputCost
        ] }, void 0, true, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 45,
          columnNumber: 35
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
        lineNumber: 44,
        columnNumber: 13
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 40,
      columnNumber: 62
    }, this), children: /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMajorStat, { children: [
      "$ ",
      trace.totalCost
    ] }, void 0, true, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 48,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 40,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsCard, { title: "Tokens", Icon: Coins, tooltip: /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(import_jsx_dev_runtime13.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: "Input" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 53,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: trace.inputTokens ? formatNumber(trace.inputTokens) : "\u2014" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 53,
          columnNumber: 34
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
        lineNumber: 52,
        columnNumber: 13
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: "Output" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 56,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: trace.outputTokens ? formatNumber(trace.outputTokens) : "\u2014" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 56,
          columnNumber: 35
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
        lineNumber: 55,
        columnNumber: 13
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 51,
      columnNumber: 59
    }, this), children: /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMajorStat, { children: formatNumber(trace.totalTokens) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 59,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 51,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsCard, { title: "Latency", Icon: Timer, tooltip: /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(import_jsx_dev_runtime13.Fragment, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: "Start" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 64,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: trace.startTime ? formatDate(trace.startTime) : "\u2014" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 64,
          columnNumber: 34
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
        lineNumber: 63,
        columnNumber: 13
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMinorStat, { children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: "End" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 67,
          columnNumber: 15
        }, this),
        " ",
        /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: trace.endTime ? formatDate(trace.endTime) : "\u2014" }, void 0, false, {
          fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
          lineNumber: 67,
          columnNumber: 32
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
        lineNumber: 66,
        columnNumber: 13
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 62,
      columnNumber: 60
    }, this), children: /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMajorStat, { children: [
      trace.duration,
      "s"
    ] }, void 0, true, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 70,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 62,
      columnNumber: 7
    }, this),
    trace.extra && /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsCard, { title: "Extra", Icon: PlusCircle, children: trace.extra ? Object.entries(trace.extra).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMinorStat, { children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: key }, void 0, false, {
        fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
        lineNumber: 75,
        columnNumber: 17
      }, this),
      " ",
      /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)("span", { children: value.toString() }, void 0, false, {
        fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
        lineNumber: 75,
        columnNumber: 36
      }, this)
    ] }, key, true, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 74,
      columnNumber: 76
    }, this)) : /* @__PURE__ */ (0, import_jsx_dev_runtime13.jsxDEV)(AnalyticsMinorStat, { children: "None" }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 76,
      columnNumber: 40
    }, this) }, void 0, false, {
      fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
      lineNumber: 73,
      columnNumber: 23
    }, this)
  ] }, void 0, true, {
    fileName: "app/components/traces/LogAnalytics/TraceAnalytics.tsx",
    lineNumber: 27,
    columnNumber: 10
  }, this);
};
_c12 = TraceAnalytics;
var _c12;
$RefreshReg$(_c12, "TraceAnalytics");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/components/traces/TraceView.tsx
var import_jsx_dev_runtime14 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/components/traces/TraceView.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s4 = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/components/traces/TraceView.tsx"
  );
  import.meta.hot.lastModified = "1712092158013.2559";
}
var TooltipWrapper2 = ({
  children,
  tooltip
}) => /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)($a093c7e1ec25a057$export$f78649fb9ca566b8, { delayDuration: 350, children: /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(Tooltip, { children: [
  /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)("div", { className: "px-2", children }, void 0, false, {
    fileName: "app/components/traces/TraceView.tsx",
    lineNumber: 35,
    columnNumber: 9
  }, this) }, void 0, false, {
    fileName: "app/components/traces/TraceView.tsx",
    lineNumber: 34,
    columnNumber: 7
  }, this),
  /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(TooltipContent, { className: "bg-secondary", children: tooltip }, void 0, false, {
    fileName: "app/components/traces/TraceView.tsx",
    lineNumber: 37,
    columnNumber: 7
  }, this)
] }, void 0, true, {
  fileName: "app/components/traces/TraceView.tsx",
  lineNumber: 33,
  columnNumber: 5
}, this) }, void 0, false, {
  fileName: "app/components/traces/TraceView.tsx",
  lineNumber: 32,
  columnNumber: 7
}, this);
_c13 = TooltipWrapper2;
var TraceView = ({
  trace
}) => {
  _s4();
  const [toggleValues, setToggleValues] = (0, import_react5.useState)(["sort"]);
  const jsonView = toggleValues.includes("json");
  const sortAscending = toggleValues.includes("sort");
  const firstLog = trace.logs[0];
  const lastLog = trace.logs[trace.logs.length - 1];
  return /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)("div", { className: "ml-4", children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)("div", { className: "mb-2 flex justify-between", children: [
      /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)("h1", { className: "flex items-center gap-2 text-xl", children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(GanttChart, { className: "bg-primary h-6 w-6 rounded p-1" }, void 0, false, {
          fileName: "app/components/traces/TraceView.tsx",
          lineNumber: 53,
          columnNumber: 11
        }, this),
        " Trace Overview"
      ] }, void 0, true, {
        fileName: "app/components/traces/TraceView.tsx",
        lineNumber: 52,
        columnNumber: 9
      }, this),
      /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(ToggleGroup, { size: "sm", type: "multiple", variant: "outline", defaultChecked: true, value: toggleValues, onValueChange: setToggleValues, defaultValue: ["sort"], children: [
        /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(ToggleGroupItem, { value: "sort", className: "p-0", children: /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(TooltipWrapper2, { tooltip: sortAscending ? "Sort Descending" : "Sort Ascending", children: /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(ArrowDownAZ, { size: 14 }, void 0, false, {
          fileName: "app/components/traces/TraceView.tsx",
          lineNumber: 59,
          columnNumber: 15
        }, this) }, void 0, false, {
          fileName: "app/components/traces/TraceView.tsx",
          lineNumber: 58,
          columnNumber: 13
        }, this) }, void 0, false, {
          fileName: "app/components/traces/TraceView.tsx",
          lineNumber: 57,
          columnNumber: 11
        }, this),
        /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(ToggleGroupItem, { value: "json", className: "p-0", children: /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(TooltipWrapper2, { tooltip: jsonView ? "Pretty View" : "JSON View", children: /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(Braces, { size: 14 }, void 0, false, {
          fileName: "app/components/traces/TraceView.tsx",
          lineNumber: 64,
          columnNumber: 15
        }, this) }, void 0, false, {
          fileName: "app/components/traces/TraceView.tsx",
          lineNumber: 63,
          columnNumber: 13
        }, this) }, void 0, false, {
          fileName: "app/components/traces/TraceView.tsx",
          lineNumber: 62,
          columnNumber: 11
        }, this)
      ] }, void 0, true, {
        fileName: "app/components/traces/TraceView.tsx",
        lineNumber: 56,
        columnNumber: 9
      }, this)
    ] }, void 0, true, {
      fileName: "app/components/traces/TraceView.tsx",
      lineNumber: 51,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)("div", { className: "mb-4 flex flex-row gap-4", children: /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(TraceAnalytics, { trace }, void 0, false, {
      fileName: "app/components/traces/TraceView.tsx",
      lineNumber: 70,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/components/traces/TraceView.tsx",
      lineNumber: 69,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime14.jsxDEV)(MessagesView, { input: firstLog.input, output: lastLog.output, inputSource: firstLog.source, outputSource: lastLog.source, jsonView, sortAscending }, void 0, false, {
      fileName: "app/components/traces/TraceView.tsx",
      lineNumber: 73,
      columnNumber: 7
    }, this)
  ] }, void 0, true, {
    fileName: "app/components/traces/TraceView.tsx",
    lineNumber: 50,
    columnNumber: 10
  }, this);
};
_s4(TraceView, "MFwDzvIOghNrFM7WBleDaMTrgbo=");
_c28 = TraceView;
var _c13;
var _c28;
$RefreshReg$(_c13, "TooltipWrapper");
$RefreshReg$(_c28, "TraceView");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

// app/hooks/useUpdateQueryWithoutNavigation.tsx
init_remix_hmr();
var import_react6 = __toESM(require_react(), 1);
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/hooks/useUpdateQueryWithoutNavigation.tsx"
  );
  import.meta.hot.lastModified = "1710795853618.8289";
}
var useUpdateQueryWithoutNavigation = (queryKey, queryValue) => {
  (0, import_react6.useEffect)(() => {
    const currentSearchParams = new URLSearchParams(window.location.search);
    const oldQuery = currentSearchParams.get(queryKey) ?? "";
    if (queryValue === oldQuery) {
      return;
    }
    if (queryValue) {
      currentSearchParams.set(queryKey, queryValue);
    } else {
      currentSearchParams.delete(queryKey);
    }
    const newUrl = [window.location.pathname, currentSearchParams.toString()].filter(Boolean).join("?");
    window.history.replaceState(null, "", newUrl);
  }, [queryKey, queryValue]);
};

// app/pages/traces/TraceIdContent.tsx
var import_jsx_dev_runtime15 = __toESM(require_jsx_dev_runtime(), 1);
if (!window.$RefreshReg$ || !window.$RefreshSig$ || !window.$RefreshRuntime$) {
  console.warn("remix:hmr: React Fast Refresh only works when the Remix compiler is running in development mode.");
} else {
  prevRefreshReg = window.$RefreshReg$;
  prevRefreshSig = window.$RefreshSig$;
  window.$RefreshReg$ = (type, id) => {
    window.$RefreshRuntime$.register(type, '"app/pages/traces/TraceIdContent.tsx"' + id);
  };
  window.$RefreshSig$ = window.$RefreshRuntime$.createSignatureFunctionForTransform;
}
var prevRefreshReg;
var prevRefreshSig;
var _s5 = $RefreshSig$();
if (import.meta) {
  import.meta.hot = createHotContext(
    //@ts-expect-error
    "app/pages/traces/TraceIdContent.tsx"
  );
  import.meta.hot.lastModified = "1713199469914.6995";
}
var TraceIdContent = ({
  trace
}) => {
  _s5();
  const queryKey = "logId";
  const [searchParams] = useSearchParams();
  const [selectedId, setSelectedId] = (0, import_react8.useState)(searchParams.get(queryKey) ?? "");
  useUpdateQueryWithoutNavigation(queryKey, selectedId);
  const selectedLog = trace.logs.find((log) => log.id === selectedId) ?? null;
  const handleSelect = (id) => {
    setSelectedId(selectedId === id ? "" : id);
  };
  const setDefaultSelectedId = () => {
    if (!selectedId) {
      setSelectedId(trace.id);
    }
  };
  useMount(setDefaultSelectedId);
  const handleArrowRight = () => {
    const nextLog = trace.logs[trace.logs.findIndex((log) => log.id === selectedId) + 1];
    if (!nextLog) {
      return;
    }
    setSelectedId(nextLog.id);
  };
  useKey("ArrowRight", handleArrowRight, {
    event: "keyup"
  }, [selectedId]);
  const handleArrowLeft = () => {
    const previousLog = trace.logs[trace.logs.findIndex((log) => log.id === selectedId) - 1];
    if (!previousLog) {
      setSelectedId(trace.id);
      return;
    }
    setSelectedId(previousLog.id);
  };
  useKey("ArrowLeft", handleArrowLeft, {
    event: "keyup"
  }, [selectedId]);
  return /* @__PURE__ */ (0, import_jsx_dev_runtime15.jsxDEV)("div", { className: "grid grid-cols-7 gap-4", children: [
    /* @__PURE__ */ (0, import_jsx_dev_runtime15.jsxDEV)("div", { className: "col-span-2", children: /* @__PURE__ */ (0, import_jsx_dev_runtime15.jsxDEV)(LogsTreeView, { trace, selectedId, handleSelect }, void 0, false, {
      fileName: "app/pages/traces/TraceIdContent.tsx",
      lineNumber: 71,
      columnNumber: 9
    }, this) }, void 0, false, {
      fileName: "app/pages/traces/TraceIdContent.tsx",
      lineNumber: 70,
      columnNumber: 7
    }, this),
    /* @__PURE__ */ (0, import_jsx_dev_runtime15.jsxDEV)("div", { className: "col-span-5", children: selectedLog?.traceId ? /* @__PURE__ */ (0, import_jsx_dev_runtime15.jsxDEV)(LogView, { log: selectedLog }, void 0, false, {
      fileName: "app/pages/traces/TraceIdContent.tsx",
      lineNumber: 74,
      columnNumber: 33
    }, this) : /* @__PURE__ */ (0, import_jsx_dev_runtime15.jsxDEV)(TraceView, { trace }, void 0, false, {
      fileName: "app/pages/traces/TraceIdContent.tsx",
      lineNumber: 74,
      columnNumber: 65
    }, this) }, void 0, false, {
      fileName: "app/pages/traces/TraceIdContent.tsx",
      lineNumber: 73,
      columnNumber: 7
    }, this)
  ] }, void 0, true, {
    fileName: "app/pages/traces/TraceIdContent.tsx",
    lineNumber: 69,
    columnNumber: 10
  }, this);
};
_s5(TraceIdContent, "phJqnq0dF5kIbdMl5QualLy4b8o=", false, function() {
  return [useSearchParams, useUpdateQueryWithoutNavigation, useMount, useKey, useKey];
});
_c14 = TraceIdContent;
var _c14;
$RefreshReg$(_c14, "TraceIdContent");
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;

export {
  TraceIdContent
};
//# sourceMappingURL=/build/_shared/chunk-3JJG57KF.js.map
