import{p as I,cx as L,cy as A,d as F,cz as N,h as E,cA as M,cB as O,i as G,b1 as H,cC as U,cD as p,cE as z,bl as Q,cF as j,o as q,E as x,bn as h,F as g,aa as J,cG as K,x as W,cs as C,y as s,cH as X,ci as Y,ch as Z,au as T,bU as $,cI as ee,bQ as te}from"./index-lCRwTiBk.js";function ae(e){const n=h(e);let t=-1;function a(){clearInterval(t)}function m(){a(),te(()=>n.value=e)}function v(r){const d=r?getComputedStyle(r):{transitionDuration:.2},i=parseFloat(d.transitionDuration)*1e3||200;if(a(),n.value<=0)return;const f=performance.now();t=window.setInterval(()=>{const k=performance.now()-f+i;n.value=Math.max(e-k,0),n.value<=0&&a()},i)}return ee(a),{clear:a,time:n,start:v,reset:m}}const ne=I({multiLine:Boolean,text:String,timer:[Boolean,String],timeout:{type:[Number,String],default:5e3},vertical:Boolean,...L({location:"bottom"}),...A(),...F(),...N(),...E(),...M(O({transition:"v-snackbar-transition"}),["persistent","noClickAnimation","scrim","scrollStrategy"])},"VSnackbar"),oe=G()({name:"VSnackbar",props:ne(),emits:{"update:modelValue":e=>!0},setup(e,n){let{slots:t}=n;const a=H(e,"modelValue"),{locationStyles:m}=U(e),{positionClasses:v}=p(e),{scopeId:r}=z(),{themeClasses:d}=Q(e),{colorClasses:i,colorStyles:f,variantClasses:k}=j(e),{roundedClasses:_}=q(e),l=ae(Number(e.timeout)),V=x(),w=x(),b=h(!1);g(a,c),g(()=>e.timeout,c),J(()=>{a.value&&c()});let y=-1;function c(){l.reset(),window.clearTimeout(y);const o=Number(e.timeout);if(!a.value||o===-1)return;const P=K(w.value);l.start(P),y=window.setTimeout(()=>{a.value=!1},o)}function R(){l.reset(),window.clearTimeout(y)}function B(){b.value=!0,R()}function D(){b.value=!1,c()}return W(()=>{const o=C.filterProps(e),P=!!(t.default||t.text||e.text);return s(C,T({ref:V,class:["v-snackbar",{"v-snackbar--active":a.value,"v-snackbar--multi-line":e.multiLine&&!e.vertical,"v-snackbar--timer":!!e.timer,"v-snackbar--vertical":e.vertical},v.value,e.class],style:e.style},o,{modelValue:a.value,"onUpdate:modelValue":u=>a.value=u,contentProps:T({class:["v-snackbar__wrapper",d.value,i.value,_.value,k.value],style:[m.value,f.value],onPointerenter:B,onPointerleave:D},o.contentProps),persistent:!0,noClickAnimation:!0,scrim:!1,scrollStrategy:"none",_disableGlobalStack:!0},r),{default:()=>{var u,S;return[X(!1,"v-snackbar"),e.timer&&!b.value&&s("div",{key:"timer",class:"v-snackbar__timer"},[s(Y,{ref:w,color:typeof e.timer=="string"?e.timer:"info",max:e.timeout,"model-value":l.time.value},null)]),P&&s("div",{key:"content",class:"v-snackbar__content",role:"status","aria-live":"polite"},[((u=t.text)==null?void 0:u.call(t))??e.text,(S=t.default)==null?void 0:S.call(t)]),t.actions&&s(Z,{defaults:{VBtn:{variant:"text",ripple:!1,slim:!0}}},{default:()=>[s("div",{class:"v-snackbar__actions"},[t.actions()])]})]},activator:t.activator})}),$({},V)}});export{oe as V};