/*!
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");var i=function(i){e.inherits(r,i);var a=e.createSuper(r);function r(){var t;e.classCallCheck(this,r);for(var i=arguments.length,n=new Array(i),u=0;u<i;u++)n[u]=arguments[u];return t=a.call.apply(a,[this].concat(n)),e.defineProperty(e.assertThisInitialized(t),"onGapJump",function(){var i=e.assertThisInitialized(t),a=i.player,n=i.config;if(a.media.readyState!==HTMLMediaElement.HAVE_NOTHING){if(a.media.seeking){if(!t.seekingEventReceived)return}else t.seekingEventReceived=!1;if(!a.media.paused||0===a.media.currentTime||!t.hasPlayed){var u=a.media.buffered,s=n.smallGapLimit||.5,l=n.gapDetectionThreshold||.3,o=a.media.currentTime,d=t._getIndex(u,o,l);if(null!==d&&0!==d){console.log("GapJump  bufferRange ",u.start(d),u.end(d));var f=u.start(d)+.1;if(!(f>a.media.duration)){var p=f-o,g=p<=s;p<r.BROWSER_GAP_TOLERANCE||g&&(!1!==n.useGapJump&&(a.media.currentTime=t.isSafari?f+.1:f),t.player&&t.player.emit("detectGap"),console.log("gapJump gapIndex",d," isGapSamll:",g," currentTime:",a.media.currentTime," jumpSize:",o-a.media.currentTime),.08!==f&&a&&a.emit("log",{type:"oneevent",end_type:"gap",vid:a.config.vid,ext:{video_postion:Math.floor(1e3*f)}}))}}}}}),t}return e.createClass(r,[{key:"afterCreate",value:function(){var e=this;!1!==this.config.useGapJump&&(this.hasPlayed=!1,this.seekingEventReceived=!1,this.isSafari=/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),this.on(t.WAITING,this.onGapJump),this.on(t.PLAY,function(){e.hasPlayed=!0}),this.on(t.SEEKING,function(){e.seekingEventReceived=!0}))}},{key:"_getIndex",value:function(e,t,i){if(!e||!e.length)return null;if(1===e.length&&e.end(0)-e.start(0)<1e-6)return null;for(var a=this._getBuffered(e),r=null,n=0;n<a.length;n++){if(a[n].start>t&&(0===n||a[n-1].end-t<=i)){r=n;break}}return r}},{key:"_getBuffered",value:function(e){if(!e)return[];for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}}],[{key:"pluginName",get:function(){return"gapJump"}},{key:"defaultConfig",get:function(){return{useGapJump:!1,smallGapLimit:.5,gapDetectionThreshold:.3}}}]),r}(require("../../plugin/plugin.js").default);i.BROWSER_GAP_TOLERANCE=.001,exports.default=i;