import { c as create_ssr_component, v as validate_component, f as escape, a as compute_rest_props, b as spread, e as escape_attribute_value, d as escape_object, l as each } from "./index-27250121.js";
import _ from "lodash";
import { T as Tag, d as StructuredListRow, e as StructuredListCell, C as CarbonMarkdown, S as StructuredList, c as StructuredListBody, A as AnchorHeader } from "./PreviousNextPage-aa1b7b9e.js";
import { isScalarType, isEnumType, isInterfaceType, isUnionType, isObjectType, isInputObjectType } from "graphql";
import { B as Button, a as TypeLinkTag, D as DeprecatedTag, N as NullableTag, A as ArgsList, T as TypeLink } from "./ArgsList-5cf1bc5a.js";
const TypeTag = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { type } = $$props;
  function getTypeString() {
    if (isScalarType(type)) {
      return "Scalar";
    } else if (isEnumType(type)) {
      return "Enum";
    } else if (isInterfaceType(type)) {
      return "Interface";
    } else if (isUnionType(type)) {
      return "Union";
    } else if (isObjectType(type)) {
      return "Object";
    } else if (isInputObjectType(type)) {
      return "Input Object";
    }
    return "Unknown";
  }
  if ($$props.type === void 0 && $$bindings.type && type !== void 0)
    $$bindings.type(type);
  return `${validate_component(Tag, "Tag").$$render($$result, { type: "teal" }, {}, {
    default: () => {
      return `${escape(getTypeString())}`;
    }
  })}`;
});
const ArrowDown = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let labelled;
  let attributes;
  let $$restProps = compute_rest_props($$props, ["size", "title"]);
  let { size = 16 } = $$props;
  let { title = void 0 } = $$props;
  if ($$props.size === void 0 && $$bindings.size && size !== void 0)
    $$bindings.size(size);
  if ($$props.title === void 0 && $$bindings.title && title !== void 0)
    $$bindings.title(title);
  labelled = $$props["aria-label"] || $$props["aria-labelledby"] || title;
  attributes = {
    "aria-hidden": labelled ? void 0 : true,
    role: labelled ? "img" : void 0,
    focusable: Number($$props["tabindex"]) === 0 ? true : void 0
  };
  return `<svg${spread(
    [
      { xmlns: "http://www.w3.org/2000/svg" },
      { viewBox: "0 0 32 32" },
      { fill: "currentColor" },
      { preserveAspectRatio: "xMidYMid meet" },
      { width: escape_attribute_value(size) },
      { height: escape_attribute_value(size) },
      escape_object(attributes),
      escape_object($$restProps)
    ],
    {}
  )}>${title ? `<title>${escape(title)}</title>` : ``}<path d="${"M24.59 16.59L17 24.17 17 4 15 4 15 24.17 7.41 16.59 6 18 16 28 26 18 24.59 16.59z"}"></path></svg>`;
});
const ArrowUp = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let labelled;
  let attributes;
  let $$restProps = compute_rest_props($$props, ["size", "title"]);
  let { size = 16 } = $$props;
  let { title = void 0 } = $$props;
  if ($$props.size === void 0 && $$bindings.size && size !== void 0)
    $$bindings.size(size);
  if ($$props.title === void 0 && $$bindings.title && title !== void 0)
    $$bindings.title(title);
  labelled = $$props["aria-label"] || $$props["aria-labelledby"] || title;
  attributes = {
    "aria-hidden": labelled ? void 0 : true,
    role: labelled ? "img" : void 0,
    focusable: Number($$props["tabindex"]) === 0 ? true : void 0
  };
  return `<svg${spread(
    [
      { xmlns: "http://www.w3.org/2000/svg" },
      { viewBox: "0 0 32 32" },
      { fill: "currentColor" },
      { preserveAspectRatio: "xMidYMid meet" },
      { width: escape_attribute_value(size) },
      { height: escape_attribute_value(size) },
      escape_object(attributes),
      escape_object($$restProps)
    ],
    {}
  )}>${title ? `<title>${escape(title)}</title>` : ``}<path d="${"M16 4L6 14 7.41 15.41 15 7.83 15 28 17 28 17 7.83 24.59 15.41 26 14 16 4z"}"></path></svg>`;
});
const AppExpandButton_svelte_svelte_type_style_lang = "";
const css$1 = {
  code: ".button-wrapper.svelte-8qz4j{display:flex;width:100%;justify-content:center;padding:0.5rem}",
  map: null
};
const AppExpandButton = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { totalItems } = $$props;
  let { expandedText } = $$props;
  let { collapsedText } = $$props;
  let { expanded = false } = $$props;
  if ($$props.totalItems === void 0 && $$bindings.totalItems && totalItems !== void 0)
    $$bindings.totalItems(totalItems);
  if ($$props.expandedText === void 0 && $$bindings.expandedText && expandedText !== void 0)
    $$bindings.expandedText(expandedText);
  if ($$props.collapsedText === void 0 && $$bindings.collapsedText && collapsedText !== void 0)
    $$bindings.collapsedText(collapsedText);
  if ($$props.expanded === void 0 && $$bindings.expanded && expanded !== void 0)
    $$bindings.expanded(expanded);
  $$result.css.add(css$1);
  return `<div class="${"button-wrapper svelte-8qz4j"}">${validate_component(Button, "Button").$$render(
    $$result,
    {
      kind: "ghost",
      size: "small",
      style: "border-radius: 20px",
      icon: expanded ? ArrowUp : ArrowDown
    },
    {},
    {
      default: () => {
        return `${escape((expanded ? expandedText : collapsedText) + ` (${totalItems})`)}`;
      }
    }
  )}
</div>`;
});
const FieldsListRow_svelte_svelte_type_style_lang = "";
const css = {
  code: ".arguments-list-wrapper.svelte-1di407r{border-left:3px solid var(--cds-ui-03, #dcdbdb);padding-left:10px;margin-top:0.7rem;margin-bottom:0.7rem}",
  map: null
};
const FieldsListRow = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { item } = $$props;
  var showArguments = false;
  if ($$props.item === void 0 && $$bindings.item && item !== void 0)
    $$bindings.item(item);
  $$result.css.add(css);
  let $$settled;
  let $$rendered;
  do {
    $$settled = true;
    $$rendered = `${validate_component(StructuredListRow, "StructuredListRow").$$render($$result, {}, {}, {
      default: () => {
        return `${validate_component(StructuredListCell, "StructuredListCell").$$render($$result, {}, {}, {
          default: () => {
            return `<p><span style="${"font-weight: bold"}">${escape(item.name)}</span>
      ${validate_component(TypeLinkTag, "TypeLinkTag").$$render($$result, { type: item.type }, {}, {})}
      ${validate_component(DeprecatedTag, "DeprecatedTag").$$render($$result, { reason: item.deprecationReason }, {}, {})}
      ${validate_component(NullableTag, "NullableTag").$$render($$result, { type: item.type }, {}, {})}</p>

    ${validate_component(CarbonMarkdown, "CarbonMarkdown").$$render($$result, { source: item.description }, {}, {})}

    ${item.args.length > 0 ? `${showArguments ? `<div class="${"arguments-list-wrapper svelte-1di407r"}">${validate_component(ArgsList, "ArgsList").$$render($$result, { data: item.args }, {}, {})}</div>` : ``}
      ${validate_component(AppExpandButton, "AppExpandButton").$$render(
              $$result,
              {
                totalItems: item.args.length,
                collapsedText: "Show arguments",
                expandedText: "Hide arguments",
                expanded: showArguments
              },
              {
                expanded: ($$value) => {
                  showArguments = $$value;
                  $$settled = false;
                }
              },
              {}
            )}` : ``}`;
          }
        })}`;
      }
    })}`;
  } while (!$$settled);
  return $$rendered;
});
const FiedsList = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let tableData;
  let { data } = $$props;
  if ($$props.data === void 0 && $$bindings.data && data !== void 0)
    $$bindings.data(data);
  tableData = _.sortBy(data, (item) => item.name);
  return `${validate_component(StructuredList, "StructuredList").$$render($$result, { condensed: true }, {}, {
    default: () => {
      return `${validate_component(StructuredListBody, "StructuredListBody").$$render($$result, {}, {}, {
        default: () => {
          return `${each(tableData, (item) => {
            return `${validate_component(FieldsListRow, "FieldsTableRow").$$render($$result, { item }, {}, {})}`;
          })}`;
        }
      })}`;
    }
  })}`;
});
const TypeEnumeration = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { types } = $$props;
  if ($$props.types === void 0 && $$bindings.types && types !== void 0)
    $$bindings.types(types);
  return `${each(types, (item, index) => {
    return `${validate_component(TypeLink, "TypeLink").$$render($$result, { type: item }, {}, {})}${index !== types.length - 1 ? `${escape(", ")}` : ``}`;
  })}`;
});
const ObjectType = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let { type } = $$props;
  if ($$props.type === void 0 && $$bindings.type && type !== void 0)
    $$bindings.type(type);
  return `<section>${validate_component(AnchorHeader, "AnchorHeader").$$render($$result, { id: "title", depth: 1 }, {}, {
    default: () => {
      return `${escape(type.name)}
    ${validate_component(TypeTag, "TypeTag").$$render($$result, { type }, {}, {})}`;
    }
  })}

  ${validate_component(CarbonMarkdown, "CarbonMarkdown").$$render($$result, { source: type.description }, {}, {})}

  ${Object.keys(type.getFields()).length > 0 ? `${validate_component(AnchorHeader, "AnchorHeader").$$render($$result, { id: "fields", depth: 2 }, {}, {
    default: () => {
      return `Fields`;
    }
  })}

    ${validate_component(FiedsList, "FiedsTable").$$render(
    $$result,
    {
      data: _.map(type.getFields(), (item) => item)
    },
    {},
    {}
  )}` : ``}

  ${type.getInterfaces().length > 0 ? `${validate_component(AnchorHeader, "AnchorHeader").$$render($$result, { id: "interfaces", depth: 2 }, {}, {
    default: () => {
      return `Interfaces`;
    }
  })}

    <p>Also implements ${validate_component(TypeEnumeration, "InterfaceList").$$render($$result, { types: type.getInterfaces() }, {}, {})}.
    </p>` : ``}</section>`;
});
export {
  AppExpandButton as A,
  FiedsList as F,
  ObjectType as O,
  TypeTag as T,
  TypeEnumeration as a
};
