import { defineComponent as h, mergeModels as w, useModel as _, createBlock as u, openBlock as c, unref as t, withCtx as r, createVNode as i, createElementVNode as m, toDisplayString as p, createElementBlock as g, Fragment as v, renderList as b, normalizeClass as C } from "vue";
import { ScalarDropdown as S, ScalarButton as k, ScalarDropdownItem as E, ScalarIcon as V } from "@scalar/components";
import { ScalarIconCaretDown as B } from "@scalar/icons";
const D = { class: "overflow-hidden text-ellipsis" }, N = /* @__PURE__ */ h({
  __name: "ExamplePicker",
  props: /* @__PURE__ */ w({
    examples: {}
  }, {
    modelValue: {
      required: !0
    },
    modelModifiers: {}
  }),
  emits: ["update:modelValue"],
  setup(d, { expose: f }) {
    const a = _(d, "modelValue"), o = (e) => {
      var n, s;
      return e ? ((s = (n = d.examples) == null ? void 0 : n[e]) == null ? void 0 : s.summary) ?? e : "Select an example";
    }, x = (e) => {
      a.value = e;
    };
    return f({
      getLabel: o,
      selectedExampleKey: a
    }), (e, n) => (c(), u(t(S), { placement: "bottom-start" }, {
      items: r(() => [
        (c(!0), g(v, null, b(e.examples, (s, l) => (c(), u(t(E), {
          key: l,
          onClick: (z) => x(l)
        }, {
          default: r(() => [
            m("div", {
              class: C([
                "flex h-4 w-4 items-center justify-center rounded-full p-[3px]",
                a.value === l ? "bg-c-accent text-b-1" : "shadow-border text-transparent"
              ])
            }, [
              i(t(V), {
                class: "size-2.5",
                icon: "Checkmark",
                thickness: "3"
              })
            ], 2),
            m("span", D, p(o(l)), 1)
          ]),
          _: 2
        }, 1032, ["onClick"]))), 128))
      ]),
      default: r(() => [
        i(t(k), {
          "data-testid": "example-picker",
          class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-1.5 py-0.75 text-base font-normal",
          fullWidth: "",
          variant: "ghost"
        }, {
          default: r(() => [
            m("span", null, p(o(a.value)), 1),
            i(t(B), {
              weight: "bold",
              class: "ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100"
            })
          ]),
          _: 1
        })
      ]),
      _: 1
    }));
  }
});
export {
  N as default
};
