import { defineComponent as b, ref as g, computed as u, watch as y, openBlock as m, createBlock as i, unref as e, withCtx as r, createVNode as a, createTextVNode as x, toDisplayString as S, createElementVNode as c, renderSlot as d, createCommentVNode as k } from "vue";
import { HttpMethod as V } from "@scalar/api-client";
import { ScalarIcon as w, ScalarCodeBlock as _ } from "@scalar/components";
import q from "./TextSelect.vue.js";
/* empty css                */
import N from "../../Card/Card.vue.js";
import $ from "../../Card/CardHeader.vue.js";
import j from "../../Card/CardContent.vue.js";
import E from "../../Card/CardFooter.vue.js";
import { useClipboard as H } from "../../../hooks/useClipboard.js";
const P = { class: "request-header" }, G = /* @__PURE__ */ b({
  __name: "CustomRequestExamples",
  props: {
    operation: {},
    examples: {}
  },
  setup(f) {
    const l = f, t = g(0), v = u(() => (
      // @ts-ignore
      {
        C: "c",
        "C#": "csharp",
        // 'C++': '',
        // 'CoffeeScript': '',
        // 'CSS': '',
        // 'Dart': '',
        // 'DM': '',
        // 'Elixir': '',
        Go: "go",
        // 'Groovy': '',
        HTML: "html",
        Java: "java",
        JavaScript: "javascript",
        Kotlin: "kotlin",
        "Objective-C": "objc",
        // 'Perl': '',
        PHP: "php",
        PowerShell: "powershell",
        Python: "python",
        Ruby: "ruby",
        // 'Rust': '',
        // 'Scala': '',
        Shell: "shell",
        Swift: "swift",
        TypeScript: "typescript",
        cURL: "curl"
      }[l.examples[t.value].lang] ?? l.examples[t.value].lang
    )), p = u(() => l.examples[t.value]);
    y(l.examples, () => {
      l.examples[t.value] === "undefined" && (t.value = 0);
    });
    const { copyToClipboard: h } = H();
    return (o, s) => (m(), i(e(N), { class: "dark-mode" }, {
      default: r(() => [
        a(e($), { muted: "" }, {
          actions: r(() => [
            a(q, {
              class: "request-client-picker",
              modelValue: t.value,
              options: o.examples.map((n, C) => ({
                value: C.toString(),
                label: n.label
              })),
              "onUpdate:modelValue": s[0] || (s[0] = (n) => (t.value = parseInt(n), 10))
            }, {
              default: r(() => [
                x(S(p.value.label), 1)
              ]),
              _: 1
            }, 8, ["modelValue", "options"]),
            c("button", {
              class: "copy-button",
              type: "button",
              onClick: s[1] || (s[1] = (n) => e(h)(p.value.source.trim()))
            }, [
              a(e(w), {
                icon: "Clipboard",
                width: "10px"
              })
            ])
          ]),
          default: r(() => [
            c("div", P, [
              a(e(V), {
                class: "request-method",
                method: o.operation.httpVerb
              }, null, 8, ["method"]),
              d(o.$slots, "header", {}, void 0, !0)
            ])
          ]),
          _: 3
        }),
        a(e(j), {
          borderless: "",
          class: "request-editor-section custom-scroll",
          frameless: ""
        }, {
          default: r(() => [
            a(e(_), {
              content: p.value.source.trim(),
              lang: v.value,
              lineNumbers: ""
            }, null, 8, ["content", "lang"])
          ]),
          _: 1
        }),
        o.$slots.footer ? (m(), i(e(E), {
          key: 0,
          class: "scalar-card-footer",
          contrast: ""
        }, {
          default: r(() => [
            d(o.$slots, "footer", {}, void 0, !0)
          ]),
          _: 3
        })) : k("", !0)
      ]),
      _: 3
    }));
  }
});
export {
  G as default
};
