import { defineComponent as p, ref as f, computed as n, createBlock as b, openBlock as g, unref as s, withCtx as v, createElementVNode as l, createVNode as x, toDisplayString as h } from "vue";
import { ScalarListbox as V } from "@scalar/components";
import { ScalarIconCaretDown as D } from "@scalar/icons";
const S = {
  class: "bg-b-1.5 hover:bg-b-2 mt-2 flex w-full items-center gap-1 rounded border px-2 py-1.25",
  type: "button"
}, _ = { class: "composition-selector-label text-c-1 relative" }, M = /* @__PURE__ */ p({
  __name: "SchemaDiscriminator",
  props: {
    discriminatorMapping: {},
    discriminator: {}
  },
  emits: ["update:modelValue"],
  setup(i, { emit: c }) {
    const m = f(""), d = c, u = (e) => {
      m.value = e, d("update:modelValue", e);
    }, a = n(() => i.discriminatorMapping ? Object.keys(i.discriminatorMapping).map((e) => ({
      id: e,
      label: e
    })) : []), o = n({
      get: () => a.value.find(
        (e) => e.id === i.discriminator
      ),
      set: (e) => {
        e != null && e.id && u(e.id);
      }
    });
    return (e, r) => (g(), b(s(V), {
      modelValue: o.value,
      "onUpdate:modelValue": r[0] || (r[0] = (t) => o.value = t),
      options: a.value,
      resize: ""
    }, {
      default: v(() => {
        var t;
        return [
          l("button", S, [
            l("span", _, h(((t = o.value) == null ? void 0 : t.label) || "Schema"), 1),
            x(s(D), { class: "z-1" })
          ])
        ];
      }),
      _: 1
    }, 8, ["modelValue", "options"]));
  }
});
export {
  M as default
};
