/*!
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"),t=require("../../events.js"),i=require("../../plugin/plugin.js"),n=require("../common/iconTools.js"),s=require("../common/iconPlugin.js"),a=require("../assets/play.js"),r=require("../assets/pause.js");var l=function(s){e.inherits(o,s);var l=e.createSuper(o);function o(){var t;e.classCallCheck(this,o);for(var i=arguments.length,n=new Array(i),s=0;s<i;s++)n[s]=arguments[s];return t=l.call.apply(l,[this].concat(n)),e.defineProperty(e.assertThisInitialized(t),"btnClick",function(i){i.preventDefault(),i.stopPropagation();var n=e.assertThisInitialized(t).player;return t.emitUserAction(i,"switch_play_pause",{prop:"paused",from:n.paused,to:!n.paused}),n.ended?n.replay():n.paused?(n.play(),t.animate(!1)):(n.pause(),t.animate(!0)),!1}),t}return e.createClass(o,[{key:"afterCreate",value:function(){e.get(e.getPrototypeOf(o.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 e=this,i=this.player;this.on([t.PLAY,t.PAUSE,t.ERROR,t.EMPTIED],function(){e.animate(i.paused)})}},{key:"registerIcons",value:function(){return{play:{icon:a.default,class:"xg-icon-play"},pause:{icon:r.default,class:"xg-icon-pause"}}}},{key:"initIcons",value:function(){var e=this.icons;this.appendChild(".xgplayer-icon",e.play),this.appendChild(".xgplayer-icon",e.pause)}},{key:"animate",value:function(e){if(this.player){var t=this.i18nKeys,i=this.find(".xg-tips");e?(this.setAttr("data-state","pause"),i&&this.changeLangTextKey(i,t.PLAY_TIPS)):(this.setAttr("data-state","play"),i&&this.changeLangTextKey(i,t.PAUSE_TIPS))}}},{key:"destroy",value:function(){e.get(e.getPrototypeOf(o.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(n.xgIconTips(this,"PLAY_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"play"}},{key:"defaultConfig",get:function(){return{position:i.POSITIONS.CONTROLS_LEFT,index:0,disable:!1}}}]),o}(s.default);exports.default=l;