@localstack/appinspector-ui 1.0.33 → 1.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -36,9 +36,8 @@ __export(index_exports, {
36
36
  module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/pages/spans-list-page.tsx
39
- var import_material8 = require("@mui/material");
40
- var import_react10 = require("react");
41
- var import_react_router_dom2 = require("react-router-dom");
39
+ var import_material21 = require("@mui/material");
40
+ var import_react21 = require("react");
42
41
 
43
42
  // src/api/use-api.tsx
44
43
  var import_react = require("react");
@@ -3270,169 +3269,10 @@ var StatusMessage = ({
3270
3269
  return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(import_jsx_runtime128.Fragment, {});
3271
3270
  };
3272
3271
 
3273
- // src/context.tsx
3274
- var import_react5 = require("react");
3275
- var import_react6 = require("react");
3276
-
3277
- // src/constants/error-messages.ts
3278
- var ERROR_MESSAGES = {
3279
- APP_INSPECTOR_DISABLED: "App Inspector is currently disabled.",
3280
- APP_INSPECTOR_NOT_FOUND: "App Inspector extension not found. Please ensure App Inspector is licensed and enabled.",
3281
- CONNECTION_FAILED: "Failed to connect to LocalStack. Please ensure LocalStack is running and accessible."
3282
- };
3283
-
3284
- // src/api/client.ts
3285
- var apiLogger = createScopedLogger("API");
3286
- var makeRequest = async (options) => {
3287
- const url = getAppInspectorApiUrl(options.localstackEndpoint, options.endpoint);
3288
- try {
3289
- apiLogger.info("Making request to:", { options, url });
3290
- const headers = new Headers(options.request?.headers);
3291
- headers.set("Content-Type", "application/json");
3292
- const response = await fetch(url, {
3293
- ...options.request,
3294
- headers
3295
- });
3296
- if (!response.ok) {
3297
- if (response.status === 404) {
3298
- throw new AppInspectorNotFoundError(
3299
- ERROR_MESSAGES.APP_INSPECTOR_NOT_FOUND,
3300
- new Error(`404 from ${url}: ${response.statusText}`)
3301
- );
3302
- }
3303
- throw new Error(`API request failed: ${response.status.toString()} ${response.statusText}`);
3304
- }
3305
- return await response.json();
3306
- } catch (error) {
3307
- if (error instanceof TypeError) {
3308
- const message = error.message.toLowerCase();
3309
- const isNetworkError = message.includes("fetch") || message.includes("network") || message.includes("failed to fetch");
3310
- if (isNetworkError) {
3311
- throw new ConnectionError(ERROR_MESSAGES.CONNECTION_FAILED, error);
3312
- }
3313
- }
3314
- if (error instanceof Error) {
3315
- throw error;
3316
- }
3317
- throw new Error("Unknown error occurred");
3318
- }
3319
- };
3320
- var buildSpansEndpoint = (request) => {
3321
- if (!request) {
3322
- return API_ENDPOINTS.SPANS;
3323
- }
3324
- const queryParameters = new URLSearchParams();
3325
- if (request.limit !== void 0) {
3326
- queryParameters.set("limit", request.limit.toString());
3327
- }
3328
- if (request.pagination_token) {
3329
- queryParameters.set("pagination_token", request.pagination_token);
3330
- }
3331
- for (const [key, value] of Object.entries(request)) {
3332
- if (value !== void 0 && key !== "limit" && key !== "pagination_token" && value !== null) {
3333
- queryParameters.set(key, String(value));
3334
- }
3335
- }
3336
- const queryString = queryParameters.toString();
3337
- return queryString ? `${API_ENDPOINTS.SPANS}?${queryString}` : API_ENDPOINTS.SPANS;
3338
- };
3339
- var buildEventsEndpoint = (request) => {
3340
- if (!request) {
3341
- return API_ENDPOINTS.EVENTS;
3342
- }
3343
- const basePath = API_ENDPOINTS.EVENTS;
3344
- const queryParameters = new URLSearchParams();
3345
- if (request.limit !== void 0) {
3346
- queryParameters.set("limit", request.limit.toString());
3347
- }
3348
- if (request.pagination_token) {
3349
- queryParameters.set("pagination_token", request.pagination_token);
3350
- }
3351
- for (const [key, value] of Object.entries(request)) {
3352
- if (value !== void 0 && key !== "limit" && key !== "pagination_token" && value !== null) {
3353
- queryParameters.set(key, String(value));
3354
- }
3355
- }
3356
- const queryString = queryParameters.toString();
3357
- return queryString ? `${basePath}?${queryString}` : basePath;
3358
- };
3359
- var createApiClient = ({ localstackEndpoint }) => {
3360
- return {
3361
- deleteSpans: async (_request) => {
3362
- return makeRequest({
3363
- endpoint: API_ENDPOINTS.SPANS,
3364
- localstackEndpoint,
3365
- request: {
3366
- method: "DELETE"
3367
- }
3368
- });
3369
- },
3370
- getEvents: async (request) => {
3371
- const endpoint = buildEventsEndpoint(request);
3372
- return makeRequest({ endpoint, localstackEndpoint });
3373
- },
3374
- getIamEvents: async (request) => {
3375
- const iamEventsRequest = {
3376
- ...request,
3377
- event_type: "iam.policy_evaluation"
3378
- };
3379
- const endpoint = buildEventsEndpoint(iamEventsRequest);
3380
- return makeRequest({ endpoint, localstackEndpoint });
3381
- },
3382
- getSpans: async (request) => {
3383
- const endpoint = buildSpansEndpoint(request);
3384
- return makeRequest({ endpoint, localstackEndpoint });
3385
- },
3386
- getStatus: async () => {
3387
- return makeRequest({
3388
- endpoint: API_ENDPOINTS.STATUS,
3389
- localstackEndpoint
3390
- });
3391
- }
3392
- };
3393
- };
3394
-
3395
- // src/context.tsx
3396
- var import_jsx_runtime129 = require("react/jsx-runtime");
3397
- var AppInspectorContext = (0, import_react5.createContext)(void 0);
3398
- var useAppInspector = () => {
3399
- const context = (0, import_react5.useContext)(AppInspectorContext);
3400
- if (!context) {
3401
- throw new Error("@localstack-studio/ui: components must be used within a <AppInspectorContextProvider>");
3402
- }
3403
- return context;
3404
- };
3405
- var AppInspectorContextProvider = (props) => {
3406
- const api = (0, import_react6.useMemo)(() => {
3407
- return false ? createApiClientMock() : createApiClient({ localstackEndpoint: props.localstackEndpoint });
3408
- }, [props.localstackEndpoint]);
3409
- const resolveLink = (0, import_react6.useCallback)(
3410
- (options) => {
3411
- if (options.to === "settings") {
3412
- return `${props.routePrefix}/settings`;
3413
- }
3414
- if (options.to === "trace-graph") {
3415
- return `${props.routePrefix}/traces/${options.traceId}`;
3416
- }
3417
- return `${props.routePrefix}/spans`;
3418
- },
3419
- [props.routePrefix]
3420
- );
3421
- const contextValue = (0, import_react6.useMemo)(
3422
- () => ({
3423
- linkComponent: props.linkComponent,
3424
- localstackEndpoint: props.localstackEndpoint,
3425
- resolveLink
3426
- }),
3427
- [props.linkComponent, props.localstackEndpoint, resolveLink]
3428
- );
3429
- return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(ApiProvider, { api, children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(AppInspectorContext.Provider, { value: contextValue, children: props.children }) });
3430
- };
3431
-
3432
3272
  // src/hooks/use-local-storage.tsx
3433
- var import_react7 = require("react");
3273
+ var import_react5 = require("react");
3434
3274
  function useLocalStorage(key, initialValue) {
3435
- const [storedValue, setStoredValue] = (0, import_react7.useState)(() => {
3275
+ const [storedValue, setStoredValue] = (0, import_react5.useState)(() => {
3436
3276
  try {
3437
3277
  const item = globalThis.localStorage.getItem(key);
3438
3278
  return item ? JSON.parse(item) : initialValue;
@@ -3441,7 +3281,7 @@ function useLocalStorage(key, initialValue) {
3441
3281
  return initialValue;
3442
3282
  }
3443
3283
  });
3444
- const setValue = (0, import_react7.useCallback)((value) => {
3284
+ const setValue = (0, import_react5.useCallback)((value) => {
3445
3285
  try {
3446
3286
  setStoredValue(value);
3447
3287
  globalThis.localStorage.setItem(key, JSON.stringify(value));
@@ -3453,7 +3293,7 @@ function useLocalStorage(key, initialValue) {
3453
3293
  console.error(`Error setting localStorage key "${key}":`, error);
3454
3294
  }
3455
3295
  }, [key]);
3456
- (0, import_react7.useEffect)(() => {
3296
+ (0, import_react5.useEffect)(() => {
3457
3297
  const handleStorageChange = (event) => {
3458
3298
  if (event.key === key && event.newValue !== null) {
3459
3299
  try {
@@ -3472,15 +3312,15 @@ function useLocalStorage(key, initialValue) {
3472
3312
  }
3473
3313
 
3474
3314
  // src/hooks/use-status.tsx
3475
- var import_react8 = require("react");
3315
+ var import_react6 = require("react");
3476
3316
  var useStatus = () => {
3477
3317
  const api = useAppInspectorApi();
3478
- const [checking, setChecking] = (0, import_react8.useState)(true);
3479
- const [status, setStatus] = (0, import_react8.useState)();
3480
- const [error, setError] = (0, import_react8.useState)();
3481
- const hasFetchedReference = (0, import_react8.useRef)(false);
3482
- const abortControllerReference = (0, import_react8.useRef)(null);
3483
- const checkStatus = (0, import_react8.useCallback)(async () => {
3318
+ const [checking, setChecking] = (0, import_react6.useState)(true);
3319
+ const [status, setStatus] = (0, import_react6.useState)();
3320
+ const [error, setError] = (0, import_react6.useState)();
3321
+ const hasFetchedReference = (0, import_react6.useRef)(false);
3322
+ const abortControllerReference = (0, import_react6.useRef)(null);
3323
+ const checkStatus = (0, import_react6.useCallback)(async () => {
3484
3324
  if (abortControllerReference.current) {
3485
3325
  abortControllerReference.current.abort();
3486
3326
  }
@@ -3504,7 +3344,7 @@ var useStatus = () => {
3504
3344
  }
3505
3345
  }
3506
3346
  }, [api]);
3507
- (0, import_react8.useEffect)(() => {
3347
+ (0, import_react6.useEffect)(() => {
3508
3348
  if (!hasFetchedReference.current) {
3509
3349
  hasFetchedReference.current = true;
3510
3350
  void checkStatus();
@@ -3513,191 +3353,16 @@ var useStatus = () => {
3513
3353
  return { checking, checkStatus, error, status };
3514
3354
  };
3515
3355
 
3516
- // src/utils/use-search-param-codec.ts
3517
- var import_react9 = require("react");
3518
- var import_react_router_dom = require("react-router-dom");
3519
- var useSearchParamCodec = (key, codec) => {
3520
- const [searchParams, setSearchParams] = (0, import_react_router_dom.useSearchParams)();
3521
- const raw = searchParams.get(key) ?? void 0;
3522
- const value = (0, import_react9.useMemo)(() => {
3523
- return codec.decode(raw);
3524
- }, [raw, codec]);
3525
- const setValue = (0, import_react9.useCallback)(
3526
- (next) => {
3527
- setSearchParams((previous) => {
3528
- const nextParams = new URLSearchParams(previous);
3529
- nextParams.set(key, codec.encode(next));
3530
- return nextParams;
3531
- });
3532
- },
3533
- [key, codec, setSearchParams]
3534
- );
3535
- return [value, setValue];
3536
- };
3537
-
3538
- // src/pages/spans-list-page.tsx
3539
- var import_jsx_runtime130 = require("react/jsx-runtime");
3540
- var spansPerPageOptions = [25, 50, 100];
3541
- var SpansListPage = () => {
3542
- const api = useAppInspectorApi();
3543
- const [spans, setSpans] = (0, import_react10.useState)();
3544
- const [loading, setLoading] = (0, import_react10.useState)(false);
3545
- const hasFetched = (0, import_react10.useRef)(false);
3546
- const [filterWriteOperations, setFilterWriteOperations] = useLocalStorage("filterWriteOperations", true);
3547
- const mapPageToNextCursor = (0, import_react10.useRef)({});
3548
- const [page, setPage] = useSearchParamCodec("page", {
3549
- decode: (raw) => {
3550
- const defaultPage = 0;
3551
- if (!raw) {
3552
- return defaultPage;
3553
- }
3554
- const parsed = Number.parseInt(raw, 10);
3555
- return Number.isNaN(parsed) || parsed < 0 ? defaultPage : parsed;
3556
- },
3557
- encode: (value) => value.toString()
3558
- });
3559
- const [pageSize, setPageSize] = useSearchParamCodec("pageSize", {
3560
- decode: (raw) => {
3561
- const defaultPageSize = 100;
3562
- if (!raw) {
3563
- return defaultPageSize;
3564
- }
3565
- const parsed = Number.parseInt(raw, 10);
3566
- return spansPerPageOptions.includes(parsed) ? parsed : defaultPageSize;
3567
- },
3568
- encode: (value) => value.toString()
3569
- });
3570
- const [spanCount, setSpanCount] = (0, import_react10.useState)(0);
3571
- const queryOptions = (0, import_react10.useMemo)(() => {
3572
- return {
3573
- is_write_operation: filterWriteOperations ? true : void 0,
3574
- limit: pageSize,
3575
- pagination_token: mapPageToNextCursor.current[page - 1]
3576
- };
3577
- }, [filterWriteOperations, pageSize, page]);
3578
- const [fetchError, setFetchError] = (0, import_react10.useState)();
3579
- const { checkStatus, error: statusError, status } = useStatus();
3580
- const fetchSpans = (0, import_react10.useCallback)(async () => {
3581
- setLoading(true);
3582
- try {
3583
- const response = await api.getSpans(queryOptions);
3584
- setSpans(response.spans);
3585
- setSpanCount(response.pagination.total_count);
3586
- setFetchError(void 0);
3587
- if (response.pagination.cursor) {
3588
- mapPageToNextCursor.current[page] = response.pagination.cursor;
3589
- }
3590
- } catch (error) {
3591
- console.error(error);
3592
- setFetchError(error instanceof Error ? error : new Error("Unknown error", { cause: error }));
3593
- } finally {
3594
- setLoading(false);
3595
- }
3596
- }, [api, page, queryOptions]);
3597
- const fetchSpansSync = (0, import_react10.useCallback)(() => {
3598
- void fetchSpans();
3599
- }, [fetchSpans]);
3600
- (0, import_react10.useEffect)(() => {
3601
- if (hasFetched.current) return;
3602
- if (status?.status !== "ENABLED") return;
3603
- hasFetched.current = true;
3604
- void fetchSpans();
3605
- }, [fetchSpans, status]);
3606
- (0, import_react10.useEffect)(() => {
3607
- if (!hasFetched.current) return;
3608
- void fetchSpans();
3609
- }, [fetchSpans]);
3610
- const navigate = (0, import_react_router_dom2.useNavigate)();
3611
- const { resolveLink } = useAppInspector();
3612
- const navigateToSpan = (0, import_react10.useCallback)((span) => {
3613
- const url = resolveLink({ to: "trace-graph", traceId: span.trace_id });
3614
- const searchParams = new URLSearchParams({
3615
- page: String(page),
3616
- pageSize: String(pageSize),
3617
- spanId: span.span_id
3618
- });
3619
- navigate(`${url}?${searchParams.toString()}`);
3620
- }, [navigate, resolveLink, page, pageSize]);
3621
- const clearSpans = (0, import_react10.useCallback)(async () => {
3622
- setLoading(true);
3623
- try {
3624
- await api.deleteSpans();
3625
- setSpans([]);
3626
- setFetchError(void 0);
3627
- await fetchSpans();
3628
- } catch (error) {
3629
- console.error("Failed to delete spans:", error);
3630
- setFetchError(error instanceof Error ? error : new Error("Failed to delete spans", { cause: error }));
3631
- } finally {
3632
- setLoading(false);
3633
- }
3634
- }, [api, fetchSpans]);
3635
- const handleRetry = (0, import_react10.useCallback)(() => {
3636
- void checkStatus();
3637
- }, [checkStatus]);
3638
- const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
3639
- return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
3640
- import_material8.Box,
3641
- {
3642
- "data-testid": "spans-list-page",
3643
- sx: {
3644
- alignItems: "center",
3645
- display: "flex",
3646
- flexDirection: "column",
3647
- flexGrow: 1,
3648
- width: "100%"
3649
- },
3650
- children: shouldShowStatusMessage ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
3651
- StatusMessage,
3652
- {
3653
- error: statusError,
3654
- onRetry: handleRetry,
3655
- status
3656
- }
3657
- ) : /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
3658
- SpansList,
3659
- {
3660
- filterWriteOperations,
3661
- onClearSpans: () => {
3662
- void clearSpans();
3663
- },
3664
- onFilterWriteOperationsChange: (value) => {
3665
- setFilterWriteOperations(value);
3666
- },
3667
- onPageChange: setPage,
3668
- onPageSizeChange: setPageSize,
3669
- onRefresh: () => {
3670
- fetchSpansSync();
3671
- },
3672
- onSpanClick: (span) => {
3673
- navigateToSpan(span);
3674
- },
3675
- page,
3676
- pageSize,
3677
- spanCount,
3678
- spans: {
3679
- data: spans,
3680
- error: fetchError,
3681
- loading
3682
- },
3683
- spansPerPageOptions
3684
- }
3685
- )
3686
- }
3687
- );
3688
- };
3689
-
3690
3356
  // src/pages/trace-graph-page.tsx
3691
3357
  var import_icons_material11 = require("@mui/icons-material");
3692
- var import_material21 = require("@mui/material");
3358
+ var import_material20 = require("@mui/material");
3693
3359
  var import_styles = require("@mui/material/styles");
3694
- var import_react23 = require("@xyflow/react");
3695
- var import_react24 = require("react");
3696
- var import_react_router_dom3 = require("react-router-dom");
3360
+ var import_react19 = require("@xyflow/react");
3361
+ var import_react20 = require("react");
3697
3362
 
3698
3363
  // src/components/event-details/event-details.tsx
3699
- var import_material16 = require("@mui/material");
3700
- var import_react14 = require("react");
3364
+ var import_material15 = require("@mui/material");
3365
+ var import_react10 = require("react");
3701
3366
 
3702
3367
  // src/utils/iam-utils.ts
3703
3368
  function determinePermissionStatus(payload) {
@@ -3895,11 +3560,11 @@ var getEventGroupsByType = (events) => {
3895
3560
 
3896
3561
  // src/components/event-details/event-details-header.tsx
3897
3562
  var import_icons_material3 = require("@mui/icons-material");
3898
- var import_material9 = require("@mui/material");
3899
- var import_jsx_runtime131 = require("react/jsx-runtime");
3563
+ var import_material8 = require("@mui/material");
3564
+ var import_jsx_runtime129 = require("react/jsx-runtime");
3900
3565
  var EventDetailsHeader = ({ event, onClose }) => {
3901
- return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
3902
- import_material9.Box,
3566
+ return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
3567
+ import_material8.Box,
3903
3568
  {
3904
3569
  sx: {
3905
3570
  alignItems: "center",
@@ -3910,60 +3575,60 @@ var EventDetailsHeader = ({ event, onClose }) => {
3910
3575
  p: 2
3911
3576
  },
3912
3577
  children: [
3913
- /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_material9.Box, { children: [
3914
- /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material9.Typography, { sx: { fontWeight: 600 }, variant: "h6", children: "Event Details" }),
3915
- /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_material9.Typography, { color: "text.secondary", variant: "body2", children: [
3578
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_material8.Box, { children: [
3579
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material8.Typography, { sx: { fontWeight: 600 }, variant: "h6", children: "Event Details" }),
3580
+ /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_material8.Typography, { color: "text.secondary", variant: "body2", children: [
3916
3581
  event.service_name,
3917
3582
  " ",
3918
3583
  "-",
3919
3584
  event.operation_name
3920
3585
  ] })
3921
3586
  ] }),
3922
- onClose && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material9.IconButton, { onClick: onClose, size: "small", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_icons_material3.Close, {}) })
3587
+ onClose && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_material8.IconButton, { onClick: onClose, size: "small", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_icons_material3.Close, {}) })
3923
3588
  ]
3924
3589
  }
3925
3590
  );
3926
3591
  };
3927
3592
 
3928
3593
  // src/components/event-details/event-section.tsx
3929
- var import_material15 = require("@mui/material");
3594
+ var import_material14 = require("@mui/material");
3930
3595
 
3931
3596
  // src/components/event-details/event-detail.tsx
3932
3597
  var import_icons_material7 = require("@mui/icons-material");
3933
- var import_material13 = require("@mui/material");
3934
- var import_react12 = require("react");
3598
+ var import_material12 = require("@mui/material");
3599
+ var import_react8 = require("react");
3935
3600
 
3936
3601
  // src/components/status-icon.tsx
3937
3602
  var import_icons_material4 = require("@mui/icons-material");
3938
- var import_material10 = require("@mui/material");
3939
- var import_jsx_runtime132 = require("react/jsx-runtime");
3603
+ var import_material9 = require("@mui/material");
3604
+ var import_jsx_runtime130 = require("react/jsx-runtime");
3940
3605
  var StatusIcon = ({ errorLevel }) => {
3941
3606
  switch (errorLevel) {
3942
3607
  case EventLevel.LevelError: {
3943
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_icons_material4.Cancel, { sx: { color: "red" } });
3608
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_icons_material4.Cancel, { sx: { color: "red" } });
3944
3609
  }
3945
3610
  case EventLevel.LevelInfo: {
3946
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_icons_material4.Info, { sx: { color: "gray" } });
3611
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_icons_material4.Info, { sx: { color: "gray" } });
3947
3612
  }
3948
3613
  case EventLevel.LevelPermission: {
3949
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_icons_material4.RemoveCircle, { sx: { color: "blue" } });
3614
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_icons_material4.RemoveCircle, { sx: { color: "blue" } });
3950
3615
  }
3951
3616
  case EventLevel.LevelWarning: {
3952
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_icons_material4.Error, { sx: { color: "orange" } });
3617
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_icons_material4.Error, { sx: { color: "orange" } });
3953
3618
  }
3954
3619
  default: {
3955
- return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_icons_material4.CheckCircle, { sx: { color: "lightgray" } });
3620
+ return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_icons_material4.CheckCircle, { sx: { color: "lightgray" } });
3956
3621
  }
3957
3622
  }
3958
3623
  };
3959
3624
 
3960
3625
  // src/components/event-details/iam-event-detail.tsx
3961
3626
  var import_icons_material5 = require("@mui/icons-material");
3962
- var import_material11 = require("@mui/material");
3963
- var import_jsx_runtime133 = require("react/jsx-runtime");
3964
- var DetailRow = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material11.Grid, { container: true, spacing: 0, sx: { mb: 1 }, children: [
3965
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Grid, { item: true, sx: { pr: 1 }, xs: 3, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3966
- import_material11.Typography,
3627
+ var import_material10 = require("@mui/material");
3628
+ var import_jsx_runtime131 = require("react/jsx-runtime");
3629
+ var DetailRow = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_material10.Grid, { container: true, spacing: 0, sx: { mb: 1 }, children: [
3630
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Grid, { item: true, sx: { pr: 1 }, xs: 3, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
3631
+ import_material10.Typography,
3967
3632
  {
3968
3633
  sx: {
3969
3634
  color: "text.secondary",
@@ -3973,8 +3638,8 @@ var DetailRow = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime13
3973
3638
  children: label
3974
3639
  }
3975
3640
  ) }),
3976
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Grid, { item: true, xs: 9, children: typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3977
- import_material11.Typography,
3641
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Grid, { item: true, xs: 9, children: typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
3642
+ import_material10.Typography,
3978
3643
  {
3979
3644
  sx: {
3980
3645
  color: "text.primary",
@@ -3989,30 +3654,30 @@ var PermissionIcon = ({ status }) => {
3989
3654
  switch (status) {
3990
3655
  case "explicitly_allowed":
3991
3656
  case "implicitly_allowed": {
3992
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_icons_material5.CheckCircle, { sx: { color: "success.main", fontSize: "1rem" } });
3657
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_icons_material5.CheckCircle, { sx: { color: "success.main", fontSize: "1rem" } });
3993
3658
  }
3994
3659
  case "explicitly_denied": {
3995
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_icons_material5.Error, { sx: { color: "error.main", fontSize: "1rem" } });
3660
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_icons_material5.Error, { sx: { color: "error.main", fontSize: "1rem" } });
3996
3661
  }
3997
3662
  case "implicitly_denied": {
3998
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_icons_material5.Warning, { sx: { color: "warning.main", fontSize: "1rem" } });
3663
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_icons_material5.Warning, { sx: { color: "warning.main", fontSize: "1rem" } });
3999
3664
  }
4000
3665
  }
4001
3666
  };
4002
3667
  var IAMEventDetail = ({ event }) => {
4003
3668
  const payloadString = event.attributes?.payload;
4004
3669
  if (!payloadString) {
4005
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Typography, { sx: { fontWeight: 600 }, variant: "body2", children: "No IAM policy evaluation data available" }) });
3670
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Typography, { sx: { fontWeight: 600 }, variant: "body2", children: "No IAM policy evaluation data available" }) });
4006
3671
  }
4007
3672
  const parsedIAM = parseIAMEvent(payloadString);
4008
3673
  if (!parsedIAM) {
4009
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Typography, { sx: { fontWeight: 600 }, variant: "body2", children: "Failed to parse IAM event data" }) });
3674
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Box, { sx: { p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Typography, { sx: { fontWeight: 600 }, variant: "body2", children: "Failed to parse IAM event data" }) });
4010
3675
  }
4011
- return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material11.Box, { sx: { p: 2 }, children: [
4012
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Box, { sx: { mb: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
4013
- import_material11.Chip,
3676
+ return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_material10.Box, { sx: { p: 2 }, children: [
3677
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Box, { sx: { mb: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
3678
+ import_material10.Chip,
4014
3679
  {
4015
- icon: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(PermissionIcon, { status: parsedIAM.permission }),
3680
+ icon: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(PermissionIcon, { status: parsedIAM.permission }),
4016
3681
  label: formatPermissionStatus(parsedIAM.permission),
4017
3682
  size: "small",
4018
3683
  sx: {
@@ -4022,13 +3687,13 @@ var IAMEventDetail = ({ event }) => {
4022
3687
  variant: "outlined"
4023
3688
  }
4024
3689
  ) }),
4025
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DetailRow, { content: `${parsedIAM.service}:${parsedIAM.operation}`, label: "Operation" }),
4026
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DetailRow, { content: parsedIAM.principal, label: "Principal" }),
4027
- parsedIAM.details.actions && parsedIAM.details.actions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3690
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(DetailRow, { content: `${parsedIAM.service}:${parsedIAM.operation}`, label: "Operation" }),
3691
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(DetailRow, { content: parsedIAM.principal, label: "Principal" }),
3692
+ parsedIAM.details.actions && parsedIAM.details.actions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
4028
3693
  DetailRow,
4029
3694
  {
4030
- content: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Box, { children: parsedIAM.details.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
4031
- import_material11.Typography,
3695
+ content: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Box, { children: parsedIAM.details.actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
3696
+ import_material10.Typography,
4032
3697
  {
4033
3698
  sx: {
4034
3699
  color: "text.primary"
@@ -4041,11 +3706,11 @@ var IAMEventDetail = ({ event }) => {
4041
3706
  label: "Actions"
4042
3707
  }
4043
3708
  ),
4044
- parsedIAM.details.resources && parsedIAM.details.resources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3709
+ parsedIAM.details.resources && parsedIAM.details.resources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
4045
3710
  DetailRow,
4046
3711
  {
4047
- content: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Box, { children: parsedIAM.details.resources.map((resource) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
4048
- import_material11.Typography,
3712
+ content: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Box, { children: parsedIAM.details.resources.map((resource) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
3713
+ import_material10.Typography,
4049
3714
  {
4050
3715
  sx: {
4051
3716
  color: "text.primary",
@@ -4059,20 +3724,20 @@ var IAMEventDetail = ({ event }) => {
4059
3724
  label: "Resources"
4060
3725
  }
4061
3726
  ),
4062
- /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material11.Box, { sx: { mt: 2 }, children: [
4063
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Typography, { sx: { fontWeight: 600, mb: 1 }, variant: "caption", children: "Policy Evaluation" }),
4064
- /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material11.Grid, { container: true, spacing: 2, children: [
4065
- parsedIAM.details.explicitAllows !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Grid, { item: true, xs: 4, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material11.Box, { sx: { textAlign: "center" }, children: [
4066
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Typography, { color: "success.main", sx: { fontWeight: "bold" }, variant: "h6", children: parsedIAM.details.explicitAllows }),
4067
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Explicit Allows" })
3727
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_material10.Box, { sx: { mt: 2 }, children: [
3728
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Typography, { sx: { fontWeight: 600, mb: 1 }, variant: "caption", children: "Policy Evaluation" }),
3729
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_material10.Grid, { container: true, spacing: 2, children: [
3730
+ parsedIAM.details.explicitAllows !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Grid, { item: true, xs: 4, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_material10.Box, { sx: { textAlign: "center" }, children: [
3731
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Typography, { color: "success.main", sx: { fontWeight: "bold" }, variant: "h6", children: parsedIAM.details.explicitAllows }),
3732
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Explicit Allows" })
4068
3733
  ] }) }),
4069
- parsedIAM.details.explicitDenies !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Grid, { item: true, xs: 4, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material11.Box, { sx: { textAlign: "center" }, children: [
4070
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Typography, { color: "error.main", sx: { fontWeight: "bold" }, variant: "h6", children: parsedIAM.details.explicitDenies }),
4071
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Explicit Denies" })
3734
+ parsedIAM.details.explicitDenies !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Grid, { item: true, xs: 4, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_material10.Box, { sx: { textAlign: "center" }, children: [
3735
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Typography, { color: "error.main", sx: { fontWeight: "bold" }, variant: "h6", children: parsedIAM.details.explicitDenies }),
3736
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Explicit Denies" })
4072
3737
  ] }) }),
4073
- parsedIAM.details.implicitDenies !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Grid, { item: true, xs: 4, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material11.Box, { sx: { textAlign: "center" }, children: [
4074
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Typography, { color: "warning.main", sx: { fontWeight: "bold" }, variant: "h6", children: parsedIAM.details.implicitDenies }),
4075
- /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material11.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Implicit Denies" })
3738
+ parsedIAM.details.implicitDenies !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Grid, { item: true, xs: 4, children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_material10.Box, { sx: { textAlign: "center" }, children: [
3739
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Typography, { color: "warning.main", sx: { fontWeight: "bold" }, variant: "h6", children: parsedIAM.details.implicitDenies }),
3740
+ /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(import_material10.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Implicit Denies" })
4076
3741
  ] }) })
4077
3742
  ] })
4078
3743
  ] })
@@ -4081,9 +3746,9 @@ var IAMEventDetail = ({ event }) => {
4081
3746
 
4082
3747
  // src/components/event-details/iam-permission-detail.tsx
4083
3748
  var import_icons_material6 = require("@mui/icons-material");
4084
- var import_material12 = require("@mui/material");
4085
- var import_react11 = require("react");
4086
- var import_jsx_runtime134 = require("react/jsx-runtime");
3749
+ var import_material11 = require("@mui/material");
3750
+ var import_react7 = require("react");
3751
+ var import_jsx_runtime132 = require("react/jsx-runtime");
4087
3752
  var getChipColors = (status) => {
4088
3753
  const isAllowed = status === "explicitly_allowed" || status === "implicitly_allowed";
4089
3754
  return {
@@ -4092,8 +3757,8 @@ var getChipColors = (status) => {
4092
3757
  };
4093
3758
  };
4094
3759
  var IAMPermissionItem = ({ event }) => {
4095
- const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
4096
- const parsedData = (0, import_react11.useMemo)(() => {
3760
+ const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
3761
+ const parsedData = (0, import_react7.useMemo)(() => {
4097
3762
  const payloadString = event.attributes?.payload;
4098
3763
  if (!payloadString) {
4099
3764
  return;
@@ -4111,13 +3776,13 @@ var IAMPermissionItem = ({ event }) => {
4111
3776
  return null;
4112
3777
  }
4113
3778
  const { chipColors, parsedIAM } = parsedData;
4114
- return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_material12.Box, { sx: { mb: 1 }, children: [
4115
- /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_material12.Box, { sx: { alignItems: "center", display: "flex" }, children: [
4116
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.IconButton, { onClick: () => {
3779
+ return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_material11.Box, { sx: { mb: 1 }, children: [
3780
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_material11.Box, { sx: { alignItems: "center", display: "flex" }, children: [
3781
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_material11.IconButton, { onClick: () => {
4117
3782
  setIsOpen(!isOpen);
4118
- }, size: "small", sx: { mr: 1, p: 0 }, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_icons_material6.KeyboardArrowDown, {}) : /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_icons_material6.KeyboardArrowRight, {}) }),
4119
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
4120
- import_material12.Chip,
3783
+ }, size: "small", sx: { mr: 1, p: 0 }, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_icons_material6.KeyboardArrowDown, {}) : /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_icons_material6.KeyboardArrowRight, {}) }),
3784
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
3785
+ import_material11.Chip,
4121
3786
  {
4122
3787
  label: formatPermissionStatus(parsedIAM.permission),
4123
3788
  size: "small",
@@ -4128,19 +3793,19 @@ var IAMPermissionItem = ({ event }) => {
4128
3793
  }
4129
3794
  )
4130
3795
  ] }),
4131
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Box, { sx: { ml: 4, mt: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_material12.Box, { children: [
4132
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Principal" }),
4133
- /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Typography, { variant: "body2", children: parsedIAM.principal })
3796
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_material11.Box, { sx: { ml: 4, mt: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_material11.Box, { children: [
3797
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_material11.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Principal" }),
3798
+ /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_material11.Typography, { variant: "body2", children: parsedIAM.principal })
4134
3799
  ] }) })
4135
3800
  ] });
4136
3801
  };
4137
- var IAMPermissionDetail = ({ events }) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material12.Box, { sx: { mt: 2 }, children: events.map((event) => /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(IAMPermissionItem, { event }, `${event.span_id}-${event.event_id}`)) });
3802
+ var IAMPermissionDetail = ({ events }) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_material11.Box, { sx: { mt: 2 }, children: events.map((event) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(IAMPermissionItem, { event }, `${event.span_id}-${event.event_id}`)) });
4138
3803
 
4139
3804
  // src/components/event-details/event-detail.tsx
4140
- var import_jsx_runtime135 = require("react/jsx-runtime");
4141
- var DetailRow2 = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_material13.Grid, { container: true, spacing: 0, sx: { mb: 1 }, children: [
4142
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_material13.Grid, { item: true, sx: { pr: 1 }, xs: 3, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4143
- import_material13.Typography,
3805
+ var import_jsx_runtime133 = require("react/jsx-runtime");
3806
+ var DetailRow2 = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material12.Grid, { container: true, spacing: 0, sx: { mb: 1 }, children: [
3807
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material12.Grid, { item: true, sx: { pr: 1 }, xs: 3, children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3808
+ import_material12.Typography,
4144
3809
  {
4145
3810
  sx: {
4146
3811
  color: "text.primary",
@@ -4150,8 +3815,8 @@ var DetailRow2 = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime1
4150
3815
  children: label
4151
3816
  }
4152
3817
  ) }),
4153
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_material13.Grid, { item: true, xs: 9, children: typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4154
- import_material13.Typography,
3818
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material12.Grid, { item: true, xs: 9, children: typeof content === "string" ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3819
+ import_material12.Typography,
4155
3820
  {
4156
3821
  sx: {
4157
3822
  color: "text.primary",
@@ -4163,15 +3828,15 @@ var DetailRow2 = ({ content, label }) => /* @__PURE__ */ (0, import_jsx_runtime1
4163
3828
  ) : content })
4164
3829
  ] });
4165
3830
  var EventMessage = ({ event }) => {
4166
- const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
4167
- const [isOverflowing, setIsOverflowing] = (0, import_react12.useState)(false);
4168
- const textReference = (0, import_react12.useRef)(null);
4169
- const parsedMessage = (0, import_react12.useMemo)(() => parseEventMessage(event), [event]);
4170
- const isIAMPolicyEvent = (0, import_react12.useMemo)(
3831
+ const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
3832
+ const [isOverflowing, setIsOverflowing] = (0, import_react8.useState)(false);
3833
+ const textReference = (0, import_react8.useRef)(null);
3834
+ const parsedMessage = (0, import_react8.useMemo)(() => parseEventMessage(event), [event]);
3835
+ const isIAMPolicyEvent = (0, import_react8.useMemo)(
4171
3836
  () => event.event_type === "iam.policy_evaluation" && event.attributes?.payload && typeof event.attributes.payload === "string",
4172
3837
  [event]
4173
3838
  );
4174
- (0, import_react12.useEffect)(() => {
3839
+ (0, import_react8.useEffect)(() => {
4175
3840
  const checkOverflow = () => {
4176
3841
  const element = textReference.current;
4177
3842
  if (element) {
@@ -4184,29 +3849,29 @@ var EventMessage = ({ event }) => {
4184
3849
  window.removeEventListener("resize", checkOverflow);
4185
3850
  };
4186
3851
  }, [parsedMessage.headline]);
4187
- const hasAdditionalContent = (0, import_react12.useMemo)(
3852
+ const hasAdditionalContent = (0, import_react8.useMemo)(
4188
3853
  () => parsedMessage.message || parsedMessage.details || isIAMPolicyEvent,
4189
3854
  [parsedMessage.message, parsedMessage.details, isIAMPolicyEvent]
4190
3855
  );
4191
- const shouldShowToggle = (0, import_react12.useMemo)(
3856
+ const shouldShowToggle = (0, import_react8.useMemo)(
4192
3857
  () => isOverflowing || hasAdditionalContent,
4193
3858
  [isOverflowing, hasAdditionalContent]
4194
3859
  );
4195
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_material13.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
4196
- /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_material13.Box, { sx: { alignItems: "flex-start", display: "flex" }, children: [
4197
- Boolean(shouldShowToggle) && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4198
- import_material13.IconButton,
3860
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material12.Box, { sx: { display: "flex", flexDirection: "column" }, children: [
3861
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material12.Box, { sx: { alignItems: "flex-start", display: "flex" }, children: [
3862
+ Boolean(shouldShowToggle) && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3863
+ import_material12.IconButton,
4199
3864
  {
4200
3865
  onClick: () => {
4201
3866
  setIsOpen(!isOpen);
4202
3867
  },
4203
3868
  size: "small",
4204
3869
  sx: { mr: 1, mt: -0.5, p: 0 },
4205
- children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_icons_material7.KeyboardArrowDown, {}) : /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_icons_material7.KeyboardArrowRight, {})
3870
+ children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_icons_material7.KeyboardArrowDown, {}) : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_icons_material7.KeyboardArrowRight, {})
4206
3871
  }
4207
3872
  ),
4208
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4209
- import_material13.Typography,
3873
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3874
+ import_material12.Typography,
4210
3875
  {
4211
3876
  ref: textReference,
4212
3877
  sx: {
@@ -4223,9 +3888,9 @@ var EventMessage = ({ event }) => {
4223
3888
  }
4224
3889
  )
4225
3890
  ] }),
4226
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_material13.Box, { sx: { ml: 4, mt: 1 }, children: isIAMPolicyEvent ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(IAMEventDetail, { event }) : /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_jsx_runtime135.Fragment, { children: [
4227
- Boolean(parsedMessage.message) && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DetailRow2, { content: parsedMessage.message, label: "Message:" }),
4228
- Boolean(parsedMessage.details) && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(DetailRow2, { content: parsedMessage.details, label: "Details:" })
3891
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material12.Box, { sx: { ml: 4, mt: 1 }, children: isIAMPolicyEvent ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(IAMEventDetail, { event }) : /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [
3892
+ Boolean(parsedMessage.message) && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DetailRow2, { content: parsedMessage.message, label: "Message:" }),
3893
+ Boolean(parsedMessage.details) && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DetailRow2, { content: parsedMessage.details, label: "Details:" })
4229
3894
  ] }) })
4230
3895
  ] });
4231
3896
  };
@@ -4254,17 +3919,17 @@ var EventDetail = ({
4254
3919
  type
4255
3920
  }) => {
4256
3921
  if (type === "permission") {
4257
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_material13.Box, { children: [
4258
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4259
- import_material13.Box,
3922
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material12.Box, { children: [
3923
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3924
+ import_material12.Box,
4260
3925
  {
4261
3926
  sx: {
4262
3927
  alignItems: "left",
4263
3928
  display: "flex",
4264
3929
  mb: 1
4265
3930
  },
4266
- children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4267
- import_material13.Typography,
3931
+ children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3932
+ import_material12.Typography,
4268
3933
  {
4269
3934
  sx: {
4270
3935
  alignItems: "left",
@@ -4278,13 +3943,13 @@ var EventDetail = ({
4278
3943
  )
4279
3944
  }
4280
3945
  ),
4281
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(IAMPermissionDetail, { events })
3946
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(IAMPermissionDetail, { events })
4282
3947
  ] });
4283
3948
  }
4284
3949
  const eventLevel = getEventLevelFromGroup(type);
4285
- return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_material13.Box, { children: [
4286
- /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
4287
- import_material13.Box,
3950
+ return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_material12.Box, { children: [
3951
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
3952
+ import_material12.Box,
4288
3953
  {
4289
3954
  sx: {
4290
3955
  alignItems: "left",
@@ -4293,9 +3958,9 @@ var EventDetail = ({
4293
3958
  mb: 1
4294
3959
  },
4295
3960
  children: [
4296
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(StatusIcon, { errorLevel: eventLevel }),
4297
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4298
- import_material13.Typography,
3961
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(StatusIcon, { errorLevel: eventLevel }),
3962
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3963
+ import_material12.Typography,
4299
3964
  {
4300
3965
  sx: {
4301
3966
  alignItems: "left",
@@ -4313,14 +3978,14 @@ var EventDetail = ({
4313
3978
  ]
4314
3979
  }
4315
3980
  ),
4316
- /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_material13.Box, { sx: { mt: 2 }, children: events.map((event) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4317
- import_material13.Box,
3981
+ /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_material12.Box, { sx: { mt: 2 }, children: events.map((event) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
3982
+ import_material12.Box,
4318
3983
  {
4319
3984
  sx: {
4320
3985
  maxWidth: "100%",
4321
3986
  mb: 1
4322
3987
  },
4323
- children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(EventMessage, { event })
3988
+ children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(EventMessage, { event })
4324
3989
  },
4325
3990
  `${event.span_id}-${event.event_id}`
4326
3991
  )) })
@@ -4329,14 +3994,14 @@ var EventDetail = ({
4329
3994
 
4330
3995
  // src/components/event-details/toggle-section.tsx
4331
3996
  var import_icons_material8 = require("@mui/icons-material");
4332
- var import_material14 = require("@mui/material");
4333
- var import_react13 = require("react");
4334
- var import_jsx_runtime136 = require("react/jsx-runtime");
3997
+ var import_material13 = require("@mui/material");
3998
+ var import_react9 = require("react");
3999
+ var import_jsx_runtime134 = require("react/jsx-runtime");
4335
4000
  var ToggleSection = ({ children, headline, initialOpen = true }) => {
4336
- const [isOpen, setIsOpen] = (0, import_react13.useState)(initialOpen);
4337
- return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material14.Box, { sx: { mt: 4 }, children: [
4338
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
4339
- import_material14.Box,
4001
+ const [isOpen, setIsOpen] = (0, import_react9.useState)(initialOpen);
4002
+ return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_material13.Box, { sx: { mt: 4 }, children: [
4003
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
4004
+ import_material13.Box,
4340
4005
  {
4341
4006
  onClick: () => {
4342
4007
  setIsOpen(!isOpen);
@@ -4345,8 +4010,8 @@ var ToggleSection = ({ children, headline, initialOpen = true }) => {
4345
4010
  cursor: "pointer",
4346
4011
  mb: 1
4347
4012
  },
4348
- children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
4349
- import_material14.Box,
4013
+ children: /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
4014
+ import_material13.Box,
4350
4015
  {
4351
4016
  role: "button",
4352
4017
  sx: {
@@ -4355,24 +4020,24 @@ var ToggleSection = ({ children, headline, initialOpen = true }) => {
4355
4020
  gap: 1
4356
4021
  },
4357
4022
  children: [
4358
- /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Typography, { sx: { fontWeight: 600 }, variant: "subtitle2", children: headline }),
4359
- isOpen ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_icons_material8.KeyboardArrowDown, { sx: { color: "text.secondary", height: 20, width: 20 } }) : /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_icons_material8.KeyboardArrowRight, { sx: { color: "text.secondary", height: 20, width: 20 } })
4023
+ /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material13.Typography, { sx: { fontWeight: 600 }, variant: "subtitle2", children: headline }),
4024
+ isOpen ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_icons_material8.KeyboardArrowDown, { sx: { color: "text.secondary", height: 20, width: 20 } }) : /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_icons_material8.KeyboardArrowRight, { sx: { color: "text.secondary", height: 20, width: 20 } })
4360
4025
  ]
4361
4026
  }
4362
4027
  )
4363
4028
  }
4364
4029
  ),
4365
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material14.Box, { children })
4030
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(import_material13.Box, { children })
4366
4031
  ] });
4367
4032
  };
4368
4033
 
4369
4034
  // src/components/event-details/event-section.tsx
4370
- var import_jsx_runtime137 = require("react/jsx-runtime");
4035
+ var import_jsx_runtime135 = require("react/jsx-runtime");
4371
4036
  var EventSection = ({
4372
4037
  eventGroups,
4373
4038
  headline
4374
- }) => /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(ToggleSection, { headline, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_material15.Box, { children: [
4375
- eventGroups.errors && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
4039
+ }) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(ToggleSection, { headline, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_material14.Box, { children: [
4040
+ eventGroups.errors && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4376
4041
  EventDetail,
4377
4042
  {
4378
4043
  displayText: "Error",
@@ -4380,7 +4045,7 @@ var EventSection = ({
4380
4045
  type: "error"
4381
4046
  }
4382
4047
  ),
4383
- eventGroups.warnings && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
4048
+ eventGroups.warnings && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4384
4049
  EventDetail,
4385
4050
  {
4386
4051
  displayText: "Warning",
@@ -4388,7 +4053,7 @@ var EventSection = ({
4388
4053
  type: "warning"
4389
4054
  }
4390
4055
  ),
4391
- eventGroups.permissions && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
4056
+ eventGroups.permissions && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4392
4057
  EventDetail,
4393
4058
  {
4394
4059
  displayText: "IAM Permission",
@@ -4396,7 +4061,7 @@ var EventSection = ({
4396
4061
  type: "permission"
4397
4062
  }
4398
4063
  ),
4399
- eventGroups.info && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
4064
+ eventGroups.info && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
4400
4065
  EventDetail,
4401
4066
  {
4402
4067
  displayText: "Info",
@@ -4407,77 +4072,77 @@ var EventSection = ({
4407
4072
  ] }) });
4408
4073
 
4409
4074
  // src/components/event-details/event-details.tsx
4410
- var import_jsx_runtime138 = require("react/jsx-runtime");
4075
+ var import_jsx_runtime136 = require("react/jsx-runtime");
4411
4076
  var EventDetails = ({ onClose, selectedEvent }) => {
4412
- const attributes = (0, import_react14.useMemo)(() => {
4077
+ const attributes = (0, import_react10.useMemo)(() => {
4413
4078
  const attributes2 = Object.entries(selectedEvent?.attributes ?? {});
4414
4079
  return attributes2.filter(([key]) => key !== "localstack.aws.account_id" && key !== "localstack.aws.service");
4415
4080
  }, [selectedEvent?.attributes]);
4416
4081
  if (!selectedEvent) {
4417
- return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Box, { sx: { p: 3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { color: "text.secondary", variant: "body2", children: "Select an event to view details" }) });
4082
+ return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Box, { sx: { p: 3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { color: "text.secondary", variant: "body2", children: "Select an event to view details" }) });
4418
4083
  }
4419
- return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { "data-testid": "event-details", sx: { display: "flex", flexDirection: "column", height: "100%" }, children: [
4420
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(EventDetailsHeader, { event: selectedEvent, onClose }),
4421
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Box, { sx: { flexGrow: 1, overflow: "auto", p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Stack, { spacing: 2, children: [
4422
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(ToggleSection, { headline: "Basic Information", children: /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Stack, { spacing: 1, children: [
4423
- /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { children: [
4424
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Span ID" }),
4425
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: selectedEvent.span_id })
4084
+ return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Box, { "data-testid": "event-details", sx: { display: "flex", flexDirection: "column", height: "100%" }, children: [
4085
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(EventDetailsHeader, { event: selectedEvent, onClose }),
4086
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Box, { sx: { flexGrow: 1, overflow: "auto", p: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Stack, { spacing: 2, children: [
4087
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ToggleSection, { headline: "Basic Information", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Stack, { spacing: 1, children: [
4088
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Box, { children: [
4089
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Span ID" }),
4090
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: selectedEvent.span_id })
4426
4091
  ] }),
4427
- /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { children: [
4428
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Trace ID" }),
4429
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: selectedEvent.trace_id })
4092
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Box, { children: [
4093
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Trace ID" }),
4094
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: selectedEvent.trace_id })
4430
4095
  ] }),
4431
- /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { children: [
4432
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Operation" }),
4433
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: selectedEvent.operation_name })
4096
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Box, { children: [
4097
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Operation" }),
4098
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: selectedEvent.operation_name })
4434
4099
  ] })
4435
4100
  ] }) }),
4436
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Divider, {}),
4437
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(ToggleSection, { headline: "Service Information", children: /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Stack, { spacing: 1, children: [
4438
- /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { children: [
4439
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Service" }),
4440
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: selectedEvent.service_name })
4101
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Divider, {}),
4102
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ToggleSection, { headline: "Service Information", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Stack, { spacing: 1, children: [
4103
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Box, { children: [
4104
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Service" }),
4105
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: selectedEvent.service_name })
4441
4106
  ] }),
4442
- /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { children: [
4443
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Resource" }),
4444
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: selectedEvent.resource_name })
4107
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Box, { children: [
4108
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Resource" }),
4109
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: selectedEvent.resource_name })
4445
4110
  ] }),
4446
- Boolean(selectedEvent.region) && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { children: [
4447
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Region" }),
4448
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: selectedEvent.region })
4111
+ Boolean(selectedEvent.region) && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Box, { children: [
4112
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Region" }),
4113
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: selectedEvent.region })
4449
4114
  ] })
4450
4115
  ] }) }),
4451
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Divider, {}),
4452
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(ToggleSection, { headline: "Timing", children: /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Stack, { spacing: 1, children: [
4453
- /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { children: [
4454
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Start Time" }),
4455
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: unixNanoToDate(selectedEvent.start_time_unix_nano)?.toISOString() })
4116
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Divider, {}),
4117
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ToggleSection, { headline: "Timing", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Stack, { spacing: 1, children: [
4118
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Box, { children: [
4119
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Start Time" }),
4120
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: unixNanoToDate(selectedEvent.start_time_unix_nano)?.toISOString() })
4456
4121
  ] }),
4457
- Boolean(selectedEvent.end_time_unix_nano) && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { children: [
4458
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Duration" }),
4459
- /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Typography, { variant: "body2", children: [
4122
+ Boolean(selectedEvent.end_time_unix_nano) && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Box, { children: [
4123
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: "Duration" }),
4124
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Typography, { variant: "body2", children: [
4460
4125
  ((BigInt(selectedEvent.end_time_unix_nano) - BigInt(selectedEvent.start_time_unix_nano)) / BigInt("1000000")).toString(),
4461
4126
  " ",
4462
4127
  "ms"
4463
4128
  ] })
4464
4129
  ] })
4465
4130
  ] }) }),
4466
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Divider, {}),
4467
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(ToggleSection, { headline: "Status", children: /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Stack, { direction: "row", spacing: 1, children: [
4468
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
4469
- import_material16.Chip,
4131
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Divider, {}),
4132
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ToggleSection, { headline: "Status", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Stack, { direction: "row", spacing: 1, children: [
4133
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
4134
+ import_material15.Chip,
4470
4135
  {
4471
4136
  color: selectedEvent.status_code === 2 ? "error" : selectedEvent.status_code === 1 ? "success" : "default",
4472
4137
  label: selectedEvent.status_code === 2 ? "Error" : selectedEvent.status_code === 1 ? "OK" : "Unset",
4473
4138
  size: "small"
4474
4139
  }
4475
4140
  ),
4476
- Boolean(selectedEvent.status_message) && /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: selectedEvent.status_message })
4141
+ Boolean(selectedEvent.status_message) && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: selectedEvent.status_message })
4477
4142
  ] }) }),
4478
- selectedEvent.events.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_jsx_runtime138.Fragment, { children: [
4479
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Divider, {}),
4480
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
4143
+ selectedEvent.events.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
4144
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Divider, {}),
4145
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
4481
4146
  EventSection,
4482
4147
  {
4483
4148
  eventGroups: getEventGroupsByType(selectedEvent.events),
@@ -4485,10 +4150,10 @@ var EventDetails = ({ onClose, selectedEvent }) => {
4485
4150
  }
4486
4151
  )
4487
4152
  ] }),
4488
- attributes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_jsx_runtime138.Fragment, { children: [
4489
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Divider, {}),
4490
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(ToggleSection, { headline: "Attributes", children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Stack, { spacing: 1, children: attributes.map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material16.Box, { children: [
4491
- /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: key }),
4153
+ attributes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [
4154
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Divider, {}),
4155
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(ToggleSection, { headline: "Attributes", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Stack, { spacing: 1, children: attributes.map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_material15.Box, { children: [
4156
+ /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { sx: { fontWeight: 600 }, variant: "caption", children: key }),
4492
4157
  renderKeyValue(key, value)
4493
4158
  ] }, key)) }) })
4494
4159
  ] })
@@ -4497,46 +4162,46 @@ var EventDetails = ({ onClose, selectedEvent }) => {
4497
4162
  };
4498
4163
  function renderKeyValue(key, value) {
4499
4164
  if (typeof value === "string" && (key === "localstack.aws.service.request" || key === "localstack.aws.service.response" || key === "localstack.aws.service.exception")) {
4500
- return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Box, { sx: { backgroundColor: (theme) => theme.palette.background.default, borderRadius: 1, p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)("pre", { style: { margin: 0, overflow: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: JSON.stringify(JSON.parse(value), void 0, 2) }) }) });
4165
+ return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Box, { sx: { backgroundColor: (theme) => theme.palette.background.default, borderRadius: 1, p: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("pre", { style: { margin: 0, overflow: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: JSON.stringify(JSON.parse(value), void 0, 2) }) }) });
4501
4166
  }
4502
4167
  if (typeof value === "boolean") {
4503
- return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: value ? "yes" : "no" });
4168
+ return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: value ? "yes" : "no" });
4504
4169
  }
4505
- return /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_material16.Typography, { variant: "body2", children: value });
4170
+ return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_material15.Typography, { variant: "body2", children: value });
4506
4171
  }
4507
4172
 
4508
4173
  // src/components/trace-graph/trace-graph.tsx
4509
4174
  var import_base = require("@xyflow/react/dist/base.css");
4510
- var import_material20 = require("@mui/material");
4511
- var import_react21 = require("@xyflow/react");
4512
- var import_react22 = require("react");
4175
+ var import_material19 = require("@mui/material");
4176
+ var import_react17 = require("@xyflow/react");
4177
+ var import_react18 = require("react");
4513
4178
 
4514
4179
  // src/components/trace-graph/service-node.tsx
4515
- var import_material18 = require("@mui/material");
4180
+ var import_material17 = require("@mui/material");
4516
4181
  var import_style = require("@xyflow/react/dist/style.css");
4517
- var import_react16 = require("@xyflow/react");
4518
- var import_react17 = require("react");
4182
+ var import_react12 = require("@xyflow/react");
4183
+ var import_react13 = require("react");
4519
4184
 
4520
4185
  // src/components/trace-graph/problem-indicator.tsx
4521
4186
  var import_icons_material9 = require("@mui/icons-material");
4522
- var import_material17 = require("@mui/material");
4523
- var import_react15 = require("react");
4524
- var import_jsx_runtime139 = require("react/jsx-runtime");
4187
+ var import_material16 = require("@mui/material");
4188
+ var import_react11 = require("react");
4189
+ var import_jsx_runtime137 = require("react/jsx-runtime");
4525
4190
  var ProblemIndicator = ({ error }) => {
4526
- const icon = (0, import_react15.useMemo)(() => {
4191
+ const icon = (0, import_react11.useMemo)(() => {
4527
4192
  switch (error.level) {
4528
4193
  case "error": {
4529
- return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons_material9.Error, { sx: { color: "#d32f2f", fontSize: "14px" } });
4194
+ return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons_material9.Error, { sx: { color: "#d32f2f", fontSize: "14px" } });
4530
4195
  }
4531
4196
  case "warning": {
4532
- return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons_material9.Warning, { sx: { color: "#ff9800", fontSize: "14px" } });
4197
+ return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons_material9.Warning, { sx: { color: "#ff9800", fontSize: "14px" } });
4533
4198
  }
4534
4199
  default: {
4535
- return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons_material9.Info, { sx: { color: "#2196f3", fontSize: "14px" } });
4200
+ return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_icons_material9.Info, { sx: { color: "#2196f3", fontSize: "14px" } });
4536
4201
  }
4537
4202
  }
4538
4203
  }, [error.level]);
4539
- const color = (0, import_react15.useMemo)(() => {
4204
+ const color = (0, import_react11.useMemo)(() => {
4540
4205
  switch (error.level) {
4541
4206
  case "error": {
4542
4207
  return "#d32f2f";
@@ -4549,8 +4214,8 @@ var ProblemIndicator = ({ error }) => {
4549
4214
  }
4550
4215
  }
4551
4216
  }, [error.level]);
4552
- return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_material17.Tooltip, { arrow: true, title: error.message ?? "Issue detected", children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
4553
- import_material17.Box,
4217
+ return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_material16.Tooltip, { arrow: true, title: error.message ?? "Issue detected", children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(
4218
+ import_material16.Box,
4554
4219
  {
4555
4220
  sx: {
4556
4221
  alignItems: "center",
@@ -4569,17 +4234,17 @@ var ProblemIndicator = ({ error }) => {
4569
4234
  };
4570
4235
 
4571
4236
  // src/components/trace-graph/service-node.tsx
4572
- var import_jsx_runtime140 = require("react/jsx-runtime");
4237
+ var import_jsx_runtime138 = require("react/jsx-runtime");
4573
4238
  var handleStyle = {
4574
4239
  backgroundColor: "white",
4575
4240
  borderColor: "lightgray",
4576
4241
  opacity: 0
4577
4242
  };
4578
- var ServiceNode = (0, import_react17.memo)(({ data, selected }) => {
4243
+ var ServiceNode = (0, import_react13.memo)(({ data, selected }) => {
4579
4244
  const hasErrors = (data.event.errors && data.event.errors.length > 0) ?? false;
4580
- return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_material18.Box, { sx: { maxWidth: 200 }, children: [
4581
- /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
4582
- import_material18.Box,
4245
+ return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_material17.Box, { sx: { maxWidth: 200 }, children: [
4246
+ /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
4247
+ import_material17.Box,
4583
4248
  {
4584
4249
  role: "button",
4585
4250
  sx: {
@@ -4599,9 +4264,9 @@ var ServiceNode = (0, import_react17.memo)(({ data, selected }) => {
4599
4264
  },
4600
4265
  tabIndex: 0,
4601
4266
  children: [
4602
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_react16.Handle, { position: import_react16.Position.Left, style: handleStyle, type: "target" }),
4603
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_react16.Handle, { position: import_react16.Position.Right, style: handleStyle, type: "source" }),
4604
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
4267
+ /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_react12.Handle, { position: import_react12.Position.Left, style: handleStyle, type: "target" }),
4268
+ /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(import_react12.Handle, { position: import_react12.Position.Right, style: handleStyle, type: "source" }),
4269
+ /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
4605
4270
  ServiceCell,
4606
4271
  {
4607
4272
  height: "32px",
@@ -4614,8 +4279,8 @@ var ServiceNode = (0, import_react17.memo)(({ data, selected }) => {
4614
4279
  ]
4615
4280
  }
4616
4281
  ),
4617
- /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
4618
- import_material18.Stack,
4282
+ /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(
4283
+ import_material17.Stack,
4619
4284
  {
4620
4285
  alignItems: "center",
4621
4286
  direction: "row",
@@ -4625,8 +4290,8 @@ var ServiceNode = (0, import_react17.memo)(({ data, selected }) => {
4625
4290
  mt: 0.5
4626
4291
  },
4627
4292
  children: [
4628
- hasErrors && /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
4629
- import_material18.Stack,
4293
+ hasErrors && /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
4294
+ import_material17.Stack,
4630
4295
  {
4631
4296
  direction: "row",
4632
4297
  spacing: 0.5,
@@ -4634,11 +4299,11 @@ var ServiceNode = (0, import_react17.memo)(({ data, selected }) => {
4634
4299
  flexWrap: "wrap",
4635
4300
  gap: "2px"
4636
4301
  },
4637
- children: data.event.errors?.map((error) => /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(ProblemIndicator, { error }, error.span_id))
4302
+ children: data.event.errors?.map((error) => /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(ProblemIndicator, { error }, error.span_id))
4638
4303
  }
4639
4304
  ),
4640
- /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
4641
- import_material18.Typography,
4305
+ /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
4306
+ import_material17.Typography,
4642
4307
  {
4643
4308
  sx: {
4644
4309
  fontSize: "0.9rem",
@@ -4660,7 +4325,7 @@ var ServiceNode = (0, import_react17.memo)(({ data, selected }) => {
4660
4325
 
4661
4326
  // src/components/trace-graph/utils.ts
4662
4327
  var import_dagre = __toESM(require("@dagrejs/dagre"), 1);
4663
- var import_react18 = require("@xyflow/react");
4328
+ var import_react14 = require("@xyflow/react");
4664
4329
  var generateNodesAndEdges = (event, parentId) => {
4665
4330
  const nodes = [];
4666
4331
  const edges = [];
@@ -4676,8 +4341,8 @@ var generateNodesAndEdges = (event, parentId) => {
4676
4341
  id: event.span_id,
4677
4342
  position: { x: 0, y: 0 },
4678
4343
  // Will be set by layout
4679
- sourcePosition: import_react18.Position.Right,
4680
- targetPosition: import_react18.Position.Left,
4344
+ sourcePosition: import_react14.Position.Right,
4345
+ targetPosition: import_react14.Position.Left,
4681
4346
  type: "service"
4682
4347
  });
4683
4348
  if (parentId) {
@@ -4687,7 +4352,7 @@ var generateNodesAndEdges = (event, parentId) => {
4687
4352
  markerEnd: {
4688
4353
  color: "lightgray",
4689
4354
  height: 16,
4690
- type: import_react18.MarkerType.Arrow,
4355
+ type: import_react14.MarkerType.Arrow,
4691
4356
  width: 16
4692
4357
  },
4693
4358
  source: parentId,
@@ -4754,9 +4419,9 @@ var calculateCenterX = (focusNodeX, viewPortPixelWidth, minX, maxX) => {
4754
4419
 
4755
4420
  // src/components/trace-graph/xyflow/controls.tsx
4756
4421
  var import_icons_material10 = require("@mui/icons-material");
4757
- var import_material19 = require("@mui/material");
4758
- var import_react19 = require("@xyflow/react");
4759
- var import_react20 = require("react");
4422
+ var import_material18 = require("@mui/material");
4423
+ var import_react15 = require("@xyflow/react");
4424
+ var import_react16 = require("react");
4760
4425
 
4761
4426
  // node_modules/zustand/esm/shallow.mjs
4762
4427
  function shallow$1(objA, objB) {
@@ -4797,15 +4462,15 @@ function shallow$1(objA, objB) {
4797
4462
  }
4798
4463
 
4799
4464
  // src/components/trace-graph/xyflow/controls.tsx
4800
- var import_jsx_runtime141 = require("react/jsx-runtime");
4465
+ var import_jsx_runtime139 = require("react/jsx-runtime");
4801
4466
  var selector = (s) => ({
4802
4467
  isInteractive: s.nodesDraggable || s.nodesConnectable || s.elementsSelectable,
4803
4468
  maxZoomReached: s.transform[2] >= s.maxZoom,
4804
4469
  minZoomReached: s.transform[2] <= s.minZoom
4805
4470
  });
4806
- var Controls = (0, import_react20.memo)(() => {
4807
- const { maxZoomReached, minZoomReached } = (0, import_react19.useStore)(selector, shallow$1);
4808
- const { fitView, zoomIn, zoomOut } = (0, import_react19.useReactFlow)();
4471
+ var Controls = (0, import_react16.memo)(() => {
4472
+ const { maxZoomReached, minZoomReached } = (0, import_react15.useStore)(selector, shallow$1);
4473
+ const { fitView, zoomIn, zoomOut } = (0, import_react15.useReactFlow)();
4809
4474
  const onZoomInHandler = () => {
4810
4475
  void zoomIn();
4811
4476
  };
@@ -4815,8 +4480,8 @@ var Controls = (0, import_react20.memo)(() => {
4815
4480
  const onFitViewHandler = () => {
4816
4481
  void fitView();
4817
4482
  };
4818
- return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
4819
- import_material19.Box,
4483
+ return /* @__PURE__ */ (0, import_jsx_runtime139.jsxs)(
4484
+ import_material18.Box,
4820
4485
  {
4821
4486
  sx: {
4822
4487
  bottom: 0,
@@ -4829,33 +4494,33 @@ var Controls = (0, import_react20.memo)(() => {
4829
4494
  zIndex: 5
4830
4495
  },
4831
4496
  children: [
4832
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
4833
- import_material19.IconButton,
4497
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
4498
+ import_material18.IconButton,
4834
4499
  {
4835
4500
  className: "react-flow__controls-zoomin",
4836
4501
  disabled: maxZoomReached,
4837
4502
  onClick: onZoomInHandler,
4838
4503
  size: "small",
4839
- children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_icons_material10.Add, {})
4504
+ children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons_material10.Add, {})
4840
4505
  }
4841
4506
  ),
4842
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
4843
- import_material19.IconButton,
4507
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
4508
+ import_material18.IconButton,
4844
4509
  {
4845
4510
  className: "react-flow__controls-zoomout",
4846
4511
  disabled: minZoomReached,
4847
4512
  onClick: onZoomOutHandler,
4848
4513
  size: "small",
4849
- children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_icons_material10.Remove, {})
4514
+ children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons_material10.Remove, {})
4850
4515
  }
4851
4516
  ),
4852
- /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
4853
- import_material19.IconButton,
4517
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(
4518
+ import_material18.IconButton,
4854
4519
  {
4855
4520
  className: "react-flow__controls-fitview",
4856
4521
  onClick: onFitViewHandler,
4857
4522
  size: "small",
4858
- children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_icons_material10.FitScreen, {})
4523
+ children: /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(import_icons_material10.FitScreen, {})
4859
4524
  }
4860
4525
  )
4861
4526
  ]
@@ -4864,7 +4529,7 @@ var Controls = (0, import_react20.memo)(() => {
4864
4529
  });
4865
4530
 
4866
4531
  // src/components/trace-graph/trace-graph.tsx
4867
- var import_jsx_runtime142 = require("react/jsx-runtime");
4532
+ var import_jsx_runtime140 = require("react/jsx-runtime");
4868
4533
  var nodeTypes = {
4869
4534
  service: ServiceNode
4870
4535
  };
@@ -4875,17 +4540,11 @@ var TraceGraph = ({
4875
4540
  spans,
4876
4541
  viewPortPixelWidth
4877
4542
  }) => {
4878
- const [nodes, setNodes] = (0, import_react22.useState)([]);
4879
- const [edges, setEdges] = (0, import_react22.useState)([]);
4880
- const [initialViewSet, setInitialViewSet] = (0, import_react22.useState)(false);
4881
- const { fitView, setCenter } = (0, import_react21.useReactFlow)();
4882
- const updateSelectedNode = (0, import_react22.useCallback)((nodeId) => {
4883
- const toSelect = new Set(nodeId ? [nodeId] : []);
4884
- setNodes((previousNodes) => {
4885
- return previousNodes.map((node) => ({ ...node, selected: toSelect.has(node.id) }));
4886
- });
4887
- }, []);
4888
- (0, import_react22.useEffect)(() => {
4543
+ const [nodes, setNodes, onNodesChange] = (0, import_react17.useNodesState)([]);
4544
+ const [edges, setEdges] = (0, import_react18.useState)([]);
4545
+ const [initialViewSet, setInitialViewSet] = (0, import_react18.useState)(false);
4546
+ const { fitView, setCenter } = (0, import_react17.useReactFlow)();
4547
+ (0, import_react18.useEffect)(() => {
4889
4548
  const spansMap = /* @__PURE__ */ new Map();
4890
4549
  const rootSpans = [];
4891
4550
  for (const span of spans.data ?? []) {
@@ -4919,8 +4578,8 @@ var TraceGraph = ({
4919
4578
  }
4920
4579
  setNodes(layoutedNodes);
4921
4580
  setEdges(layoutedEdges);
4922
- }, [spans.data, initialFocusEventId]);
4923
- (0, import_react22.useEffect)(() => {
4581
+ }, [spans.data, initialFocusEventId, setNodes]);
4582
+ (0, import_react18.useEffect)(() => {
4924
4583
  const shouldSetInitialView = !spans.loading && nodes.length > 0 && !initialViewSet;
4925
4584
  if (shouldSetInitialView) {
4926
4585
  if (initialFocusEventId) {
@@ -4940,21 +4599,12 @@ var TraceGraph = ({
4940
4599
  setInitialViewSet(true);
4941
4600
  }
4942
4601
  }, [spans.loading, nodes, initialFocusEventId, viewPortPixelWidth, setCenter, fitView, onEventSelect, initialViewSet]);
4943
- (0, import_react22.useEffect)(() => {
4944
- if (initialFocusEventId) {
4945
- updateSelectedNode(initialFocusEventId);
4946
- }
4947
- }, [initialFocusEventId, updateSelectedNode]);
4948
- const onNodeClick = (0, import_react22.useCallback)((_event, node) => {
4949
- onEventSelect(node.data.event);
4950
- updateSelectedNode(node.id);
4951
- }, [onEventSelect, updateSelectedNode]);
4952
- const theme = (0, import_material20.useTheme)();
4953
- return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
4954
- spans.error && /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
4955
- import_material20.Alert,
4602
+ const theme = (0, import_material19.useTheme)();
4603
+ return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [
4604
+ spans.error && /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
4605
+ import_material19.Alert,
4956
4606
  {
4957
- action: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_material20.Button, { onClick: () => {
4607
+ action: /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(import_material19.Button, { onClick: () => {
4958
4608
  onRefresh();
4959
4609
  }, children: "Retry" }),
4960
4610
  severity: "error",
@@ -4965,8 +4615,8 @@ var TraceGraph = ({
4965
4615
  ]
4966
4616
  }
4967
4617
  ),
4968
- /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(
4969
- import_react21.ReactFlow,
4618
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(
4619
+ import_react17.ReactFlow,
4970
4620
  {
4971
4621
  "data-testid": "trace-graph",
4972
4622
  defaultViewport: { x: 0, y: 0, zoom: 1 },
@@ -4976,12 +4626,15 @@ var TraceGraph = ({
4976
4626
  minZoom: 0.1,
4977
4627
  nodes,
4978
4628
  nodeTypes,
4979
- onNodeClick,
4629
+ onNodeClick: (_event, node) => {
4630
+ onEventSelect(node.data.event);
4631
+ },
4632
+ onNodesChange,
4980
4633
  selectNodesOnDrag: false,
4981
4634
  children: [
4982
- /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(Controls, {}),
4983
- /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
4984
- import_react21.Background,
4635
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(Controls, {}),
4636
+ /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(
4637
+ import_react17.Background,
4985
4638
  {
4986
4639
  bgColor: theme.palette.background.paper,
4987
4640
  color: theme.palette.text.disabled
@@ -4994,7 +4647,7 @@ var TraceGraph = ({
4994
4647
  };
4995
4648
 
4996
4649
  // src/pages/trace-graph-page.tsx
4997
- var import_jsx_runtime143 = require("react/jsx-runtime");
4650
+ var import_jsx_runtime141 = require("react/jsx-runtime");
4998
4651
  var HEADER_HEIGHT = 56;
4999
4652
  var DRAWER_WIDTH = "35%";
5000
4653
  var Main = (0, import_styles.styled)("main", { shouldForwardProp: (property) => property !== "open" })(({ open, theme }) => ({
@@ -5012,7 +4665,7 @@ var Main = (0, import_styles.styled)("main", { shouldForwardProp: (property) =>
5012
4665
  })
5013
4666
  }
5014
4667
  }));
5015
- var StyledDrawer = (0, import_styles.styled)(import_material21.Drawer)(() => ({
4668
+ var StyledDrawer = (0, import_styles.styled)(import_material20.Drawer)(() => ({
5016
4669
  "& .MuiDrawer-paper": {
5017
4670
  bottom: 0,
5018
4671
  boxSizing: "border-box",
@@ -5043,8 +4696,8 @@ var TraceGraphView = ({
5043
4696
  viewPortPixelWidth
5044
4697
  }) => {
5045
4698
  const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
5046
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(
5047
- import_material21.Box,
4699
+ return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
4700
+ import_material20.Box,
5048
4701
  {
5049
4702
  "data-testid": "trace-graph-page",
5050
4703
  sx: {
@@ -5056,14 +4709,14 @@ var TraceGraphView = ({
5056
4709
  overflow: "hidden"
5057
4710
  },
5058
4711
  children: [
5059
- /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(import_material21.Box, { sx: { display: "flex", width: "100%" }, children: [
5060
- /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_material21.Button, { onClick: () => {
4712
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_material20.Box, { sx: { display: "flex", width: "100%" }, children: [
4713
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_material20.Button, { onClick: () => {
5061
4714
  navigateToSpansList();
5062
- }, startIcon: /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_icons_material11.ArrowBack, {}), children: "Go back" }),
5063
- /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_material21.Box, { sx: { flexGrow: 1 } })
4715
+ }, startIcon: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_icons_material11.ArrowBack, {}), children: "Go back" }),
4716
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_material20.Box, { sx: { flexGrow: 1 } })
5064
4717
  ] }),
5065
- /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
5066
- import_material21.Paper,
4718
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
4719
+ import_material20.Paper,
5067
4720
  {
5068
4721
  sx: {
5069
4722
  display: "flex",
@@ -5072,22 +4725,22 @@ var TraceGraphView = ({
5072
4725
  position: "relative",
5073
4726
  width: "100%"
5074
4727
  },
5075
- children: shouldShowStatusMessage ? /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
4728
+ children: shouldShowStatusMessage ? /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
5076
4729
  StatusMessage,
5077
4730
  {
5078
4731
  error: statusError,
5079
4732
  onRetry: handleRetry,
5080
4733
  status
5081
4734
  }
5082
- ) : /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)(import_jsx_runtime143.Fragment, { children: [
5083
- /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(Main, { open, children: /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
5084
- import_material21.Box,
4735
+ ) : /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_jsx_runtime141.Fragment, { children: [
4736
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Main, { open, children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
4737
+ import_material20.Box,
5085
4738
  {
5086
4739
  sx: {
5087
4740
  height: "100%",
5088
4741
  overflow: "auto"
5089
4742
  },
5090
- children: traceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(import_react23.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
4743
+ children: traceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(import_react19.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
5091
4744
  TraceGraph,
5092
4745
  {
5093
4746
  initialFocusEventId: spanId,
@@ -5105,7 +4758,7 @@ var TraceGraphView = ({
5105
4758
  ) })
5106
4759
  }
5107
4760
  ) }),
5108
- /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(StyledDrawer, { anchor: "right", open, variant: "persistent", children: /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(EventDetails, { onClose: handleClose, selectedEvent }) })
4761
+ /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(StyledDrawer, { anchor: "right", open, variant: "persistent", children: /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(EventDetails, { onClose: handleClose, selectedEvent }) })
5109
4762
  ] })
5110
4763
  }
5111
4764
  )
@@ -5113,15 +4766,12 @@ var TraceGraphView = ({
5113
4766
  }
5114
4767
  );
5115
4768
  };
5116
- var TraceGraphPage = () => {
5117
- const { traceId } = (0, import_react_router_dom3.useParams)();
5118
- const [searchParameters] = (0, import_react_router_dom3.useSearchParams)();
5119
- const spanId = searchParameters.get("spanId");
4769
+ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
5120
4770
  const api = useAppInspectorApi();
5121
- const [spans, setSpans] = (0, import_react24.useState)();
5122
- const [loading, setLoading] = (0, import_react24.useState)(false);
5123
- const [fetchError, setFetchError] = (0, import_react24.useState)();
5124
- const fetchSpans = (0, import_react24.useCallback)(async () => {
4771
+ const [spans, setSpans] = (0, import_react20.useState)();
4772
+ const [loading, setLoading] = (0, import_react20.useState)(false);
4773
+ const [fetchError, setFetchError] = (0, import_react20.useState)();
4774
+ const fetchSpans = (0, import_react20.useCallback)(async () => {
5125
4775
  setLoading(true);
5126
4776
  try {
5127
4777
  const response = await api.getSpans({
@@ -5136,14 +4786,14 @@ var TraceGraphPage = () => {
5136
4786
  setLoading(false);
5137
4787
  }
5138
4788
  }, [api, traceId]);
5139
- (0, import_react24.useEffect)(() => {
4789
+ (0, import_react20.useEffect)(() => {
5140
4790
  void fetchSpans();
5141
4791
  }, [fetchSpans]);
5142
- const [open, setOpen] = (0, import_react24.useState)(true);
5143
- const [selectedEvent, setSelectedEvent] = (0, import_react24.useState)();
5144
- const [viewPortPixelWidth, setViewPortPixelWidth] = (0, import_react24.useState)(0);
4792
+ const [open, setOpen] = (0, import_react20.useState)(true);
4793
+ const [selectedEvent, setSelectedEvent] = (0, import_react20.useState)();
4794
+ const [viewPortPixelWidth, setViewPortPixelWidth] = (0, import_react20.useState)(0);
5145
4795
  const { checkStatus, error: statusError, status } = useStatus();
5146
- const calculateDrawerWidth = (0, import_react24.useCallback)(() => {
4796
+ const calculateDrawerWidth = (0, import_react20.useCallback)(() => {
5147
4797
  const percentageMatch = /(\d+)%/.exec(DRAWER_WIDTH);
5148
4798
  if (percentageMatch && open) {
5149
4799
  const percentage = Number.parseInt(percentageMatch[1], 10);
@@ -5151,7 +4801,7 @@ var TraceGraphPage = () => {
5151
4801
  }
5152
4802
  return 0;
5153
4803
  }, [open]);
5154
- (0, import_react24.useEffect)(() => {
4804
+ (0, import_react20.useEffect)(() => {
5155
4805
  const updateViewportWidth = () => {
5156
4806
  const totalWidth = window.innerWidth;
5157
4807
  const drawerPixelWidth = open ? calculateDrawerWidth() : 0;
@@ -5165,24 +4815,17 @@ var TraceGraphPage = () => {
5165
4815
  clearTimeout(timeoutId);
5166
4816
  };
5167
4817
  }, [open, calculateDrawerWidth]);
5168
- const handleEventSelect = (0, import_react24.useCallback)((event) => {
4818
+ const handleEventSelect = (0, import_react20.useCallback)((event) => {
5169
4819
  setSelectedEvent(event);
5170
4820
  setOpen(true);
5171
4821
  }, []);
5172
- const handleRetry = (0, import_react24.useCallback)(() => {
4822
+ const handleRetry = (0, import_react20.useCallback)(() => {
5173
4823
  void checkStatus();
5174
4824
  }, [checkStatus]);
5175
- const navigate = (0, import_react_router_dom3.useNavigate)();
5176
- const { resolveLink } = useAppInspector();
5177
- const navigateToSpansList = (0, import_react24.useCallback)(() => {
5178
- const url = resolveLink({ to: "spans-list" });
5179
- const searchParams = new URLSearchParams({
5180
- page: searchParameters.get("page") ?? "",
5181
- pageSize: searchParameters.get("pageSize") ?? ""
5182
- });
5183
- navigate(`${url}?${searchParams.toString()}`);
5184
- }, [navigate, resolveLink, searchParameters]);
5185
- return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(
4825
+ const navigateToSpansList = (0, import_react20.useCallback)(() => {
4826
+ onClose?.();
4827
+ }, [onClose]);
4828
+ return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
5186
4829
  TraceGraphView,
5187
4830
  {
5188
4831
  fetchError,
@@ -5206,16 +4849,302 @@ var TraceGraphPage = () => {
5206
4849
  );
5207
4850
  };
5208
4851
 
4852
+ // src/pages/spans-list-page.tsx
4853
+ var import_jsx_runtime142 = require("react/jsx-runtime");
4854
+ var spansPerPageOptions = [25, 50, 100];
4855
+ var SpansListPage = () => {
4856
+ const api = useAppInspectorApi();
4857
+ const [spans, setSpans] = (0, import_react21.useState)();
4858
+ const [loading, setLoading] = (0, import_react21.useState)(false);
4859
+ const hasFetched = (0, import_react21.useRef)(false);
4860
+ const [filterWriteOperations, setFilterWriteOperations] = useLocalStorage("filterWriteOperations", true);
4861
+ const mapPageToNextCursor = (0, import_react21.useRef)({});
4862
+ const [page, setPage] = (0, import_react21.useState)(0);
4863
+ const [pageSize, setPageSize] = (0, import_react21.useState)(100);
4864
+ const [spanCount, setSpanCount] = (0, import_react21.useState)(0);
4865
+ const queryOptions = (0, import_react21.useMemo)(() => {
4866
+ return {
4867
+ is_write_operation: filterWriteOperations ? true : void 0,
4868
+ limit: pageSize,
4869
+ pagination_token: mapPageToNextCursor.current[page - 1]
4870
+ };
4871
+ }, [filterWriteOperations, pageSize, page]);
4872
+ const [fetchError, setFetchError] = (0, import_react21.useState)();
4873
+ const { checkStatus, error: statusError, status } = useStatus();
4874
+ const fetchSpans = (0, import_react21.useCallback)(async () => {
4875
+ setLoading(true);
4876
+ try {
4877
+ const response = await api.getSpans(queryOptions);
4878
+ setSpans(response.spans);
4879
+ setSpanCount(response.pagination.total_count);
4880
+ setFetchError(void 0);
4881
+ if (response.pagination.cursor) {
4882
+ mapPageToNextCursor.current[page] = response.pagination.cursor;
4883
+ }
4884
+ } catch (error) {
4885
+ console.error(error);
4886
+ setFetchError(error instanceof Error ? error : new Error("Unknown error", { cause: error }));
4887
+ } finally {
4888
+ setLoading(false);
4889
+ }
4890
+ }, [api, page, queryOptions]);
4891
+ const fetchSpansSync = (0, import_react21.useCallback)(() => {
4892
+ void fetchSpans();
4893
+ }, [fetchSpans]);
4894
+ (0, import_react21.useEffect)(() => {
4895
+ if (hasFetched.current) return;
4896
+ if (status?.status !== "ENABLED") return;
4897
+ hasFetched.current = true;
4898
+ void fetchSpans();
4899
+ }, [fetchSpans, status]);
4900
+ (0, import_react21.useEffect)(() => {
4901
+ if (!hasFetched.current) return;
4902
+ void fetchSpans();
4903
+ }, [fetchSpans]);
4904
+ const [selectedTraceId, setSelectedTraceId] = (0, import_react21.useState)();
4905
+ const [selectedSpanId, setSelectedSpanId] = (0, import_react21.useState)();
4906
+ const navigateToSpan = (0, import_react21.useCallback)((span) => {
4907
+ setSelectedTraceId(span.trace_id);
4908
+ setSelectedSpanId(span.span_id);
4909
+ }, []);
4910
+ const clearSpans = (0, import_react21.useCallback)(async () => {
4911
+ setLoading(true);
4912
+ try {
4913
+ await api.deleteSpans();
4914
+ setSpans([]);
4915
+ setFetchError(void 0);
4916
+ await fetchSpans();
4917
+ } catch (error) {
4918
+ console.error("Failed to delete spans:", error);
4919
+ setFetchError(error instanceof Error ? error : new Error("Failed to delete spans", { cause: error }));
4920
+ } finally {
4921
+ setLoading(false);
4922
+ }
4923
+ }, [api, fetchSpans]);
4924
+ const handleRetry = (0, import_react21.useCallback)(() => {
4925
+ void checkStatus();
4926
+ }, [checkStatus]);
4927
+ const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
4928
+ return /* @__PURE__ */ (0, import_jsx_runtime142.jsxs)(import_jsx_runtime142.Fragment, { children: [
4929
+ /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
4930
+ import_material21.Box,
4931
+ {
4932
+ "data-testid": "spans-list-page",
4933
+ sx: {
4934
+ alignItems: "center",
4935
+ display: "flex",
4936
+ flexDirection: "column",
4937
+ // Do not consume vertical space if trace graph is open
4938
+ flexGrow: selectedTraceId ? 0 : 1,
4939
+ height: selectedTraceId ? 0 : void 0,
4940
+ // Do not show if trace graph is open
4941
+ visibility: selectedTraceId ? "hidden" : "visible",
4942
+ width: "100%"
4943
+ },
4944
+ children: shouldShowStatusMessage ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
4945
+ StatusMessage,
4946
+ {
4947
+ error: statusError,
4948
+ onRetry: handleRetry,
4949
+ status
4950
+ }
4951
+ ) : /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
4952
+ SpansList,
4953
+ {
4954
+ filterWriteOperations,
4955
+ onClearSpans: () => {
4956
+ void clearSpans();
4957
+ },
4958
+ onFilterWriteOperationsChange: (value) => {
4959
+ setFilterWriteOperations(value);
4960
+ },
4961
+ onPageChange: setPage,
4962
+ onPageSizeChange: setPageSize,
4963
+ onRefresh: () => {
4964
+ fetchSpansSync();
4965
+ },
4966
+ onSpanClick: (span) => {
4967
+ navigateToSpan(span);
4968
+ },
4969
+ page,
4970
+ pageSize,
4971
+ spanCount,
4972
+ spans: {
4973
+ data: spans,
4974
+ error: fetchError,
4975
+ loading
4976
+ },
4977
+ spansPerPageOptions
4978
+ }
4979
+ )
4980
+ }
4981
+ ),
4982
+ selectedTraceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(TraceGraphPage, { onClose: () => {
4983
+ setSelectedTraceId(void 0);
4984
+ }, spanId: selectedSpanId, traceId: selectedTraceId })
4985
+ ] });
4986
+ };
4987
+
5209
4988
  // src/routes.ts
5210
4989
  var routes = {
5211
- APP_INSPECTOR_SPANS_LIST: "spans",
5212
- APP_INSPECTOR_TRACE_GRAPH: "traces/:traceId"
4990
+ APP_INSPECTOR_SPANS_LIST: "spans"
4991
+ };
4992
+
4993
+ // src/context.tsx
4994
+ var import_react22 = require("react");
4995
+ var import_react23 = require("react");
4996
+
4997
+ // src/constants/error-messages.ts
4998
+ var ERROR_MESSAGES = {
4999
+ APP_INSPECTOR_DISABLED: "App Inspector is currently disabled.",
5000
+ APP_INSPECTOR_NOT_FOUND: "App Inspector extension not found. Please ensure App Inspector is licensed and enabled.",
5001
+ CONNECTION_FAILED: "Failed to connect to LocalStack. Please ensure LocalStack is running and accessible."
5002
+ };
5003
+
5004
+ // src/api/client.ts
5005
+ var apiLogger = createScopedLogger("API");
5006
+ var makeRequest = async (options) => {
5007
+ const url = getAppInspectorApiUrl(options.localstackEndpoint, options.endpoint);
5008
+ try {
5009
+ apiLogger.info("Making request to:", { options, url });
5010
+ const headers = new Headers(options.request?.headers);
5011
+ headers.set("Content-Type", "application/json");
5012
+ const response = await fetch(url, {
5013
+ ...options.request,
5014
+ headers
5015
+ });
5016
+ if (!response.ok) {
5017
+ if (response.status === 404) {
5018
+ throw new AppInspectorNotFoundError(
5019
+ ERROR_MESSAGES.APP_INSPECTOR_NOT_FOUND,
5020
+ new Error(`404 from ${url}: ${response.statusText}`)
5021
+ );
5022
+ }
5023
+ throw new Error(`API request failed: ${response.status.toString()} ${response.statusText}`);
5024
+ }
5025
+ return await response.json();
5026
+ } catch (error) {
5027
+ if (error instanceof TypeError) {
5028
+ const message = error.message.toLowerCase();
5029
+ const isNetworkError = message.includes("fetch") || message.includes("network") || message.includes("failed to fetch");
5030
+ if (isNetworkError) {
5031
+ throw new ConnectionError(ERROR_MESSAGES.CONNECTION_FAILED, error);
5032
+ }
5033
+ }
5034
+ if (error instanceof Error) {
5035
+ throw error;
5036
+ }
5037
+ throw new Error("Unknown error occurred");
5038
+ }
5039
+ };
5040
+ var buildSpansEndpoint = (request) => {
5041
+ if (!request) {
5042
+ return API_ENDPOINTS.SPANS;
5043
+ }
5044
+ const queryParameters = new URLSearchParams();
5045
+ if (request.limit !== void 0) {
5046
+ queryParameters.set("limit", request.limit.toString());
5047
+ }
5048
+ if (request.pagination_token) {
5049
+ queryParameters.set("pagination_token", request.pagination_token);
5050
+ }
5051
+ for (const [key, value] of Object.entries(request)) {
5052
+ if (value !== void 0 && key !== "limit" && key !== "pagination_token" && value !== null) {
5053
+ queryParameters.set(key, String(value));
5054
+ }
5055
+ }
5056
+ const queryString = queryParameters.toString();
5057
+ return queryString ? `${API_ENDPOINTS.SPANS}?${queryString}` : API_ENDPOINTS.SPANS;
5058
+ };
5059
+ var buildEventsEndpoint = (request) => {
5060
+ if (!request) {
5061
+ return API_ENDPOINTS.EVENTS;
5062
+ }
5063
+ const basePath = API_ENDPOINTS.EVENTS;
5064
+ const queryParameters = new URLSearchParams();
5065
+ if (request.limit !== void 0) {
5066
+ queryParameters.set("limit", request.limit.toString());
5067
+ }
5068
+ if (request.pagination_token) {
5069
+ queryParameters.set("pagination_token", request.pagination_token);
5070
+ }
5071
+ for (const [key, value] of Object.entries(request)) {
5072
+ if (value !== void 0 && key !== "limit" && key !== "pagination_token" && value !== null) {
5073
+ queryParameters.set(key, String(value));
5074
+ }
5075
+ }
5076
+ const queryString = queryParameters.toString();
5077
+ return queryString ? `${basePath}?${queryString}` : basePath;
5078
+ };
5079
+ var createApiClient = ({ localstackEndpoint }) => {
5080
+ return {
5081
+ deleteSpans: async (_request) => {
5082
+ return makeRequest({
5083
+ endpoint: API_ENDPOINTS.SPANS,
5084
+ localstackEndpoint,
5085
+ request: {
5086
+ method: "DELETE"
5087
+ }
5088
+ });
5089
+ },
5090
+ getEvents: async (request) => {
5091
+ const endpoint = buildEventsEndpoint(request);
5092
+ return makeRequest({ endpoint, localstackEndpoint });
5093
+ },
5094
+ getIamEvents: async (request) => {
5095
+ const iamEventsRequest = {
5096
+ ...request,
5097
+ event_type: "iam.policy_evaluation"
5098
+ };
5099
+ const endpoint = buildEventsEndpoint(iamEventsRequest);
5100
+ return makeRequest({ endpoint, localstackEndpoint });
5101
+ },
5102
+ getSpans: async (request) => {
5103
+ const endpoint = buildSpansEndpoint(request);
5104
+ return makeRequest({ endpoint, localstackEndpoint });
5105
+ },
5106
+ getStatus: async () => {
5107
+ return makeRequest({
5108
+ endpoint: API_ENDPOINTS.STATUS,
5109
+ localstackEndpoint
5110
+ });
5111
+ }
5112
+ };
5113
+ };
5114
+
5115
+ // src/context.tsx
5116
+ var import_jsx_runtime143 = require("react/jsx-runtime");
5117
+ var AppInspectorContext = (0, import_react22.createContext)(void 0);
5118
+ var AppInspectorContextProvider = (props) => {
5119
+ const api = (0, import_react23.useMemo)(() => {
5120
+ return false ? createApiClientMock() : createApiClient({ localstackEndpoint: props.localstackEndpoint });
5121
+ }, [props.localstackEndpoint]);
5122
+ const resolveLink = (0, import_react23.useCallback)(
5123
+ (options) => {
5124
+ if (options.to === "settings") {
5125
+ return `${props.routePrefix}/settings`;
5126
+ }
5127
+ if (options.to === "trace-graph") {
5128
+ return `${props.routePrefix}/traces/${options.traceId}`;
5129
+ }
5130
+ return `${props.routePrefix}/spans`;
5131
+ },
5132
+ [props.routePrefix]
5133
+ );
5134
+ const contextValue = (0, import_react23.useMemo)(
5135
+ () => ({
5136
+ linkComponent: props.linkComponent,
5137
+ localstackEndpoint: props.localstackEndpoint,
5138
+ resolveLink
5139
+ }),
5140
+ [props.linkComponent, props.localstackEndpoint, resolveLink]
5141
+ );
5142
+ return /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(ApiProvider, { api, children: /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(AppInspectorContext.Provider, { value: contextValue, children: props.children }) });
5213
5143
  };
5214
5144
 
5215
5145
  // src/index.ts
5216
5146
  var pages = {
5217
- APP_INSPECTOR_SPANS_LIST: [routes.APP_INSPECTOR_SPANS_LIST, SpansListPage],
5218
- APP_INSPECTOR_TRACE_GRAPH: [routes.APP_INSPECTOR_TRACE_GRAPH, TraceGraphPage]
5147
+ APP_INSPECTOR_SPANS_LIST: [routes.APP_INSPECTOR_SPANS_LIST, SpansListPage]
5219
5148
  };
5220
5149
  // Annotate the CommonJS export names for ESM import in node:
5221
5150
  0 && (module.exports = {