/*!
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 i,classCallCheck as e,defineProperty as o,assertThisInitialized as n,createClass as r,get as s,getPrototypeOf as a}from"../../_virtual/_rollupPluginBabelHelpers.js";import l from"../../../../../_virtual/download.js";import c from"../../utils/util.js";import{POSITIONS as u}from"../../plugin/plugin.js";import{xgIconTips as d}from"../common/iconTools.js";import f from"../common/iconPlugin.js";import h from"../assets/download.js";var p=/* @__PURE__ */function(){t(m,f);var p=i(m);function m(t){var i;return e(this,m),i=p.call(this,t),o(n(i),"download",function(t){if(!i.isLock){i.emitUserAction(t,"download");var e=i.playerConfig.url,o="";"String"===c.typeOf(e)?o=e:"Array"===c.typeOf(e)&&e.length>0&&(o=e[0].src);var n=i.getAbsoluteURL(o);l(n),i.isLock=!0,i.timer=window.setTimeout(function(){i.isLock=!1,window.clearTimeout(i.timer),i.timer=null},300)}}),i.timer=null,i.isLock=!1,i}return r(m,[{key:"afterCreate",value:function(){s(a(m.prototype),"afterCreate",this).call(this),this.config.disable||(this.appendChild(".xgplayer-icon",this.icons.download),this._handler=this.hook("click",this.download,{pre:function(t){t.preventDefault(),t.stopPropagation()}}),this.bind(["click","touchend"],this._handler))}},{key:"registerIcons",value:function(){return{download:h}}},{key:"getAbsoluteURL",value:function(t){if(!t.match(/^https?:\/\//)){var i=document.createElement("div");i.innerHTML='<a href="'.concat(t,'">x</a>'),t=i.firstChild.href}return t}},{key:"destroy",value:function(){s(a(m.prototype),"destroy",this).call(this),this.unbind(["click","touchend"],this.download),window.clearTimeout(this.timer),this.timer=null}},{key:"render",value:function(){if(!this.config.disable)return'<xg-icon class="xgplayer-download">\n   <div class="xgplayer-icon">\n   </div>\n   '.concat(d(this,"DOWNLOAD_TIPS",this.playerConfig.isHideTips),"\n    </xg-icon>")}}],[{key:"pluginName",get:function(){return"download"}},{key:"defaultConfig",get:function(){return{position:u.CONTROLS_RIGHT,index:3,disable:!0}}}]),m}();export{p as default};