@clickview/lite 0.104.0-rc.3 → 0.104.0-rc.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/.vite/manifest.json +699 -699
  2. package/dist/bundles.json +1 -1
  3. package/dist/en.json +1 -1
  4. package/dist/scripts/{CW1i-QHv.chunk.js → -7qiRMLt.chunk.js} +2 -2
  5. package/dist/scripts/{CW1i-QHv.chunk.js.map → -7qiRMLt.chunk.js.map} +1 -1
  6. package/dist/scripts/{CXN0_XjU.chunk.js → -KvTbeQV.chunk.js} +2 -2
  7. package/dist/scripts/{CXN0_XjU.chunk.js.map → -KvTbeQV.chunk.js.map} +1 -1
  8. package/dist/scripts/{Bu7Sr1dy.chunk.js → 0Fek4oFk.chunk.js} +2 -2
  9. package/dist/scripts/{Bu7Sr1dy.chunk.js.map → 0Fek4oFk.chunk.js.map} +1 -1
  10. package/dist/scripts/{CfRQYWGG.chunk.js → 5PKjjI4Y.chunk.js} +2 -2
  11. package/dist/scripts/{CfRQYWGG.chunk.js.map → 5PKjjI4Y.chunk.js.map} +1 -1
  12. package/dist/scripts/{Ta3cqTAC.chunk.js → AEOAlemi.chunk.js} +2 -2
  13. package/dist/scripts/{Ta3cqTAC.chunk.js.map → AEOAlemi.chunk.js.map} +1 -1
  14. package/dist/scripts/{DBcWjmUy.chunk.js → B1TqilLB.chunk.js} +2 -2
  15. package/dist/scripts/{DBcWjmUy.chunk.js.map → B1TqilLB.chunk.js.map} +1 -1
  16. package/dist/scripts/{ft2cSH-j.chunk.js → B3AhKFfz.chunk.js} +2 -2
  17. package/dist/scripts/{ft2cSH-j.chunk.js.map → B3AhKFfz.chunk.js.map} +1 -1
  18. package/dist/scripts/{DFFq-sgD.chunk.js → B3y60nT5.chunk.js} +2 -2
  19. package/dist/scripts/{DFFq-sgD.chunk.js.map → B3y60nT5.chunk.js.map} +1 -1
  20. package/dist/scripts/{DWJiezgB2.chunk.js → BBWnpWNB2.chunk.js} +2 -2
  21. package/dist/scripts/{DWJiezgB2.chunk.js.map → BBWnpWNB2.chunk.js.map} +1 -1
  22. package/dist/scripts/{B6GfukUn2.chunk.js → B_TE5XUR2.chunk.js} +2 -2
  23. package/dist/scripts/{B6GfukUn2.chunk.js.map → B_TE5XUR2.chunk.js.map} +1 -1
  24. package/dist/scripts/{BpHA-MkZ.chunk.js → BiWUSyJr.chunk.js} +2 -2
  25. package/dist/scripts/{BpHA-MkZ.chunk.js.map → BiWUSyJr.chunk.js.map} +1 -1
  26. package/dist/scripts/{VJQU9c4G2.chunk.js → Bld7iWR52.chunk.js} +2 -2
  27. package/dist/scripts/{VJQU9c4G2.chunk.js.map → Bld7iWR52.chunk.js.map} +1 -1
  28. package/dist/scripts/{C_tdgSWS2.chunk.js → Bzk4AwVx2.chunk.js} +2 -2
  29. package/dist/scripts/{C_tdgSWS2.chunk.js.map → Bzk4AwVx2.chunk.js.map} +1 -1
  30. package/dist/scripts/{9oMRc0cb2.chunk.js → CAs2Sere2.chunk.js} +2 -2
  31. package/dist/scripts/{9oMRc0cb2.chunk.js.map → CAs2Sere2.chunk.js.map} +1 -1
  32. package/dist/scripts/CCBk_ENs.chunk.js +1 -0
  33. package/dist/scripts/{qT_Twe2q.chunk.js → CMHxOVI7.chunk.js} +2 -2
  34. package/dist/scripts/{qT_Twe2q.chunk.js.map → CMHxOVI7.chunk.js.map} +1 -1
  35. package/dist/scripts/{Bm5qACA52.chunk.js → CNfmLVE82.chunk.js} +2 -2
  36. package/dist/scripts/{Bm5qACA52.chunk.js.map → CNfmLVE82.chunk.js.map} +1 -1
  37. package/dist/scripts/{CpzveYo2.chunk.js → CVL6bQWp.chunk.js} +2 -2
  38. package/dist/scripts/{CpzveYo2.chunk.js.map → CVL6bQWp.chunk.js.map} +1 -1
  39. package/dist/scripts/{CNPKh2z72.chunk.js → CX6c7KRp2.chunk.js} +2 -2
  40. package/dist/scripts/{CNPKh2z72.chunk.js.map → CX6c7KRp2.chunk.js.map} +1 -1
  41. package/dist/scripts/{BTm7hIyP2.chunk.js → CaCm4N_d2.chunk.js} +2 -2
  42. package/dist/scripts/{BTm7hIyP2.chunk.js.map → CaCm4N_d2.chunk.js.map} +1 -1
  43. package/dist/scripts/{DW_sm5se2.chunk.js → CfNYFxJl2.chunk.js} +2 -2
  44. package/dist/scripts/{DW_sm5se2.chunk.js.map → CfNYFxJl2.chunk.js.map} +1 -1
  45. package/dist/scripts/{C4OV7pr-.chunk.js → CmnbQiBA.chunk.js} +2 -2
  46. package/dist/scripts/{C4OV7pr-.chunk.js.map → CmnbQiBA.chunk.js.map} +1 -1
  47. package/dist/scripts/CpsbRDII.chunk.js +2 -0
  48. package/dist/scripts/{jAtAipGN.chunk.js.map → CpsbRDII.chunk.js.map} +1 -1
  49. package/dist/scripts/{CFduwlo0.chunk.js → Cqq1N9xw.chunk.js} +2 -2
  50. package/dist/scripts/{CFduwlo0.chunk.js.map → Cqq1N9xw.chunk.js.map} +1 -1
  51. package/dist/scripts/{UCiRB6cQ.chunk.js → CwFYdvvA.chunk.js} +2 -2
  52. package/dist/scripts/{UCiRB6cQ.chunk.js.map → CwFYdvvA.chunk.js.map} +1 -1
  53. package/dist/scripts/{DLcyKjA7.chunk.js → Cyit3dMk.chunk.js} +2 -2
  54. package/dist/scripts/{DLcyKjA7.chunk.js.map → Cyit3dMk.chunk.js.map} +1 -1
  55. package/dist/scripts/{BxjzTnvL2.chunk.js → D-iyHqNw2.chunk.js} +3 -3
  56. package/dist/scripts/{BxjzTnvL2.chunk.js.map → D-iyHqNw2.chunk.js.map} +1 -1
  57. package/dist/scripts/{x2GB1P6E2.chunk.js → D3ncynN72.chunk.js} +3 -3
  58. package/dist/scripts/{x2GB1P6E2.chunk.js.map → D3ncynN72.chunk.js.map} +1 -1
  59. package/dist/scripts/{DH_0KtTK2.chunk.js → DICsRDM42.chunk.js} +2 -2
  60. package/dist/scripts/{DH_0KtTK2.chunk.js.map → DICsRDM42.chunk.js.map} +1 -1
  61. package/dist/scripts/{BTcLMVw4.chunk.js → DKDWcWxk.chunk.js} +2 -2
  62. package/dist/scripts/{BTcLMVw4.chunk.js.map → DKDWcWxk.chunk.js.map} +1 -1
  63. package/dist/scripts/{2p_6pVn6.chunk.js → DSPMbDdF.chunk.js} +2 -2
  64. package/dist/scripts/{2p_6pVn6.chunk.js.map → DSPMbDdF.chunk.js.map} +1 -1
  65. package/dist/scripts/{Bh-26cqn.chunk.js → Dnz8CbEu.chunk.js} +3 -3
  66. package/dist/scripts/{Bh-26cqn.chunk.js.map → Dnz8CbEu.chunk.js.map} +1 -1
  67. package/dist/scripts/{CukXgE1z.chunk.js → Dt5731Ay.chunk.js} +2 -2
  68. package/dist/scripts/{CukXgE1z.chunk.js.map → Dt5731Ay.chunk.js.map} +1 -1
  69. package/dist/scripts/{DCPsmD1m.chunk.js → Dtag-27K.chunk.js} +2 -2
  70. package/dist/scripts/{DCPsmD1m.chunk.js.map → Dtag-27K.chunk.js.map} +1 -1
  71. package/dist/scripts/{DOCHl5Sy.chunk.js → DyE6EUDb.chunk.js} +2 -2
  72. package/dist/scripts/{DOCHl5Sy.chunk.js.map → DyE6EUDb.chunk.js.map} +1 -1
  73. package/dist/scripts/{app-LEZ4B6dG.js → app-BzH1hkoU.js} +4 -4
  74. package/dist/scripts/{app-LEZ4B6dG.js.map → app-BzH1hkoU.js.map} +1 -1
  75. package/dist/scripts/{DerPQKk6.chunk.js → cDv6zuhh.chunk.js} +2 -2
  76. package/dist/scripts/{DerPQKk6.chunk.js.map → cDv6zuhh.chunk.js.map} +1 -1
  77. package/dist/scripts/{Cl2FZEIX.chunk.js → fMgBORUX.chunk.js} +2 -2
  78. package/dist/scripts/{Cl2FZEIX.chunk.js.map → fMgBORUX.chunk.js.map} +1 -1
  79. package/package.json +1 -1
  80. package/dist/scripts/BILyzh0I.chunk.js +0 -1
  81. package/dist/scripts/jAtAipGN.chunk.js +0 -2
