"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const ActionBar = require("../action-bar/ActionBar.js");
const index_esm = require("../../../@vant/use/dist/index.esm.js");
const useExpose = require("../composables/use-expose.js");
const useRoute = require("../composables/use-route.js");
const index = require("../button/index.js");
const basic = require("../utils/basic.js");
const create = require("../utils/create.js");
const [name, bem] = create.createNamespace("action-bar-button");
const actionBarButtonProps = basic.extend({}, useRoute.routeProps, {
  type: String,
  text: String,
  icon: String,
  color: String,
  loading: Boolean,
  disabled: Boolean
});
var stdin_default = Vue.defineComponent({
  name,
  props: actionBarButtonProps,
  setup(props, {
    slots
  }) {
    const route = useRoute.useRoute();
    const {
      parent,
      index: index$1
    } = index_esm.useParent(ActionBar.ACTION_BAR_KEY);
    const isFirst = Vue.computed(() => {
      if (parent) {
        const prev = parent.children[index$1.value - 1];
        return !(prev && "isButton" in prev);
      }
    });
    const isLast = Vue.computed(() => {
      if (parent) {
        const next = parent.children[index$1.value + 1];
        return !(next && "isButton" in next);
      }
    });
    useExpose.useExpose({
      isButton: true
    });
    return () => {
      const {
        type,
        icon,
        text,
        color,
        loading,
        disabled
      } = props;
      return Vue.createVNode(index.Button, {
        "class": bem([type, {
          last: isLast.value,
          first: isFirst.value
        }]),
        "size": "large",
        "type": type,
        "icon": icon,
        "color": color,
        "loading": loading,
        "disabled": disabled,
        "onClick": route
      }, {
        default: () => [slots.default ? slots.default() : text]
      });
    };
  }
});
exports.actionBarButtonProps = actionBarButtonProps;
exports.default = stdin_default;
