/*!
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
*/
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../_virtual/_rollupPluginBabelHelpers.js"),i=require("../../utils/sniffer.js"),t=require("../../events.js"),n=require("../../plugin/basePlugin.js");require("../../../../../_virtual/delegate.js");const o=require("../../plugin/hooksDescriptor.js");var r={mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousemove:"onMouseMove"},l=["videoClick","videoDbClick"],s=function(n){e.inherits(a,n);var s=e.createSuper(a);function a(){var i;e.classCallCheck(this,a);for(var n=arguments.length,r=new Array(n),c=0;c<n;c++)r[c]=arguments[c];return i=s.call.apply(s,[this].concat(r)),e.defineProperty(e.assertThisInitialized(i),"onMouseMove",function(t){var n=e.assertThisInitialized(i),o=n.player,r=n.playerConfig;o.isActive||(o.focus({autoHide:!r.closeDelayBlur}),!r.closeFocusVideoFocus&&o.media.focus())}),e.defineProperty(e.assertThisInitialized(i),"onMouseEnter",function(n){var o=e.assertThisInitialized(i),r=o.playerConfig,l=o.player;!r.closeFocusVideoFocus&&l.media.focus(),r.closeDelayBlur?l.focus({autoHide:!1}):l.focus(),i.emit(t.ENTER_PLAYER)}),e.defineProperty(e.assertThisInitialized(i),"onMouseLeave",function(e){var n=i.playerConfig,o=n.closePlayerBlur,r=n.leavePlayerTime,l=n.closeDelayBlur;o||l||(r?i.player.focus({autoHide:!0,delay:r}):i.player.blur({ignorePaused:!0})),i.emit(t.LEAVE_PLAYER)}),e.defineProperty(e.assertThisInitialized(i),"onVideoClick",function(t){var n=e.assertThisInitialized(i),r=n.player,s=n.playerConfig;t.target&&s.closeVideoClick||t.target!==r.root&&t.target!==r.media&&t.target!==r.innerContainer&&t.target!==r.media.__canvas||(t.preventDefault(),s.closeVideoStopPropagation||t.stopPropagation(),i._clickCount++,i.clickTimer&&(clearTimeout(i.clickTimer),i.clickTimer=null),i.clickTimer=setTimeout(function(){i._clickCount&&(i._clickCount--,o.runHooks(e.assertThisInitialized(i),l[0],function(e,t){i.switchPlayPause(t.e)},{e:t,paused:r.paused}),clearTimeout(i.clickTimer),i.clickTimer=null)},300))}),e.defineProperty(e.assertThisInitialized(i),"onVideoDblClick",function(t){var n=e.assertThisInitialized(i),r=n.player,s=n.playerConfig;s.closeVideoDblclick||!t.target||t.target!==r.media&&t.target!==r.media.__canvas||(!s.closeVideoClick&&i._clickCount<2?i._clickCount=0:(i._clickCount=0,i.clickTimer&&(clearTimeout(i.clickTimer),i.clickTimer=null),t.preventDefault(),t.stopPropagation(),o.runHooks(e.assertThisInitialized(i),l[1],function(e,t){i.emitUserAction(t.e,"switch_fullscreen",{props:"fullscreen",from:r.fullscreen,to:!r.fullscreen}),r.fullscreen?r.exitFullscreen():r.getFullscreen()},{e:t,fullscreen:r.fullscreen})))}),i}return e.createClass(a,[{key:"afterCreate",value:function(){var e=this;this._clickCount=0,l.map(function(i){e.__hooks[i]=null}),"mobile"===this.playerConfig.isMobileSimulateMode||"mobile"===i.default.device&&!i.default.os.isIpad||this.initEvents()}},{key:"initEvents",value:function(){var e=this,i=this.player,t=i.media,n=i.root,o=this.playerConfig.enableContextmenu;n&&n.addEventListener("click",this.onVideoClick,!1),n&&n.addEventListener("dblclick",this.onVideoDblClick,!1),Object.keys(r).map(function(i){n.addEventListener(i,e[r[i]],!1)}),!o&&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,n=i.root;this.clickTimer&&clearTimeout(this.clickTimer),n.removeEventListener("click",this.onVideoClick,!1),n.removeEventListener("dblclick",this.onVideoDblClick,!1),t.removeEventListener("contextmenu",this.onContextmenu,!1),Object.keys(r).map(function(i){n.removeEventListener(i,e[r[i]],!1)})}}],[{key:"pluginName",get:function(){return"pc"}},{key:"defaultConfig",get:function(){return{}}}]),a}(n.default);exports.default=s;