(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("overlayscrollbars")):typeof define=="function"&&define.amd?define(["exports","vue","overlayscrollbars"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.OverlayScrollbarsVue={},s.Vue,s.OverlayScrollbarsGlobal))})(this,function(s,e,S){"use strict";const k=()=>{if(typeof window>"u"){const n=()=>{};return[n,n]}let i,o;const r=window,a=typeof r.requestIdleCallback=="function",c=r.requestAnimationFrame,l=r.cancelAnimationFrame,p=a?r.requestIdleCallback:c,y=a?r.cancelIdleCallback:l,t=()=>{y(i),l(o)};return[(n,m)=>{t(),i=p(a?()=>{t(),o=c(n)}:n,typeof m=="object"?m:{timeout:2233})},t]},w=i=>{let o=null,r,a,c;const l=e.shallowRef(i||{}),[p,y]=k();return e.watch(()=>{var t;return e.unref((t=l.value)==null?void 0:t.defer)},t=>{c=t},{deep:!0,immediate:!0}),e.watch(()=>{var t;return e.unref((t=l.value)==null?void 0:t.options)},t=>{r=t,S.OverlayScrollbars.valid(o)&&o.options(r||{},!0)},{deep:!0,immediate:!0}),e.watch(()=>{var t;return e.unref((t=l.value)==null?void 0:t.events)},t=>{a=t,S.OverlayScrollbars.valid(o)&&o.on(a||{},!0)},{deep:!0,immediate:!0}),e.onUnmounted(()=>{y(),o==null||o.destroy()}),[t=>{if(S.OverlayScrollbars.valid(o))return o;const n=()=>o=S.OverlayScrollbars(t,r||{},a||{});c?p(n,c):n()},()=>o]},I=e.defineComponent({__name:"OverlayScrollbarsComponent",props:{element:{type:[String,Object],default:"div"},options:{type:Object},events:{type:Object},defer:{type:[Boolean,Object]}},emits:["osInitialized","osUpdated","osDestroyed","osScroll"],setup(i,{expose:o,emit:r}){const a=i,c={initialized:"osInitialized",updated:"osUpdated",destroyed:"osDestroyed",scroll:"osScroll"},{element:l,options:p,events:y,defer:t}=e.toRefs(a),n=e.shallowRef(null),m=e.shallowRef(null),h=e.ref(),[R,v]=w({options:p,events:h,defer:t});return o({osInstance:v,getElement:()=>n.value}),e.watchPostEffect(d=>{const{value:f}=n,{value:b}=m;f&&(R(l.value==="body"?{target:f,cancel:{body:null}}:{target:f,elements:{viewport:b,content:b}}),d(()=>{var u;return(u=v())==null?void 0:u.destroy()}))}),e.watch(()=>e.unref(y),d=>{const f=d||{};h.value=Object.keys(c).reduce((b,u)=>{const O=f[u];return b[u]=[(...C)=>r(c[u],...C),...(Array.isArray(O)?O:[O]).filter(Boolean)],b},{})},{deep:!0,immediate:!0}),(d,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(l)),{"data-overlayscrollbars-initialize":"",ref_key:"elementRef",ref:n},{default:e.withCtx(()=>[e.unref(l)==="body"?e.renderSlot(d.$slots,"default",{key:0}):(e.openBlock(),e.createElementBlock("div",{key:1,"data-overlayscrollbars-contents":"",ref_key:"slotRef",ref:m},[e.renderSlot(d.$slots,"default")],512))]),_:3},512))}});s.OverlayScrollbarsComponent=I,s.useOverlayScrollbars=w,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
//# sourceMappingURL=overlayscrollbars-vue.umd.js.map
