import { x as c, n as o } from "./plus-base-10eea8a6.mjs";
import { e as g } from "./custom-element-eaccb8d2.mjs";
import { t as y } from "./state-f0bfed48.mjs";
import $ from "./plus.js";
import { F as I } from "./floating.service-ed834de8.mjs";
import { s as z } from "./index-975d3293.mjs";
import "./floating-ui-5c56eab3.mjs";
const _ = z({
  slots: {
    base: ["plus-popconfirm font-sans antialiased", " max-w-96", "absolute top-0 left-0 z-50 hidden"],
    descriptionClass: [""],
    titleClass: ["font-medium flex gap-2 items-center"],
    arrowClass: ["arrow absolute w-3 h-3 bg-color-default rotate-45 rounded-sm z-auto shadow-md z-[-1]"],
    contentClass: ["flex flex-col gap-2.5"],
    footerClass: ["flex justify-end gap-2"],
    wrapperClass: ["flex flex-col gap-5 p-5 rounded bg-color-default text-color-default "],
    prefixIconClass: ["text-color-primary"]
  },
  variants: {
    size: {
      sm: {
        base: [""],
        descriptionClass: ["text-xs"],
        titleClass: ["text-sm"],
        contentClass: [""],
        footerClass: [""],
        wrapperClass: ["p-3"]
      },
      md: {
        base: [""],
        descriptionClass: ["text-sm"],
        titleClass: ["text-base"],
        contentClass: [""],
        footerClass: [""],
        wrapperClass: ["p-3.5"]
      },
      lg: {
        base: [""],
        descriptionClass: ["text-base"],
        titleClass: ["text-lg"],
        contentClass: [""],
        footerClass: [""],
        wrapperClass: ["p-4"]
      }
    },
    available: {
      true: {
        base: ["shadow-md"]
      },
      false: {
        base: []
      }
    },
    status: {
      default: [""],
      success: {
        prefixIconClass: ["text-color-success"]
      },
      warning: {
        prefixIconClass: ["text-color-warning"]
      },
      error: {
        prefixIconClass: ["text-color-error"]
      },
      info: {
        prefixIconClass: ["text-color-info"]
      },
      primary: {
        prefixIconClass: ["text-color-primary"]
      },
      attention: {
        prefixIconClass: ["text-color-default"]
      }
    }
  },
  compoundVariants: [],
  defaultVariants: {
    size: "md",
    available: !0,
    status: "default"
  }
});
var S = Object.defineProperty, P = Object.getOwnPropertyDescriptor, s = (e, r, l, i) => {
  for (var a = i > 1 ? void 0 : i ? P(r, l) : r, n = e.length - 1, p; n >= 0; n--)
    (p = e[n]) && (a = (i ? p(r, l, a) : p(a)) || a);
  return i && a && S(r, l, a), a;
};
let t = class extends I {
  constructor() {
    super(), this.size = $.Sizes.md, this.placement = "top", this.showArrow = !0, this.status = "primary", this.okText = "Confirm", this.cancelText = "Cancel", this.trigger = "click", this._prefixIcon = "";
  }
  set prefixIcon(e) {
    this._prefixIcon = e;
  }
  get prefixIcon() {
    const e = {
      info: "fa-solid fa-circle-info",
      success: "fa-solid fa-circle-check",
      warning: "fa-solid fa-triangle-exclamation",
      error: "fa-solid fa-xmark-circle",
      attention: "fa-solid fa-circle-exclamation"
    };
    return this._prefixIcon ? this._prefixIcon : e[this.status];
  }
  onConfirm() {
    this.emit("plus-confirm"), this.hide();
  }
  onCancel() {
    this.emit("plus-cancel"), this.hide();
  }
  firstUpdated() {
    this.options = {
      ...this.options,
      position: this.placement,
      showArrow: this.showArrow
    };
  }
  render() {
    const { size: e, title: r, prefixIcon: l, description: i, showArrow: a, cancelText: n, okText: p, status: f } = this, { base: d, contentClass: x, footerClass: u, wrapperClass: m, titleClass: C, descriptionClass: h, prefixIconClass: w, arrowClass: v } = _({
      size: e,
      available: !!(r || i),
      status: f
    }), b = () => {
      if (l)
        return c`<div class=${w()}><i class=${l}></i></div>`;
    };
    return c`
      <slot @slotchange=${this.handleSlotChange.bind(this)}></slot>
      <div class=${d()}>
        <div class=${m()}>
          <div class=${x()}>
            ${a && (r || i) ? c`<div class=${v()}></div>` : ""}
            ${r ? c`<div class=${C()}>${b()}<span>${r}</span></div>` : ""}
            ${i ? c`<div class=${h()}>${i}</div>` : ""}
          </div>
          <div class=${u()}>
            <plus-button @click=${this.onCancel} size=${e}>${n}</plus-button>
            <plus-button @click=${this.onConfirm} status=${f != "attention" ? f : "invert"} size=${e}>${p}</plus-button>
          </div>
        </div>
      </div>
    `;
  }
};
s([
  o({ type: String })
], t.prototype, "size", 2);
s([
  o({ type: String })
], t.prototype, "placement", 2);
s([
  o({ type: Boolean, attribute: "show-arrow" })
], t.prototype, "showArrow", 2);
s([
  o({ type: String })
], t.prototype, "title", 2);
s([
  o({ type: String })
], t.prototype, "description", 2);
s([
  o({ type: String })
], t.prototype, "status", 2);
s([
  o({ attribute: "ok-text" })
], t.prototype, "okText", 2);
s([
  o({ attribute: "cancel-text" })
], t.prototype, "cancelText", 2);
s([
  o()
], t.prototype, "trigger", 2);
s([
  y()
], t.prototype, "_prefixIcon", 2);
s([
  o({ type: String })
], t.prototype, "prefixIcon", 1);
t = s([
  g("plus-popconfirm")
], t);
export {
  t as PopconfirmComponent
};
