import { h as attr_class, aj as attr, l as escape_html, al as spread_props, n as derived, d as stringify } from './index-BHoOpAe1.js';
import { B as Button, h as html } from './Button-DPcpECFE.js';
import { c as closeSvg } from './close-DR469d4F.js';

/* empty css                                          */
function Pill($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    let {
      text,
      dismissible = false,
      disabled = false,
      testId,
      dismissIcon,
      onclick,
      ondismiss,
      classes
    } = $$props;
    let interactive = derived(() => typeof onclick === "function");
    function handleDismiss(event) {
      event.stopPropagation();
      if (disabled) {
        return;
      }
      ondismiss?.();
    }
    $$renderer2.push(`<div${attr_class(`pill ${stringify(classes ?? "")}`, "svelte-1y6787q", { "disabled": disabled })}${attr("role", interactive() ? "button" : null)}${attr("tabindex", interactive() ? 0 : null)}${attr("aria-disabled", interactive() && disabled ? true : null)}${attr("data-pw", typeof testId === "string" ? testId : null)}><span class="pill-text svelte-1y6787q">${escape_html(text)}</span> `);
    if (dismissible) {
      $$renderer2.push("<!--[0-->");
      $$renderer2.push(`<div class="pill-dismiss svelte-1y6787q">`);
      Button($$renderer2, spread_props([
        { disabled, onclick: handleDismiss, ariaLabel: "Dismiss" },
        typeof testId === "string" ? { testId: `${testId}-dismiss` } : {},
        {
          children: ($$renderer3) => {
            if (typeof dismissIcon === "function") {
              $$renderer3.push("<!--[0-->");
              dismissIcon($$renderer3);
              $$renderer3.push(`<!---->`);
            } else {
              $$renderer3.push("<!--[-1-->");
              $$renderer3.push(`${html(closeSvg)}`);
            }
            $$renderer3.push(`<!--]-->`);
          },
          $$slots: { default: true }
        }
      ]));
      $$renderer2.push(`<!----></div>`);
    } else {
      $$renderer2.push("<!--[-1-->");
    }
    $$renderer2.push(`<!--]--></div>`);
  });
}

export { Pill as P };
//# sourceMappingURL=Pill-CbH1G79Z.js.map
