"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),g=require("@antsoo-lib/icons"),k=require("../_util/canUseDom.js"),h=require("../_util/classNames.js"),F=require("../_util/hooks/useMergedState.js"),S=require("../_util/props-util/index.js"),y=require("../_util/transition.js"),D=require("../config-provider/hooks/useConfigInject.js"),m=require("./FloatButton.js"),G=require("./context.js"),T=require("./interface.js"),A=require("./style/index.js"),E=require("../_util/props-util/initDefaultProps.js"),I=e.defineComponent({compatConfig:{MODE:3},name:"AFloatButtonGroup",inheritAttrs:!1,props:E.default(T.floatButtonGroupProps(),{type:"default",shape:"circle"}),setup(n,{attrs:s,slots:o,emit:u}){const{prefixCls:d,direction:C}=D.default(m.floatButtonPrefixCls,n),[q,f]=A.default(d),[i,a]=F.default(!1,{value:e.computed(()=>n.open)}),p=e.ref(null),v=e.ref(null);G.useProvideFloatButtonGroupContext({shape:e.computed(()=>n.shape)});const O={onMouseenter(){a(!0),u("update:open",!0),n.onOpenChange?.(!0)},onMouseleave(){a(!1),u("update:open",!1),n.onOpenChange?.(!1)}},x=e.computed(()=>n.trigger==="hover"?O:{}),B=()=>{const t=!i.value;u("update:open",t),n.onOpenChange?.(t),a(t)},l=t=>{if(p.value?.contains(t.target)){S.findDOMNode(v.value)?.contains(t.target)&&B();return}a(!1),u("update:open",!1),n.onOpenChange?.(!1)};return e.watch(e.computed(()=>n.trigger),t=>{k.default()&&(document.removeEventListener("click",l),t==="click"&&document.addEventListener("click",l))},{immediate:!0}),e.onBeforeUnmount(()=>{document.removeEventListener("click",l)}),()=>{const{shape:t="circle",type:N="default",tooltip:$,description:w,trigger:c}=n,r=`${d.value}-group`,P=h.default(r,f.value,s.class,{[`${r}-rtl`]:C.value==="rtl",[`${r}-${t}`]:t,[`${r}-${t}-shadow`]:!c}),M=h.default(f.value,`${r}-wrap`),V=y.getTransitionProps(`${r}-wrap`);return q(e.createVNode("div",{ref:p,...s,class:P,...x.value},[c&&["click","hover"].includes(c)?e.createVNode(e.Fragment,null,[e.createVNode(e.Transition,V,{default:()=>[e.withDirectives(e.createVNode("div",{class:M},[o.default&&o.default()]),[[e.vShow,i.value]])]}),e.createVNode(m.default,{ref:v,type:N,shape:t,tooltip:$,description:w},{icon:()=>i.value?o.closeIcon?.()||e.createVNode(g.CloseOutlined,null,null):o.icon?.()||e.createVNode(g.FileTextOutlined,null,null),tooltip:o.tooltip,description:o.description})]):o.default?.()]))}}});exports.default=I;
