import{m as N,u as E,a as x,f as F}from"./VMenu-97c1c955.js";import{V as O,u as Y}from"./layout-42d7f450.js";import{z,A as G,g as $,B as j,C as H,D as J,n as K,c as U,E as q,r as Q,F as W}from"./VListItem-cb387084.js";import{l as X,v as Z,as as ee,m as te,A as ae,a4 as ne,r as V,a5 as w,at as se,au as oe,J as _,o as re,av as ie,z as le,f as o,G as L,aw as ue,ar as ce,ax as me}from"./index-2dd0c7d2.js";function ve(e){const s=w(e);let a=-1;function t(){clearInterval(a)}function v(){t(),ce(()=>s.value=e)}function f(i){const d=i?getComputedStyle(i):{transitionDuration:.2},l=parseFloat(d.transitionDuration)*1e3||200;if(t(),s.value<=0)return;const k=performance.now();a=window.setInterval(()=>{const y=performance.now()-k+l;s.value=Math.max(e-y,0),s.value<=0&&t()},l)}return ue(t),{clear:t,time:s,start:f,reset:v}}const fe=X({multiLine:Boolean,text:String,timer:[Boolean,String],timeout:{type:[Number,String],default:5e3},vertical:Boolean,...z({location:"bottom"}),...G(),...$(),...j(),...Z(),...ee(N({transition:"v-snackbar-transition"}),["persistent","noClickAnimation","scrim","scrollStrategy"])},"VSnackbar"),Pe=te()({name:"VSnackbar",props:fe(),emits:{"update:modelValue":e=>!0},setup(e,s){let{slots:a}=s;const t=ae(e,"modelValue"),{positionClasses:v}=H(e),{scopeId:f}=E(),{themeClasses:i}=ne(e),{colorClasses:d,colorStyles:l,variantClasses:k}=J(e),{roundedClasses:y}=K(e),u=ve(Number(e.timeout)),S=V(),h=V(),b=w(!1),g=w(0),T=V(),p=se(O,void 0);oe(()=>!!p,()=>{const n=Y();me(()=>{T.value=n.mainStyles.value})}),_(t,c),_(()=>e.timeout,c),re(()=>{t.value&&c()});let P=-1;function c(){u.reset(),window.clearTimeout(P);const n=Number(e.timeout);if(!t.value||n===-1)return;const r=ie(h.value);u.start(r),P=window.setTimeout(()=>{t.value=!1},n)}function R(){u.reset(),window.clearTimeout(P)}function A(){b.value=!0,R()}function B(){b.value=!1,c()}function D(n){g.value=n.touches[0].clientY}function I(n){Math.abs(g.value-n.changedTouches[0].clientY)>50&&(t.value=!1)}const M=le(()=>e.location.split(" ").reduce((n,r)=>(n[`v-snackbar--${r}`]=!0,n),{}));return U(()=>{const n=x.filterProps(e),r=!!(a.default||a.text||e.text);return o(x,L({ref:S,class:["v-snackbar",{"v-snackbar--active":t.value,"v-snackbar--multi-line":e.multiLine&&!e.vertical,"v-snackbar--timer":!!e.timer,"v-snackbar--vertical":e.vertical},M.value,v.value,e.class],style:[T.value,e.style]},n,{modelValue:t.value,"onUpdate:modelValue":m=>t.value=m,contentProps:L({class:["v-snackbar__wrapper",i.value,d.value,y.value,k.value],style:[l.value],onPointerenter:A,onPointerleave:B},n.contentProps),persistent:!0,noClickAnimation:!0,scrim:!1,scrollStrategy:"none",_disableGlobalStack:!0,onTouchstartPassive:D,onTouchend:I},f),{default:()=>{var m,C;return[q(!1,"v-snackbar"),e.timer&&!b.value&&o("div",{key:"timer",class:"v-snackbar__timer"},[o(Q,{ref:h,color:typeof e.timer=="string"?e.timer:"info",max:e.timeout,"model-value":u.time.value},null)]),r&&o("div",{key:"content",class:"v-snackbar__content",role:"status","aria-live":"polite"},[((m=a.text)==null?void 0:m.call(a))??e.text,(C=a.default)==null?void 0:C.call(a)]),a.actions&&o(W,{defaults:{VBtn:{variant:"text",ripple:!1,slim:!0}}},{default:()=>[o("div",{class:"v-snackbar__actions"},[a.actions({isActive:t})])]})]},activator:a.activator})}),F({},S)}});export{Pe as V};
