import { defineComponent as V, computed as k, createElementBlock as d, openBlock as a, Fragment as l, createCommentVNode as c, createBlock as p, renderList as y } from "vue";
import h from "./SchemaProperty.vue.js";
const j = /* @__PURE__ */ V({
  __name: "SchemaObjectProperties",
  props: {
    schema: { type: [Object, Boolean] },
    compact: { type: Boolean },
    hideHeading: { type: Boolean },
    level: {},
    hideModelNames: { type: Boolean },
    schemas: {},
    discriminator: {},
    discriminatorMapping: {},
    discriminatorPropertyName: {},
    hasDiscriminator: { type: Boolean },
    breadcrumb: {}
  },
  emits: ["update:modelValue"],
  setup(s, { emit: v }) {
    const P = v, M = k(() => {
      if (!s.schema.properties)
        return [];
      const e = Object.keys(s.schema.properties), t = new Set(s.schema.required || []);
      return e.sort((r, i) => {
        const m = t.has(r), o = t.has(i);
        return m && !o ? -1 : !m && o ? 1 : r.localeCompare(i);
      });
    }), n = (e) => {
      P("update:modelValue", e);
    }, f = (e) => typeof e == "object" && typeof e["x-additionalPropertiesName"] == "string" && e["x-additionalPropertiesName"].trim().length > 0 ? `${e["x-additionalPropertiesName"].trim()}*` : "propertyName*", u = (e) => e === !0 || typeof e == "object" && Object.keys(e).length === 0 || typeof e != "object" || !("type" in e) ? {
      type: "anything",
      ...typeof e == "object" ? e : {}
    } : e;
    return (e, t) => (a(), d(l, null, [
      e.schema.properties ? (a(!0), d(l, { key: 0 }, y(M.value, (r) => {
        var i, m, o, N, b, g;
        return a(), p(h, {
          key: r,
          breadcrumb: e.breadcrumb,
          compact: e.compact,
          hideHeading: e.hideHeading,
          level: e.level,
          name: r,
          hideModelNames: e.hideModelNames,
          required: ((i = e.schema.required) == null ? void 0 : i.includes(r)) || ((m = e.schema.properties[r]) == null ? void 0 : m.required) === !0,
          schemas: e.schemas,
          resolvedSchema: e.schema.properties[r],
          value: {
            ...e.schema.properties[r],
            parent: e.schema,
            isDiscriminator: r === e.discriminatorPropertyName || ((o = e.schema.discriminator) == null ? void 0 : o.propertyName) === r
          },
          discriminatorMapping: ((N = e.schema.discriminator) == null ? void 0 : N.mapping) || e.discriminatorMapping,
          discriminatorPropertyName: ((b = e.schema.discriminator) == null ? void 0 : b.propertyName) || e.discriminatorPropertyName,
          isDiscriminator: r === (((g = e.schema.discriminator) == null ? void 0 : g.propertyName) || e.discriminatorPropertyName),
          modelValue: e.discriminator,
          "onUpdate:modelValue": n
        }, null, 8, ["breadcrumb", "compact", "hideHeading", "level", "name", "hideModelNames", "required", "schemas", "resolvedSchema", "value", "discriminatorMapping", "discriminatorPropertyName", "isDiscriminator", "modelValue"]);
      }), 128)) : c("", !0),
      e.schema.patternProperties ? (a(!0), d(l, { key: 1 }, y(Object.keys(e.schema.patternProperties), (r) => (a(), p(h, {
        breadcrumb: e.breadcrumb,
        key: r,
        variant: "patternProperties",
        compact: e.compact,
        hideHeading: e.hideHeading,
        level: e.level,
        name: r,
        hideModelNames: e.hideModelNames,
        schemas: e.schemas,
        resolvedSchema: e.schema.patternProperties[r],
        value: {
          ...e.schema.patternProperties[r]
        },
        discriminatorMapping: e.discriminatorMapping,
        discriminatorPropertyName: e.discriminatorPropertyName,
        isDiscriminator: !1,
        modelValue: e.discriminator,
        "onUpdate:modelValue": n
      }, null, 8, ["breadcrumb", "compact", "hideHeading", "level", "name", "hideModelNames", "schemas", "resolvedSchema", "value", "discriminatorMapping", "discriminatorPropertyName", "modelValue"]))), 128)) : c("", !0),
      e.schema.additionalProperties ? (a(), p(h, {
        key: 2,
        breadcrumb: e.breadcrumb,
        variant: "additionalProperties",
        compact: e.compact,
        hideHeading: e.hideHeading,
        level: e.level,
        name: f(e.schema.additionalProperties),
        hideModelNames: e.hideModelNames,
        schemas: e.schemas,
        resolvedSchema: u(e.schema.additionalProperties),
        value: u(e.schema.additionalProperties),
        discriminatorMapping: e.discriminatorMapping,
        discriminatorPropertyName: e.discriminatorPropertyName,
        isDiscriminator: !1,
        modelValue: e.discriminator,
        noncollapsible: "",
        "onUpdate:modelValue": n
      }, null, 8, ["breadcrumb", "compact", "hideHeading", "level", "name", "hideModelNames", "schemas", "resolvedSchema", "value", "discriminatorMapping", "discriminatorPropertyName", "modelValue"])) : c("", !0)
    ], 64));
  }
});
export {
  j as default
};
