import{definePlugin}from"../../core/extension";import{ModelMouseEvent}from"../../common/constant";export default definePlugin("hover-color",{destroyed(){this.dispose()},setup(a,b){let c,d=a.color||"#FF0000",e=a.opacity||.5,f="";const g=a=>{c&&h(),f=a.model.color,a.model.color=`${d} ${e}`,c=a},h=()=>{c&&(c.model.color=f,c=void 0,f="")};let i,j=b.addEventListener(ModelMouseEvent.Hover,a=>{let b=a.params.component;if(c!=b){if(i){let b=i(a);if(!1===b)return}b?g(b):h()}});return{hover:g,blur:h,interceptor:a=>(i=a,()=>{i=void 0}),dispose(){j()}}}});