import { jsx, jsxs, Fragment } from "react/jsx-runtime";
import { c } from "react-compiler-runtime";
import { pick, useGraphiQL, ToolbarButton, KEY_MAP, PrettifyIcon, MergeIcon, 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(15);
  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 = pick("copyQuery", "prettifyEditors", "mergeQuery");
    $[0] = t2;
  } else {
    t2 = $[0];
  }
  const {
    copyQuery,
    prettifyEditors,
    mergeQuery
  } = useGraphiQL(t2);
  let t3;
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
    t3 = /* @__PURE__ */ jsx(PrettifyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" });
    $[1] = t3;
  } else {
    t3 = $[1];
  }
  let t4;
  if ($[2] !== prettifyEditors) {
    t4 = /* @__PURE__ */ jsx(ToolbarButton, { onClick: prettifyEditors, label: `Prettify query (${KEY_MAP.prettify.key})`, children: t3 });
    $[2] = prettifyEditors;
    $[3] = t4;
  } else {
    t4 = $[3];
  }
  const prettify = t4;
  let t5;
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
    t5 = /* @__PURE__ */ jsx(MergeIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" });
    $[4] = t5;
  } else {
    t5 = $[4];
  }
  let t6;
  if ($[5] !== mergeQuery) {
    t6 = /* @__PURE__ */ jsx(ToolbarButton, { onClick: mergeQuery, label: `Merge fragments into query (${KEY_MAP.mergeFragments.key})`, children: t5 });
    $[5] = mergeQuery;
    $[6] = t6;
  } else {
    t6 = $[6];
  }
  const merge = t6;
  let t7;
  if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
    t7 = /* @__PURE__ */ jsx(CopyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" });
    $[7] = t7;
  } else {
    t7 = $[7];
  }
  let t8;
  if ($[8] !== copyQuery) {
    t8 = /* @__PURE__ */ jsx(ToolbarButton, { onClick: copyQuery, label: `Copy query (${KEY_MAP.copyQuery.key})`, children: t7 });
    $[8] = copyQuery;
    $[9] = t8;
  } else {
    t8 = $[9];
  }
  const copy = t8;
  let t9;
  if ($[10] !== children || $[11] !== copy || $[12] !== merge || $[13] !== prettify) {
    t9 = children({
      prettify,
      copy,
      merge
    });
    $[10] = children;
    $[11] = copy;
    $[12] = merge;
    $[13] = prettify;
    $[14] = t9;
  } else {
    t9 = $[14];
  }
  return t9;
};
export {
  GraphiQLToolbar
};
//# sourceMappingURL=toolbar.js.map
