import {
  PanelContainer
} from "./chunk-34BKYKWL.mjs";

// src/panels/edge/EdgeDashboardPanel/EdgeDashboardPanel.tsx
import React from "react";
import { PublicKey, useClient, useMulticastObservable } from "@dxos/react-client";
import { SyntaxHighlighter } from "@dxos/react-ui-syntax-highlighter";
import { arrayToString, deepMapValues } from "@dxos/util";
var EdgeDashboardPanel = () => {
  const client = useClient();
  const credentials = useMulticastObservable(client.halo.credentials);
  const serviceCredentials = credentials.filter((cred) => cred.subject.assertion["@type"] === "dxos.halo.credentials.ServiceAccess");
  return /* @__PURE__ */ React.createElement(PanelContainer, {
    classNames: "flex-1 flex-row"
  }, /* @__PURE__ */ React.createElement(SyntaxHighlighter, {
    language: "json"
  }, JSON.stringify(formatData(serviceCredentials), null, 2)));
};
var formatData = (data) => deepMapValues(data, (value, recurse) => {
  if (value instanceof Uint8Array) {
    return arrayToString(value);
  }
  if (value instanceof PublicKey) {
    return value.truncate();
  }
  return recurse(value);
});

// src/panels/edge/EdgeDashboardPanel/index.ts
var EdgeDashboardPanel_default = EdgeDashboardPanel;
export {
  EdgeDashboardPanel_default as default
};
//# sourceMappingURL=EdgeDashboardPanel-J4MX342A.mjs.map
