/*!
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 t,createSuper as e,classCallCheck as i,defineProperty as a,assertThisInitialized as s,createClass as n,get as r,getPrototypeOf as o}from"../../_virtual/_rollupPluginBabelHelpers.js";import{PLAY as l,PAUSE as p,ERROR as c,EMPTIED as u}from"../../events.js";import{POSITIONS as h}from"../../plugin/plugin.js";import{xgIconTips as y}from"../common/iconTools.js";import f from"../common/iconPlugin.js";import d from"../assets/play.js";import g from"../assets/pause.js";var m=/* @__PURE__ */function(){t(v,f);var m=e(v);function v(){var t;i(this,v);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t=m.call.apply(m,[this].concat(n)),a(s(t),"btnClick",function(e){e.preventDefault(),e.stopPropagation();var i=s(t).player;return t.emitUserAction(e,"switch_play_pause",{prop:"paused",from:i.paused,to:!i.paused}),i.ended?i.replay():i.paused?(i.play(),t.animate(!1)):(i.pause(),t.animate(!0)),!1}),t}return n(v,[{key:"afterCreate",value:function(){r(o(v.prototype),"afterCreate",this).call(this),this.config.disable||(this.initIcons(),this.bind(["touchend","click"],this.btnClick),this.listenEvents(),this.animate(!0))}},{key:"listenEvents",value:function(){var t=this,e=this.player;this.on([l,p,c,u],function(){t.animate(e.paused)})}},{key:"registerIcons",value:function(){return{play:{icon:d,class:"xg-icon-play"},pause:{icon:g,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var t=this.icons;this.appendChild(".xgplayer-icon",t.play),this.appendChild(".xgplayer-icon",t.pause)}},{key:"animate",value:function(t){if(this.player){var e=this.i18nKeys,i=this.find(".xg-tips");t?(this.setAttr("data-state","pause"),i&&this.changeLangTextKey(i,e.PLAY_TIPS)):(this.setAttr("data-state","play"),i&&this.changeLangTextKey(i,e.PAUSE_TIPS))}}},{key:"destroy",value:function(){r(o(v.prototype),"destroy",this).call(this),this.unbind(["touchend","click"],this.btnClick)}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-play">\n    <div class="xgplayer-icon">\n    </div>\n    '.concat(y(this,"PLAY_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:h.CONTROLS_LEFT,index:0,disable:!1}}}]),v}();export{m as default};