import { jsx, jsxs, Fragment } from "react/jsx-runtime";
import { c } from "react-compiler-runtime";
import { ToolbarButton, KEY_MAP, prettifyEditors, PrettifyIcon, mergeQuery, MergeIcon, copyQuery, CopyIcon } from "@graphiql/react";
const DefaultToolbarRenderProps = (t0) => {
  const $ = c(4);
  const {
    prettify,
    copy,
    merge
  } = t0;
  let t1;
  if ($[0] !== copy || $[1] !== merge || $[2] !== prettify) {
    t1 = /* @__PURE__ */ jsxs(Fragment, { children: [
      prettify,
      merge,
      copy
    ] });
    $[0] = copy;
    $[1] = merge;
    $[2] = prettify;
    $[3] = t1;
  } else {
    t1 = $[3];
  }
  return t1;
};
const GraphiQLToolbar = (t0) => {
  const $ = c(5);
  const {
    children: t1
  } = t0;
  const children = t1 === void 0 ? DefaultToolbarRenderProps : t1;
  if (typeof children !== "function") {
    throw new TypeError("The `GraphiQL.Toolbar` component requires a render prop function as its child.");
  }
  let t2;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t2 = /* @__PURE__ */ jsx(ToolbarButton, { onClick: prettifyEditors, label: `Prettify query (${KEY_MAP.prettify.key})`, children: /* @__PURE__ */ jsx(PrettifyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) });
    $[0] = t2;
  } else {
    t2 = $[0];
  }
  const prettify = t2;
  let t3;
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
    t3 = /* @__PURE__ */ jsx(ToolbarButton, { onClick: mergeQuery, label: `Merge fragments into query (${KEY_MAP.mergeFragments.key})`, children: /* @__PURE__ */ jsx(MergeIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) });
    $[1] = t3;
  } else {
    t3 = $[1];
  }
  const merge = t3;
  let t4;
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
    t4 = /* @__PURE__ */ jsx(ToolbarButton, { onClick: copyQuery, label: `Copy query (${KEY_MAP.copyQuery.key})`, children: /* @__PURE__ */ jsx(CopyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) });
    $[2] = t4;
  } else {
    t4 = $[2];
  }
  const copy = t4;
  let t5;
  if ($[3] !== children) {
    t5 = children({
      prettify,
      copy,
      merge
    });
    $[3] = children;
    $[4] = t5;
  } else {
    t5 = $[4];
  }
  return t5;
};
export {
  GraphiQLToolbar
};
//# sourceMappingURL=toolbar.js.map
