/*!
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 t,classCallCheck as o,createClass as n}from"../../_virtual/_rollupPluginBabelHelpers.js";import i from"../../utils/util.js";import{ENDED as a,TIME_UPDATE as s,URL_CHANGE as r,PLAY as c}from"../../events.js";import u from"../../plugin/plugin.js";var l=/* @__PURE__ */function(){e(f,u);var l=t(f);function f(){return o(this,f),l.apply(this,arguments)}return n(f,[{key:"isEndedShow",get:function(){return this.config.isEndedShow},set:function(e){this.config.isEndedShow=e}},{key:"hide",value:function(){i.addClass(this.root,"hide")}},{key:"show",value:function(e){i.removeClass(this.root,"hide")}},{key:"beforeCreate",value:function(e){"string"==typeof e.player.config.poster&&(e.config.poster=e.player.config.poster)}},{key:"afterCreate",value:function(){var e=this;this.on(a,function(){e.isEndedShow&&i.removeClass(e.root,"hide")}),this.config.hideCanplay?(this.once(s,function(){e.onTimeUpdate()}),this.on(r,function(){i.removeClass(e.root,"hide"),i.addClass(e.root,"xg-showplay"),e.once(s,function(){e.onTimeUpdate()})})):this.on(c,function(){i.addClass(e.root,"hide")})}},{key:"setConfig",value:function(e){var t=this;Object.keys(e).forEach(function(o){t.config[o]=e[o]});var o=this.config.poster;this.update(o)}},{key:"onTimeUpdate",value:function(){var e=this;this.player.currentTime?i.removeClass(this.root,"xg-showplay"):this.once(s,function(){e.onTimeUpdate()})}},{key:"update",value:function(e){e&&(this.config.poster=e,this.root.style.backgroundImage="url(".concat(e,")"))}},{key:"getBgSize",value:function(e){var t="";switch(e){case"cover":t="cover";break;case"contain":t="contain";break;case"fixHeight":t="auto 100%";break;default:t=""}return t?"background-size: ".concat(t,";"):""}},{key:"render",value:function(){var e=this.config,t=e.poster,o=e.hideCanplay,n=e.fillMode,i=e.notHidden,a=this.getBgSize(n),s=t?"background-image:url(".concat(t,");").concat(a):a;return'<xg-poster class="xgplayer-poster '.concat(i?"xg-not-hidden":o?"xg-showplay":"",'" style="').concat(s,'">\n    </xg-poster>')}}],[{key:"pluginName",get:function(){return"poster"}},{key:"defaultConfig",get:function(){return{isEndedShow:!0,hideCanplay:!1,notHidden:!1,poster:"",fillMode:"fixWidth"}}}]),f}();export{l as default};