import { defineComponent as L, computed as C, createElementBlock as m, openBlock as r, createCommentVNode as a, createBlock as i, normalizeClass as $, renderSlot as T, Fragment as f, withCtx as u, createVNode as y, createTextVNode as l, toDisplayString as o, unref as s } from "vue";
import { isDefined as p } from "@scalar/helpers/array/is-defined";
import S from "../../ScreenReader.vue.js";
import { getDiscriminatorSchemaName as b } from "../../../hooks/useDiscriminator.js";
import { getSchemaType as F } from "./helpers/get-schema-type.js";
import { getModelName as J } from "./helpers/schema-name.js";
import h from "./RenderString.vue.js";
import n from "./SchemaPropertyDetail.vue.js";
import z from "./SchemaPropertyExamples.vue.js";
import H from "../../Badge/Badge.vue.js";
const R = { class: "property-heading" }, j = {
  key: 1,
  class: "property-discriminator"
}, G = {
  key: 3,
  class: "property-additional"
}, K = {
  key: 4,
  class: "property-deprecated"
}, Q = {
  key: 5,
  class: "property-const"
}, U = {
  key: 7,
  class: "property-write-only"
}, W = {
  key: 8,
  class: "property-read-only"
}, X = {
  key: 9,
  class: "property-required"
}, ae = /* @__PURE__ */ L({
  __name: "SchemaPropertyHeading",
  props: {
    value: {},
    enum: { type: Boolean },
    required: { type: Boolean, default: !1 },
    additional: { type: Boolean },
    withExamples: { type: Boolean, default: !0 },
    hideModelNames: { type: Boolean, default: !1 },
    schemas: {}
  },
  setup(d) {
    const E = (e) => (e == null ? void 0 : e.default) === null ? "null" : Array.isArray(e == null ? void 0 : e.default) && e.default.length === 1 ? e.default[0] : typeof (e == null ? void 0 : e.default) == "string" || Array.isArray(e == null ? void 0 : e.default) ? JSON.stringify(e.default) : e == null ? void 0 : e.default, B = C(() => {
      var e, t, v, k, g, N;
      if (((e = d.value) == null ? void 0 : e.const) !== void 0)
        return (t = d.value) == null ? void 0 : t.const;
      if (((k = (v = d.value) == null ? void 0 : v.enum) == null ? void 0 : k.length) === 1)
        return d.value.enum[0];
      if ((g = d.value) != null && g.items) {
        if (p(d.value.items.const))
          return d.value.items.const;
        if (((N = d.value.items.enum) == null ? void 0 : N.length) === 1)
          return d.value.items.enum[0];
      }
    }), D = C(() => d.value ? J(
      d.value,
      d.schemas,
      d.hideModelNames,
      b
    ) : null);
    return (e, t) => {
      var v, k, g, N, M, q, w, O, P, I, V, A;
      return r(), m("div", R, [
        e.$slots.name ? (r(), m("div", {
          key: 0,
          class: $(["property-name", { deprecated: (v = e.value) == null ? void 0 : v.deprecated }])
        }, [
          T(e.$slots, "name", {}, void 0, !0)
        ], 2)) : a("", !0),
        (k = e.value) != null && k.isDiscriminator ? (r(), m("div", j, " Discriminator ")) : a("", !0),
        e.value ? (r(), m(f, { key: 2 }, [
          (g = e.value) != null && g.type ? (r(), i(n, {
            key: 0,
            truncate: ""
          }, {
            default: u(() => [
              y(S, null, {
                default: u(() => t[0] || (t[0] = [
                  l("Type: ")
                ])),
                _: 1,
                __: [0]
              }),
              D.value ? (r(), m(f, { key: 0 }, [
                l(o(D.value), 1)
              ], 64)) : (r(), m(f, { key: 1 }, [
                l(o(s(F)(e.value)), 1)
              ], 64))
            ]),
            _: 1
          })) : a("", !0),
          e.value.minItems || e.value.maxItems ? (r(), i(n, { key: 1 }, {
            default: u(() => [
              l(o(e.value.minItems) + "…" + o(e.value.maxItems), 1)
            ]),
            _: 1
          })) : a("", !0),
          e.value.minLength ? (r(), i(n, { key: 2 }, {
            prefix: u(() => t[1] || (t[1] = [
              l("min length: ")
            ])),
            default: u(() => [
              l(" " + o(e.value.minLength), 1)
            ]),
            _: 1
          })) : a("", !0),
          e.value.maxLength ? (r(), i(n, { key: 3 }, {
            prefix: u(() => t[2] || (t[2] = [
              l("max length: ")
            ])),
            default: u(() => [
              l(" " + o(e.value.maxLength), 1)
            ]),
            _: 1
          })) : a("", !0),
          e.value.uniqueItems ? (r(), i(n, { key: 4 }, {
            default: u(() => t[3] || (t[3] = [
              l(" unique! ")
            ])),
            _: 1,
            __: [3]
          })) : a("", !0),
          e.value.format ? (r(), i(n, {
            key: 5,
            truncate: ""
          }, {
            default: u(() => [
              y(S, null, {
                default: u(() => t[4] || (t[4] = [
                  l("Format:")
                ])),
                _: 1,
                __: [4]
              }),
              l(" " + o(e.value.format), 1)
            ]),
            _: 1
          })) : a("", !0),
          s(p)(e.value.exclusiveMinimum) ? (r(), i(n, { key: 6 }, {
            prefix: u(() => t[5] || (t[5] = [
              l("greater than: ")
            ])),
            default: u(() => [
              l(" " + o(e.value.exclusiveMinimum), 1)
            ]),
            _: 1
          })) : a("", !0),
          s(p)(e.value.minimum) ? (r(), i(n, { key: 7 }, {
            prefix: u(() => t[6] || (t[6] = [
              l("min: ")
            ])),
            default: u(() => [
              l(" " + o(e.value.minimum), 1)
            ]),
            _: 1
          })) : a("", !0),
          s(p)(e.value.exclusiveMaximum) ? (r(), i(n, { key: 8 }, {
            prefix: u(() => t[7] || (t[7] = [
              l("less than: ")
            ])),
            default: u(() => [
              l(" " + o(e.value.exclusiveMaximum), 1)
            ]),
            _: 1
          })) : a("", !0),
          s(p)(e.value.maximum) ? (r(), i(n, { key: 9 }, {
            prefix: u(() => t[8] || (t[8] = [
              l("max: ")
            ])),
            default: u(() => [
              l(" " + o(e.value.maximum), 1)
            ]),
            _: 1
          })) : a("", !0),
          s(p)(e.value.multipleOf) ? (r(), i(n, { key: 10 }, {
            prefix: u(() => t[9] || (t[9] = [
              l("multiple of: ")
            ])),
            default: u(() => [
              l(" " + o(e.value.multipleOf), 1)
            ]),
            _: 1
          })) : a("", !0),
          e.value.pattern ? (r(), i(n, {
            key: 11,
            code: "",
            truncate: ""
          }, {
            default: u(() => [
              y(S, null, {
                default: u(() => t[10] || (t[10] = [
                  l("Pattern:")
                ])),
                _: 1,
                __: [10]
              }),
              l(" " + o(e.value.pattern), 1)
            ]),
            _: 1
          })) : a("", !0),
          e.$props.enum ? (r(), i(n, { key: 12 }, {
            default: u(() => t[11] || (t[11] = [
              l("enum")
            ])),
            _: 1,
            __: [11]
          })) : a("", !0),
          e.value.default !== void 0 ? (r(), i(n, {
            key: 13,
            truncate: ""
          }, {
            prefix: u(() => t[12] || (t[12] = [
              l("default: ")
            ])),
            default: u(() => [
              l(" " + o(E(e.value)), 1)
            ]),
            _: 1
          })) : a("", !0)
        ], 64)) : a("", !0),
        e.additional ? (r(), m("div", G, [
          (N = e.value) != null && N["x-additionalPropertiesName"] ? (r(), m(f, { key: 0 }, [
            l(o(e.value["x-additionalPropertiesName"]), 1)
          ], 64)) : (r(), m(f, { key: 1 }, [
            l("additional properties")
          ], 64))
        ])) : a("", !0),
        (M = e.value) != null && M.deprecated ? (r(), m("div", K, [
          y(s(H), null, {
            default: u(() => t[13] || (t[13] = [
              l("deprecated")
            ])),
            _: 1,
            __: [13]
          })
        ])) : a("", !0),
        B.value !== void 0 ? (r(), m("div", Q, [
          y(n, { truncate: "" }, {
            prefix: u(() => t[14] || (t[14] = [
              l("const: ")
            ])),
            default: u(() => [
              y(h, { value: B.value }, null, 8, ["value"])
            ]),
            _: 1
          })
        ])) : (r(), m(f, { key: 6 }, [
          ((q = e.value) == null ? void 0 : q.nullable) === !0 ? (r(), i(n, { key: 0 }, {
            default: u(() => t[15] || (t[15] = [
              l(" nullable ")
            ])),
            _: 1,
            __: [15]
          })) : a("", !0)
        ], 64)),
        (w = e.value) != null && w.writeOnly ? (r(), m("div", U, " write-only ")) : (O = e.value) != null && O.readOnly ? (r(), m("div", W, " read-only ")) : a("", !0),
        e.required ? (r(), m("div", X, " required ")) : a("", !0),
        e.withExamples ? (r(), i(z, {
          key: 10,
          examples: (P = e.value) == null ? void 0 : P.examples,
          example: ((I = e.value) == null ? void 0 : I.example) || ((A = (V = e.value) == null ? void 0 : V.items) == null ? void 0 : A.example)
        }, null, 8, ["examples", "example"])) : a("", !0)
      ]);
    };
  }
});
export {
  ae as default
};
