var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var stdin_exports = {};
__export(stdin_exports, {
  FooterToolbar: () => FooterToolbar
});
module.exports = __toCommonJS(stdin_exports);
var import_vue = require("vue");
var import_pro_utils = require("@antdv/pro-utils");
var import_context = require("ant-design-vue/lib/config-provider/context");
var import_vue2 = require("vue");
var import__ = require("../../index");
var import_style = require("./style");
var import_stylish = require("./style/stylish");
const FooterToolbar = (0, import_vue2.defineComponent)((props, {
  attrs,
  slots
}) => {
  const contextValue = import__.RouteContext.useContext();
  const {
    getPrefixCls,
    getTargetContainer
  } = (0, import_context.useConfigContextInject)();
  const prefixCls = props.prefixCls || getPrefixCls("pro");
  const baseClassName = (0, import_vue2.computed)(() => `${prefixCls}-footer-bar`);
  const {
    wrapSSR,
    hashId
  } = (0, import_style.useStyle)(baseClassName);
  (0, import_vue2.onMounted)(() => {
    contextValue.hasFooterToolbar = true;
  });
  (0, import_vue2.onUnmounted)(() => {
    contextValue.hasFooterToolbar = false;
  });
  const width = (0, import_vue2.computed)(() => {
    if (!contextValue.hasSiderMenu) {
      return void 0;
    }
    if (!contextValue.siderWidth) {
      return "100%";
    }
    return contextValue.isMobile ? "100%" : `calc(100% - ${contextValue.siderWidth}px)`;
  });
  const stylish = (0, import_stylish.useStylish)((0, import_vue2.computed)(() => `${baseClassName.value}.${baseClassName.value}-stylish`), {
    stylish: props.stylish
  });
  return () => {
    var _a, _b, _d;
    const _c = props, {
      children = (_a = slots.default) == null ? void 0 : _a.call(slots),
      className = attrs.class,
      extra = (_b = slots.extra) == null ? void 0 : _b.call(slots),
      portalDom = true,
      style,
      renderContent
    } = _c, restProps = __objRest(_c, [
      "children",
      "className",
      "extra",
      "portalDom",
      "style",
      "renderContent"
    ]);
    const containerDom = typeof window === "undefined" || typeof document === "undefined" ? null : ((_d = getTargetContainer == null ? void 0 : getTargetContainer.value) == null ? void 0 : _d.call(getTargetContainer)) || document.body;
    const dom = (0, import_vue.createVNode)(import_vue.Fragment, null, [(0, import_vue.createVNode)("div", {
      "class": `${baseClassName.value}-left ${hashId.value}`.trim()
    }, [extra]), (0, import_vue.createVNode)("div", {
      "class": `${baseClassName.value}-right ${hashId.value}`.trim()
    }, [children])]);
    const renderDom = (0, import_vue.createVNode)("div", (0, import_vue.mergeProps)({
      "class": (0, import_pro_utils.classNames)(className, hashId.value, baseClassName.value, {
        [`${baseClassName.value}-stylish`]: !!props.stylish
      }),
      "style": __spreadValues({
        width: width.value
      }, style)
    }, (0, import_pro_utils.omit)(restProps, ["prefixCls"])), [renderContent ? renderContent(__spreadProps(__spreadValues(__spreadValues({}, props), contextValue), {
      leftWidth: width.value
    })) : dom]);
    const ssrDom = !(0, import_pro_utils.isBrowser)() || !portalDom || !containerDom ? renderDom : (0, import_vue.createVNode)(import_vue2.Teleport, {
      "to": containerDom
    }, {
      default: () => [renderDom]
    });
    return stylish.wrapSSR(wrapSSR((0, import_vue.createVNode)(import_vue.Fragment, null, [ssrDom])));
  };
}, {
  name: "FooterToolbar",
  inheritAttrs: false,
  props: ["extra", "style", "className", "renderContent", "prefixCls", "stylish", "children", "portalDom"],
  slots: Object
});
