import{_ as H}from"./BSpinner.vue_vue_type_script_setup_true_lang-H1MzHypA-D8AXjJB0.js";import{u as L,a as V,_ as x}from"./BLink.vue_vue_type_script_setup_true_lang-Ct47WhzE-DDPYis_D.js";import{o as D}from"./index-C0p9vHHI-DoOEDIMw.js";import{u as $}from"./useDefaults-DESCdb0p-CFLjYrdG.js";import{l as F,m,q as N,p as P,x as t,c as S,o as y,w as q,J as r,D as a,L as z,G as M,d as w,h as A,F as I,e as R,t as W,b as E}from"./index-D02r7Zsc.js";const Y=F({__name:"BButton",props:m({loading:{type:Boolean,default:!1},loadingFill:{type:Boolean,default:!1},loadingText:{default:"Loading..."},pill:{type:Boolean,default:!1},size:{default:"md"},squared:{type:Boolean,default:!1},tag:{default:"button"},type:{default:"button"},variant:{default:"secondary"},active:{type:Boolean,default:!1},activeClass:{default:void 0},disabled:{type:Boolean,default:void 0},exactActiveClass:{default:void 0},href:{default:void 0},icon:{type:Boolean,default:!1},noRel:{type:Boolean},opacity:{default:void 0},opacityHover:{default:void 0},prefetch:{type:Boolean},prefetchOn:{},noPrefetch:{type:Boolean},prefetchedClass:{},rel:{default:void 0},replace:{type:Boolean,default:void 0},routerComponentName:{default:void 0},routerTag:{default:void 0},stretched:{type:Boolean,default:!1},target:{default:void 0},to:{default:void 0},underlineOffset:{default:void 0},underlineOffsetHover:{default:void 0},underlineOpacity:{default:void 0},underlineOpacityHover:{default:void 0},underlineVariant:{default:null}},{pressed:{type:Boolean,default:void 0},pressedModifiers:{}}),emits:m(["click"],["update:pressed"]),setup(d,{emit:g}){const e=$(d,"BButton"),b=g,u=N("_element"),o=P(d,"pressed"),{computedLink:n,computedLinkProps:k}=L(e,["active-class","exact-active-class","replace","routerComponentName","routerTag"]),i=t(()=>typeof o.value=="boolean"),s=t(()=>e.tag==="button"&&e.href===void 0&&e.to===void 0),f=t(()=>e.to!==void 0),c=t(()=>e.href!==void 0?!1:!s.value),B=t(()=>f.value?k.value:[]),h=t(()=>e.href==="#"&&e.disabled?!0:c.value?e.disabled:null),p=t(()=>e.variant?.startsWith("link")||!1),v=t(()=>e.variant?.startsWith("link-")||!1),C=V(t(()=>({...p.value?{icon:e.icon,opacity:e.opacity,opacityHover:e.opacityHover,underlineOffset:e.underlineOffset,underlineOffsetHover:e.underlineOffsetHover,underlineOpacity:e.underlineOpacity,underlineOpacityHover:e.underlineOpacityHover,underlineVariant:e.underlineVariant,variant:v.value===!0?e.variant?.slice(5):null}:void 0}))),O=t(()=>[p.value===!0&&n.value===!1?C.value:void 0,[`btn-${e.size}`],{[`btn-${e.variant}`]:e.variant!==null&&v.value===!1,active:e.active||o.value,"rounded-pill":e.pill,"rounded-0":e.squared,disabled:e.disabled}]),_=t(()=>f.value?x:e.href?"a":e.tag),T=l=>{if(e.disabled){l.preventDefault(),l.stopPropagation();return}b("click",l),i.value&&(o.value=!o.value)};return D([" ","enter"],l=>{e.href==="#"&&(l.preventDefault(),u.value?.click())},{target:u}),(l,J)=>(y(),S(M(_.value),z({ref:"_element",class:"btn"},B.value,{class:O.value,"aria-disabled":h.value,"aria-pressed":i.value?o.value:null,autocomplete:i.value?"off":null,disabled:s.value?a(e).disabled:null,href:a(e).href,rel:a(n)?a(e).rel:null,role:c.value||a(n)?"button":null,target:a(n)?a(e).target:null,type:s.value?a(e).type:null,to:s.value?null:a(e).to,onClick:T}),{default:q(()=>[a(e).loading?r(l.$slots,"loading",{key:0},()=>[a(e).loadingFill?A("",!0):(y(),w(I,{key:0},[R(W(a(e).loadingText),1)],64)),r(l.$slots,"loading-spinner",{},()=>[E(H,{small:a(e).size!=="lg",label:a(e).loadingFill?a(e).loadingText:void 0},null,8,["small","label"])])]):r(l.$slots,"default",{key:1})]),_:3},16,["class","aria-disabled","aria-pressed","autocomplete","disabled","href","rel","role","target","type","to"]))}});export{Y as _};
