import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
import { c } from "react-compiler-runtime";
import { useEffect, useState, Children, Fragment, cloneElement } from "react";
import { useEditorContext, useExecutionContext, useSchemaStore, useStorage, usePluginStore, useTheme, useDragResize, cn, QueryEditor, UnStyledButton, ChevronUpIcon, ChevronDownIcon, VariableEditor, HeaderEditor, Spinner, ResponseEditor, Dialog, ButtonGroup, Button, Tooltip, GraphiQLProvider, useCopyQuery, useMergeQuery, usePrettifyEditors, ToolbarButton, MergeIcon, CopyIcon, PrettifyIcon, isMacOs, ReloadIcon, KeyboardShortcutIcon, SettingsIcon, Tab, Tabs, PlusIcon, ExecuteButton } from "@graphiql/react";
import { HISTORY_PLUGIN, HistoryContextProvider } from "@graphiql/plugin-history";
import { DOC_EXPLORER_PLUGIN, DocExplorerContextProvider } from "@graphiql/plugin-doc-explorer";
const GraphiQL_ = (t0) => {
  var _a, _b;
  const $ = c(72);
  let confirmCloseTab;
  let dangerouslyAssumeSchemaIsValid;
  let defaultHeaders;
  let defaultQuery;
  let defaultTabs;
  let externalFragments;
  let fetcher;
  let getDefaultFieldNames;
  let headers;
  let inputValueDeprecation;
  let introspectionQueryName;
  let maxHistoryLength;
  let onEditOperationName;
  let onSchemaChange;
  let onTabChange;
  let onTogglePluginVisibility;
  let operationName;
  let props;
  let query;
  let response;
  let schema;
  let schemaDescription;
  let shouldPersistHeaders;
  let storage;
  let t1;
  let t2;
  let validationRules;
  let variables;
  let visiblePlugin;
  if ($[0] !== t0) {
    ({
      dangerouslyAssumeSchemaIsValid,
      confirmCloseTab,
      defaultQuery,
      defaultTabs,
      externalFragments,
      fetcher,
      getDefaultFieldNames,
      headers,
      inputValueDeprecation,
      introspectionQueryName,
      maxHistoryLength,
      onEditOperationName,
      onSchemaChange,
      onTabChange,
      onTogglePluginVisibility,
      operationName,
      plugins: t1,
      referencePlugin: t2,
      query,
      response,
      schema,
      schemaDescription,
      shouldPersistHeaders,
      storage,
      validationRules,
      variables,
      visiblePlugin,
      defaultHeaders,
      ...props
    } = t0);
    $[0] = t0;
    $[1] = confirmCloseTab;
    $[2] = dangerouslyAssumeSchemaIsValid;
    $[3] = defaultHeaders;
    $[4] = defaultQuery;
    $[5] = defaultTabs;
    $[6] = externalFragments;
    $[7] = fetcher;
    $[8] = getDefaultFieldNames;
    $[9] = headers;
    $[10] = inputValueDeprecation;
    $[11] = introspectionQueryName;
    $[12] = maxHistoryLength;
    $[13] = onEditOperationName;
    $[14] = onSchemaChange;
    $[15] = onTabChange;
    $[16] = onTogglePluginVisibility;
    $[17] = operationName;
    $[18] = props;
    $[19] = query;
    $[20] = response;
    $[21] = schema;
    $[22] = schemaDescription;
    $[23] = shouldPersistHeaders;
    $[24] = storage;
    $[25] = t1;
    $[26] = t2;
    $[27] = validationRules;
    $[28] = variables;
    $[29] = visiblePlugin;
  } else {
    confirmCloseTab = $[1];
    dangerouslyAssumeSchemaIsValid = $[2];
    defaultHeaders = $[3];
    defaultQuery = $[4];
    defaultTabs = $[5];
    externalFragments = $[6];
    fetcher = $[7];
    getDefaultFieldNames = $[8];
    headers = $[9];
    inputValueDeprecation = $[10];
    introspectionQueryName = $[11];
    maxHistoryLength = $[12];
    onEditOperationName = $[13];
    onSchemaChange = $[14];
    onTabChange = $[15];
    onTogglePluginVisibility = $[16];
    operationName = $[17];
    props = $[18];
    query = $[19];
    response = $[20];
    schema = $[21];
    schemaDescription = $[22];
    shouldPersistHeaders = $[23];
    storage = $[24];
    t1 = $[25];
    t2 = $[26];
    validationRules = $[27];
    variables = $[28];
    visiblePlugin = $[29];
  }
  let t3;
  if ($[30] !== t1) {
    t3 = t1 === void 0 ? [] : t1;
    $[30] = t1;
    $[31] = t3;
  } else {
    t3 = $[31];
  }
  const plugins = t3;
  const referencePlugin = t2 === void 0 ? DOC_EXPLORER_PLUGIN : t2;
  if ((_a = props.toolbar) == null ? void 0 : _a.additionalContent) {
    throw new TypeError("`toolbar.additionalContent` was removed. Use render props on `GraphiQL.Toolbar` component instead.");
  }
  if ((_b = props.toolbar) == null ? void 0 : _b.additionalComponent) {
    throw new TypeError("`toolbar.additionalComponent` was removed. Use render props on `GraphiQL.Toolbar` component instead.");
  }
  let t4;
  if ($[32] !== plugins || $[33] !== referencePlugin) {
    t4 = [referencePlugin, HISTORY_PLUGIN, ...plugins];
    $[32] = plugins;
    $[33] = referencePlugin;
    $[34] = t4;
  } else {
    t4 = $[34];
  }
  let t5;
  if ($[35] !== dangerouslyAssumeSchemaIsValid || $[36] !== defaultHeaders || $[37] !== defaultQuery || $[38] !== defaultTabs || $[39] !== externalFragments || $[40] !== fetcher || $[41] !== getDefaultFieldNames || $[42] !== headers || $[43] !== inputValueDeprecation || $[44] !== introspectionQueryName || $[45] !== onEditOperationName || $[46] !== onSchemaChange || $[47] !== onTabChange || $[48] !== onTogglePluginVisibility || $[49] !== operationName || $[50] !== query || $[51] !== referencePlugin || $[52] !== response || $[53] !== schema || $[54] !== schemaDescription || $[55] !== shouldPersistHeaders || $[56] !== storage || $[57] !== t4 || $[58] !== validationRules || $[59] !== variables || $[60] !== visiblePlugin) {
    t5 = {
      getDefaultFieldNames,
      dangerouslyAssumeSchemaIsValid,
      defaultQuery,
      defaultHeaders,
      defaultTabs,
      externalFragments,
      fetcher,
      headers,
      inputValueDeprecation,
      introspectionQueryName,
      onEditOperationName,
      onSchemaChange,
      onTabChange,
      onTogglePluginVisibility,
      plugins: t4,
      referencePlugin,
      visiblePlugin,
      operationName,
      query,
      response,
      schema,
      schemaDescription,
      shouldPersistHeaders,
      storage,
      validationRules,
      variables
    };
    $[35] = dangerouslyAssumeSchemaIsValid;
    $[36] = defaultHeaders;
    $[37] = defaultQuery;
    $[38] = defaultTabs;
    $[39] = externalFragments;
    $[40] = fetcher;
    $[41] = getDefaultFieldNames;
    $[42] = headers;
    $[43] = inputValueDeprecation;
    $[44] = introspectionQueryName;
    $[45] = onEditOperationName;
    $[46] = onSchemaChange;
    $[47] = onTabChange;
    $[48] = onTogglePluginVisibility;
    $[49] = operationName;
    $[50] = query;
    $[51] = referencePlugin;
    $[52] = response;
    $[53] = schema;
    $[54] = schemaDescription;
    $[55] = shouldPersistHeaders;
    $[56] = storage;
    $[57] = t4;
    $[58] = validationRules;
    $[59] = variables;
    $[60] = visiblePlugin;
    $[61] = t5;
  } else {
    t5 = $[61];
  }
  const graphiqlProps = t5;
  const t6 = shouldPersistHeaders !== false;
  let t7;
  if ($[62] !== confirmCloseTab || $[63] !== props || $[64] !== t6) {
    t7 = /* @__PURE__ */ jsx(DocExplorerContextProvider, { children: /* @__PURE__ */ jsx(GraphiQLInterface, { confirmCloseTab, showPersistHeadersSettings: t6, forcedTheme: props.forcedTheme, ...props }) });
    $[62] = confirmCloseTab;
    $[63] = props;
    $[64] = t6;
    $[65] = t7;
  } else {
    t7 = $[65];
  }
  let t8;
  if ($[66] !== maxHistoryLength || $[67] !== t7) {
    t8 = /* @__PURE__ */ jsx(HistoryContextProvider, { maxHistoryLength, children: t7 });
    $[66] = maxHistoryLength;
    $[67] = t7;
    $[68] = t8;
  } else {
    t8 = $[68];
  }
  let t9;
  if ($[69] !== graphiqlProps || $[70] !== t8) {
    t9 = /* @__PURE__ */ jsx(GraphiQLProvider, { ...graphiqlProps, children: t8 });
    $[69] = graphiqlProps;
    $[70] = t8;
    $[71] = t9;
  } else {
    t9 = $[71];
  }
  return t9;
};
const THEMES = ["light", "dark", "system"];
const TAB_CLASS_PREFIX = "graphiql-session-tab-";
const GraphiQLInterface = (props) => {
  const $ = c(232);
  const isHeadersEditorEnabled = props.isHeadersEditorEnabled ?? true;
  let t0;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t0 = {
      nonNull: true
    };
    $[0] = t0;
  } else {
    t0 = $[0];
  }
  const {
    initialVariables,
    initialHeaders,
    setShouldPersistHeaders,
    addTab,
    moveTab,
    closeTab,
    changeTab,
    shouldPersistHeaders,
    tabs,
    activeTabIndex
  } = useEditorContext(t0);
  let t1;
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
    t1 = {
      nonNull: true
    };
    $[1] = t1;
  } else {
    t1 = $[1];
  }
  const executionContext = useExecutionContext(t1);
  const {
    isFetching: isSchemaFetching,
    introspect
  } = useSchemaStore();
  let t2;
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
    t2 = {
      nonNull: true
    };
    $[2] = t2;
  } else {
    t2 = $[2];
  }
  const storageContext = useStorage(t2);
  const {
    visiblePlugin,
    setVisiblePlugin,
    plugins
  } = usePluginStore();
  const forcedTheme = props.forcedTheme && THEMES.includes(props.forcedTheme) ? props.forcedTheme : void 0;
  const {
    theme,
    setTheme
  } = useTheme(props.defaultTheme);
  let t3;
  let t4;
  if ($[3] !== forcedTheme || $[4] !== setTheme) {
    t3 = () => {
      if (forcedTheme === "system") {
        setTheme(null);
      } else {
        if (forcedTheme === "light" || forcedTheme === "dark") {
          setTheme(forcedTheme);
        }
      }
    };
    t4 = [forcedTheme, setTheme];
    $[3] = forcedTheme;
    $[4] = setTheme;
    $[5] = t3;
    $[6] = t4;
  } else {
    t3 = $[5];
    t4 = $[6];
  }
  useEffect(t3, t4);
  const PluginContent = visiblePlugin == null ? void 0 : visiblePlugin.content;
  const t5 = visiblePlugin ? void 0 : "first";
  let t6;
  if ($[7] !== setVisiblePlugin || $[8] !== t5) {
    t6 = {
      defaultSizeRelation: 0.3333333333333333,
      direction: "horizontal",
      initiallyHidden: t5,
      onHiddenElementChange(resizableElement) {
        if (resizableElement === "first") {
          setVisiblePlugin(null);
        }
      },
      sizeThresholdSecond: 200,
      storageKey: "docExplorerFlex"
    };
    $[7] = setVisiblePlugin;
    $[8] = t5;
    $[9] = t6;
  } else {
    t6 = $[9];
  }
  const pluginResize = useDragResize(t6);
  let t7;
  if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
    t7 = {
      direction: "horizontal",
      storageKey: "editorFlex"
    };
    $[10] = t7;
  } else {
    t7 = $[10];
  }
  const editorResize = useDragResize(t7);
  let t8;
  bb0: {
    if (props.defaultEditorToolsVisibility === "variables" || props.defaultEditorToolsVisibility === "headers") {
      t8 = void 0;
      break bb0;
    }
    if (typeof props.defaultEditorToolsVisibility === "boolean") {
      t8 = props.defaultEditorToolsVisibility ? void 0 : "second";
      break bb0;
    }
    t8 = initialVariables || initialHeaders ? void 0 : "second";
  }
  let t9;
  if ($[11] !== t8) {
    t9 = {
      defaultSizeRelation: 3,
      direction: "vertical",
      initiallyHidden: t8,
      sizeThresholdSecond: 60,
      storageKey: "secondaryEditorFlex"
    };
    $[11] = t8;
    $[12] = t9;
  } else {
    t9 = $[12];
  }
  const editorToolsResize = useDragResize(t9);
  let t10;
  if ($[13] !== initialHeaders || $[14] !== initialVariables || $[15] !== isHeadersEditorEnabled || $[16] !== props.defaultEditorToolsVisibility) {
    t10 = () => {
      if (props.defaultEditorToolsVisibility === "variables" || props.defaultEditorToolsVisibility === "headers") {
        return props.defaultEditorToolsVisibility;
      }
      return !initialVariables && initialHeaders && isHeadersEditorEnabled ? "headers" : "variables";
    };
    $[13] = initialHeaders;
    $[14] = initialVariables;
    $[15] = isHeadersEditorEnabled;
    $[16] = props.defaultEditorToolsVisibility;
    $[17] = t10;
  } else {
    t10 = $[17];
  }
  const [activeSecondaryEditor, setActiveSecondaryEditor] = useState(t10);
  const [showDialog, setShowDialog] = useState(null);
  const [clearStorageStatus, setClearStorageStatus] = useState(null);
  let t11;
  if ($[18] !== props.children || $[19] !== props.onCopyQuery || $[20] !== props.onPrettifyQuery) {
    let t122;
    if ($[22] !== props.onCopyQuery || $[23] !== props.onPrettifyQuery) {
      t122 = (acc, curr) => {
        bb80: switch (getChildComponentType(curr)) {
          case GraphiQL.Logo: {
            acc.logo = curr;
            break bb80;
          }
          case GraphiQL.Toolbar: {
            acc.toolbar = cloneElement(curr, {
              onCopyQuery: props.onCopyQuery,
              onPrettifyQuery: props.onPrettifyQuery
            });
            break bb80;
          }
          case GraphiQL.Footer: {
            acc.footer = curr;
          }
        }
        return acc;
      };
      $[22] = props.onCopyQuery;
      $[23] = props.onPrettifyQuery;
      $[24] = t122;
    } else {
      t122 = $[24];
    }
    let t132;
    if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
      t132 = /* @__PURE__ */ jsx(GraphiQL.Logo, {});
      $[25] = t132;
    } else {
      t132 = $[25];
    }
    let t142;
    if ($[26] !== props.onCopyQuery || $[27] !== props.onPrettifyQuery) {
      t142 = /* @__PURE__ */ jsx(GraphiQL.Toolbar, { onCopyQuery: props.onCopyQuery, onPrettifyQuery: props.onPrettifyQuery });
      $[26] = props.onCopyQuery;
      $[27] = props.onPrettifyQuery;
      $[28] = t142;
    } else {
      t142 = $[28];
    }
    t11 = Children.toArray(props.children).reduce(t122, {
      logo: t132,
      toolbar: t142
    });
    $[18] = props.children;
    $[19] = props.onCopyQuery;
    $[20] = props.onPrettifyQuery;
    $[21] = t11;
  } else {
    t11 = $[21];
  }
  const {
    logo,
    toolbar,
    footer
  } = t11;
  let t12;
  if ($[29] !== pluginResize) {
    t12 = () => {
      if (pluginResize.hiddenElement === "first") {
        pluginResize.setHiddenElement(null);
      }
    };
    $[29] = pluginResize;
    $[30] = t12;
  } else {
    t12 = $[30];
  }
  const onClickReference = t12;
  let t13;
  if ($[31] !== storageContext) {
    t13 = () => {
      try {
        storageContext.clear();
        setClearStorageStatus("success");
      } catch {
        setClearStorageStatus("error");
      }
    };
    $[31] = storageContext;
    $[32] = t13;
  } else {
    t13 = $[32];
  }
  const handleClearData = t13;
  let t14;
  if ($[33] !== setShouldPersistHeaders) {
    t14 = (event) => {
      setShouldPersistHeaders(event.currentTarget.dataset.value === "true");
    };
    $[33] = setShouldPersistHeaders;
    $[34] = t14;
  } else {
    t14 = $[34];
  }
  const handlePersistHeaders = t14;
  let t15;
  if ($[35] !== setTheme) {
    t15 = (event_0) => {
      const selectedTheme = event_0.currentTarget.dataset.theme;
      setTheme(selectedTheme || null);
    };
    $[35] = setTheme;
    $[36] = t15;
  } else {
    t15 = $[36];
  }
  const handleChangeTheme = t15;
  let t16;
  if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
    t16 = (event_1) => {
      setShowDialog(event_1.currentTarget.dataset.value);
    };
    $[37] = t16;
  } else {
    t16 = $[37];
  }
  const handleShowDialog = t16;
  let t17;
  if ($[38] !== pluginResize || $[39] !== plugins || $[40] !== setVisiblePlugin || $[41] !== visiblePlugin) {
    t17 = (event_2) => {
      const pluginIndex = Number(event_2.currentTarget.dataset.index);
      const plugin = plugins.find((_, index) => pluginIndex === index);
      const isVisible = plugin === visiblePlugin;
      if (isVisible) {
        setVisiblePlugin(null);
        pluginResize.setHiddenElement("first");
      } else {
        setVisiblePlugin(plugin);
        pluginResize.setHiddenElement(null);
      }
    };
    $[38] = pluginResize;
    $[39] = plugins;
    $[40] = setVisiblePlugin;
    $[41] = visiblePlugin;
    $[42] = t17;
  } else {
    t17 = $[42];
  }
  const handlePluginClick = t17;
  let t18;
  if ($[43] !== editorToolsResize) {
    t18 = (event_3) => {
      if (editorToolsResize.hiddenElement === "second") {
        editorToolsResize.setHiddenElement(null);
      }
      setActiveSecondaryEditor(event_3.currentTarget.dataset.name);
    };
    $[43] = editorToolsResize;
    $[44] = t18;
  } else {
    t18 = $[44];
  }
  const handleToolsTabClick = t18;
  let t19;
  if ($[45] !== editorToolsResize) {
    t19 = () => {
      editorToolsResize.setHiddenElement(editorToolsResize.hiddenElement === "second" ? null : "second");
    };
    $[45] = editorToolsResize;
    $[46] = t19;
  } else {
    t19 = $[46];
  }
  const toggleEditorTools = t19;
  let t20;
  if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
    t20 = (isOpen) => {
      if (!isOpen) {
        setShowDialog(null);
      }
    };
    $[47] = t20;
  } else {
    t20 = $[47];
  }
  const handleOpenShortKeysDialog = t20;
  let t21;
  if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
    t21 = (isOpen_0) => {
      if (!isOpen_0) {
        setShowDialog(null);
        setClearStorageStatus(null);
      }
    };
    $[48] = t21;
  } else {
    t21 = $[48];
  }
  const handleOpenSettingsDialog = t21;
  const confirmClose = props.confirmCloseTab;
  let t22;
  if ($[49] !== activeTabIndex || $[50] !== closeTab || $[51] !== confirmClose || $[52] !== executionContext) {
    t22 = async (event_4) => {
      const tabButton = event_4.currentTarget.previousSibling;
      const index_0 = Number(tabButton.id.replace(TAB_CLASS_PREFIX, ""));
      const shouldCloseTab = confirmClose ? await confirmClose(index_0) : true;
      if (!shouldCloseTab) {
        return;
      }
      if (activeTabIndex === index_0) {
        executionContext.stop();
      }
      closeTab(index_0);
    };
    $[49] = activeTabIndex;
    $[50] = closeTab;
    $[51] = confirmClose;
    $[52] = executionContext;
    $[53] = t22;
  } else {
    t22 = $[53];
  }
  const handleTabClose = t22;
  let t23;
  if ($[54] !== changeTab || $[55] !== executionContext) {
    t23 = (event_5) => {
      const index_1 = Number(event_5.currentTarget.id.replace(TAB_CLASS_PREFIX, ""));
      executionContext.stop();
      changeTab(index_1);
    };
    $[54] = changeTab;
    $[55] = executionContext;
    $[56] = t23;
  } else {
    t23 = $[56];
  }
  const handleTabClick = t23;
  let t24;
  if ($[57] !== props.className) {
    t24 = cn("graphiql-container", props.className);
    $[57] = props.className;
    $[58] = t24;
  } else {
    t24 = $[58];
  }
  let t25;
  if ($[59] !== handlePluginClick || $[60] !== plugins || $[61] !== visiblePlugin) {
    let t262;
    if ($[63] !== handlePluginClick || $[64] !== visiblePlugin) {
      t262 = (plugin_0, index_2) => {
        const isVisible_0 = plugin_0 === visiblePlugin;
        const label = `${isVisible_0 ? "Hide" : "Show"} ${plugin_0.title}`;
        return /* @__PURE__ */ jsx(Tooltip, { label, children: /* @__PURE__ */ jsx(UnStyledButton, { type: "button", className: cn(isVisible_0 && "active"), onClick: handlePluginClick, "data-index": index_2, "aria-label": label, children: /* @__PURE__ */ jsx(plugin_0.icon, { "aria-hidden": "true" }) }) }, plugin_0.title);
      };
      $[63] = handlePluginClick;
      $[64] = visiblePlugin;
      $[65] = t262;
    } else {
      t262 = $[65];
    }
    t25 = plugins.map(t262);
    $[59] = handlePluginClick;
    $[60] = plugins;
    $[61] = visiblePlugin;
    $[62] = t25;
  } else {
    t25 = $[62];
  }
  let t26;
  if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
    t26 = {
      marginTop: "auto"
    };
    $[66] = t26;
  } else {
    t26 = $[66];
  }
  const t27 = isSchemaFetching && "graphiql-spin";
  let t28;
  if ($[67] !== t27) {
    t28 = cn(t27);
    $[67] = t27;
    $[68] = t28;
  } else {
    t28 = $[68];
  }
  let t29;
  if ($[69] !== t28) {
    t29 = /* @__PURE__ */ jsx(ReloadIcon, { className: t28, "aria-hidden": "true" });
    $[69] = t28;
    $[70] = t29;
  } else {
    t29 = $[70];
  }
  let t30;
  if ($[71] !== introspect || $[72] !== isSchemaFetching || $[73] !== t29) {
    t30 = /* @__PURE__ */ jsx(Tooltip, { label: "Re-fetch GraphQL schema", children: /* @__PURE__ */ jsx(UnStyledButton, { type: "button", disabled: isSchemaFetching, onClick: introspect, "aria-label": "Re-fetch GraphQL schema", style: t26, children: t29 }) });
    $[71] = introspect;
    $[72] = isSchemaFetching;
    $[73] = t29;
    $[74] = t30;
  } else {
    t30 = $[74];
  }
  let t31;
  if ($[75] === Symbol.for("react.memo_cache_sentinel")) {
    t31 = /* @__PURE__ */ jsx(Tooltip, { label: "Open short keys dialog", children: /* @__PURE__ */ jsx(UnStyledButton, { type: "button", "data-value": "short-keys", onClick: handleShowDialog, "aria-label": "Open short keys dialog", children: /* @__PURE__ */ jsx(KeyboardShortcutIcon, { "aria-hidden": "true" }) }) });
    $[75] = t31;
  } else {
    t31 = $[75];
  }
  let t32;
  if ($[76] === Symbol.for("react.memo_cache_sentinel")) {
    t32 = /* @__PURE__ */ jsx(Tooltip, { label: "Open settings dialog", children: /* @__PURE__ */ jsx(UnStyledButton, { type: "button", "data-value": "settings", onClick: handleShowDialog, "aria-label": "Open settings dialog", children: /* @__PURE__ */ jsx(SettingsIcon, { "aria-hidden": "true" }) }) });
    $[76] = t32;
  } else {
    t32 = $[76];
  }
  let t33;
  if ($[77] !== t25 || $[78] !== t30) {
    t33 = /* @__PURE__ */ jsxs("div", { className: "graphiql-sidebar", children: [
      t25,
      t30,
      t31,
      t32
    ] });
    $[77] = t25;
    $[78] = t30;
    $[79] = t33;
  } else {
    t33 = $[79];
  }
  let t34;
  if ($[80] === Symbol.for("react.memo_cache_sentinel")) {
    t34 = {
      minWidth: "200px"
    };
    $[80] = t34;
  } else {
    t34 = $[80];
  }
  let t35;
  if ($[81] !== PluginContent) {
    t35 = PluginContent ? /* @__PURE__ */ jsx(PluginContent, {}) : null;
    $[81] = PluginContent;
    $[82] = t35;
  } else {
    t35 = $[82];
  }
  let t36;
  if ($[83] !== pluginResize.firstRef || $[84] !== t35) {
    t36 = /* @__PURE__ */ jsx("div", { ref: pluginResize.firstRef, className: "graphiql-plugin", style: t34, children: t35 });
    $[83] = pluginResize.firstRef;
    $[84] = t35;
    $[85] = t36;
  } else {
    t36 = $[85];
  }
  let t37;
  if ($[86] !== pluginResize.dragBarRef || $[87] !== visiblePlugin) {
    t37 = visiblePlugin && /* @__PURE__ */ jsx("div", { className: "graphiql-horizontal-drag-bar", ref: pluginResize.dragBarRef });
    $[86] = pluginResize.dragBarRef;
    $[87] = visiblePlugin;
    $[88] = t37;
  } else {
    t37 = $[88];
  }
  const t38 = pluginResize.secondRef;
  let t39;
  if ($[89] !== activeTabIndex || $[90] !== handleTabClick || $[91] !== handleTabClose || $[92] !== tabs) {
    let t402;
    if ($[94] !== activeTabIndex || $[95] !== handleTabClick || $[96] !== handleTabClose) {
      t402 = (tab, index_3, arr) => /* @__PURE__ */ jsxs(Tab, { value: tab, isActive: index_3 === activeTabIndex, children: [
        /* @__PURE__ */ jsx(Tab.Button, { "aria-controls": "graphiql-session", id: `graphiql-session-tab-${index_3}`, title: tab.title, onClick: handleTabClick, children: tab.title }),
        arr.length > 1 && /* @__PURE__ */ jsx(Tab.Close, { onClick: handleTabClose })
      ] }, tab.id);
      $[94] = activeTabIndex;
      $[95] = handleTabClick;
      $[96] = handleTabClose;
      $[97] = t402;
    } else {
      t402 = $[97];
    }
    t39 = tabs.map(t402);
    $[89] = activeTabIndex;
    $[90] = handleTabClick;
    $[91] = handleTabClose;
    $[92] = tabs;
    $[93] = t39;
  } else {
    t39 = $[93];
  }
  let t40;
  if ($[98] !== moveTab || $[99] !== t39 || $[100] !== tabs) {
    t40 = /* @__PURE__ */ jsx(Tabs, { values: tabs, onReorder: moveTab, "aria-label": "Select active operation", className: "no-scrollbar", children: t39 });
    $[98] = moveTab;
    $[99] = t39;
    $[100] = tabs;
    $[101] = t40;
  } else {
    t40 = $[101];
  }
  let t41;
  if ($[102] === Symbol.for("react.memo_cache_sentinel")) {
    t41 = /* @__PURE__ */ jsx(PlusIcon, { "aria-hidden": "true" });
    $[102] = t41;
  } else {
    t41 = $[102];
  }
  let t42;
  if ($[103] !== addTab) {
    t42 = /* @__PURE__ */ jsx(Tooltip, { label: "New tab", children: /* @__PURE__ */ jsx(UnStyledButton, { type: "button", className: "graphiql-tab-add", onClick: addTab, "aria-label": "New tab", children: t41 }) });
    $[103] = addTab;
    $[104] = t42;
  } else {
    t42 = $[104];
  }
  let t43;
  if ($[105] !== logo || $[106] !== t40 || $[107] !== t42) {
    t43 = /* @__PURE__ */ jsxs("div", { className: "graphiql-session-header", children: [
      t40,
      t42,
      logo
    ] });
    $[105] = logo;
    $[106] = t40;
    $[107] = t42;
    $[108] = t43;
  } else {
    t43 = $[108];
  }
  const t44 = `${TAB_CLASS_PREFIX}${activeTabIndex}`;
  const t45 = editorResize.firstRef;
  let t46;
  if ($[109] !== onClickReference || $[110] !== props.editorTheme || $[111] !== props.keyMap || $[112] !== props.onCopyQuery || $[113] !== props.onEditQuery || $[114] !== props.onPrettifyQuery || $[115] !== props.readOnly) {
    t46 = /* @__PURE__ */ jsx(QueryEditor, { editorTheme: props.editorTheme, keyMap: props.keyMap, onClickReference, onCopyQuery: props.onCopyQuery, onPrettifyQuery: props.onPrettifyQuery, onEdit: props.onEditQuery, readOnly: props.readOnly });
    $[109] = onClickReference;
    $[110] = props.editorTheme;
    $[111] = props.keyMap;
    $[112] = props.onCopyQuery;
    $[113] = props.onEditQuery;
    $[114] = props.onPrettifyQuery;
    $[115] = props.readOnly;
    $[116] = t46;
  } else {
    t46 = $[116];
  }
  let t47;
  if ($[117] === Symbol.for("react.memo_cache_sentinel")) {
    t47 = /* @__PURE__ */ jsx(ExecuteButton, {});
    $[117] = t47;
  } else {
    t47 = $[117];
  }
  let t48;
  if ($[118] !== toolbar) {
    t48 = /* @__PURE__ */ jsxs("div", { className: "graphiql-toolbar", role: "toolbar", "aria-label": "Editor Commands", children: [
      t47,
      toolbar
    ] });
    $[118] = toolbar;
    $[119] = t48;
  } else {
    t48 = $[119];
  }
  let t49;
  if ($[120] !== editorToolsResize.firstRef || $[121] !== t46 || $[122] !== t48) {
    t49 = /* @__PURE__ */ jsxs("section", { className: "graphiql-query-editor", "aria-label": "Query Editor", ref: editorToolsResize.firstRef, children: [
      t46,
      t48
    ] });
    $[120] = editorToolsResize.firstRef;
    $[121] = t46;
    $[122] = t48;
    $[123] = t49;
  } else {
    t49 = $[123];
  }
  const t50 = editorToolsResize.dragBarRef;
  const t51 = activeSecondaryEditor === "variables" && editorToolsResize.hiddenElement !== "second" && "active";
  let t52;
  if ($[124] !== t51) {
    t52 = cn(t51);
    $[124] = t51;
    $[125] = t52;
  } else {
    t52 = $[125];
  }
  let t53;
  if ($[126] !== handleToolsTabClick || $[127] !== t52) {
    t53 = /* @__PURE__ */ jsx(UnStyledButton, { type: "button", className: t52, onClick: handleToolsTabClick, "data-name": "variables", children: "Variables" });
    $[126] = handleToolsTabClick;
    $[127] = t52;
    $[128] = t53;
  } else {
    t53 = $[128];
  }
  let t54;
  if ($[129] !== activeSecondaryEditor || $[130] !== editorToolsResize.hiddenElement || $[131] !== handleToolsTabClick || $[132] !== isHeadersEditorEnabled) {
    t54 = isHeadersEditorEnabled && /* @__PURE__ */ jsx(UnStyledButton, { type: "button", className: cn(activeSecondaryEditor === "headers" && editorToolsResize.hiddenElement !== "second" && "active"), onClick: handleToolsTabClick, "data-name": "headers", children: "Headers" });
    $[129] = activeSecondaryEditor;
    $[130] = editorToolsResize.hiddenElement;
    $[131] = handleToolsTabClick;
    $[132] = isHeadersEditorEnabled;
    $[133] = t54;
  } else {
    t54 = $[133];
  }
  const t55 = editorToolsResize.hiddenElement === "second" ? "Show editor tools" : "Hide editor tools";
  const t56 = editorToolsResize.hiddenElement === "second" ? "Show editor tools" : "Hide editor tools";
  let t57;
  if ($[134] !== editorToolsResize.hiddenElement) {
    t57 = editorToolsResize.hiddenElement === "second" ? /* @__PURE__ */ jsx(ChevronUpIcon, { className: "graphiql-chevron-icon", "aria-hidden": "true" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "graphiql-chevron-icon", "aria-hidden": "true" });
    $[134] = editorToolsResize.hiddenElement;
    $[135] = t57;
  } else {
    t57 = $[135];
  }
  let t58;
  if ($[136] !== t56 || $[137] !== t57 || $[138] !== toggleEditorTools) {
    t58 = /* @__PURE__ */ jsx(UnStyledButton, { type: "button", onClick: toggleEditorTools, "aria-label": t56, className: "graphiql-toggle-editor-tools", children: t57 });
    $[136] = t56;
    $[137] = t57;
    $[138] = toggleEditorTools;
    $[139] = t58;
  } else {
    t58 = $[139];
  }
  let t59;
  if ($[140] !== t55 || $[141] !== t58) {
    t59 = /* @__PURE__ */ jsx(Tooltip, { label: t55, children: t58 });
    $[140] = t55;
    $[141] = t58;
    $[142] = t59;
  } else {
    t59 = $[142];
  }
  let t60;
  if ($[143] !== editorToolsResize.dragBarRef || $[144] !== t53 || $[145] !== t54 || $[146] !== t59) {
    t60 = /* @__PURE__ */ jsxs("div", { ref: t50, className: "graphiql-editor-tools", children: [
      t53,
      t54,
      t59
    ] });
    $[143] = editorToolsResize.dragBarRef;
    $[144] = t53;
    $[145] = t54;
    $[146] = t59;
    $[147] = t60;
  } else {
    t60 = $[147];
  }
  const t61 = activeSecondaryEditor === "variables" ? "Variables" : "Headers";
  const t62 = activeSecondaryEditor !== "variables";
  let t63;
  if ($[148] !== onClickReference || $[149] !== props.editorTheme || $[150] !== props.keyMap || $[151] !== props.onEditVariables || $[152] !== props.readOnly || $[153] !== t62) {
    t63 = /* @__PURE__ */ jsx(VariableEditor, { editorTheme: props.editorTheme, isHidden: t62, keyMap: props.keyMap, onEdit: props.onEditVariables, onClickReference, readOnly: props.readOnly });
    $[148] = onClickReference;
    $[149] = props.editorTheme;
    $[150] = props.keyMap;
    $[151] = props.onEditVariables;
    $[152] = props.readOnly;
    $[153] = t62;
    $[154] = t63;
  } else {
    t63 = $[154];
  }
  let t64;
  if ($[155] !== activeSecondaryEditor || $[156] !== isHeadersEditorEnabled || $[157] !== props.editorTheme || $[158] !== props.keyMap || $[159] !== props.onEditHeaders || $[160] !== props.readOnly) {
    t64 = isHeadersEditorEnabled && /* @__PURE__ */ jsx(HeaderEditor, { editorTheme: props.editorTheme, isHidden: activeSecondaryEditor !== "headers", keyMap: props.keyMap, onEdit: props.onEditHeaders, readOnly: props.readOnly });
    $[155] = activeSecondaryEditor;
    $[156] = isHeadersEditorEnabled;
    $[157] = props.editorTheme;
    $[158] = props.keyMap;
    $[159] = props.onEditHeaders;
    $[160] = props.readOnly;
    $[161] = t64;
  } else {
    t64 = $[161];
  }
  let t65;
  if ($[162] !== editorToolsResize.secondRef || $[163] !== t61 || $[164] !== t63 || $[165] !== t64) {
    t65 = /* @__PURE__ */ jsxs("section", { className: "graphiql-editor-tool", "aria-label": t61, ref: editorToolsResize.secondRef, children: [
      t63,
      t64
    ] });
    $[162] = editorToolsResize.secondRef;
    $[163] = t61;
    $[164] = t63;
    $[165] = t64;
    $[166] = t65;
  } else {
    t65 = $[166];
  }
  let t66;
  if ($[167] !== editorResize.firstRef || $[168] !== t49 || $[169] !== t60 || $[170] !== t65) {
    t66 = /* @__PURE__ */ jsxs("div", { className: "graphiql-editors", ref: t45, children: [
      t49,
      t60,
      t65
    ] });
    $[167] = editorResize.firstRef;
    $[168] = t49;
    $[169] = t60;
    $[170] = t65;
    $[171] = t66;
  } else {
    t66 = $[171];
  }
  let t67;
  if ($[172] !== editorResize.dragBarRef) {
    t67 = /* @__PURE__ */ jsx("div", { className: "graphiql-horizontal-drag-bar", ref: editorResize.dragBarRef });
    $[172] = editorResize.dragBarRef;
    $[173] = t67;
  } else {
    t67 = $[173];
  }
  let t68;
  if ($[174] !== executionContext.isFetching) {
    t68 = executionContext.isFetching ? /* @__PURE__ */ jsx(Spinner, {}) : null;
    $[174] = executionContext.isFetching;
    $[175] = t68;
  } else {
    t68 = $[175];
  }
  let t69;
  if ($[176] !== props.editorTheme || $[177] !== props.keyMap || $[178] !== props.responseTooltip) {
    t69 = /* @__PURE__ */ jsx(ResponseEditor, { editorTheme: props.editorTheme, responseTooltip: props.responseTooltip, keyMap: props.keyMap });
    $[176] = props.editorTheme;
    $[177] = props.keyMap;
    $[178] = props.responseTooltip;
    $[179] = t69;
  } else {
    t69 = $[179];
  }
  let t70;
  if ($[180] !== editorResize.secondRef || $[181] !== footer || $[182] !== t68 || $[183] !== t69) {
    t70 = /* @__PURE__ */ jsxs("div", { className: "graphiql-response", ref: editorResize.secondRef, children: [
      t68,
      t69,
      footer
    ] });
    $[180] = editorResize.secondRef;
    $[181] = footer;
    $[182] = t68;
    $[183] = t69;
    $[184] = t70;
  } else {
    t70 = $[184];
  }
  let t71;
  if ($[185] !== t44 || $[186] !== t66 || $[187] !== t67 || $[188] !== t70) {
    t71 = /* @__PURE__ */ jsxs("div", { role: "tabpanel", id: "graphiql-session", "aria-labelledby": t44, children: [
      t66,
      t67,
      t70
    ] });
    $[185] = t44;
    $[186] = t66;
    $[187] = t67;
    $[188] = t70;
    $[189] = t71;
  } else {
    t71 = $[189];
  }
  let t72;
  if ($[190] !== pluginResize.secondRef || $[191] !== t43 || $[192] !== t71) {
    t72 = /* @__PURE__ */ jsxs("div", { ref: t38, className: "graphiql-sessions", children: [
      t43,
      t71
    ] });
    $[190] = pluginResize.secondRef;
    $[191] = t43;
    $[192] = t71;
    $[193] = t72;
  } else {
    t72 = $[193];
  }
  let t73;
  if ($[194] !== t36 || $[195] !== t37 || $[196] !== t72) {
    t73 = /* @__PURE__ */ jsxs("div", { className: "graphiql-main", children: [
      t36,
      t37,
      t72
    ] });
    $[194] = t36;
    $[195] = t37;
    $[196] = t72;
    $[197] = t73;
  } else {
    t73 = $[197];
  }
  const t74 = showDialog === "short-keys";
  let t75;
  if ($[198] === Symbol.for("react.memo_cache_sentinel")) {
    t75 = /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-header", children: [
      /* @__PURE__ */ jsx(Dialog.Title, { className: "graphiql-dialog-title", children: "Short Keys" }),
      /* @__PURE__ */ jsx(Dialog.Close, {})
    ] });
    $[198] = t75;
  } else {
    t75 = $[198];
  }
  let t76;
  if ($[199] !== props.keyMap) {
    t76 = /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section", children: /* @__PURE__ */ jsx(ShortKeys, { keyMap: props.keyMap }) });
    $[199] = props.keyMap;
    $[200] = t76;
  } else {
    t76 = $[200];
  }
  let t77;
  if ($[201] !== t74 || $[202] !== t76) {
    t77 = /* @__PURE__ */ jsxs(Dialog, { open: t74, onOpenChange: handleOpenShortKeysDialog, children: [
      t75,
      t76
    ] });
    $[201] = t74;
    $[202] = t76;
    $[203] = t77;
  } else {
    t77 = $[203];
  }
  const t78 = showDialog === "settings";
  let t79;
  if ($[204] === Symbol.for("react.memo_cache_sentinel")) {
    t79 = /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-header", children: [
      /* @__PURE__ */ jsx(Dialog.Title, { className: "graphiql-dialog-title", children: "Settings" }),
      /* @__PURE__ */ jsx(Dialog.Close, {})
    ] });
    $[204] = t79;
  } else {
    t79 = $[204];
  }
  let t80;
  if ($[205] !== handlePersistHeaders || $[206] !== props.showPersistHeadersSettings || $[207] !== shouldPersistHeaders) {
    t80 = props.showPersistHeadersSettings ? /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-section", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section-title", children: "Persist headers" }),
        /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-section-caption", children: [
          "Save headers upon reloading.",
          " ",
          /* @__PURE__ */ jsx("span", { className: "graphiql-warning-text", children: "Only enable if you trust this device." })
        ] })
      ] }),
      /* @__PURE__ */ jsxs(ButtonGroup, { children: [
        /* @__PURE__ */ jsx(Button, { type: "button", id: "enable-persist-headers", className: cn(shouldPersistHeaders && "active"), "data-value": "true", onClick: handlePersistHeaders, children: "On" }),
        /* @__PURE__ */ jsx(Button, { type: "button", id: "disable-persist-headers", className: cn(!shouldPersistHeaders && "active"), onClick: handlePersistHeaders, children: "Off" })
      ] })
    ] }) : null;
    $[205] = handlePersistHeaders;
    $[206] = props.showPersistHeadersSettings;
    $[207] = shouldPersistHeaders;
    $[208] = t80;
  } else {
    t80 = $[208];
  }
  let t81;
  if ($[209] !== forcedTheme || $[210] !== handleChangeTheme || $[211] !== theme) {
    t81 = !forcedTheme && /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-section", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section-title", children: "Theme" }),
        /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section-caption", children: "Adjust how the interface appears." })
      ] }),
      /* @__PURE__ */ jsxs(ButtonGroup, { children: [
        /* @__PURE__ */ jsx(Button, { type: "button", className: cn(theme === null && "active"), onClick: handleChangeTheme, children: "System" }),
        /* @__PURE__ */ jsx(Button, { type: "button", className: cn(theme === "light" && "active"), "data-theme": "light", onClick: handleChangeTheme, children: "Light" }),
        /* @__PURE__ */ jsx(Button, { type: "button", className: cn(theme === "dark" && "active"), "data-theme": "dark", onClick: handleChangeTheme, children: "Dark" })
      ] })
    ] });
    $[209] = forcedTheme;
    $[210] = handleChangeTheme;
    $[211] = theme;
    $[212] = t81;
  } else {
    t81 = $[212];
  }
  let t82;
  if ($[213] === Symbol.for("react.memo_cache_sentinel")) {
    t82 = /* @__PURE__ */ jsxs("div", { children: [
      /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section-title", children: "Clear storage" }),
      /* @__PURE__ */ jsx("div", { className: "graphiql-dialog-section-caption", children: "Remove all locally stored data and start fresh." })
    ] });
    $[213] = t82;
  } else {
    t82 = $[213];
  }
  const t83 = clearStorageStatus || void 0;
  const t84 = clearStorageStatus === "success";
  let t85;
  if ($[214] !== clearStorageStatus) {
    t85 = {
      success: "Cleared data",
      error: "Failed"
    }[clearStorageStatus] || "Clear data";
    $[214] = clearStorageStatus;
    $[215] = t85;
  } else {
    t85 = $[215];
  }
  let t86;
  if ($[216] !== handleClearData || $[217] !== t83 || $[218] !== t84 || $[219] !== t85) {
    t86 = /* @__PURE__ */ jsxs("div", { className: "graphiql-dialog-section", children: [
      t82,
      /* @__PURE__ */ jsx(Button, { type: "button", state: t83, disabled: t84, onClick: handleClearData, children: t85 })
    ] });
    $[216] = handleClearData;
    $[217] = t83;
    $[218] = t84;
    $[219] = t85;
    $[220] = t86;
  } else {
    t86 = $[220];
  }
  let t87;
  if ($[221] !== t78 || $[222] !== t80 || $[223] !== t81 || $[224] !== t86) {
    t87 = /* @__PURE__ */ jsxs(Dialog, { open: t78, onOpenChange: handleOpenSettingsDialog, children: [
      t79,
      t80,
      t81,
      t86
    ] });
    $[221] = t78;
    $[222] = t80;
    $[223] = t81;
    $[224] = t86;
    $[225] = t87;
  } else {
    t87 = $[225];
  }
  let t88;
  if ($[226] !== t24 || $[227] !== t33 || $[228] !== t73 || $[229] !== t77 || $[230] !== t87) {
    t88 = /* @__PURE__ */ jsx(Tooltip.Provider, { children: /* @__PURE__ */ jsxs("div", { className: t24, children: [
      t33,
      t73,
      t77,
      t87
    ] }) });
    $[226] = t24;
    $[227] = t33;
    $[228] = t73;
    $[229] = t77;
    $[230] = t87;
    $[231] = t88;
  } else {
    t88 = $[231];
  }
  return t88;
};
const modifier = isMacOs ? "⌘" : "Ctrl";
const SHORT_KEYS = Object.entries({
  "Search in editor": [modifier, "F"],
  "Search in documentation": [modifier, "K"],
  "Execute query": [modifier, "Enter"],
  "Prettify editors": ["Ctrl", "Shift", "P"],
  "Merge fragments definitions into operation definition": ["Ctrl", "Shift", "M"],
  "Copy query": ["Ctrl", "Shift", "C"],
  "Re-fetch schema using introspection": ["Ctrl", "Shift", "R"]
});
const ShortKeys = (t0) => {
  const $ = c(5);
  const {
    keyMap: t1
  } = t0;
  const keyMap = t1 === void 0 ? "sublime" : t1;
  let t2;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t2 = /* @__PURE__ */ jsxs("table", { className: "graphiql-table", children: [
      /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
        /* @__PURE__ */ jsx("th", { children: "Short Key" }),
        /* @__PURE__ */ jsx("th", { children: "Function" })
      ] }) }),
      /* @__PURE__ */ jsx("tbody", { children: SHORT_KEYS.map(_temp2) })
    ] });
    $[0] = t2;
  } else {
    t2 = $[0];
  }
  let t3;
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
    t3 = /* @__PURE__ */ jsx("a", { href: "https://codemirror.net/5/doc/manual.html#keymaps", target: "_blank", rel: "noopener noreferrer", children: "CodeMirror Key Maps" });
    $[1] = t3;
  } else {
    t3 = $[1];
  }
  let t4;
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
    t4 = /* @__PURE__ */ jsx("em", { children: "i" });
    $[2] = t4;
  } else {
    t4 = $[2];
  }
  let t5;
  if ($[3] !== keyMap) {
    t5 = /* @__PURE__ */ jsxs("div", { children: [
      t2,
      /* @__PURE__ */ jsxs("p", { children: [
        "The editors use",
        " ",
        t3,
        " ",
        "that add more short keys. This instance of Graph",
        t4,
        "QL uses",
        " ",
        /* @__PURE__ */ jsx("code", { children: keyMap }),
        "."
      ] })
    ] });
    $[3] = keyMap;
    $[4] = t5;
  } else {
    t5 = $[4];
  }
  return t5;
};
const defaultGraphiqlLogo = /* @__PURE__ */ jsxs("a", { className: "graphiql-logo-link", href: "https://github.com/graphql/graphiql", target: "_blank", rel: "noreferrer", children: [
  "Graph",
  /* @__PURE__ */ jsx("em", { children: "i" }),
  "QL"
] });
const GraphiQLLogo = (t0) => {
  const $ = c(2);
  const {
    children: t1
  } = t0;
  const children = t1 === void 0 ? defaultGraphiqlLogo : t1;
  let t2;
  if ($[0] !== children) {
    t2 = /* @__PURE__ */ jsx("div", { className: "graphiql-logo", children });
    $[0] = children;
    $[1] = t2;
  } else {
    t2 = $[1];
  }
  return t2;
};
const DefaultToolbarRenderProps = (t0) => {
  const $ = c(4);
  const {
    prettify,
    copy,
    merge
  } = t0;
  let t1;
  if ($[0] !== copy || $[1] !== merge || $[2] !== prettify) {
    t1 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
      prettify,
      merge,
      copy
    ] });
    $[0] = copy;
    $[1] = merge;
    $[2] = prettify;
    $[3] = t1;
  } else {
    t1 = $[3];
  }
  return t1;
};
const GraphiQLToolbar = ({
  children = DefaultToolbarRenderProps,
  // @ts-expect-error -- Hide this prop for user, we use cloneElement to pass onCopyQuery
  onCopyQuery,
  // @ts-expect-error -- Hide this prop for user, we use cloneElement to pass onPrettifyQuery
  onPrettifyQuery
}) => {
  "use no memo";
  if (typeof children !== "function") {
    throw new TypeError("The `GraphiQL.Toolbar` component requires a render prop function as its child.");
  }
  const onCopy = useCopyQuery({
    onCopyQuery
  });
  const onMerge = useMergeQuery();
  const onPrettify = usePrettifyEditors({
    onPrettifyQuery
  });
  const prettify = /* @__PURE__ */ jsx(ToolbarButton, { onClick: onPrettify, label: "Prettify query (Shift-Ctrl-P)", children: /* @__PURE__ */ jsx(PrettifyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) });
  const merge = /* @__PURE__ */ jsx(ToolbarButton, { onClick: onMerge, label: "Merge fragments into query (Shift-Ctrl-M)", children: /* @__PURE__ */ jsx(MergeIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) });
  const copy = /* @__PURE__ */ jsx(ToolbarButton, { onClick: onCopy, label: "Copy query (Shift-Ctrl-C)", children: /* @__PURE__ */ jsx(CopyIcon, { className: "graphiql-toolbar-icon", "aria-hidden": "true" }) });
  return children({
    prettify,
    copy,
    merge
  });
};
const GraphiQLFooter = (props) => {
  const $ = c(2);
  let t0;
  if ($[0] !== props.children) {
    t0 = /* @__PURE__ */ jsx("div", { className: "graphiql-footer", children: props.children });
    $[0] = props.children;
    $[1] = t0;
  } else {
    t0 = $[1];
  }
  return t0;
};
function getChildComponentType(child) {
  if (child && typeof child === "object" && "type" in child && typeof child.type === "function") {
    return child.type;
  }
}
const GraphiQL = Object.assign(GraphiQL_, {
  Logo: GraphiQLLogo,
  Toolbar: GraphiQLToolbar,
  Footer: GraphiQLFooter
});
function _temp(key, index, array) {
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx("code", { className: "graphiql-key", children: key }),
    index !== array.length - 1 && " + "
  ] }, key);
}
function _temp2(t0) {
  const [title, keys] = t0;
  return /* @__PURE__ */ jsxs("tr", { children: [
    /* @__PURE__ */ jsx("td", { children: keys.map(_temp) }),
    /* @__PURE__ */ jsx("td", { children: title })
  ] }, title);
}
export {
  GraphiQL,
  GraphiQLInterface
};
//# sourceMappingURL=GraphiQL.js.map
