import{b as o,c as D,d as R}from"./chunk-UGBMCXS6.js";import{g,k as h,na as v}from"./chunk-4P6SOZDY.js";import{Aa as _,Da as f,cb as b,na as d,ra as n,za as u}from"./chunk-GJDGQISV.js";var y={capture:!0},I=["focus","mousedown","mouseenter","touchstart"],p="mat-ripple-loader-uninitialized",l="mat-ripple-loader-class-name",A="mat-ripple-loader-centered",s="mat-ripple-loader-disabled",N=(()=>{class r{_document=n(_);_animationsDisabled=v();_globalRippleOptions=n(R,{optional:!0});_platform=n(g);_ngZone=n(f);_injector=n(u);_eventCleanups;_hosts=new Map;constructor(){let e=n(b).createRenderer(null,null);this._eventCleanups=this._ngZone.runOutsideAngular(()=>I.map(t=>e.listen(this._document,t,this._onInteraction,y)))}ngOnDestroy(){let e=this._hosts.keys();for(let t of e)this.destroyRipple(t);this._eventCleanups.forEach(t=>t())}configureRipple(e,t){e.setAttribute(p,this._globalRippleOptions?.namespace??""),(t.className||!e.hasAttribute(l))&&e.setAttribute(l,t.className||""),t.centered&&e.setAttribute(A,""),t.disabled&&e.setAttribute(s,"")}setDisabled(e,t){let i=this._hosts.get(e);i?(i.target.rippleDisabled=t,!t&&!i.hasSetUpEvents&&(i.hasSetUpEvents=!0,i.renderer.setupTriggerEvents(e))):t?e.setAttribute(s,""):e.removeAttribute(s)}_onInteraction=e=>{let t=h(e);if(t instanceof HTMLElement){let i=t.closest(`[${p}="${this._globalRippleOptions?.namespace??""}"]`);i&&this._createRipple(i)}};_createRipple(e){if(!this._document||this._hosts.has(e))return;e.querySelector(".mat-ripple")?.remove();let t=this._document.createElement("span");t.classList.add("mat-ripple",e.getAttribute(l)),e.append(t);let i=this._globalRippleOptions,E=this._animationsDisabled?0:i?.animation?.enterDuration??o.enterDuration,O=this._animationsDisabled?0:i?.animation?.exitDuration??o.exitDuration,a={rippleDisabled:this._animationsDisabled||i?.disabled||e.hasAttribute(s),rippleConfig:{centered:e.hasAttribute(A),terminateOnPointerUp:i?.terminateOnPointerUp,animation:{enterDuration:E,exitDuration:O}}},c=new D(a,this._ngZone,t,this._platform,this._injector),m=!a.rippleDisabled;m&&c.setupTriggerEvents(e),this._hosts.set(e,{target:a,renderer:c,hasSetUpEvents:m}),e.removeAttribute(p)}destroyRipple(e){let t=this._hosts.get(e);t&&(t.renderer._removeTriggerEvents(),this._hosts.delete(e))}static \u0275fac=function(t){return new(t||r)};static \u0275prov=d({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{N as a};
