"use strict";
const vue = require("vue");
const useFormSelect = require("./useFormSelect-BrveyBvf.js");
const useDefaults = require("./useDefaults-YXpmugKp.js");
const useId = require("./useId-Dl8Hi5_U.js");
const _hoisted_1$1 = ["id"];
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
  __name: "BFormDatalistBase",
  props: {
    disabled: { type: Boolean, default: false },
    disabledField: { default: "disabled" },
    id: { default: void 0 },
    options: { default: () => [] },
    textField: { default: "text" },
    valueField: { default: "value" }
  },
  setup(__props) {
    const _props = __props;
    const props = useDefaults.useDefaults(_props, "BFormDatalist");
    const computedId = useId.useId(() => props.id, "datalist");
    const { normalizedOptions, isComplex } = useFormSelect.useFormSelect(
      () => props.options,
      vue.computed(() => ({ ...props, optionsField: "options", labelField: "label" }))
    );
    const normalizedOptsWrapper = vue.computed(
      () => (
        // Datalist doesn't support complex options
        normalizedOptions.value.filter((opt) => !isComplex(opt))
      )
    );
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("datalist", { id: vue.unref(computedId) }, [
        vue.renderSlot(_ctx.$slots, "first"),
        (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(normalizedOptsWrapper.value, (option, index) => {
          return vue.openBlock(), vue.createBlock(useFormSelect._sfc_main, vue.mergeProps({ key: index }, { ref_for: true }, option), {
            default: vue.withCtx(() => [
              vue.renderSlot(_ctx.$slots, "option", vue.mergeProps({ ref_for: true }, option), () => [
                vue.createTextVNode(vue.toDisplayString("text" in option ? option.text : ""), 1)
              ])
            ]),
            _: 2
          }, 1040);
        }), 128)),
        vue.renderSlot(_ctx.$slots, "default")
      ], 8, _hoisted_1$1);
    };
  }
});
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
  __name: "BFormDatalist",
  props: {
    disabled: { type: Boolean, default: false },
    disabledField: { default: "disabled" },
    id: { default: void 0 },
    options: { default: () => [] },
    textField: { default: "text" },
    valueField: { default: "value" }
  },
  setup(__props) {
    const props = __props;
    const normalizedOptions = vue.computed(
      () => props.options.map((el) => {
        if (typeof el === "string") {
          return el;
        }
        if (typeof el === "number") {
          return String(el);
        }
        if (typeof el === "boolean") {
          return String(el);
        }
        return {
          value: el[props.valueField],
          text: el[props.textField] ?? "",
          disabled: el[props.disabledField] ?? false
        };
      })
    );
    const forwardedProps = vue.computed(() => ({
      disabled: props.disabled,
      id: props.id
    }));
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createBlock(_sfc_main$2, vue.mergeProps(forwardedProps.value, {
        options: normalizedOptions.value
      }), {
        first: vue.withCtx(() => [
          vue.renderSlot(_ctx.$slots, "first")
        ]),
        option: vue.withCtx((slotProps) => [
          vue.renderSlot(_ctx.$slots, "option", vue.normalizeProps(vue.guardReactiveProps(slotProps)))
        ]),
        default: vue.withCtx(() => [
          vue.renderSlot(_ctx.$slots, "default")
        ]),
        _: 3
      }, 16, ["options"]);
    };
  }
});
const _hoisted_1 = { class: "form-floating" };
const _hoisted_2 = ["for"];
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  __name: "BFormFloatingLabel",
  props: {
    label: { default: void 0 },
    labelFor: { default: void 0 }
  },
  setup(__props) {
    const _props = __props;
    const props = useDefaults.useDefaults(_props, "BFormFloatingLabel");
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
        vue.renderSlot(_ctx.$slots, "default"),
        vue.createElementVNode("label", {
          for: vue.unref(props).labelFor
        }, [
          vue.renderSlot(_ctx.$slots, "label", {}, () => [
            vue.createTextVNode(vue.toDisplayString(vue.unref(props).label), 1)
          ])
        ], 8, _hoisted_2)
      ]);
    };
  }
});
exports._sfc_main = _sfc_main$1;
exports._sfc_main$1 = _sfc_main;
//# sourceMappingURL=BFormFloatingLabel.vue_vue_type_script_setup_true_lang-DxSvTRel.js.map
