/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
import{inherits as e,createSuper as i,classCallCheck as t,defineProperty as o,assertThisInitialized as n,createClass as l}from"../../_virtual/_rollupPluginBabelHelpers.js";import r from"../../utils/sniffer.js";import{ENTER_PLAYER as a,LEAVE_PLAYER as c}from"../../events.js";import s from"../../plugin/basePlugin.js";import"../../../../../_virtual/delegate.js";import{runHooks as u}from"../../plugin/hooksDescriptor.js";var p={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},m=["videoClick","videoDbClick"],f=/* @__PURE__ */function(){e(d,s);var f=i(d);function d(){var e;t(this,d);for(var i=arguments.length,l=new Array(i),r=0;r<i;r++)l[r]=arguments[r];return e=f.call.apply(f,[this].concat(l)),o(n(e),"onMouseMove",function(i){var t=n(e),o=t.player,l=t.playerConfig;o.isActive||(o.focus({autoHide:!l.closeDelayBlur}),!l.closeFocusVideoFocus&&o.media.focus())}),o(n(e),"onMouseEnter",function(i){var t=n(e),o=t.playerConfig,l=t.player;!o.closeFocusVideoFocus&&l.media.focus(),o.closeDelayBlur?l.focus({autoHide:!1}):l.focus(),e.emit(a)}),o(n(e),"onMouseLeave",function(i){var t=e.playerConfig,o=t.closePlayerBlur,n=t.leavePlayerTime,l=t.closeDelayBlur;o||l||(n?e.player.focus({autoHide:!0,delay:n}):e.player.blur({ignorePaused:!0})),e.emit(c)}),o(n(e),"onVideoClick",function(i){var t=n(e),o=t.player,l=t.playerConfig;i.target&&l.closeVideoClick||i.target!==o.root&&i.target!==o.media&&i.target!==o.innerContainer&&i.target!==o.media.__canvas||(i.preventDefault(),l.closeVideoStopPropagation||i.stopPropagation(),e._clickCount++,e.clickTimer&&(clearTimeout(e.clickTimer),e.clickTimer=null),e.clickTimer=setTimeout(function(){e._clickCount&&(e._clickCount--,u(n(e),m[0],function(i,t){e.switchPlayPause(t.e)},{e:i,paused:o.paused}),clearTimeout(e.clickTimer),e.clickTimer=null)},300))}),o(n(e),"onVideoDblClick",function(i){var t=n(e),o=t.player,l=t.playerConfig;l.closeVideoDblclick||!i.target||i.target!==o.media&&i.target!==o.media.__canvas||(!l.closeVideoClick&&e._clickCount<2?e._clickCount=0:(e._clickCount=0,e.clickTimer&&(clearTimeout(e.clickTimer),e.clickTimer=null),i.preventDefault(),i.stopPropagation(),u(n(e),m[1],function(i,t){e.emitUserAction(t.e,"switch_fullscreen",{props:"fullscreen",from:o.fullscreen,to:!o.fullscreen}),o.fullscreen?o.exitFullscreen():o.getFullscreen()},{e:i,fullscreen:o.fullscreen})))}),e}return l(d,[{key:"afterCreate",value:function(){var e=this;this._clickCount=0,m.map(function(i){e.__hooks[i]=null}),"mobile"===this.playerConfig.isMobileSimulateMode||"mobile"===r.device&&!r.os.isIpad||this.initEvents()}},{key:"initEvents",value:function(){var e=this,i=this.player,t=i.media,o=i.root,n=this.playerConfig.enableContextmenu;o&&o.addEventListener("click",this.onVideoClick,!1),o&&o.addEventListener("dblclick",this.onVideoDblClick,!1),Object.keys(p).map(function(i){o.addEventListener(i,e[p[i]],!1)}),!n&&t&&t.addEventListener("contextmenu",this.onContextmenu,!1)}},{key:"switchPlayPause",value:function(e){var i=this.player;this.emitUserAction(e,"switch_play_pause",{props:"paused",from:i.paused,to:!i.paused}),i.ended?i.duration!==1/0&&i.duration>0&&i.replay():i.paused?i.play():i.pause()}},{key:"onContextmenu",value:function(e){(e=e||window.event).preventDefault&&e.preventDefault(),e.stopPropagation?e.stopPropagation():(e.returnValue=!1,e.cancelBubble=!0)}},{key:"destroy",value:function(){var e=this,i=this.player,t=i.video,o=i.root;this.clickTimer&&clearTimeout(this.clickTimer),o.removeEventListener("click",this.onVideoClick,!1),o.removeEventListener("dblclick",this.onVideoDblClick,!1),t.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(p).map(function(i){o.removeEventListener(i,e[p[i]],!1)})}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),d}();export{f as default};