@@ -1,4 +1,4 @@
1
- import{o as e}from"./DAXXjFlN.chunk.js";import{x as t}from"./BftnFbcr.chunk.js";import{t as n}from"./C2w0pmFW.chunk.js";import{t as r}from"./wrLrTezN.chunk.js";import{C as i,U as a,d as o,l as s,z as c}from"./NlCAcBdo.chunk.js";import{t as l}from"./Dyy-PWHO.chunk.js";import{a as u,c as d,d as f,f as p,m,n as h,o as g,p as _,s as v,t as ee,u as te}from"./BTcLMVw4.chunk.js";import{t as y}from"./CnnDkGmK.chunk.js";import{n as b}from"./B5XaBzZh.chunk.js";import"./DerPQKk6.chunk.js";import"./CFduwlo0.chunk.js";import{t as x}from"./BiKac8UT2.chunk.js";import"./Bm5qACA52.chunk.js";import{a as S,i as C,n as w,o as T,r as E,s as D,t as O}from"./_jJAx6fU.chunk.js";import{t as ne}from"./CLjADRa42.chunk.js";var k=e(n()),re=m.getComponent(`Button`),A=class extends re{constructor(...e){super(...e),this.alwaysCollapsed=!1,this.isCollapsed=!1,this.isCollabsible=!0}buildCSSClass(){return`cv-create-clip-button`}getCollabsibleName(){return this.controlText_}getCollabsibleValue(){return``}showInCollabsibleMenu(){return!0}showCollapsibleMenu(){super.handleClick(null)}};A.prototype.controlText_=`Create clip`,m.registerComponent(`CreateClipButton`,A);var ie=m.getPlugin(`plugin`),ae=class extends ie{constructor(e,t){super(e,t),this.options=t,e.ready(()=>this.onReady())}onReady(){let e=this.player.getChild(`collapserator`);e&&e.addChild(`CreateClipButton`,{clickHandler:this.options.onClick})}};m.registerPlugin(`createClipButtonPlugin`,ae);var oe=m.getComponent(`PictureInPictureToggle`),se=class extends oe{handlePictureInPictureEnabledChange(){this.enable()}};m.registerComponent(`PictureInPictureToggle`,se);var ce=m.getComponent(`PlayToggle`),le=m.getPlugin(`plugin`),ue=800,de=class extends le{constructor(e,t){super(e,t),this.options=t,this.bindFunctions(),e.ready(()=>this.initialize())}bindFunctions(){this.requestPictureInPicture=this.requestPictureInPicture.bind(this),this.exitPictureInPicture=this.exitPictureInPicture.bind(this),this.onPlayerResize=this.onPlayerResize.bind(this),this.playerRequestPictureInPictureFn=this.player.requestPictureInPicture,this.playerExitPictureInPictureFn=this.player.exitPictureInPicture,this.player.requestPictureInPicture=this.requestPictureInPicture,this.player.exitPictureInPicture=this.exitPictureInPicture}initialize(){let e=this.player.getChild(`collapserator`);this.toggle=e.addChild(`pictureInPictureToggle`,{}),this.toggle.enable(),this.player.on(`playerresize`,this.onPlayerResize),this.player.on(`dispose`,()=>{this.player?.off(`playerresize`,this.onPlayerResize)})}togglePictureInPicture(e){if(e===this.player.isInPictureInPicture())return;let t=e?`enterpictureinpicture`:`leavepictureinpicture`;this.player.isInPictureInPicture(e),this.player.trigger(t),e?this.addPipStyles():this.removePipStyles()}onPlayerResize(){if(this.player.isInPictureInPicture())return;let e=this.player.el().getBoundingClientRect();e.width!==0&&(e.width<ue?this.toggle?.hide():this.toggle?.show())}addPipStyles(){this.player.addClass(`cv-picture-in-picture`),this.playToggle=new ce(this.player),this.playToggle.addClass(`cv-pip-play-toggle`),this.player.addChild(this.playToggle),this.player.paused()?this.playToggle.handlePause():this.playToggle.handlePlay()}removePipStyles(){this.player.removeClass(`cv-picture-in-picture`),this.player.removeChild(this.playToggle),delete this.playToggle}requestPictureInPicture(){this.togglePictureInPicture(!0),typeof this.options?.onRequestPictureInPicture==`function`&&this.options.onRequestPictureInPicture(!0)}async exitPictureInPicture(){this.togglePictureInPicture(!1),this.options.onRequestPictureInPicture(!1),this.removePipStyles()}dispose(){this.player.requestPictureInPicture=this.playerRequestPictureInPictureFn,this.player.exitPictureInPicture=this.playerExitPictureInPictureFn,super.dispose()}};m.registerPlugin(`pictureInPicture`,de);var fe=m.getComponent(`Component`),pe=class extends fe{constructor(e,t){super(e,t),this.hasBuffered=!1,this.hasPlayed=!1,this.eventsService=ne,this.pointOfInterest=t.pointOfInterest,this.onMouseOver=this.onMouseOver.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onGlancePointOfInterestMouseEnter=this.onGlancePointOfInterestMouseEnter.bind(this),this.onGlancePointOfInterestMouseLeave=this.onGlancePointOfInterestMouseLeave.bind(this),this.initialize()}initialize(){this.setPosition(),this.bindListeners()}buildCSSClass(){return`cv-point-of-interest-indicator ${super.buildCSSClass()}`}createEl(e,t,n){return super.createEl(e,{...t,className:this.buildCSSClass()},n)}bindListeners(){this.on(`mouseover`,this.onMouseOver),this.on(`mouseleave`,this.onMouseLeave),this.eventsService.subscribe(`glance:poi:mouseover`,this.onGlancePointOfInterestMouseEnter),this.eventsService.subscribe(`glance:poi:mouseleave`,this.onGlancePointOfInterestMouseLeave)}dispose(){this.eventsService.unsubscribe(`glance:poi:mouseover`,this.onGlancePointOfInterestMouseEnter),this.eventsService.unsubscribe(`glance:poi:mouseleave`,this.onGlancePointOfInterestMouseLeave)}getPointOfInterestTime(){return this.pointOfInterest.startTime}setPosition(){let e=this.player().duration();this.el_.style.left=this.getPointOfInterestTime()/e*100+`%`}updateBuffered(e){let t=this.getPointOfInterestTime()<=e;if(t===this.hasBuffered)return;this.hasBuffered=t;let n=`cv-point-of-interest-indicator-buffered`;this.hasBuffered?this.addClass(n):this.removeClass(n)}updatePlaybackProgress(e){let t=this.getPointOfInterestTime()<=e;if(t===this.hasPlayed)return;this.hasPlayed=t;let n=`cv-point-of-interest-indicator-played`;t?this.addClass(n):this.removeClass(n)}toggleVisibility(e){let t=`cv-point-of-interest-indicator-hidden`;e?this.removeClass(t):this.addClass(t)}onMouseOver(){this.setTimeTooltipText(),this.eventsService.trigger(`player:poi:mouseover`,this.pointOfInterest)}onMouseLeave(){this.clearTimeTooltipText(),this.eventsService.trigger(`player:poi:mouseleave`)}onGlancePointOfInterestMouseEnter(e){e.id===this.pointOfInterest.id&&(this.addClass(`cv-point-of-interest-indicator-highlight`),this.setTimeTooltipTime(),this.setTimeTooltipText(),this.positionMouseTimeDisplay(),this.showMouseTimeDisplay())}onGlancePointOfInterestMouseLeave(){this.removeClass(`cv-point-of-interest-indicator-highlight`),this.hideMouseTimeDisplay()}setTimeTooltipText(){this.getTimeTooltip()?.setCustomChapterText(this.pointOfInterest.description)}clearTimeTooltipText(){this.getTimeTooltip()?.setCustomChapterText()}setTimeTooltipTime(){this.getTimeTooltip()?.updateTime(this.getPointOfInterestTime())}positionMouseTimeDisplay(){let e=this.getSeekBar()?.el();if(!e)return;let t=m.dom.findPosition(e),n=this.getPointOfInterestTime()/this.player().duration();this.getMouseTimeDisplay()?.update(t,n)}showMouseTimeDisplay(){this.getMouseTimeDisplay()?.forceShow()}hideMouseTimeDisplay(){this.getMouseTimeDisplay()?.removeForceShow()}getSeekBar(){return this.player().controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`)}getMouseTimeDisplay(){return this.getSeekBar()?.getChild(`MouseTimeDisplay`)}getTimeTooltip(){return this.getMouseTimeDisplay()?.getChild(`TimeTooltip`)}},me=m.getComponent(`MenuItem`),j=class extends me{constructor(e,t){super(e,t),this.pointsOfInterestVisible=t.pointsOfInterestVisible,this.toggle(this.pointsOfInterestVisible)}handleToggle(){this.toggle(!this.pointsOfInterestVisible)}toggle(e){e?this.toggleOn():this.toggleOff()}toggleOn(){m.dom.addClass(this.toggleEl,`on`),m.dom.setAttribute(this.toggleEl,`aria-checked`,`true`),this.pointsOfInterestVisible=!0,this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible)}toggleOff(){m.dom.removeClass(this.toggleEl,`on`),m.dom.setAttribute(this.toggleEl,`aria-checked`,`false`),this.pointsOfInterestVisible=!1,this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible)}handleClick(e){e.stopImmediatePropagation()}createEl(e,t,n){this.handlerBound||=(this.handleToggle=this.handleToggle.bind(this),!0),this.toggleEl&&this.toggleEl.removeEventListener(`click`,this.handleToggle),this.toggleEl=m.dom.createEl(`div`,{className:`custom-toggle custom-toggle-info toggle-option float-end`,innerHTML:`<span class="handle"></span></div>`}),m.dom.setAttribute(this.toggleEl,`id`,`poi-toggle`),m.dom.setAttribute(this.toggleEl,`role`,`switch`),this.toggleEl.addEventListener(`click`,this.handleToggle);let r=super.createEl(e,{className:`vjs-menu-item cv-cog-menu-item cv-poi-toggle`,innerHTML:`
1
+ import{o as e}from"./DAXXjFlN.chunk.js";import{x as t}from"./BftnFbcr.chunk.js";import{t as n}from"./C2w0pmFW.chunk.js";import{t as r}from"./wrLrTezN.chunk.js";import{C as i,U as a,d as o,l as s,z as c}from"./NlCAcBdo.chunk.js";import{t as l}from"./Dyy-PWHO.chunk.js";import{a as u,c as d,d as f,f as p,m,n as h,o as g,p as _,s as v,t as ee,u as te}from"./DKDWcWxk.chunk.js";import{t as y}from"./CnnDkGmK.chunk.js";import{n as b}from"./B5XaBzZh.chunk.js";import"./cDv6zuhh.chunk.js";import"./Cqq1N9xw.chunk.js";import{t as x}from"./BiKac8UT2.chunk.js";import"./CNfmLVE82.chunk.js";import{a as S,i as C,n as w,o as T,r as E,s as D,t as O}from"./_jJAx6fU.chunk.js";import{t as ne}from"./CLjADRa42.chunk.js";var k=e(n()),re=m.getComponent(`Button`),A=class extends re{constructor(...e){super(...e),this.alwaysCollapsed=!1,this.isCollapsed=!1,this.isCollabsible=!0}buildCSSClass(){return`cv-create-clip-button`}getCollabsibleName(){return this.controlText_}getCollabsibleValue(){return``}showInCollabsibleMenu(){return!0}showCollapsibleMenu(){super.handleClick(null)}};A.prototype.controlText_=`Create clip`,m.registerComponent(`CreateClipButton`,A);var ie=m.getPlugin(`plugin`),ae=class extends ie{constructor(e,t){super(e,t),this.options=t,e.ready(()=>this.onReady())}onReady(){let e=this.player.getChild(`collapserator`);e&&e.addChild(`CreateClipButton`,{clickHandler:this.options.onClick})}};m.registerPlugin(`createClipButtonPlugin`,ae);var oe=m.getComponent(`PictureInPictureToggle`),se=class extends oe{handlePictureInPictureEnabledChange(){this.enable()}};m.registerComponent(`PictureInPictureToggle`,se);var ce=m.getComponent(`PlayToggle`),le=m.getPlugin(`plugin`),ue=800,de=class extends le{constructor(e,t){super(e,t),this.options=t,this.bindFunctions(),e.ready(()=>this.initialize())}bindFunctions(){this.requestPictureInPicture=this.requestPictureInPicture.bind(this),this.exitPictureInPicture=this.exitPictureInPicture.bind(this),this.onPlayerResize=this.onPlayerResize.bind(this),this.playerRequestPictureInPictureFn=this.player.requestPictureInPicture,this.playerExitPictureInPictureFn=this.player.exitPictureInPicture,this.player.requestPictureInPicture=this.requestPictureInPicture,this.player.exitPictureInPicture=this.exitPictureInPicture}initialize(){let e=this.player.getChild(`collapserator`);this.toggle=e.addChild(`pictureInPictureToggle`,{}),this.toggle.enable(),this.player.on(`playerresize`,this.onPlayerResize),this.player.on(`dispose`,()=>{this.player?.off(`playerresize`,this.onPlayerResize)})}togglePictureInPicture(e){if(e===this.player.isInPictureInPicture())return;let t=e?`enterpictureinpicture`:`leavepictureinpicture`;this.player.isInPictureInPicture(e),this.player.trigger(t),e?this.addPipStyles():this.removePipStyles()}onPlayerResize(){if(this.player.isInPictureInPicture())return;let e=this.player.el().getBoundingClientRect();e.width!==0&&(e.width<ue?this.toggle?.hide():this.toggle?.show())}addPipStyles(){this.player.addClass(`cv-picture-in-picture`),this.playToggle=new ce(this.player),this.playToggle.addClass(`cv-pip-play-toggle`),this.player.addChild(this.playToggle),this.player.paused()?this.playToggle.handlePause():this.playToggle.handlePlay()}removePipStyles(){this.player.removeClass(`cv-picture-in-picture`),this.player.removeChild(this.playToggle),delete this.playToggle}requestPictureInPicture(){this.togglePictureInPicture(!0),typeof this.options?.onRequestPictureInPicture==`function`&&this.options.onRequestPictureInPicture(!0)}async exitPictureInPicture(){this.togglePictureInPicture(!1),this.options.onRequestPictureInPicture(!1),this.removePipStyles()}dispose(){this.player.requestPictureInPicture=this.playerRequestPictureInPictureFn,this.player.exitPictureInPicture=this.playerExitPictureInPictureFn,super.dispose()}};m.registerPlugin(`pictureInPicture`,de);var fe=m.getComponent(`Component`),pe=class extends fe{constructor(e,t){super(e,t),this.hasBuffered=!1,this.hasPlayed=!1,this.eventsService=ne,this.pointOfInterest=t.pointOfInterest,this.onMouseOver=this.onMouseOver.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onGlancePointOfInterestMouseEnter=this.onGlancePointOfInterestMouseEnter.bind(this),this.onGlancePointOfInterestMouseLeave=this.onGlancePointOfInterestMouseLeave.bind(this),this.initialize()}initialize(){this.setPosition(),this.bindListeners()}buildCSSClass(){return`cv-point-of-interest-indicator ${super.buildCSSClass()}`}createEl(e,t,n){return super.createEl(e,{...t,className:this.buildCSSClass()},n)}bindListeners(){this.on(`mouseover`,this.onMouseOver),this.on(`mouseleave`,this.onMouseLeave),this.eventsService.subscribe(`glance:poi:mouseover`,this.onGlancePointOfInterestMouseEnter),this.eventsService.subscribe(`glance:poi:mouseleave`,this.onGlancePointOfInterestMouseLeave)}dispose(){this.eventsService.unsubscribe(`glance:poi:mouseover`,this.onGlancePointOfInterestMouseEnter),this.eventsService.unsubscribe(`glance:poi:mouseleave`,this.onGlancePointOfInterestMouseLeave)}getPointOfInterestTime(){return this.pointOfInterest.startTime}setPosition(){let e=this.player().duration();this.el_.style.left=this.getPointOfInterestTime()/e*100+`%`}updateBuffered(e){let t=this.getPointOfInterestTime()<=e;if(t===this.hasBuffered)return;this.hasBuffered=t;let n=`cv-point-of-interest-indicator-buffered`;this.hasBuffered?this.addClass(n):this.removeClass(n)}updatePlaybackProgress(e){let t=this.getPointOfInterestTime()<=e;if(t===this.hasPlayed)return;this.hasPlayed=t;let n=`cv-point-of-interest-indicator-played`;t?this.addClass(n):this.removeClass(n)}toggleVisibility(e){let t=`cv-point-of-interest-indicator-hidden`;e?this.removeClass(t):this.addClass(t)}onMouseOver(){this.setTimeTooltipText(),this.eventsService.trigger(`player:poi:mouseover`,this.pointOfInterest)}onMouseLeave(){this.clearTimeTooltipText(),this.eventsService.trigger(`player:poi:mouseleave`)}onGlancePointOfInterestMouseEnter(e){e.id===this.pointOfInterest.id&&(this.addClass(`cv-point-of-interest-indicator-highlight`),this.setTimeTooltipTime(),this.setTimeTooltipText(),this.positionMouseTimeDisplay(),this.showMouseTimeDisplay())}onGlancePointOfInterestMouseLeave(){this.removeClass(`cv-point-of-interest-indicator-highlight`),this.hideMouseTimeDisplay()}setTimeTooltipText(){this.getTimeTooltip()?.setCustomChapterText(this.pointOfInterest.description)}clearTimeTooltipText(){this.getTimeTooltip()?.setCustomChapterText()}setTimeTooltipTime(){this.getTimeTooltip()?.updateTime(this.getPointOfInterestTime())}positionMouseTimeDisplay(){let e=this.getSeekBar()?.el();if(!e)return;let t=m.dom.findPosition(e),n=this.getPointOfInterestTime()/this.player().duration();this.getMouseTimeDisplay()?.update(t,n)}showMouseTimeDisplay(){this.getMouseTimeDisplay()?.forceShow()}hideMouseTimeDisplay(){this.getMouseTimeDisplay()?.removeForceShow()}getSeekBar(){return this.player().controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`)}getMouseTimeDisplay(){return this.getSeekBar()?.getChild(`MouseTimeDisplay`)}getTimeTooltip(){return this.getMouseTimeDisplay()?.getChild(`TimeTooltip`)}},me=m.getComponent(`MenuItem`),j=class extends me{constructor(e,t){super(e,t),this.pointsOfInterestVisible=t.pointsOfInterestVisible,this.toggle(this.pointsOfInterestVisible)}handleToggle(){this.toggle(!this.pointsOfInterestVisible)}toggle(e){e?this.toggleOn():this.toggleOff()}toggleOn(){m.dom.addClass(this.toggleEl,`on`),m.dom.setAttribute(this.toggleEl,`aria-checked`,`true`),this.pointsOfInterestVisible=!0,this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible)}toggleOff(){m.dom.removeClass(this.toggleEl,`on`),m.dom.setAttribute(this.toggleEl,`aria-checked`,`false`),this.pointsOfInterestVisible=!1,this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible)}handleClick(e){e.stopImmediatePropagation()}createEl(e,t,n){this.handlerBound||=(this.handleToggle=this.handleToggle.bind(this),!0),this.toggleEl&&this.toggleEl.removeEventListener(`click`,this.handleToggle),this.toggleEl=m.dom.createEl(`div`,{className:`custom-toggle custom-toggle-info toggle-option float-end`,innerHTML:`<span class="handle"></span></div>`}),m.dom.setAttribute(this.toggleEl,`id`,`poi-toggle`),m.dom.setAttribute(this.toggleEl,`role`,`switch`),this.toggleEl.addEventListener(`click`,this.handleToggle);let r=super.createEl(e,{className:`vjs-menu-item cv-cog-menu-item cv-poi-toggle`,innerHTML:`
2
2
  <span for="poi-toggle" class="vjs-menu-item-text">Points of Interest</span>
3
3
  <span class="cv-toggle-container"></span>`},n);return r.children[1].appendChild(this.toggleEl),r}};m.registerComponent(`PointsOfInterestMenuItem`,j);var M=m.getPlugin(`plugin`),N=`cvplayer-points-of-interest`,P=class extends M{constructor(e,t){super(e),this.pointOfInterestIndicators=[],this.enabled=!0,this.pointsOfInterest=t?.pointsOfInterest,this.initialize=this.initialize.bind(this),this.updateBuffered=this.updateBuffered.bind(this),this.updatePlaybackProgress=this.updatePlaybackProgress.bind(this),this.player.one(`loadedmetadata`,()=>this.player.ready(this.initialize))}initialize(){this.pointsOfInterest&&(b.hasLocalStorage()&&b.get(N)===`false`&&(this.enabled=!1),this.setupTrack(),this.createPointOfInterestIndicators(),this.addMenuItem(),this.bindListeners())}bindListeners(){this.player.on(`progress`,this.updateBuffered),this.player.on(`timeupdate`,this.updatePlaybackProgress),this.player.on(`dispose`,()=>{this.player?.off(`progress`,this.updateBuffered),this.player?.off(`timeupdate`,this.updatePlaybackProgress)})}togglePointsOfInterest(e){b.set(N,e.toString()),this.pointOfInterestIndicators.forEach(t=>t.toggleVisibility(e))}setupTrack(){let e=this.player.addTextTrack(`metadata`,`pointsofinterest`);this.pointsOfInterest.forEach(t=>{e.addCue({startTime:t.startTime,endTime:t.endTime,text:t.description})}),e.trigger({type:`loadeddata`,target:e})}createPointOfInterestIndicators(){let e=this.player.controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`);this.pointsOfInterest.forEach(t=>{let n=new pe(this.player,{pointOfInterest:t});this.pointOfInterestIndicators.push(n),e.addChild(n)})}addMenuItem(){(this.player.getChild(`collapserator`)?.getChild(`cogButton`)).addItem({ctor:j,name:`PointsOfInterestMenuItem`,options:{pointsOfInterestVisible:this.enabled}})}updateBuffered(){this.pointOfInterestIndicators.forEach(e=>e.updateBuffered(u(this.player)))}updatePlaybackProgress(){this.pointOfInterestIndicators.forEach(e=>e.updatePlaybackProgress(this.player.currentTime()))}};m.registerPlugin(`pointsOfInterestPlugin`,P);var F=m.getComponent(`Component`),I=class extends F{constructor(e,t){super(e,t),this.initialize()}initialize(){this.setPosition()}buildCSSClass(){return`cv-range-indicator ${super.buildCSSClass()}`}createEl(e,t,n){return super.createEl(e,{...t,className:this.buildCSSClass()},n)}setPosition(){let e=this.player().duration();this.el_.style.left=this.options_.time/e*100+`%`}},L=m.getComponent(`ClickableComponent`),R=class extends L{constructor(e,t){super(e,t)}buildCSSClass(){return`cv-replay-view-button ${super.buildCSSClass()}`}createEl(e,t,n){return super.createEl(e,{...t,innerHTML:`<span class="${this.options_.iconClassName}"></span><span>${this.options_.label}</span>`,className:this.buildCSSClass()},n)}handleClick(){this.options_.onPress()}},z=m.getComponent(`Component`),he=class extends z{constructor(e,t){super(e,t)}buildCSSClass(){return`cv-replay-view ${super.buildCSSClass()}`}createEl(e,t,n){let r=super.createEl(e,{...t,className:this.buildCSSClass()},n),i=m.dom.createEl(`h5`,{innerHTML:this.localize(`This clip has finished`),className:`cv-replay-heading`}),a=m.dom.createEl(`div`,{className:`cv-button-container`}),o=new R(this.player_,{label:this.localize(`Replay clip`),iconClassName:`cv-replay-icon`,onPress:this.options_.onReplayPress}),s=new R(this.player_,{label:this.localize(`Continue watching`),iconClassName:`cv-continue-icon`,onPress:this.options_.onContinuePress});return r.appendChild(i),r.appendChild(a),a.appendChild(o.el()),a.appendChild(s.el()),r}},ge=m.getPlugin(`plugin`),_e=class extends ge{constructor(e,t){if(super(e,t),this.startTime=parseFloat(t.startTime.toPrecision(4)),this.endTime=parseFloat(t.endTime.toPrecision(4)),this.dismissed=!1,this.startTime>this.endTime)throw Error(`Range start cannot be greater than range end`);this.bindFunctions(),this.initialize()}bindFunctions(){this.onReady=this.onReady.bind(this),this.onTimeUpdateOrSeeked=this.onTimeUpdateOrSeeked.bind(this),this.onReplayPress=this.onReplayPress.bind(this),this.onContinuePress=this.onContinuePress.bind(this)}initialize(){this.player.one(`loadedmetadata`,()=>this.player.ready(this.onReady)),this.player.on(`timeupdate`,this.onTimeUpdateOrSeeked),this.player.on(`seeked`,this.onTimeUpdateOrSeeked)}onReady(){this.addCssClasses(),this.showRangeIndicators(),this.addMaskToProgressBar()}onTimeUpdateOrSeeked(){if(this.dismissed)return;let e=this.player.currentTime();if(e<this.startTime){this.player.currentTime(this.startTime);return}if(e>this.endTime){this.showReplayView(),this.disablePlayToggle(),this.player.pause(),this.player.currentTime(this.endTime);return}}onReplayPress(){this.player.currentTime(this.startTime),this.player.play(),this.hideReplayView(),this.enablePlayToggle()}onContinuePress(){this.dismissed=!0,this.player.play(),this.hideRangeIndicators(),this.removeMaskFromProgressBar(),this.hideReplayView(),this.enablePlayToggle(),this.removeCssClasses()}showRangeIndicators(){let e=this.player.controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`);this.startTimeIndicator||(this.startTimeIndicator=new I(this.player,{time:this.startTime}),e?.addChild(this.startTimeIndicator)),this.endTimeIndicator||(this.endTimeIndicator=new I(this.player,{time:this.endTime}),e?.addChild(this.endTimeIndicator))}hideRangeIndicators(){this.startTimeIndicator?.hide(),this.endTimeIndicator?.hide()}addMaskToProgressBar(){let e=(this.player.controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`))?.el().getElementsByClassName(`cv-chapter-bar-items`);if(e&&e.length){let t=e[0],n=this.player.duration(),r=this.startTime/n*100,i=100-this.endTime/n*100;t.style.clipPath=`inset(-5em ${i}% -5em ${r}%)`}}removeMaskFromProgressBar(){let e=(this.player.controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`))?.el().getElementsByClassName(`cv-chapter-bar-items`);if(e&&e.length){let t=e[0];t.style.clipPath=``}}showReplayView(){this.replayView||(this.replayView=new he(this.player,{onContinuePress:this.onContinuePress,onReplayPress:this.onReplayPress}),this.player.addChild(this.replayView)),this.replayView.show()}hideReplayView(){this.replayView?.hide()}getPlayToggle(){return this.player.getChild(`collapserator`)?.getChild(`PlayToggle`)}enablePlayToggle(){let e=this.getPlayToggle();e&&e.enable()}disablePlayToggle(){let e=this.getPlayToggle();e&&e.disable()}addCssClasses(){this.player.addClass(`cv-range-indicator-plugin`)}removeCssClasses(){this.player.removeClass(`cv-range-indicator-plugin`)}dispose(){this.removeCssClasses(),this.player.off(`timeupdate`,this.onTimeUpdateOrSeeked),this.player.off(`seeked`,this.onTimeUpdateOrSeeked),this.startTimeIndicator?.dispose(),this.endTimeIndicator?.dispose(),this.replayView?.dispose(),super.dispose()}};m.registerPlugin(`rangeIndicatorPlugin`,_e);var B={generateRandomId:()=>window.crypto?.randomUUID?.()??Math.random().toString()},ve=class extends ee{constructor(e,t){super(e,t)}getPlayerOptions(){let e=super.getPlayerOptions();return this.options.allowTranscript&&(e.allowTranscript=!0),e.devicesConfig?.canUserCastToDevices?{...e,techOrder:[`devices`,...e.techOrder],devices:{instanceId:B.generateRandomId()}}:e}configurePlugins(){try{this.options.onClickCreateClip&&this.player.createClipButtonPlugin({onClick:this.options.onClickCreateClip}),this.options.onRequestPictureInPicture&&this.player.pictureInPicture({onRequestPictureInPicture:this.options.onRequestPictureInPicture}),this.options.pointsOfInterest?.length&&this.player.pointsOfInterestPlugin({pointsOfInterest:this.options.pointsOfInterest}),this.player.loopVideoPlugin({allowLoop:this.options.allowLoop})}catch(e){console.log(`failed to register plugins`,e)}}setNextVideo(e,t,n){this.player.nextVideoPlugin&&this.player.nextVideoPlugin().setNextVideo(e,t,n)}togglePictureInPicture(e){let t=this.player.pictureInPicture();t&&t.togglePictureInPicture(e)}toggleTheatreMode(e){let t=this.player.theatreModePlugin();t&&t.toggleTheatreMode(e,{shouldLog:!0})}toggleTranscript(e){if(!this.player.viewTranscriptPlugin)return;let t=this.player.viewTranscriptPlugin();t&&t.toggleTranscript(e)}hasStarted(){return this.player.hasStarted()}async additionalSetup(e){if(this.options.onRequestTheatreMode&&this.options.allowTheatreMode&&this.player.theatreModePlugin&&this.player.theatreModePlugin({onRequestTheatreMode:this.options.onRequestTheatreMode,theatreMode:this.options.theatreMode,playbackObject:e}),super.additionalSetup(e),this.options.showResources&&e.resources&&this.player.resourcesPlugin&&this.player.resourcesPlugin({resources:e.resources.list,imageCdnUrl:this.options.imageCdnUrl}),e.mediaType===`MasterClip`){let t=e.additionalData;if(t===null)throw Error(`Invalid clip data`);this.player.clipPlugin({startTime:t.startTime,endTime:t.endTime})}e.mediaType===`MasterVideo`&&this.options.startTime&&this.options.endTime&&this.player.rangeIndicatorPlugin({startTime:this.options.startTime,endTime:this.options.endTime})}setupAnalyticsDependentPlugins(e){super.setupAnalyticsDependentPlugins(e),this.options.allowTranscript&&this.player.viewTranscriptPlugin().registerAnalytics(this.analyticsService,e),this.options.onRequestTheatreMode&&this.options.allowTheatreMode&&this.player.theatreModePlugin&&this.player.theatreModePlugin().registerAnalytics(this.analyticsService),this.options.devicesConfig?.canUserCastToDevices&&this.player.devicesPlugin&&this.player.devicesPlugin({...this.options.devicesConfig,userId:parseInt(e.viewerId),title:e.title,analyticsService:this.analyticsService})}setActivityStatus(e,t){this.player.activityStatusPlugin().setActivityStatus(e,t)}useCurrentTranscript(e,t){p.useMetadataTracks(this.player,`transcript`,e,t)}useChapters(e){p.useChapters(this.player,e)}},V={reconnectIntervalInMilliseconds:3e3,heartbeatEnabled:!1,heartbeatIntervalInMillseconds:1e4,heartbeatMessage:``},ye=class{constructor(e,t=V){this.bindFunctions(),this.url=e,this.options={...V,...t},this.webSocket=this.connect(),this.heartbeat=new E().schedule(()=>this.send(this.options.heartbeatMessage)).every(this.options.heartbeatIntervalInMillseconds)}bindFunctions(){this.cleanup=this.cleanup.bind(this),this.handleOpen=this.handleOpen.bind(this),this.handleMessage=this.handleMessage.bind(this),this.handleClose=this.handleClose.bind(this),this.handleError=this.handleError.bind(this),this.connect=this.connect.bind(this),this.send=this.send.bind(this),this.dipose=this.dipose.bind(this)}cleanup(){this.heartbeat.stop(),this.webSocket.removeEventListener(`error`,this.handleError),this.webSocket.removeEventListener(`message`,this.handleMessage),this.webSocket.removeEventListener(`open`,this.handleOpen),this.webSocket.removeEventListener(`close`,this.handleClose)}handleOpen(e){this.onOpen?.(e),this.options.heartbeatEnabled&&this.heartbeat.start()}handleMessage(e){this.onMessage?.(e)}handleClose(e){this.onClose?.(e),this.cleanup(),setTimeout(()=>{this.webSocket=this.connect()},this.options.reconnectIntervalInMilliseconds)}handleError(e){this.onError?.(e),this.handleClose()}connect(){let e=new WebSocket(this.url);return e.addEventListener(`open`,this.handleOpen),e.addEventListener(`message`,this.handleMessage),e.addEventListener(`close`,this.handleClose),e.addEventListener(`error`,this.handleError),e}send(e){this.webSocket.send(e)}dipose(){this.cleanup(),this.webSocket.close()}},be=2e3,xe=class{constructor(e,t){return this._timerStartedAt=0,this.position=0,this.duration=void 0,this.playing=!1,this.mute=!1,this.videoSource=``,this.subtitleSource=``,this.subtitles=!1,this.volume=0,this.title=e,this.device=t,this.ready=!1,this.playbackFinished=!1,this.debounced=w.withDebouncedSetters(this,be),w.withTimestampedSetters(this)}get position(){return this._position+this.getTimerDurationInSeconds()}set position(e){this._position=e,this.restartTimer()}get playing(){return this._playing}set playing(e){this._playing=e,e?this.restartTimer():(this._position+=this.getTimerDurationInSeconds(),this.stopTimer())}restartTimer(){this._timerStartedAt=Date.now()}stopTimer(){this._timerStartedAt=0}getTimerDurationInSeconds(){return this._timerStartedAt?(Date.now()-this._timerStartedAt)/1e3:0}},H=function(e){return e.Update=`update`,e.Volume=`volume`,e.Playing=`playing`,e.Paused=`paused`,e.NewChapter=`new_chapter`,e.Stopped=`stopped`,e.Ready=`ready`,e.Mute=`mute`,e.Finished=`finished`,e.Subtitles=`subtitles`,e}({}),Se=class extends S{constructor(e,t){super(),this.client=e,this.localState=new xe(t.title,t.device),this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.handleClientConnected=this.handleClientConnected.bind(this),this.handleDisconnectMessage=this.handleDisconnectMessage.bind(this),this.handleAllVideoMessages=this.handleAllVideoMessages.bind(this),this.handleUpdateMessage=this.handleUpdateMessage.bind(this),this.handleVolumeMessage=this.handleVolumeMessage.bind(this),this.handlePlayingMessage=this.handlePlayingMessage.bind(this),this.handlePausedMessage=this.handlePausedMessage.bind(this),this.handleFinishedMessage=this.handleFinishedMessage.bind(this),this.handleNewChapterMessage=this.handleNewChapterMessage.bind(this),this.handleStoppedMessage=this.handleStoppedMessage.bind(this),this.loadSource=this.loadSource.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.isPlaying=this.isPlaying.bind(this),this.getPosition=this.getPosition.bind(this),this.getDuration=this.getDuration.bind(this),this.getVolume=this.getVolume.bind(this)}initialize(){this.client.on(`dispose`,this.dispose),this.client.on(`connected`,this.handleClientConnected),this.client.on(`message`,this.handleDisconnectMessage).filter(e=>e.source===this.getDevice().id&&e.message.type===`disconnect`),this.client.on(`message`,this.handleAllVideoMessages).filter(e=>e.source===this.getDevice().id&&e.message.type===`video_event`)}dispose(){this.client.off(`dispose`,this.dispose),this.client.off(`connected`,this.handleClientConnected),this.client.off(`message`,this.handleDisconnectMessage),this.client.off(`message`,this.handleAllVideoMessages),this.client.stop(this.getDevice().id).catch(e=>console.error(e)),super.dispose()}async handleClientConnected(){try{await this.client.joinRoom(this.getDevice().id)}catch(e){this.trigger(`error`,e)}}handleDisconnectMessage(){this.dispose()}handleAllVideoMessages(e){let t=this.localState.debounced,n=e.message.payload.params||{};switch(e.message.payload.event){case H.Update:this.handleUpdateMessage(t,n);break;case H.NewChapter:this.handleNewChapterMessage(t,n);break;case H.Volume:this.handleVolumeMessage(t,n);break;case H.Playing:this.handlePlayingMessage(t);break;case H.Paused:this.handlePausedMessage(t);break;case H.Finished:this.handleFinishedMessage(t);break;case H.Stopped:this.handleStoppedMessage();break}}handleUpdateMessage(e,t){e.duration!==t.duration&&(e.duration=t.duration,this.trigger(`durationchange`,C.void)),e.position!==t.position&&(e.position=t.position,this.trigger(`positionchange`,C.void)),e.subtitles!==t.subtitles&&(e.subtitles=t.subtitles,this.trigger(`subtitleschange`,C.void))}handleVolumeMessage(e,t){e.volume!==t.level&&(e.volume=t.level,e.mute=t.level===0,this.trigger(`volumechange`,C.void))}handlePlayingMessage(e){e.playing!==!0&&(e.playing=!0,e.playbackFinished=!1,this.trigger(`playingchange`,C.void))}handlePausedMessage(e){e.playing!==!1&&(e.playing=!1,this.trigger(`playingchange`,C.void))}handleFinishedMessage(e){e.playbackFinished!==!0&&(e.playing=!1,e.playbackFinished=!0,this.trigger(`playingchange`,C.void))}handleNewChapterMessage(e,t){let n=(t.queue??[]).find(t=>t.url===e.videoSource);if(!n){console.info(`The device is no longer playing the source we loaded - disposing the session`),this.dispose();return}e.subtitleSource!==n.suburl&&(e.subtitleSource=n.suburl,this.trigger(`subtitleschange`,C.void))}handleStoppedMessage(){this.dispose()}async loadSource(e,t){if(!(this.localState.videoSource===e&&this.localState.subtitleSource===t))try{let n=this.getDevice().id,r=this.getPosition();this.localState.videoSource=e,this.localState.subtitleSource=t,this.localState.ready=!1,await this.client.joinRoom(n),await this.client.loadQueue({title:this.getTitle(),roomId:n,videoSource:e,subtitleSource:t}),this.localState.ready=!0,this.trigger(`sourceloaded`,C.void),r>0&&this.seek(r),t&&this.setSubtitles(t)}catch(e){console.error(e),this.trigger(`error`,Error(`Could not load video on Vivi device`))}}play(){this.localState.ready&&this.localState.playing!==!0&&(this.localState.playing=!0,this.client.play(this.getDevice().id),this.trigger(`playingchange`,C.void))}pause(){this.localState.ready&&this.localState.playing!==!1&&(this.localState.playing=!1,this.client.pause(this.getDevice().id),this.trigger(`playingchange`,C.void))}seek(e){this.localState.ready&&this.localState.position!==e&&(this.localState.position=e,this.client.seek(this.getDevice().id,e),this.trigger(`positionchange`,C.void))}setVolume(e){this.localState.ready&&this.localState.volume!==e&&(this.localState.volume=e,this.client.setVolume(this.getDevice().id,e),this.trigger(`volumechange`,C.void))}setMuted(e){this.localState.ready&&this.localState.mute!==e&&(this.localState.mute=e,this.client.setMuted(this.getDevice().id,e),this.trigger(`volumechange`,C.void))}async setSubtitles(e){if(!this.localState.ready)return;e&&await this.loadSource(this.localState.videoSource,e);let t=!!e;this.localState.subtitles!==t&&(this.localState.subtitles=t,this.client.setSubtitles(this.getDevice().id,t),this.trigger(`subtitleschange`,C.void))}isPlaying(){return this.localState.playing}isPlaybackFinished(){return this.localState.playbackFinished}getPosition(){return this.localState.position}getDuration(){return this.localState.duration}getVolume(){return this.localState.volume}getMuted(){return this.localState.mute}getSubtitles(){if(this.localState.subtitles)return this.localState.subtitleSource}getDevice(){return this.localState.device}getTitle(){return this.localState.title}},U=1e4,Ce=500,we=1e4,W=class e extends S{constructor(e){super(),this.options=e,this.accessToken=``,this.devices=[],this.devicesFingerprint=``,this.deviceDiscovery=new E,this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendMessageDebounced=y(this.sendMessage,Ce,!0),this.beginDeviceDiscovery=this.beginDeviceDiscovery.bind(this),this.dispose=this.dispose.bind(this),this.canCastToDevice=this.canCastToDevice.bind(this),this.getDevices=this.getDevices.bind(this),this.startCastSession=this.startCastSession.bind(this),this.authenticateWithVivi=this.authenticateWithVivi.bind(this),this.getRoomList=this.getRoomList.bind(this),this.joinRoom=this.joinRoom.bind(this),this.query=this.query.bind(this),this.loadQueue=this.loadQueue.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.stop=this.stop.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.setMuted=this.setMuted.bind(this),this.setSubtitles=this.setSubtitles.bind(this)}initialize(){this.webSocket=new ye(this.options.url),this.webSocket.onMessage=e=>this.trigger(`message`,JSON.parse(e.data)),this.webSocket.onOpen=async()=>{try{this.accessToken=await this.options.fetchAccessToken(),await this.authenticateWithVivi(),this.beginDeviceDiscovery(),this.trigger(`connected`,C.void)}catch(e){console.error(e),this.trigger(`error`,Error(`Could not connect to Vivi`))}}}sendMessage(e){this.webSocket?.send(JSON.stringify(e))}beginDeviceDiscovery(){this.deviceDiscovery.every(we).schedule(async()=>{try{let t=await this.getRoomList(),n=e.calculateFingerprint(t);if(n===this.devicesFingerprint)return;let r=new Set(t.map(e=>e.organisation??``)).size,i=new Set(t.map(e=>e.location??``)).size;this.devices=t.map(e=>({id:e.id,name:e.name,schoolName:r>1?e.organisation:``,description:i>1?e.location:``,type:D.Vivi,status:T.Available})),this.devicesFingerprint=n,this.trigger(`deviceschange`,C.void)}catch(e){console.warn(e)}}).trigger().start()}dispose(){this.deviceDiscovery.stop(),this.webSocket?.dipose(),super.dispose()}canCastToDevice(e){return e===D.Vivi}getDevices(){return this.devices}startCastSession(e){return new Se(this,e)}async authenticateWithVivi(){this.sendMessage({destination:`relay`,message:{token:this.accessToken,type:`identify_video_api`}}),await this.one(`message`,e=>e.message.type===`video_api_identified`).timeout(U).catch(()=>{throw Error(`Failed to authenticate with Vivi`)})}async getRoomList(){return this.sendMessage({destination:`relay`,message:{type:`video_api_rooms`}}),(await this.one(`message`,e=>e.message.type===`video_api_rooms`).timeout(U).catch(()=>{throw Error(`Failed to fetch rooms`)})).message.rooms||[]}async joinRoom(e){this.sendMessage({destination:`relay`,message:{destination_type:`box`,new_destination:e,token:this.accessToken,type:`connect`}}),await this.one(`message`,t=>{if(t.source===e&&t.message.type===`connect`||t.message.type===`error`&&t.message.error_type===`already_connected`)return!0}).timeout(U).catch(()=>{throw Error(`Failed to join room`)})}async query(t){let n=e.createAckId();return this.sendMessage({destination:t,message:{type:`message_with_ack`,ack_id:n,name:`query`}}),await this.one(`message`,e=>e.message.ack_id===n).timeout(U).catch(()=>{throw Error(`Failed to fetch query`)})}async loadQueue({roomId:t,title:n,videoSource:r,subtitleSource:i}){this.sendMessage({destination:t,message:{type:`message_with_ack`,ack_id:e.createAckId(),name:`queue_load`,payload:{urls:[{title:n,url:r,suburl:i}]}}}),await this.one(`message`,e=>e.source===t&&e.message.payload?.event===`ready`).timeout(U).catch(()=>{throw Error(`Failed to load media`)})}async play(e){this.sendMessage({destination:e,message:{type:`message`,name:`video_play`,payload:{}}}),await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`playing`).timeout(U).catch(()=>{throw Error(`Failed to play video`)})}async pause(e){this.sendMessage({destination:e,message:{type:`message`,name:`video_pause`}}),await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`paused`).timeout(U).catch(()=>{throw Error(`Failed to pause video`)})}async stop(e){this.sendMessage({destination:e,message:{type:`message`,name:`video_stop`}}),await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`stopped`).timeout(U).catch(()=>{throw Error(`Failed to stop video`)})}async seek(e,t){this.sendMessageDebounced({destination:e,message:{type:`message`,name:`video_seek`,payload:{position:t}}})&&await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`playing`).timeout(U).catch(()=>{throw Error(`Failed to seek video`)})}async setVolume(e,t){this.sendMessageDebounced({destination:e,message:{type:`message`,name:`set_volume`,payload:{volume:t}}})&&await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`volume`).timeout(U).catch(()=>{throw Error(`Failed to set volume`)})}async setMuted(e,t){this.sendMessage({destination:e,message:{type:`message`,name:`set_mute`,payload:{mute:t}}}),await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`mute`).timeout(U).catch(()=>{throw Error(`Failed to set mute`)})}async setSubtitles(t,n){let r=e.createAckId();this.sendMessage({destination:t,message:{type:`message_with_ack`,ack_id:r,name:`set_subtitles`,payload:{subtitles:n}}}),await this.one(`message`,e=>e.source===t&&e.message.payload?.event===`subtitles`).timeout(U).catch(()=>{throw Error(`Failed to set subtitles`)})}static createAckId(){return B.generateRandomId()}static calculateFingerprint(e){return e.map(e=>e.id).sort().join(`,`)}},G=class e extends S{constructor(e){super(),this.instanceId=e,this.clients=[],this.bindFunctions()}bindFunctions(){this.addClient=this.addClient.bind(this),this.hasInstanceOfClient=this.hasInstanceOfClient.bind(this),this.startCastSession=this.startCastSession.bind(this),this.gatherAndPublishDevices=this.gatherAndPublishDevices.bind(this),this.dispose=this.dispose.bind(this)}addClient(e){e.on(`deviceschange`,this.gatherAndPublishDevices),e.on(`error`,e=>this.trigger(`error`,e)),this.clients.push(e)}hasInstanceOfClient(e){return this.clients.some(t=>t instanceof e)}startCastSession(e){if(this.castSession)if(this.castSession.getDevice().id!==e.device.id)this.castSession.dispose();else{console.info(`A session with device ${e.device.id} already exists - this is a no-op`);return}let t=this.clients.find(t=>t.canCastToDevice(e.device.type));t&&(this.castSession=t.startCastSession(e),this.castSession.on(`error`,e=>{this.castSession.dispose(),this.trigger(`error`,e)}),this.castSession.on(`dispose`,()=>{this.castSession=void 0,this.trigger(`castsessionchange`,void 0)}),this.trigger(`castsessionchange`,this.castSession))}getCastSession(){return this.castSession}gatherAndPublishDevices(){let e=this.clients.map(e=>e.getDevices()).reduce((e,t)=>[...e,...t],[]);this.trigger(`deviceschange`,e)}dispose(){this.castSession?.dispose(),this.clients.forEach(e=>e.dispose()),this.castSession=void 0,this.clients=[],super.dispose()}static{this.instances={}}static getOrCreateInstance(t){if(!t)throw Error(`instanceId is required`);return this.instances[t]||(this.instances[t]=new e(t)),this.instances[t]}static disposeAndRemoveInstance(e){e.dispose(),delete this.instances[e.instanceId]}static isActive(){return Object.keys(this.instances).length>0}},Te=m.getComponent(`MenuItem`),K=class extends Te{constructor(e,t){super(e,t),this.isVisible=this.isVisible.bind(this)}createEl(){let e={vivi:`cv-vivi-icon`,"apple-tv":`cv-apple-icon`},t=super.createEl(`li`,{className:`vjs-menu-item cv-device-menu-item`}),n=m.dom.createEl(`div`,{className:`cv-device-menu-item-body`,innerHTML:`
4
4
  <span class="cv-device-icon ${e[this.options_.type]}"></span>
@@ -14,4 +14,4 @@ import{o as e}from"./DAXXjFlN.chunk.js";import{x as t}from"./BftnFbcr.chunk.js";
14
14
  </div>
15
15
  <div class="cv-devices-background" style="background-image: url(${this.poster})"></div>
16
16
  `;let t=document.createElement(`button`),n=e=>{e.stopPropagation(),this.options_.onStopCasting()};t.onclick=n,t.ontouchstart=n,t.className=`stop-casting-button`,t.innerHTML=this.localize(`Stop casting`),this.el_.querySelector(`.cv-devices-content`).appendChild(t)}play(){}},Fe=m.getComponent(`Tech`),Ie=class extends Fe{constructor(e,t){super(e,t),this.featuresVolumeControl=!0,this.featuresPlaybackRate=!1,this.movingMediaElementInDOM=!1,this.featuresFullscreenResize=!0,this.featuresTimeupdateEvents=!0,this.featuresProgressEvents=!1,this.featuresNativeTextTracks=!1,this.featuresNativeAudioTracks=!1,this.featuresNativeVideoTracks=!1,this.featuresMuteControl=!0,this.featuresSourceset=!1,this.videojsPlayer=m(this.options_.playerId),this.bindFunctions(),this.bindEventListeners(),this.ready(()=>{this.setSource(this.options_.source)}),this.triggerReady()}bindFunctions(){this.bindEventListeners=this.bindEventListeners.bind(this),this.onTextTrackChanged=this.onTextTrackChanged.bind(this),this.getSelectedTextTrack=this.getSelectedTextTrack.bind(this),this.setSelectedTextTrack=this.setSelectedTextTrack.bind(this),this.showUI=this.showUI.bind(this),this.hideUI=this.hideUI.bind(this),this.dispose=this.dispose.bind(this),this.setSource=this.setSource.bind(this),this.getCastSession=this.getCastSession.bind(this)}bindEventListeners(){let e=this.getCastSession();e&&(this.textTracks().on(`change`,this.onTextTrackChanged),this.videojsPlayer.one(`ended`,()=>{e.dispose()}),e.on(`durationchange`,()=>{this.trigger(`durationchange`)}),e.on(`dispose`,()=>{this.trigger(`ended`),this.hideUI()}),e.on(`playingchange`,()=>{e.isPlaying()?(this.trigger(`play`),this.trigger(`playing`)):this.trigger(`pause`)}),e.on(`volumechange`,()=>{this.trigger(`volumechange`)}),e.on(`sourceloaded`,()=>{this.trigger(`loadeddata`)}),e.on(`subtitleschange`,()=>{this.setSelectedTextTrack(e.getSubtitles())}))}onTextTrackChanged(){let e=this.getSelectedTextTrack();this.getCastSession()?.setSubtitles(e?.src)}getSelectedTextTrack(){return p.findTrackByPredicate(this.videojsPlayer.player_,e=>e.mode===`showing`&&!!e.src)}setSelectedTextTrack(e){p.forEachTrack(this.videojsPlayer.player_,t=>{t.kind===`subtitles`&&(t.src===e?t.mode=`showing`:t.mode=`disabled`)})}showUI(e){this.ui&&(this.ui.setPoster(this.options_.poster),this.ui.setDevice(e),this.ui.show())}hideUI(){this.ui?.hide()}dispose(){this.textTracks().off(`change`,this.onTextTrackChanged);let e=this.getCastSession();e&&e.dispose(),super.cleanupAutoTextTracks(),super.dispose()}createEl(){return this.ui=this.ui||new Pe({onStopCasting:()=>{this.getCastSession()?.dispose()}}),this.ui.el()}setSource(e){let t=this.getCastSession();if(!t)return;this.showUI(t.getDevice()),this.trigger(`loadstart`);let n=this.getSelectedTextTrack();t.loadSource(d.getOriginalUrl(e.src),n?.src)}addRemoteTextTrack(e){return super.addRemoteTextTrack(e,!0)}getCastSession(){return G.getOrCreateInstance(this.options_.instanceId??``).getCastSession()}play(){this.getCastSession()?.play()}pause(){this.getCastSession()?.pause()}paused(){return this.getCastSession()?.isPlaying()===!1}ended(){return this.getCastSession()?.isPlaybackFinished()??!1}setCurrentTime(e){this.getCastSession()?.seek(e??0)}currentTime(){return this.getCastSession()?.getPosition()??0}duration(){return this.getCastSession()?.getDuration()??this.videojsPlayer.duration()}volume(){return this.getCastSession()?.getVolume()??1}setVolume(e){this.getCastSession()?.setVolume(e)}muted(){return this.getCastSession()?.getMuted()??!1}setMuted(e){this.getCastSession()?.setMuted(e)}buffered(){}seekable(){return m.createTimeRanges(0,this.duration())}playbackRate(){return 1}readyState(){return 4}controls(){return!1}playsinline(){return!0}supportsFullScreen(){return!0}setAutoplay(){}preload(){}load(){}setPlaybackRate(){}static canPlayType(){return``}static canPlaySource(e,t){return e.type!==`application/dash+xml`&&!!G.getOrCreateInstance(t?.instanceId??``).getCastSession()}static isSupported(){return G.isActive()}};m.registerTech(`devices`,Ie);var Z=m.getPlugin(`plugin`),Le=class extends Z{constructor(e,t){super(e,t),this.options=t,this.instanceId=this.player.options_.devices?.instanceId??``,this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.onReady=this.onReady.bind(this),this.onDevicesChanged=this.onDevicesChanged.bind(this),this.onCastSessionChanged=this.onCastSessionChanged.bind(this),this.onDevicesError=this.onDevicesError.bind(this),this.addViviClient=this.addViviClient.bind(this),this.addAppleTvClient=this.addAppleTvClient.bind(this),this.reloadTech=this.reloadTech.bind(this),this.getSessionManager=this.getSessionManager.bind(this),this.dispose=this.dispose.bind(this)}initialize(){this.player.ready(this.onReady)}onReady(){let e=this.player.getChild(`collapserator`),t=this.getSessionManager();if(!e||!t)return;t.on(`deviceschange`,this.onDevicesChanged),t.on(`castsessionchange`,this.onCastSessionChanged),t.on(`error`,this.onDevicesError);let n=()=>{this.addViviClient(t),this.addAppleTvClient(t)},r=(e,n)=>{t.startCastSession({device:n,title:this.options.title}),this.options.analyticsService?.logUserAction(n,{actionType:c.Select,workflowPhase:a.Complete,descriptor:i.ChangeDevice,entity:s.Device,eventVersion:o.V3})},l=this.options.ctaOptions,u=this.options.vivi,d=this.options.appleTv,f=[];d.enabled||f.push(D.AppleTv),(!u.enabled||!u.accountConnected)&&f.push(D.Vivi);let p={onClick:n,onDeviceMenuItemClick:r,ctaOptions:{...l,inactiveIntegrations:f}};this.devicesButton=e.addChild(`DevicesButton`,p)}onDevicesChanged(e){this.devicesButton?.setDevices(e)}onCastSessionChanged(e){this.devicesButton?.setCastSession(e),this.reloadTech(),e?(this.player.addClass(`cv-device-casting`),this.player.addClass(`cv-device-${e.getDevice().type}`),this.player.isFullscreen()&&this.player.exitFullscreen()):(this.player.removeClass(`cv-device-casting`),this.player.removeClass(`cv-device-${D.AppleTv}`),this.player.removeClass(`cv-device-${D.Vivi}`))}onDevicesError(e){this.player.error(e.message),this.player.pause()}addViviClient(e){if(!this.options.vivi.enabled||!this.options.vivi.accountConnected||!this.options.vivi.apiUrl||e.hasInstanceOfClient(W))return;let t=new W({url:this.options.vivi.apiUrl,fetchAccessToken:this.options.vivi.fetchAccessToken});e.addClient(t)}addAppleTvClient(e){if(!this.options.appleTv.enabled||!this.options.trackingCode||!this.options.userId||e.hasInstanceOfClient(O))return;let t=new O({fetchAccessToken:this.options.appleTv.fetchAccessToken,trackingCode:this.options.trackingCode,userId:this.options.userId});e.addClient(t)}reloadTech(){let e=this.player,t=e.currentSources(),n=e.volume(),r=e.muted(),i=e.currentTime(),a=e.paused();e.src(t),e.one(`playing`,()=>{e.volume(n),e.muted(r),e.currentTime(i),a?e.pause():e.play()})}getSessionManager(){if(this.instanceId)return G.getOrCreateInstance(this.instanceId)}dispose(){let e=this.getSessionManager();e&&(e.off(`deviceschange`,this.onDevicesChanged),e.off(`castsessionchange`,this.onCastSessionChanged),e.off(`error`,this.onDevicesError),G.disposeAndRemoveInstance(e),super.dispose())}};m.registerPlugin(`devicesPlugin`,Le);function Re(e){return(0,J.jsx)(`div`,{className:`cv-resource-item`,children:(0,J.jsx)(l,{data:e.resource,imageCdnUrl:e.imageCdnUrl,titlePosition:`above`,hideTypeBadge:!0})})}var ze=h((e,t)=>(0,J.jsx)(Re,{...t})),Be=m.getComponent(`MenuItem`),Ve=class extends Be{constructor(e,t){super(e,t);let n=new ze(e,{resource:t.resource,imageCdnUrl:t.imageCdnUrl});this.addChild(n)}createEl(e,t={},n){return super.createEl(e,{...t,className:`${t.className} cv-resource-menu-item`},n)}handleClick(e){e.stopImmediatePropagation(),this.options_.downloadResource(this.options_.resource)}},He=m.getComponent(`MenuButton`),Q=class extends He{constructor(...e){super(...e),this.alwaysCollapsed=!1,this.isCollapsed=!1,this.isCollabsible=!0}buildWrapperCSSClass(){return`cv-menu-small cv-resources-button-wrapper ${super.buildWrapperCSSClass()}`}buildCSSClass(){return`cv-resources-button ${super.buildCSSClass()}`}update(){super.update()}createItems(){let e=[];return e.push(new _(this.player_,{label:`Resources`})),this.options_.resources.forEach(t=>{let n=new Ve(this.player(),{resource:t,imageCdnUrl:this.options_.imageCdnUrl,downloadResource:e=>this.downloadResource(e),label:t.name});e.push(n)}),e}downloadResource(e){if(e.type===`link`){t.PageLoad(e.url,!0);return}this.getDownloadIframe().src=e.url}getDownloadIframe(){return this.downloadIframe?this.downloadIframe:(this.downloadIframe=m.dom.createEl(`iframe`),this.downloadIframe.style.display=`none`,m.dom.appendContent(m.dom.$(`body`),this.downloadIframe),this.downloadIframe)}getCollabsibleName(){return this.controlText_}getCollabsibleValue(){return``}showInCollabsibleMenu(){return!0}showCollapsibleMenu(){super.handleClick(null)}};Q.prototype.controlText_=`Resources`,m.registerComponent(`ResourcesButton`,Q);var Ue=m.getPlugin(`plugin`),We=class extends Ue{constructor(e,t){super(e,t),this.options=t,e.ready(()=>this.onReady())}onReady(){this.options.resources.length&&this.player.getChild(`collapserator`).addChild(`ResourcesButton`,{resources:this.options.resources,imageCdnUrl:this.options.imageCdnUrl})}};m.registerPlugin(`resourcesPlugin`,We);function $(e){let{className:t=``,playerApi:n,onReady:r,onDispose:i,...a}=e,o=k.useRef(null);return k.useEffect(()=>{if(!o)return;let e=new ve(o.current,{...a,playerApi:n});return r&&e.ready(()=>{r(x(e))}),i&&e.one(`dispose`,i),()=>{e?.dispose()}},[e.viewKey]),(0,J.jsx)(`div`,{ref:o,className:t})}export{$ as ClickViewPlayer,$ as default};
17
- //# sourceMappingURL=BpHA-MkZ.chunk.js.map
17
+ //# sourceMappingURL=BiWUSyJr.chunk.js.map