@clickview/curator 1.101.0-rc.5 → 1.101.0
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.
- package/dist/.vite/manifest.json +214 -214
- package/dist/Assets/js/dist/scripts/{DRFvgQ8W2.chunk.js → BKQIzKcF2.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{DRFvgQ8W2.chunk.js.map → BKQIzKcF2.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{DVVpmgqo.chunk.js → BOrAaHLK.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{DVVpmgqo.chunk.js.map → BOrAaHLK.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{BhSjbB8b.chunk.js → COH92JF5.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{BhSjbB8b.chunk.js.map → COH92JF5.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{DjPcCTgD.chunk.js → CR-5nCWm.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{DjPcCTgD.chunk.js.map → CR-5nCWm.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{DWI3MPMB.chunk.js → CqZqlJSF.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{DWI3MPMB.chunk.js.map → CqZqlJSF.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{6Xv7Rh4u.chunk.js → CzCUe0Ej.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{6Xv7Rh4u.chunk.js.map → CzCUe0Ej.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/DOdn0XmW2.chunk.js +2 -0
- package/dist/Assets/js/dist/scripts/{D6kT_5BE2.chunk.js.map → DOdn0XmW2.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{UFmS4XTi.chunk.js → DTUkmChD.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{UFmS4XTi.chunk.js.map → DTUkmChD.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{mnL4Dbfb.chunk.js → DW7-la-i.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{mnL4Dbfb.chunk.js.map → DW7-la-i.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{DRewBr6v.chunk.js → Dhnl-PB5.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{DRewBr6v.chunk.js.map → Dhnl-PB5.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{DQKCtEam.chunk.js → DuU4GBw5.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{DQKCtEam.chunk.js.map → DuU4GBw5.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{4RooerDO2.chunk.js → LmwQmHZz2.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{4RooerDO2.chunk.js.map → LmwQmHZz2.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{app-BZJms7pb.js → app-DHtN6XkT.js} +3 -3
- package/dist/Assets/js/dist/scripts/{app-BZJms7pb.js.map → app-DHtN6XkT.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{B-n4bfSb.chunk.js → eKSK4iyn.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{B-n4bfSb.chunk.js.map → eKSK4iyn.chunk.js.map} +1 -1
- package/dist/Assets/js/dist/scripts/{CZpBv6pj.chunk.js → esASf9N4.chunk.js} +2 -2
- package/dist/Assets/js/dist/scripts/{CZpBv6pj.chunk.js.map → esASf9N4.chunk.js.map} +1 -1
- package/dist/bundles.json +1 -1
- package/dist/en.json +1 -1
- package/package.json +1 -1
- package/dist/Assets/js/dist/scripts/D6kT_5BE2.chunk.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,an as t,c as n,ln as r,r as i,w as a}from"./BlDu0qdC.chunk.js";import{Y as o,at as s,ct as c,et as l,q as u}from"./BjSaXG862.chunk.js";import{n as d}from"./CsF4wDV1.chunk.js";import{r as f}from"./CDJGGlmi.chunk.js";import{t as p}from"./SkqOfrUt2.chunk.js";import{F as m,I as h,L as g,M as _,N as v,O as y,P as b,c as x,j as S,n as ee,o as te,r as C,s as ne,t as re}from"./
|
|
1
|
+
import{a as e,an as t,c as n,ln as r,r as i,w as a}from"./BlDu0qdC.chunk.js";import{Y as o,at as s,ct as c,et as l,q as u}from"./BjSaXG862.chunk.js";import{n as d}from"./CsF4wDV1.chunk.js";import{r as f}from"./CDJGGlmi.chunk.js";import{t as p}from"./SkqOfrUt2.chunk.js";import{F as m,I as h,L as g,M as _,N as v,O as y,P as b,c as x,j as S,n as ee,o as te,r as C,s as ne,t as re}from"./DTUkmChD.chunk.js";import"./CzCUe0Ej.chunk.js";import{t as ie}from"./Bw_2JWQD.chunk.js";var w=r(e()),ae=g.getComponent(`Button`),T=class extends ae{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)}};T.prototype.controlText_=`Create clip`,g.registerComponent(`CreateClipButton`,T);var oe=g.getPlugin(`plugin`),se=class extends oe{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})}};g.registerPlugin(`createClipButtonPlugin`,se);var ce=g.getComponent(`PictureInPictureToggle`),le=class extends ce{handlePictureInPictureEnabledChange(){this.enable()}};g.registerComponent(`PictureInPictureToggle`,le);var ue=g.getComponent(`PlayToggle`),de=g.getPlugin(`plugin`),fe=800,pe=class extends de{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<fe?this.toggle?.hide():this.toggle?.show())}addPipStyles(){this.player.addClass(`cv-picture-in-picture`),this.playToggle=new ue(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()}};g.registerPlugin(`pictureInPicture`,pe);var me=g.getComponent(`Component`),he=class extends me{constructor(e,t){super(e,t),this.hasBuffered=!1,this.hasPlayed=!1,this.eventsService=f,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=g.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`)}},ge=g.getComponent(`MenuItem`),E=class extends ge{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(){g.dom.addClass(this.toggleEl,`on`),g.dom.setAttribute(this.toggleEl,`aria-checked`,`true`),this.pointsOfInterestVisible=!0,this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible)}toggleOff(){g.dom.removeClass(this.toggleEl,`on`),g.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=g.dom.createEl(`div`,{className:`custom-toggle custom-toggle-info toggle-option float-end`,innerHTML:`<span class="handle"></span></div>`}),g.dom.setAttribute(this.toggleEl,`id`,`poi-toggle`),g.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}};g.registerComponent(`PointsOfInterestMenuItem`,E);var _e=g.getPlugin(`plugin`),D=`cvplayer-points-of-interest`,ve=class extends _e{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&&(S.hasLocalStorage()&&S.get(D)===`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){S.set(D,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 he(this.player,{pointOfInterest:t});this.pointOfInterestIndicators.push(n),e.addChild(n)})}addMenuItem(){(this.player.getChild(`collapserator`)?.getChild(`cogButton`)).addItem({ctor:E,name:`PointsOfInterestMenuItem`,options:{pointsOfInterestVisible:this.enabled}})}updateBuffered(){this.pointOfInterestIndicators.forEach(e=>e.updateBuffered(te(this.player)))}updatePlaybackProgress(){this.pointOfInterestIndicators.forEach(e=>e.updatePlaybackProgress(this.player.currentTime()))}};g.registerPlugin(`pointsOfInterestPlugin`,ve);var ye=g.getComponent(`Component`),O=class extends ye{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+`%`}},be=g.getComponent(`ClickableComponent`),k=class extends be{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()}},xe=g.getComponent(`Component`),Se=class extends xe{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=g.dom.createEl(`h5`,{innerHTML:this.localize(`This clip has finished`),className:`cv-replay-heading`}),a=g.dom.createEl(`div`,{className:`cv-button-container`}),o=new k(this.player_,{label:this.localize(`Replay clip`),iconClassName:`cv-replay-icon`,onPress:this.options_.onReplayPress}),s=new k(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}},Ce=g.getPlugin(`plugin`),we=class extends Ce{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 O(this.player,{time:this.startTime}),e?.addChild(this.startTimeIndicator)),this.endTimeIndicator||(this.endTimeIndicator=new O(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 Se(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()}};g.registerPlugin(`rangeIndicatorPlugin`,we);var A={generateRandomId:()=>window.crypto?.randomUUID?.()??Math.random().toString()},Te=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:A.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){m.useMetadataTracks(this.player,`transcript`,e,t)}useChapters(e){m.useChapters(this.player,e)}},Ee=t(((e,t)=>{var n=t.exports={type:a,isArray:s,isFunction:o,isPlainObject:l,each:c,extend:u,noop:function(){}},r=Object.prototype.toString,i={};`Boolean Number String Function Array Date RegExp Object`.split(` `).forEach(function(e){i[`[object `+e+`]`]=e.toLowerCase()});function a(e){return e==null?String(e):i[r.call(e)]||`object`}function o(e){return n.type(e)===`function`}function s(e){return n.type(e)===`array`}function c(e,t,n){var r,i=0,a=e.length,s=a===void 0||o(e);if(n)if(s){for(r in e)if(t.apply(e[r],n)===!1)break}else for(;i<a&&t.apply(e[i++],n)!==!1;);else if(s){for(r in e)if(t.call(e[r],r,e[r])===!1)break}else for(;i<a&&t.call(e[i],i,e[i++])!==!1;);return e}function l(e){return!(!e||n.type(e)!==`object`)}function u(){var e,t,r,i,a,o,s=arguments[0]||{},c=1,l=arguments.length,u=!1;for(typeof s==`boolean`&&(u=s,s=arguments[1]||{},c=2),typeof s!=`object`&&!n.isFunction(s)&&(s={}),l===c&&(s=this,--c);c<l;c++)if((e=arguments[c])!=null)for(t in e)r=s[t],i=e[t],s!==i&&(u&&i&&(n.isPlainObject(i)||(a=n.isArray(i)))?(a?(a=!1,o=r&&n.isArray(r)?r:[]):o=r&&n.isPlainObject(r)?r:{},s[t]=n.extend(u,o,i)):i!==void 0&&(s[t]=i));return s}})),De=t(((e,t)=>{var n=t.exports=Ee(),r=/\s+/,i={};function a(e){var t=i[e]={};return n.each(e.split(r),function(e,n){t[n]=!0}),t}n.Callbacks=function(e){e=typeof e==`string`?i[e]||a(e):n.extend({},e);var t,r,o,s,c,l,u=[],d=!e.once&&[],f=function(n){for(t=e.memory&&n,r=!0,l=s||0,s=0,c=u.length,o=!0;u&&l<c;l++)if(u[l].apply(n[0],n[1])===!1&&e.stopOnFalse){t=!1;break}o=!1,u&&(d?d.length&&f(d.shift()):t?u=[]:p.disable())},p={add:function(){if(u){var r=u.length;(function t(r){n.each(r,function(r,i){var a=n.type(i);a===`function`?(!e.unique||!p.has(i))&&u.push(i):i&&i.length&&a!==`string`&&t(i)})})(arguments),o?c=u.length:t&&(s=r,f(t))}return this},remove:function(){return u&&n.each(arguments,function(e,t){for(var r;(r=n.inArray(t,u,r))>-1;)u.splice(r,1),o&&(r<=c&&c--,r<=l&&l--)}),this},has:function(e){return n.inArray(e,u)>-1},empty:function(){return u=[],this},disable:function(){return u=d=t=void 0,this},disabled:function(){return!u},lock:function(){return d=void 0,t||p.disable(),this},locked:function(){return!d},fireWith:function(e,t){return t||=[],t=[e,t.slice?t.slice():t],u&&(!r||d)&&(o?d.push(t):f(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!r}};return p}})),Oe=t(((e,t)=>{var n=t.exports=De(),r=Array.prototype.slice;n.extend({Deferred:function(e){var t=[[`resolve`,`done`,n.Callbacks(`once memory`),`resolved`],[`reject`,`fail`,n.Callbacks(`once memory`),`rejected`],[`notify`,`progress`,n.Callbacks(`memory`)]],r=`pending`,i={state:function(){return r},always:function(){return a.done(arguments).fail(arguments),this},then:function(){var e=arguments;return n.Deferred(function(r){n.each(t,function(t,i){var o=i[0],s=e[t];a[i[1]](n.isFunction(s)?function(){var e=s.apply(this,arguments);e&&n.isFunction(e.promise)?e.promise().done(r.resolve).fail(r.reject).progress(r.notify):r[o+`With`](this===a?r:this,[e])}:r[o])}),e=null}).promise()},promise:function(e){return e==null?i:n.extend(e,i)}},a={};return i.pipe=i.then,n.each(t,function(e,n){var o=n[2],s=n[3];i[n[1]]=o.add,s&&o.add(function(){r=s},t[e^1][2].disable,t[2][2].lock),a[n[0]]=o.fire,a[n[0]+`With`]=o.fireWith}),i.promise(a),e&&e.call(a,a),a},when:function(e){var t=0,i=r.call(arguments),a=i.length,o=a!==1||e&&n.isFunction(e.promise)?a:0,s=o===1?e:n.Deferred(),c=function(e,t,n){return function(i){t[e]=this,n[e]=arguments.length>1?r.call(arguments):i,n===l?s.notifyWith(t,n):--o||s.resolveWith(t,n)}},l,u,d;if(a>1)for(l=Array(a),u=Array(a),d=Array(a);t<a;t++)i[t]&&n.isFunction(i[t].promise)?i[t].promise().done(c(t,d,i)).fail(s.reject).progress(c(t,u,l)):--o;return o||s.resolveWith(d,i),s.promise()}})})),ke=t(((e,t)=>{t.exports=Oe()})),Ae=t(((e,t)=>{(function(e){var n=function(e){var t=[],n=/\[\]$/,r=function(e){return Object.prototype.toString.call(e)===`[object Array]`},i=function(e,n){n=typeof n==`function`?n():n??``,t[t.length]=encodeURIComponent(e)+`=`+encodeURIComponent(n)},a=function(e,o){var s,c,l;if(e)if(r(o))for(s=0,c=o.length;s<c;s++)n.test(e)?i(e,o[s]):a(e+`[`+(typeof o[s]==`object`?s:``)+`]`,o[s]);else if(o&&String(o)===`[object Object]`)for(l in o)a(e+`[`+l+`]`,o[l]);else i(e,o);else if(r(o))for(s=0,c=o.length;s<c;s++)i(o[s].name,o[s].value);else for(l in o)a(l,o[l]);return t};return a(``,e).join(`&`).replace(/%20/g,`+`)};typeof t==`object`&&typeof t.exports==`object`?t.exports=n:typeof define==`function`&&define.amd?define([],function(){return n}):e.param=n})(e)})),je=t(((e,t)=>{var n=ke(),r=Ae(),i=function(e){var t=e.events||{};return e&&e===e.window?{0:e,load:function(t){return e.addEventListener(`load`,t,!1)},bind:function(t,n){return e.addEventListener(t,n,!1)},unbind:function(t,n){return e.removeEventListener(t,n,!1)}}:{0:e,unbind:function(n,r){var i=t[n]||[];if(r){var a=i.indexOf(r);a!==-1&&i.splice(a,1)}else i=[];t[n]=i,e.events=t},bind:function(n,r){t[n]=(t[n]||[]).concat(r),e.events=t},triggerHandler:function(e,n){var r=this;(t[e]||[]).forEach(function(t){n&&n[0]&&n[0].type===void 0?n=[{type:e}].concat(n||[]):n||=[],t.apply(r,n)})}}},a=function(){try{return new window.XMLHttpRequest}catch{}};t.exports=n.extend(i,n,{defaultAjaxHeaders:null,ajax:function(e){var t=a();e.xhrFields&&e.xhrFields.withCredentials&&(t.withCredentials=!0),t.onreadystatechange=function(){if(t.readyState===4)if(t.status===200&&!t._hasError)try{e.success&&e.success(JSON.parse(t.responseText))}catch{e.error&&e.error(t)}else e.error&&e.error(t)},t.withCredentials=e.xhrFields.withCredentials;var n=`_=`+new Date().getTime();return e.url.indexOf(`?`)===-1?e.url+=`?`+n:e.url.indexOf(`_=`)===-1?e.url+=`&`+n:e.url=e.url.replace(/_=\d+/,n),t.open(e.type,e.url),t.setRequestHeader(`content-type`,e.contentType),e.headers&&Object.keys(e.headers).forEach(function(n){var r=e.headers[n];t.setRequestHeader(n,r)}),t.send(e.data.data&&`data=`+encodeURIComponent(e.data.data)),{abort:function(e){return t.abort(e)}}},inArray:function(e,t){return e.indexOf(t)!==-1},trim:function(e){return e&&e.trim()},isEmptyObject:function(e){return!e||Object.keys(e).length===0},makeArray:function(e){return[].slice.call(e,0)},param:function(e){return r(e)},support:{cors:function(){var e=a();return!!e&&`withCredentials`in e}()}})})),Me=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n=je();(function(e,t,n){var r={nojQuery:`jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.`,noTransportOnInit:`No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization.`,errorOnNegotiate:`Error during negotiation request.`,stoppedWhileLoading:`The connection was stopped during page load.`,stoppedWhileNegotiating:`The connection was stopped during the negotiate request.`,errorParsingNegotiateResponse:`Error parsing negotiate response.`,errorRedirectionExceedsLimit:`Negotiate redirection limit exceeded.`,errorDuringStartRequest:`Error during start request. Stopping the connection.`,errorFromServer:`Error message received from the server: '{0}'.`,stoppedDuringStartRequest:`The connection was stopped during the start request.`,errorParsingStartResponse:`Error parsing start response: '{0}'. Stopping the connection.`,invalidStartResponse:`Invalid start response: '{0}'. Stopping the connection.`,protocolIncompatible:`You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.`,aspnetCoreSignalrServer:`Detected a connection attempt to an ASP.NET Core SignalR Server. This client only supports connecting to an ASP.NET SignalR Server. See https://aka.ms/signalr-core-differences for details.`,sendFailed:`Send failed.`,parseFailed:`Failed at parsing response: {0}`,longPollFailed:`Long polling request failed.`,eventSourceFailedToConnect:`EventSource failed to connect.`,eventSourceError:`Error raised by EventSource`,webSocketClosed:`WebSocket closed.`,pingServerFailedInvalidResponse:`Invalid ping response when pinging server: '{0}'.`,pingServerFailed:`Failed to ping server.`,pingServerFailedStatusCode:`Failed to ping server. Server responded with status code {0}, stopping the connection.`,pingServerFailedParse:`Failed to parse ping server response, stopping the connection.`,noConnectionTransport:`Connection is in an invalid state, there is no transport active.`,webSocketsInvalidState:`The Web Socket transport is in an invalid state, transitioning into reconnecting.`,reconnectTimeout:`Couldn't reconnect within the configured timeout of {0} ms, disconnecting.`,reconnectWindowTimeout:`The client has been inactive since {0} and it has exceeded the inactivity timeout of {1} ms. Stopping the connection.`,jsonpNotSupportedWithAccessToken:`The JSONP protocol does not support connections that require a Bearer token to connect, such as the Azure SignalR Service.`};if(typeof e!=`function`)throw Error(r.nojQuery);var i,a,o=t.document.readyState===`complete`,s=e(t),c=`__Negotiate Aborted__`,l={onStart:`onStart`,onStarting:`onStarting`,onReceived:`onReceived`,onError:`onError`,onConnectionSlow:`onConnectionSlow`,onReconnecting:`onReconnecting`,onReconnect:`onReconnect`,onStateChanged:`onStateChanged`,onDisconnect:`onDisconnect`},u={processData:!0,timeout:null,async:!0,global:!1,cache:!1},d=function(e,n){if(n!==!1){var r;t.console!==void 0&&(r=`[`+new Date().toTimeString()+`] SignalR: `+e,t.console.debug?t.console.debug(r):t.console.log&&t.console.log(r))}},f=function(t,n,r){return n===t.state?(t.state=r,e(t).triggerHandler(l.onStateChanged,[{oldState:n,newState:r}]),!0):!1},p=function(e){return e.state===i.connectionState.disconnected},m=function(e){return e._.keepAliveData.activated&&e.transport.supportsKeepAlive(e)},h=function(n){var r,a;n._.configuredStopReconnectingTimeout||(a=function(t){var n=i._.format(i.resources.reconnectTimeout,t.disconnectTimeout);t.log(n),e(t).triggerHandler(l.onError,[i._.error(n,`TimeoutException`)]),t.stop(!1,!1)},n.reconnecting(function(){var e=this;e.state===i.connectionState.reconnecting&&(r=t.setTimeout(function(){a(e)},e.disconnectTimeout))}),n.stateChanged(function(e){e.oldState===i.connectionState.reconnecting&&t.clearTimeout(r)}),n._.configuredStopReconnectingTimeout=!0)};i=function(e,t,n){return new i.fn.init(e,t,n)},i._={defaultContentType:`application/x-www-form-urlencoded; charset=UTF-8`,ieVersion:function(){var e,n;return t.navigator.appName===`Microsoft Internet Explorer`&&(n=/MSIE ([0-9]+\.[0-9]+)/.exec(t.navigator.userAgent),n&&(e=t.parseFloat(n[1]))),e}(),error:function(e,t,n){var r=Error(e);return r.source=t,n!==void 0&&(r.context=n),r},transportError:function(e,t,r,i){var a=this.error(e,r,i);return a.transport=t?t.name:n,a},format:function(){for(var e=arguments[0],t=0;t<arguments.length-1;t++)e=e.replace(`{`+t+`}`,arguments[t+1]);return e},firefoxMajorVersion:function(e){var t=e.match(/Firefox\/(\d+)/);return!t||!t.length||t.length<2?0:parseInt(t[1],10)},configurePingInterval:function(n){var r=n._.config,a=function(t){e(n).triggerHandler(l.onError,[t])};r&&!n._.pingIntervalId&&r.pingInterval&&(n._.pingIntervalId=t.setInterval(function(){i.transports._logic.pingServer(n).fail(a)},r.pingInterval))}},i.events=l,i.resources=r,i.ajaxDefaults=u,i.changeState=f,i.isDisconnecting=p,i.connectionState={connecting:0,connected:1,reconnecting:2,disconnected:4},i.hub={start:function(){throw Error(`SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'><\/script>.`)}},typeof s.on==`function`?s.on(`load`,function(){o=!0}):s.load(function(){o=!0});function g(t,n){if(e.isArray(t)){for(var r=t.length-1;r>=0;r--){var a=t[r];(e.type(a)!==`string`||!i.transports[a])&&(n.log(`Invalid transport: `+a+`, removing it from the transports list.`),t.splice(r,1))}t.length===0&&(n.log(`No transports remain within the specified transport array.`),t=null)}else if(!i.transports[t]&&t!==`auto`)n.log(`Invalid transport: `+t.toString()+`.`),t=null;else if(t===`auto`&&i._.ieVersion<=8)return[`longPolling`];return t}function _(e){if(e===`http:`)return 80;if(e===`https:`)return 443}function v(e,t){return t.match(/:\d+$/)?t:t+`:`+_(e)}function y(t,n){var r=this,i=[];r.tryBuffer=function(n){return t.state===e.signalR.connectionState.connecting?(i.push(n),!0):!1},r.drain=function(){if(t.state===e.signalR.connectionState.connected)for(;i.length>0;)n(i.shift())},r.clear=function(){i=[]}}i.fn=i.prototype={init:function(t,n,r){var i=e(this);this.url=t,this.qs=n,this.lastError=null,this._={keepAliveData:{},connectingMessageBuffer:new y(this,function(e){i.triggerHandler(l.onReceived,[e])}),lastMessageAt:new Date().getTime(),lastActiveAt:new Date().getTime(),beatInterval:5e3,beatHandle:null,totalTransportConnectTimeout:0,redirectQs:null},typeof r==`boolean`&&(this.logging=r)},_parseResponse:function(e){var t=this;return e&&(typeof e==`string`?t.json.parse(e):e)},_originalJson:t.JSON,json:t.JSON,isCrossDomain:function(n,r){var i;return n=e.trim(n),r||=t.location,n.indexOf(`http`)===0?(i=t.document.createElement(`a`),i.href=n,i.protocol+v(i.protocol,i.host)!==r.protocol+v(r.protocol,r.host)):!1},ajaxDataType:`text`,contentType:`application/json; charset=UTF-8`,logging:!1,state:i.connectionState.disconnected,clientProtocol:`2.1`,supportedProtocols:[`1.5`,`2.0`,`2.1`],negotiateRedirectSupportedProtocols:[`2.0`,`2.1`],reconnectDelay:2e3,transportConnectTimeout:0,disconnectTimeout:3e4,reconnectWindow:3e4,keepAliveWarnAt:2/3,start:function(n,a){var u=this,d={pingInterval:3e5,waitForPageLoad:!0,transport:`auto`,jsonp:!1},p,_=u._deferral||e.Deferred(),v=t.document.createElement(`a`),y=function(n,r){n.url===r&&n.baseUrl||(n.url=r,v.href=n.url,!v.protocol||v.protocol===`:`?(n.protocol=t.document.location.protocol,n.host=v.host||t.document.location.host):(n.protocol=v.protocol,n.host=v.host),n.baseUrl=n.protocol+`//`+n.host,n.wsProtocol=n.protocol===`https:`?`wss://`:`ws://`,n.url.indexOf(`//`)===0&&(n.url=t.location.protocol+n.url,n.log(`Protocol relative URL detected, normalizing it to '`+n.url+`'.`)),n.isCrossDomain(n.url)&&(n.log(`Auto detected cross domain url.`),d.transport===`auto`&&(d.transport=[`webSockets`,`serverSentEvents`,`longPolling`]),n.withCredentials===void 0&&(n.withCredentials=!0),e.support.cors||(n.ajaxDataType=`jsonp`,n.log(`Using jsonp because this browser doesn't support CORS.`)),n.contentType=i._.defaultContentType))};if(u.lastError=null,u._deferral=_,!u.json)throw Error(`SignalR: No JSON parser found. Please ensure json2.js is referenced before the SignalR.js file if you need to support clients without native JSON parsing support, e.g. IE<8.`);if(e.type(n)===`function`?a=n:e.type(n)===`object`&&(e.extend(d,n),e.type(d.callback)===`function`&&(a=d.callback)),d.transport=g(d.transport,u),!d.transport)throw Error(`SignalR: Invalid transport(s) specified, aborting start.`);if(u._.config=d,!o&&d.waitForPageLoad===!0)return u._.deferredStartHandler=function(){u.start(n,a)},s.bind(`load`,u._.deferredStartHandler),_.promise();if(u.state===i.connectionState.connecting)return _.promise();if(f(u,i.connectionState.disconnected,i.connectionState.connecting)===!1)return _.resolve(u),_.promise();h(u),d.transport===`auto`&&d.jsonp===!0&&(d.transport=`longPolling`),u.withCredentials=d.withCredentials,u._originalUrl=u.url,u.ajaxDataType=d.jsonp?`jsonp`:`text`,y(u,u.url),e(u).bind(l.onStart,function(t,n){e.type(a)===`function`&&a.call(u),_.resolve(u)}),u._.initHandler=i.transports._logic.initHandler(u),p=function(n,a){var o=i._.error(r.noTransportOnInit);if(a||=0,a>=n.length){a===0?u.log(`No transports supported by the server were selected.`):a===1?u.log(`No fallback transports were selected.`):u.log(`Fallback transports exhausted.`),e(u).triggerHandler(l.onError,[o]),_.reject(o),u.stop();return}if(u.state!==i.connectionState.disconnected){var c=n[a],d=i.transports[c],h=function(){p(n,a+1)};u.transport=d;try{u._.initHandler.start(d,function(){var n=i._.firefoxMajorVersion(t.navigator.userAgent)>=11,r=!0;u.log(`The start request succeeded. Transitioning to the connected state.`),m(u)&&i.transports._logic.monitorKeepAlive(u),i.transports._logic.startHeartbeat(u),i._.configurePingInterval(u),f(u,i.connectionState.connecting,i.connectionState.connected)||u.log(`WARNING! The connection was not in the connecting state.`),u._.connectingMessageBuffer.drain(),e(u).triggerHandler(l.onStart),s.bind(`unload`,function(){u.log(`Window unloading, stopping the connection.`),u.stop(r)}),n&&s.bind(`beforeunload`,function(){t.setTimeout(function(){u.stop(r)},0)})},h)}catch(e){u.log(d.name+` transport threw '`+e.message+`' when attempting to start.`),h()}}};var b=u.url+`/negotiate`,x=function(t,n){var a=i._.error(r.errorOnNegotiate,t,n._.negotiateRequest);e(n).triggerHandler(l.onError,a),_.reject(a),n.stop()};return e(u).triggerHandler(l.onStarting),b=i.transports._logic.prepareQueryString(u,b),u.log(`Negotiating with '`+b+`'.`),u._.negotiateRequest=function(){var t,n=0,a,o,s=[],f=[],m=function(e,t){var n=i.transports._logic.prepareQueryString(e,e.url+`/negotiate`);e.log(`Negotiating with '`+n+`'.`);var a={url:n,error:function(t,n){n===c?_.reject(i._.error(r.stoppedWhileNegotiating,null,e._.negotiateRequest)):x(t,e)},success:t};return e.accessToken&&(a.headers={Authorization:`Bearer `+e.accessToken}),i.transports._logic.ajax(e,a)};return m(u,function c(h){try{t=u._parseResponse(h)}catch(e){x(i._.error(r.errorParsingNegotiateResponse,e),u);return}if(t.availableTransports){o=i._.error(r.aspnetCoreSignalrServer),e(u).triggerHandler(l.onError,[o]),_.reject(o);return}if(!t.ProtocolVersion||u.supportedProtocols.indexOf(t.ProtocolVersion)===-1){o=i._.error(i._.format(r.protocolIncompatible,u.clientProtocol,t.ProtocolVersion)),e(u).triggerHandler(l.onError,[o]),_.reject(o);return}if(u.negotiateRedirectSupportedProtocols.indexOf(t.ProtocolVersion)!==-1){if(t.Error){o=i._.error(i._.format(r.errorFromServer,t.Error)),e(u).triggerHandler(l.onError,[o]),_.reject(o);return}else if(t.RedirectUrl){if(n===100){x(i._.error(r.errorRedirectionExceedsLimit),u);return}d.transport===`auto`&&(d.transport=[`webSockets`,`serverSentEvents`,`longPolling`]),u.log(`Received redirect to: `+t.RedirectUrl),u.accessToken=t.AccessToken;var g=t.RedirectUrl.split(`?`,2);if(y(u,g[0]),u._.redirectQs=g.length===2?g[1]:null,u.ajaxDataType===`jsonp`&&u.accessToken){x(i._.error(r.jsonpNotSupportedWithAccessToken),u);return}n++,m(u,c);return}}a=u._.keepAliveData,u.appRelativeUrl=t.Url,u.id=t.ConnectionId,u.token=t.ConnectionToken,u.webSocketServerUrl=t.WebSocketServerUrl,u._.pollTimeout=t.ConnectionTimeout*1e3+1e4,u.disconnectTimeout=t.DisconnectTimeout*1e3,u._.totalTransportConnectTimeout=u.transportConnectTimeout+t.TransportConnectTimeout*1e3,t.KeepAliveTimeout?(a.activated=!0,a.timeout=t.KeepAliveTimeout*1e3,a.timeoutWarning=a.timeout*u.keepAliveWarnAt,u._.beatInterval=(a.timeout-a.timeoutWarning)/3):a.activated=!1,u.reconnectWindow=u.disconnectTimeout+(a.timeout||0),e.each(i.transports,function(e){if(e.indexOf(`_`)===0||e===`webSockets`&&!t.TryWebSockets)return!0;f.push(e)}),e.isArray(d.transport)?e.each(d.transport,function(t,n){e.inArray(n,f)>=0&&s.push(n)}):d.transport===`auto`?s=f:e.inArray(d.transport,f)>=0&&s.push(d.transport),p(s)})}(),_.promise()},starting:function(t){var n=this;return e(n).bind(l.onStarting,function(e,r){t.call(n)}),n},send:function(e){var t=this;if(t.state===i.connectionState.disconnected)throw Error(`SignalR: Connection must be started before data can be sent. Call .start() before .send()`);if(t.state===i.connectionState.connecting)throw Error(`SignalR: Connection has not been fully initialized. Use .start().done() or .start().fail() to run logic after the connection has started.`);return t.transport.send(t,e),t},received:function(t){var n=this;return e(n).bind(l.onReceived,function(e,r){t.call(n,r)}),n},stateChanged:function(t){var n=this;return e(n).bind(l.onStateChanged,function(e,r){t.call(n,r)}),n},error:function(t){var n=this;return e(n).bind(l.onError,function(e,r,i){n.lastError=r,t.call(n,r,i)}),n},disconnected:function(t){var n=this;return e(n).bind(l.onDisconnect,function(e,r){t.call(n)}),n},connectionSlow:function(t){var n=this;return e(n).bind(l.onConnectionSlow,function(e,r){t.call(n)}),n},reconnecting:function(t){var n=this;return e(n).bind(l.onReconnecting,function(e,r){t.call(n)}),n},reconnected:function(t){var n=this;return e(n).bind(l.onReconnect,function(e,r){t.call(n)}),n},stop:function(n,a){var u=this,d=u._deferral;if(u._.deferredStartHandler&&s.unbind(`load`,u._.deferredStartHandler),delete u._.config,delete u._.deferredStartHandler,!o&&(!u._.config||u._.config.waitForPageLoad===!0)){u.log(`Stopping connection prior to negotiate.`),d&&d.reject(i._.error(r.stoppedWhileLoading));return}if(u.state!==i.connectionState.disconnected)return u.log(`Stopping connection.`),t.clearTimeout(u._.beatHandle),t.clearInterval(u._.pingIntervalId),u.transport&&=(u.transport.stop(u),a!==!1&&u.transport.abort(u,n),m(u)&&i.transports._logic.stopMonitoringKeepAlive(u),null),u._.negotiateRequest&&(u._.negotiateRequest.abort(c),delete u._.negotiateRequest),u._.initHandler&&u._.initHandler.stop(),delete u._deferral,delete u.messageId,delete u.groupsToken,delete u.id,delete u._.pingIntervalId,delete u._.lastMessageAt,delete u._.lastActiveAt,u._.connectingMessageBuffer.clear(),e(u).unbind(l.onStart),delete u.accessToken,delete u.protocol,delete u.host,delete u.baseUrl,delete u.wsProtocol,delete u.contentType,u.url=u._originalUrl,u._.redirectQs=null,f(u,u.state,i.connectionState.disconnected),e(u).triggerHandler(l.onDisconnect),u},log:function(e){d(e,this.logging)}},i.fn.init.prototype=i.fn,i.noConflict=function(){return e.connection===i&&(e.connection=a),i},e.connection&&(a=e.connection),e.connection=e.signalR=i})(n,window),(function(e,n,r){var i=e.signalR,a=e.signalR.events,o=e.signalR.changeState,s=`__Start Aborted__`,c;i.transports={};function l(e){e._.keepAliveData.monitoring&&u(e),c.markActive(e)&&(e._.beatHandle=n.setTimeout(function(){l(e)},e._.beatInterval))}function u(t){var n=t._.keepAliveData,r;t.state===i.connectionState.connected&&(r=new Date().getTime()-t._.lastMessageAt,r>=n.timeout?(t.log(`Keep alive timed out. Notifying transport that connection has been lost.`),t.transport.lostConnection(t)):r>=n.timeoutWarning?n.userNotified||=(t.log(`Keep alive has been missed, connection may be dead/slow.`),e(t).triggerHandler(a.onConnectionSlow),!0):n.userNotified=!1)}function d(e,t){var n=e.url+t;return e.transport&&(n+=`?transport=`+e.transport.name),c.prepareQueryString(e,n)}function f(e){this.connection=e,this.startRequested=!1,this.startCompleted=!1,this.connectionStopped=!1}f.prototype={start:function(e,t,i){var a=this,o=a.connection,s=!1;if(a.startRequested||a.connectionStopped){o.log(`WARNING! `+e.name+` transport cannot be started. Initialization ongoing or completed.`);return}o.log(e.name+` transport starting.`),e.start(o,function(){s||a.initReceived(e,t)},function(t){return s||(s=!0,a.transportFailed(e,t,i)),!a.startCompleted||a.connectionStopped}),a.transportTimeoutHandle=n.setTimeout(function(){s||(s=!0,o.log(e.name+` transport timed out when trying to connect.`),a.transportFailed(e,r,i))},o._.totalTransportConnectTimeout)},stop:function(){this.connectionStopped=!0,n.clearTimeout(this.transportTimeoutHandle),i.transports._logic.tryAbortStartRequest(this.connection)},initReceived:function(e,t){var r=this,a=r.connection;if(r.startRequested){a.log(`WARNING! The client received multiple init messages.`);return}r.connectionStopped||(r.startRequested=!0,n.clearTimeout(r.transportTimeoutHandle),a.log(e.name+` transport connected. Initiating start request.`),i.transports._logic.ajaxStart(a,function(){r.startCompleted=!0,t()}))},transportFailed:function(t,r,o){var s=this.connection,c=s._deferral,l;this.connectionStopped||(n.clearTimeout(this.transportTimeoutHandle),this.startRequested?this.startCompleted||(l=i._.error(i.resources.errorDuringStartRequest,r),s.log(t.name+` transport failed during the start request. Stopping the connection.`),e(s).triggerHandler(a.onError,[l]),c&&c.reject(l),s.stop()):(t.stop(s),s.log(t.name+` transport failed to connect. Attempting to fall back.`),o()))}},c=i.transports._logic={ajax:function(t,n){return e.ajax(e.extend(!0,{},e.signalR.ajaxDefaults,{type:`GET`,data:{},xhrFields:{withCredentials:t.withCredentials},contentType:t.contentType,dataType:t.ajaxDataType},n))},pingServer:function(t){var n,r,a=e.Deferred();return t.transport?(n=t.url+`/ping`,n=c.addQs(n,t.qs),r=c.ajax(t,{url:n,headers:t.accessToken?{Authorization:`Bearer `+t.accessToken}:{},success:function(e){var n;try{n=t._parseResponse(e)}catch(e){a.reject(i._.transportError(i.resources.pingServerFailedParse,t.transport,e,r)),t.stop();return}n.Response===`pong`?a.resolve():a.reject(i._.transportError(i._.format(i.resources.pingServerFailedInvalidResponse,e),t.transport,null,r))},error:function(e){e.status===401||e.status===403?(a.reject(i._.transportError(i._.format(i.resources.pingServerFailedStatusCode,e.status),t.transport,e,r)),t.stop()):a.reject(i._.transportError(i.resources.pingServerFailed,t.transport,e,r))}})):a.reject(i._.transportError(i.resources.noConnectionTransport,t.transport)),a.promise()},prepareQueryString:function(e,t){var r=c.addQs(t,`clientProtocol=`+e.clientProtocol);return r=typeof e._.redirectQs==`string`?c.addQs(r,e._.redirectQs):c.addQs(r,e.qs),e.token&&(r+=`&connectionToken=`+n.encodeURIComponent(e.token)),e.data&&(r+=`&connectionData=`+n.encodeURIComponent(e.data)),r},addQs:function(n,r){var i=n.indexOf(`?`)===-1?`?`:`&`,a;if(!r)return n;if((r===void 0?`undefined`:t(r))===`object`)return n+i+e.param(r);if(typeof r==`string`)return a=r.charAt(0),(a===`?`||a===`&`)&&(i=``),n+i+r;throw Error(`Query string property must be either a string or object.`)},getUrl:function(e,t,r,i,a){var o=(t===`webSockets`?``:e.baseUrl)+e.appRelativeUrl,s=`transport=`+t;return!a&&e.groupsToken&&(s+=`&groupsToken=`+n.encodeURIComponent(e.groupsToken)),r?(i?o+=`/poll`:o+=`/reconnect`,!a&&e.messageId&&(s+=`&messageId=`+n.encodeURIComponent(e.messageId))):o+=`/connect`,o+=`?`+s,o=c.prepareQueryString(e,o),e.transport&&e.accessToken&&(e.transport.name===`serverSentEvents`||e.transport.name===`webSockets`)&&(o+=`&access_token=`+n.encodeURIComponent(e.accessToken)),a||(o+=`&tid=`+Math.floor(Math.random()*11)),o},maximizePersistentResponse:function(e){return{MessageId:e.C,Messages:e.M,Initialized:e.S!==void 0,ShouldReconnect:e.T!==void 0,LongPollDelay:e.L,GroupsToken:e.G,Error:e.E}},updateGroups:function(e,t){t&&(e.groupsToken=t)},stringifySend:function(e,t){return typeof t==`string`||t==null?t:e.json.stringify(t)},ajaxSend:function(t,n){var r=c.stringifySend(t,n),o=d(t,`/send`),s,l=function(t,r){e(r).triggerHandler(a.onError,[i._.transportError(i.resources.sendFailed,r.transport,t,s),n])};return s=c.ajax(t,{url:o,type:t.ajaxDataType===`jsonp`?`GET`:`POST`,contentType:i._.defaultContentType,headers:t.accessToken?{Authorization:`Bearer `+t.accessToken}:{},data:{data:r},success:function(e){var n;if(e){try{n=t._parseResponse(e)}catch(e){l(e,t),t.stop();return}c.triggerReceived(t,n)}},error:function(e,n){n===`abort`||n===`parsererror`||l(e,t)}}),s},ajaxAbort:function(e,t){if(e.transport!==void 0){t=t===void 0||t;var n=d(e,`/abort`);c.ajax(e,{url:n,async:t,timeout:1e3,type:`POST`,headers:e.accessToken?{Authorization:`Bearer `+e.accessToken}:{},dataType:`text`}),e.log(`Fired ajax abort async = `+t+`.`)}},ajaxStart:function(t,n){var r=function(e){var n=t._deferral;n&&n.reject(e)},o=function(n){t.log(`The start request failed. Stopping the connection.`),e(t).triggerHandler(a.onError,[n]),r(n),t.stop()};t._.startRequest=c.ajax(t,{url:d(t,`/start`),headers:t.accessToken?{Authorization:`Bearer `+t.accessToken}:{},success:function(e,r,a){var s;try{s=t._parseResponse(e)}catch(t){o(i._.error(i._.format(i.resources.errorParsingStartResponse,e),t,a));return}s.Response===`started`?n():o(i._.error(i._.format(i.resources.invalidStartResponse,e),null,a))},error:function(e,n,a){n===s?(t.log(`The start request aborted because connection.stop() was called.`),r(i._.error(i.resources.stoppedDuringStartRequest,null,e))):o(i._.error(i.resources.errorDuringStartRequest,a,e))}})},tryAbortStartRequest:function(e){e._.startRequest&&(e._.startRequest.abort(s),delete e._.startRequest)},tryInitialize:function(e,t,n){t.Initialized&&n?n():t.Initialized&&e.log(`WARNING! The client received an init message after reconnecting.`)},triggerReceived:function(t,n){t._.connectingMessageBuffer.tryBuffer(n)||e(t).triggerHandler(a.onReceived,[n])},processMessages:function(t,n,r){var a;if(n&&n.I!==void 0){c.triggerReceived(t,n);return}if(c.markLastMessage(t),n){if(a=c.maximizePersistentResponse(n),a.Error){t.log(`Received an error message from the server: `+n.E),e(t).triggerHandler(i.events.onError,[i._.error(n.E,`ServerError`)]),t.stop(!1,!1);return}c.updateGroups(t,a.GroupsToken),a.MessageId&&(t.messageId=a.MessageId),a.Messages&&(e.each(a.Messages,function(e,n){c.triggerReceived(t,n)}),c.tryInitialize(t,a,r))}},monitorKeepAlive:function(t){var n=t._.keepAliveData;n.monitoring?t.log(`Tried to monitor keep alive but it's already being monitored.`):(n.monitoring=!0,c.markLastMessage(t),t._.keepAliveData.reconnectKeepAliveUpdate=function(){c.markLastMessage(t)},e(t).bind(a.onReconnect,t._.keepAliveData.reconnectKeepAliveUpdate),t.log(`Now monitoring keep alive with a warning timeout of `+n.timeoutWarning+`, keep alive timeout of `+n.timeout+` and disconnecting timeout of `+t.disconnectTimeout))},stopMonitoringKeepAlive:function(t){var n=t._.keepAliveData;n.monitoring&&(n.monitoring=!1,e(t).unbind(a.onReconnect,t._.keepAliveData.reconnectKeepAliveUpdate),t._.keepAliveData={},t.log(`Stopping the monitoring of the keep alive.`))},startHeartbeat:function(e){e._.lastActiveAt=new Date().getTime(),l(e)},markLastMessage:function(e){e._.lastMessageAt=new Date().getTime()},markActive:function(e){return c.verifyLastActive(e)?(e._.lastActiveAt=new Date().getTime(),!0):!1},isConnectedOrReconnecting:function(e){return e.state===i.connectionState.connected||e.state===i.connectionState.reconnecting},ensureReconnectingState:function(t){return o(t,i.connectionState.connected,i.connectionState.reconnecting)===!0&&e(t).triggerHandler(a.onReconnecting),t.state===i.connectionState.reconnecting},clearReconnectTimeout:function(e){e&&e._.reconnectTimeout&&(n.clearTimeout(e._.reconnectTimeout),delete e._.reconnectTimeout)},verifyLastActive:function(t){if(new Date().getTime()-t._.lastActiveAt>=t.reconnectWindow){var n=i._.format(i.resources.reconnectWindowTimeout,new Date(t._.lastActiveAt),t.reconnectWindow);return t.log(n),e(t).triggerHandler(a.onError,[i._.error(n,`TimeoutException`)]),t.stop(!1,!1),!1}return!0},reconnect:function(e,t){var r=i.transports[t];if(c.isConnectedOrReconnecting(e)&&!e._.reconnectTimeout){if(!c.verifyLastActive(e))return;e._.reconnectTimeout=n.setTimeout(function(){c.verifyLastActive(e)&&(r.stop(e),c.ensureReconnectingState(e)&&(e.log(t+` reconnecting.`),r.start(e)))},e.reconnectDelay)}},handleParseFailure:function(t,n,r,o,s){var c=i._.transportError(i._.format(i.resources.parseFailed,n),t.transport,r,s);o&&o(c)?t.log(`Failed to parse server response while attempting to connect.`):(e(t).triggerHandler(a.onError,[c]),t.stop())},initHandler:function(e){return new f(e)},foreverFrame:{count:0,connections:{}}}})(n,window),(function(e,t,n){var r=e.signalR,i=e.signalR.events,a=e.signalR.changeState,o=r.transports._logic;r.transports.webSockets={name:`webSockets`,supportsKeepAlive:function(){return!0},send:function(t,n){var a=o.stringifySend(t,n);try{t.socket.send(a)}catch(a){e(t).triggerHandler(i.onError,[r._.transportError(r.resources.webSocketsInvalidState,t.transport,a,t.socket),n])}},start:function(n,s,c){var l,u=!1,d=this,f=!s,p=e(n);if(!t.WebSocket){c();return}n.socket||(l=n.webSocketServerUrl?n.webSocketServerUrl:n.wsProtocol+n.host,l+=o.getUrl(n,this.name,f),n.log(`Connecting to websocket endpoint '`+l+`'.`),n.socket=new t.WebSocket(l),n.socket.onopen=function(){u=!0,n.log(`Websocket opened.`),o.clearReconnectTimeout(n),a(n,r.connectionState.reconnecting,r.connectionState.connected)===!0&&p.triggerHandler(i.onReconnect)},n.socket.onclose=function(t){var a;this===n.socket&&(u&&t.wasClean!==void 0&&t.wasClean===!1?(a=r._.transportError(r.resources.webSocketClosed,n.transport,t),n.log(`Unclean disconnect from websocket: `+(t.reason||`[no reason given].`))):n.log(`Websocket closed.`),(!c||!c(a))&&(a&&e(n).triggerHandler(i.onError,[a]),d.reconnect(n)))},n.socket.onmessage=function(e){var t;try{t=n._parseResponse(e.data)}catch(t){o.handleParseFailure(n,e.data,t,c,e);return}t&&o.processMessages(n,t,s)})},reconnect:function(e){o.reconnect(e,this.name)},lostConnection:function(e){this.reconnect(e)},stop:function(e){o.clearReconnectTimeout(e),e.socket&&=(e.log(`Closing the Websocket.`),e.socket.close(),null)},abort:function(e,t){o.ajaxAbort(e,t)}}})(n,window),(function(e,t,n){var r=e.signalR,i=e.signalR.events,a=e.signalR.changeState,o=r.transports._logic,s=function(e){t.clearTimeout(e._.reconnectAttemptTimeoutHandle),delete e._.reconnectAttemptTimeoutHandle};r.transports.serverSentEvents={name:`serverSentEvents`,supportsKeepAlive:function(){return!0},timeOut:3e3,start:function(n,c,l){var u=this,d=!1,f=e(n),p=!c,m;if(n.eventSource&&(n.log(`The connection already has an event source. Stopping it.`),n.stop()),!t.EventSource){l&&(n.log(`This browser doesn't support SSE.`),l());return}m=o.getUrl(n,this.name,p);try{n.log(`Attempting to connect to SSE endpoint '`+m+`'.`),n.eventSource=new t.EventSource(m,{withCredentials:n.withCredentials})}catch(e){n.log(`EventSource failed trying to connect with error `+e.Message+`.`),l?l():(f.triggerHandler(i.onError,[r._.transportError(r.resources.eventSourceFailedToConnect,n.transport,e)]),p&&u.reconnect(n));return}p&&(n._.reconnectAttemptTimeoutHandle=t.setTimeout(function(){d===!1&&n.eventSource.readyState!==t.EventSource.OPEN&&u.reconnect(n)},u.timeOut)),n.eventSource.addEventListener(`open`,function(e){n.log(`EventSource connected.`),s(n),o.clearReconnectTimeout(n),d===!1&&(d=!0,a(n,r.connectionState.reconnecting,r.connectionState.connected)===!0&&f.triggerHandler(i.onReconnect))},!1),n.eventSource.addEventListener(`message`,function(e){var t;if(e.data!==`initialized`){try{t=n._parseResponse(e.data)}catch(t){o.handleParseFailure(n,e.data,t,l,e);return}o.processMessages(n,t,c)}},!1),n.eventSource.addEventListener(`error`,function(e){var a=r._.transportError(r.resources.eventSourceError,n.transport,e);this===n.eventSource&&(l&&l(a)||(n.log(`EventSource readyState: `+n.eventSource.readyState+`.`),e.eventPhase===t.EventSource.CLOSED?(n.log(`EventSource reconnecting due to the server connection ending.`),u.reconnect(n)):(n.log(`EventSource error.`),f.triggerHandler(i.onError,[a]))))},!1)},reconnect:function(e){o.reconnect(e,this.name)},lostConnection:function(e){this.reconnect(e)},send:function(e,t){o.ajaxSend(e,t)},stop:function(e){s(e),o.clearReconnectTimeout(e),e&&e.eventSource&&(e.log(`EventSource calling close().`),e.eventSource.close(),e.eventSource=null,delete e.eventSource)},abort:function(e,t){o.ajaxAbort(e,t)}}})(n,window),(function(e,t,n){var r=e.signalR,i=e.signalR.events,a=e.signalR.changeState,o=r.transports._logic,s=function(){var e=t.document.createElement(`iframe`);return e.setAttribute(`style`,`position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;`),e},c=function(){var e=null,n=0;return{prevent:function(){r._.ieVersion<=8&&(n===0&&(e=t.setInterval(function(){var e=s();t.document.body.appendChild(e),t.document.body.removeChild(e),e=null},1e3)),n++)},cancel:function(){n===1&&t.clearInterval(e),n>0&&n--}}}();r.transports.foreverFrame={name:`foreverFrame`,supportsKeepAlive:function(){return!0},iframeClearThreshold:50,start:function(e,n,r){if(e.accessToken){r&&(e.log(`Forever Frame does not support connections that require a Bearer token to connect, such as the Azure SignalR Service.`),r());return}var i=this,a=o.foreverFrame.count+=1,l,u=s(),d=function(){e.log(`Forever frame iframe finished loading and is no longer receiving messages.`),(!r||!r())&&i.reconnect(e)};if(t.EventSource){r&&(e.log(`Forever Frame is not supported by SignalR on browsers with SSE support.`),r());return}u.setAttribute(`data-signalr-connection-id`,e.id),c.prevent(),l=o.getUrl(e,this.name),l+=`&frameId=`+a,t.document.documentElement.appendChild(u),e.log(`Binding to iframe's load event.`),u.addEventListener?u.addEventListener(`load`,d,!1):u.attachEvent&&u.attachEvent(`onload`,d),u.src=l,o.foreverFrame.connections[a]=e,e.frame=u,e.frameId=a,n&&(e.onSuccess=function(){e.log(`Iframe transport started.`),n()})},reconnect:function(e){var n=this;o.isConnectedOrReconnecting(e)&&o.verifyLastActive(e)&&t.setTimeout(function(){if(o.verifyLastActive(e)&&e.frame&&o.ensureReconnectingState(e)){var t=e.frame,r=o.getUrl(e,n.name,!0)+`&frameId=`+e.frameId;e.log(`Updating iframe src to '`+r+`'.`),t.src=r}},e.reconnectDelay)},lostConnection:function(e){this.reconnect(e)},send:function(e,t){o.ajaxSend(e,t)},receive:function(t,n){var i,a,s;if(t.json!==t._originalJson&&(n=t._originalJson.stringify(n)),s=t._parseResponse(n),o.processMessages(t,s,t.onSuccess),t.state===e.signalR.connectionState.connected&&(t.frameMessageCount=(t.frameMessageCount||0)+1,t.frameMessageCount>r.transports.foreverFrame.iframeClearThreshold&&(t.frameMessageCount=0,i=t.frame.contentWindow||t.frame.contentDocument,i&&i.document&&i.document.body)))for(a=i.document.body;a.firstChild;)a.removeChild(a.firstChild)},stop:function(e){var n=null;if(c.cancel(),e.frame){if(e.frame.stop)e.frame.stop();else try{n=e.frame.contentWindow||e.frame.contentDocument,n.document&&n.document.execCommand&&n.document.execCommand(`Stop`)}catch(t){e.log(`Error occurred when stopping foreverFrame transport. Message = `+t.message+`.`)}e.frame.parentNode===t.document.documentElement&&t.document.documentElement.removeChild(e.frame),delete o.foreverFrame.connections[e.frameId],e.frame=null,e.frameId=null,delete e.frame,delete e.frameId,delete e.onSuccess,delete e.frameMessageCount,e.log(`Stopping forever frame.`)}},abort:function(e,t){o.ajaxAbort(e,t)},getConnection:function(e){return o.foreverFrame.connections[e]},started:function(t){a(t,r.connectionState.reconnecting,r.connectionState.connected)===!0&&e(t).triggerHandler(i.onReconnect)}}})(n,window),(function(e,t,n){var r=e.signalR,i=e.signalR.events,a=e.signalR.changeState,o=e.signalR.isDisconnecting,s=r.transports._logic;r.transports.longPolling={name:`longPolling`,supportsKeepAlive:function(){return!1},reconnectDelay:3e3,start:function(n,c,l){var u=this,d=function(){d=e.noop,n.log(`LongPolling connected.`),c?c():n.log(`WARNING! The client received an init message after reconnecting.`)},f=function(e){return l(e)?(n.log(`LongPolling failed to connect.`),!0):!1},p=n._,m=0,h=function(n){t.clearTimeout(p.reconnectTimeoutId),p.reconnectTimeoutId=null,a(n,r.connectionState.reconnecting,r.connectionState.connected)===!0&&(n.log(`Raising the reconnect event`),e(n).triggerHandler(i.onReconnect))},g=36e5;n.pollXhr&&(n.log(`Polling xhr requests already exists, aborting.`),n.stop()),n.messageId=null,p.reconnectTimeoutId=null,p.pollTimeoutId=t.setTimeout(function(){(function a(c,l){var _=c.messageId!==null,v=!l,y=s.getUrl(c,u.name,_,v,!0),b={};c.messageId&&(b.messageId=c.messageId),c.groupsToken&&(b.groupsToken=c.groupsToken),o(c)!==!0&&(n.log(`Opening long polling request to '`+y+`'.`),c.pollXhr=s.ajax(n,{xhrFields:{onprogress:function(){s.markLastMessage(n)}},url:y,type:`POST`,contentType:r._.defaultContentType,data:b,timeout:n._.pollTimeout,headers:n.accessToken?{Authorization:`Bearer `+n.accessToken}:{},success:function(r){var i,l=0,u,g;n.log(`Long poll complete.`),m=0;try{i=n._parseResponse(r)}catch(e){s.handleParseFailure(c,r,e,f,c.pollXhr);return}p.reconnectTimeoutId!==null&&h(c),i&&(u=s.maximizePersistentResponse(i)),s.processMessages(c,i,d),u&&e.type(u.LongPollDelay)===`number`&&(l=u.LongPollDelay),o(c)!==!0&&(g=u&&u.ShouldReconnect,!(g&&!s.ensureReconnectingState(c))&&(l>0?p.pollTimeoutId=t.setTimeout(function(){a(c,g)},l):a(c,g)))},error:function(o,l){var d=r._.transportError(r.resources.longPollFailed,n.transport,o,c.pollXhr);if(t.clearTimeout(p.reconnectTimeoutId),p.reconnectTimeoutId=null,l===`abort`){n.log(`Aborted xhr request.`);return}if(!f(d)){if(m++,n.state!==r.connectionState.reconnecting&&(n.log(`An error occurred using longPolling. Status = `+l+`. Response = `+o.responseText+`.`),e(c).triggerHandler(i.onError,[d])),(n.state===r.connectionState.connected||n.state===r.connectionState.reconnecting)&&!s.verifyLastActive(n)||!s.ensureReconnectingState(c))return;p.pollTimeoutId=t.setTimeout(function(){a(c,!0)},u.reconnectDelay)}}}),_&&l===!0&&(p.reconnectTimeoutId=t.setTimeout(function(){h(c)},Math.min(1e3*(2**m-1),g))))})(n)},250)},lostConnection:function(e){e.pollXhr&&e.pollXhr.abort(`lostConnection`)},send:function(e,t){s.ajaxSend(e,t)},stop:function(e){t.clearTimeout(e._.pollTimeoutId),t.clearTimeout(e._.reconnectTimeoutId),delete e._.pollTimeoutId,delete e._.reconnectTimeoutId,e.pollXhr&&(e.pollXhr.abort(),e.pollXhr=null,delete e.pollXhr)},abort:function(e,t){s.ajaxAbort(e,t)}}})(n,window),(function(e,t,n){var r=0,i=e.signalR;function a(e){return e+`.hubProxy`}function o(e,t,n){var r,i=e.length,a=[];for(r=0;r<i;r+=1)e.hasOwnProperty(r)&&(a[r]=t.call(n,e[r],r,e));return a}function s(t){return e.isFunction(t)||e.type(t)===`undefined`?null:t}function c(e){for(var t in e)if(e.hasOwnProperty(t))return!0;return!1}function l(e,t){var n=e._.invocationCallbacks,r;for(var i in c(n)&&e.log(`Clearing hub invocation callbacks with error: `+t+`.`),e._.invocationCallbackId=0,delete e._.invocationCallbacks,e._.invocationCallbacks={},n)r=n[i],r.method.call(r.scope,{E:t})}function u(t){return e.isFunction(t)&&t.toString().slice(0,256).indexOf(`// Call the client hub method`)>=0}function d(e,t){return new d.fn.init(e,t)}d.fn=d.prototype={init:function(e,t){this.state={},this.connection=e,this.hubName=t,this._={callbackMap:{}}},constructor:d,hasSubscriptions:function(){return c(this._.callbackMap)},on:function(t,n,i){var o=this,s=o._.callbackMap,c=!i&&u(n);i||=n,i._signalRGuid||=r++,t=t.toLowerCase();var l=s[t];l||(l=[],s[t]=l);for(var d,f=0;f<l.length;f++)(l[f].guid===i._signalRGuid||c&&l[f].isFromOldGeneratedHubProxy)&&(d=l[f]);d||(d={guid:i._signalRGuid,eventHandlers:[],isFromOldGeneratedHubProxy:c},s[t].push(d));var p=function(e,t){n.apply(o,t)};return d.eventHandlers.push(p),e(o).bind(a(t),p),o},off:function(t,n,r){var i=this,o=i._.callbackMap,s,c=!r&&u(n);if(r||=n,t=t.toLowerCase(),s=o[t],s)if(n){for(var l,d=0;d<s.length;d++)(s[d].guid===r._signalRGuid||c&&s[d].isFromOldGeneratedHubProxy)&&(l=s[d]);if(l){for(var f=0;f<l.eventHandlers.length;f++)e(i).unbind(a(t),l.eventHandlers[f]);s.splice(d,1),s.length===0&&delete o[t]}}else n||(e(i).unbind(a(t)),delete o[t]);return i},invoke:function(t){var n=this,r=n.connection,a=o(e.makeArray(arguments).slice(1),s),c={H:n.hubName,M:t,A:a,I:r._.invocationCallbackId},l=e.Deferred(),u=function(a){var o=n._maximizeHubResponse(a),s,c;e.extend(n.state,o.State),o.Progress?l.notifyWith?l.notifyWith(n,[o.Progress.Data]):r._.progressjQueryVersionLogged||(r.log(`A hub method invocation progress update was received but the version of jQuery in use (`+e.prototype.jquery+`) does not support progress updates. Upgrade to jQuery 1.7+ to receive progress notifications.`),r._.progressjQueryVersionLogged=!0):o.Error?(o.StackTrace&&r.log(o.Error+`
|
|
4
4
|
`+o.StackTrace+`.`),s=o.IsHubException?`HubException`:`Exception`,c=i._.error(o.Error,s),c.data=o.ErrorData,r.log(n.hubName+`.`+t+` failed to execute. Error: `+c.message),l.rejectWith(n,[c])):(r.log(`Invoked `+n.hubName+`.`+t),l.resolveWith(n,[o.Result]))};return r._.invocationCallbacks[r._.invocationCallbackId.toString()]={scope:n,method:u},r._.invocationCallbackId+=1,e.isEmptyObject(n.state)||(c.S=n.state),r.log(`Invoking `+n.hubName+`.`+t),r.send(c),l.promise()},_maximizeHubResponse:function(e){return{State:e.S,Result:e.R,Progress:e.P?{Id:e.P.I,Data:e.P.D}:null,Id:e.I,IsHubException:e.H,Error:e.E,StackTrace:e.T,ErrorData:e.D}}},d.fn.init.prototype=d.fn;function f(t,n){var r={qs:null,logging:!1,useDefaultPath:!0};return e.extend(r,n),(!t||r.useDefaultPath)&&(t=(t||``)+`/signalr`),new f.fn.init(t,r)}f.fn=f.prototype=e.connection(),f.fn.init=function(t,n){var r={qs:null,logging:!1,useDefaultPath:!0},i=this;e.extend(r,n),e.signalR.fn.init.call(i,t,r.qs,r.logging),i.proxies={},i._.invocationCallbackId=0,i._.invocationCallbacks={},i.received(function(t){var n,r,o,s,c,l;t&&(t.P===void 0?t.I===void 0?(n=this._maximizeClientHubInvocation(t),i.log(`Triggering client hub event '`+n.Method+`' on hub '`+n.Hub+`'.`),c=n.Hub.toLowerCase(),l=n.Method.toLowerCase(),r=this.proxies[c],e.extend(r.state,n.State),e(r).triggerHandler(a(l),[n.Args])):(o=t.I.toString(),s=i._.invocationCallbacks[o],s&&(i._.invocationCallbacks[o]=null,delete i._.invocationCallbacks[o],s.method.call(s.scope,t))):(o=t.P.I.toString(),s=i._.invocationCallbacks[o],s&&s.method.call(s.scope,t)))}),i.error(function(e,t){var n,r;t&&(n=t.I,r=i._.invocationCallbacks[n],r&&(i._.invocationCallbacks[n]=null,delete i._.invocationCallbacks[n],r.method.call(r.scope,{E:e})))}),i.reconnecting(function(){i.transport&&i.transport.name===`webSockets`&&l(i,`Connection started reconnecting before invocation result was received.`)}),i.disconnected(function(){l(i,`Connection was disconnected before invocation result was received.`)})},f.fn._maximizeClientHubInvocation=function(e){return{Hub:e.H,Method:e.M,Args:e.A,State:e.S}},f.fn._registerSubscribedHubs=function(){var t=this;t._subscribedToHubs||(t._subscribedToHubs=!0,t.starting(function(){var n=[];e.each(t.proxies,function(e){this.hasSubscriptions()&&(n.push({name:e}),t.log(`Client subscribed to hub '`+e+`'.`))}),n.length===0&&t.log(`No hubs have been subscribed to. The client will not receive data from hubs. To fix, declare at least one client side function prior to connection start for each hub you wish to subscribe to.`),t.data=t.json.stringify(n)}))},f.fn.createHubProxy=function(e){e=e.toLowerCase();var t=this.proxies[e];return t||(t=d(this,e),this.proxies[e]=t),this._registerSubscribedHubs(),t},f.fn.init.prototype=f.fn,e.hubConnection=f})(n,window),(function(e,t){e.signalR.version=`2.4.1`})(n),e.hubConnection=n.hubConnection,e.signalR=n.signalR}))(),j=function(e){return e.AppleTv=`apple-tv`,e.Vivi=`vivi`,e}({}),M=function(e){return e.Available=`available`,e.Offline=`offline`,e.Busy=`busy`,e}({}),N=class e{constructor(e,t){this[Symbol.toStringTag]=e[Symbol.toStringTag],this.innerPromise=e,this.onTimeout=t,this.bindFunctions()}bindFunctions(){this.timeout=this.timeout.bind(this),this.then=this.then.bind(this),this.catch=this.catch.bind(this),this.finally=this.finally.bind(this)}timeout(e){return new Promise((t,n)=>{this.then(t).catch(n).finally(()=>clearTimeout(r));let r=setTimeout(()=>{this.onTimeout?.(),n(Error(`Promise timed out`))},e)})}then(e,t){return this.innerPromise.then(e,t)}catch(e){return this.innerPromise.catch(e)}finally(e){return this.innerPromise.finally(e)}static reject(t){return new e(Promise.reject(t))}static fromPromise(t){return new e(t)}},Ne=class{constructor(){this.callbacks=[],this.predicates=[],this.controller=new AbortController,this.signal=this.controller.signal,this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.isDisposed=this.isDisposed.bind(this)}trigger(e){this.callbacks.forEach((t,n)=>{let r=this.predicates[n];r&&!r(e)||t(e)})}on(e){this.isDisposed()&&console.warn(`This EventChannel instance been disposed - this is a no-op`);let t=this.callbacks.length;this.callbacks[t]=e,this.predicates[t]=()=>!0;let n=()=>{this.off(e)};return{off:n,filter:e=>(this.predicates[t]=e,n)}}one(e=()=>!0){if(this.isDisposed())return N.reject(Error(`This EventChannel instance has been disposed`));let t;return new N(new Promise((n,r)=>{t=this.on(e=>{this.signal.removeEventListener(`abort`,i),t(),n(e)}).filter(e);let i=()=>{t(),r(Error(`Aborted while waiting for message`))};this.signal.addEventListener(`abort`,i,{once:!0})}),()=>{t()})}off(e){let t=this.callbacks.indexOf(e);t!==-1&&(this.callbacks.splice(t,1),this.predicates.splice(t,1))}dispose(){this.callbacks.length=0,this.predicates.length=0,this.controller.abort()}isDisposed(){return this.signal.aborted}},P=class{constructor(){this.channels={},this.trigger=this.trigger.bind(this),this.on=this.on.bind(this),this.one=this.one.bind(this),this.off=this.off.bind(this),this.dispose=this.dispose.bind(this),this.getChannel=this.getChannel.bind(this)}trigger(e,t){this.getChannel(e).trigger(t)}on(e,t){return this.getChannel(e).on(t)}one(e,t){return this.getChannel(e).one(t)}off(e,t){this.getChannel(e).off(t)}dispose(){this.trigger(`dispose`,F.void),Object.values(this.channels).forEach(e=>e.dispose()),this.channels={}}getChannel(e){return this.channels[e]||(this.channels[e]=new Ne),this.channels[e]}},F={void:void 0},I=class{constructor(){this.bindFunctions()}bindFunctions(){this.schedule=this.schedule.bind(this),this.every=this.every.bind(this),this.trigger=this.trigger.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this)}schedule(e){return this.task=e,this}every(e){return this.intervalInMilliseconds=e,this}trigger(){return this.task?.(this),this}start(){return this.intervalId||=setInterval(()=>this.trigger(),this.intervalInMilliseconds),this}stop(){return this.intervalId&&=(clearInterval(this.intervalId),void 0),this}};function Pe(e,t){return e._lastModified||={},new Proxy(e,{set:(n,r,i,a)=>{let o=e._lastModified[r.toString()];return o&&Date.now()<o+t?!0:Reflect.set(n,r,i,a)}})}function Fe(e){return e._lastModified||={},new Proxy(e,{set:(t,n,r,i)=>(e._lastModified[n.toString()]=Date.now(),Reflect.set(t,n,r,i))})}var L={withDebouncedSetters:Pe,withTimestampedSetters:Fe},R=function(e){return e[e.Offline=0]=`Offline`,e[e.Online=1]=`Online`,e[e.Locked=2]=`Locked`,e[e.Suspended=3]=`Suspended`,e}({}),z=function(e){return e[e.PlaybackStatusChange=0]=`PlaybackStatusChange`,e[e.PositionChange=1]=`PositionChange`,e}({}),B=function(e){return e.Begin=`BEGIN`,e.Play=`PLAY`,e.Pause=`PAUSE`,e.Load=`LOAD`,e.Scan=`SCAN`,e.Stop=`STOP`,e}({}),Ie=2e3,Le=class{constructor(e,t){return this.title=e,this.device=t,this.locked=!1,this.position=0,this.playbackStatus=B.Load,this.debounced=L.withDebouncedSetters(this,Ie),L.withTimestampedSetters(this)}},Re=class extends P{constructor(e,t){super(),this.client=e,this.localState=new Le(t.title,t.device),this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.handleDisconnected=this.handleDisconnected.bind(this),this.handleAllVideoMessages=this.handleAllVideoMessages.bind(this),this.handlePlaybackChange=this.handlePlaybackChange.bind(this),this.handlePositionChange=this.handlePositionChange.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(`disconnected`,this.handleDisconnected),this.client.on(`message`,this.handleAllVideoMessages)}dispose(){this.client.off(`dispose`,this.dispose),this.client.off(`disconnected`,this.handleDisconnected),this.client.off(`message`,this.handleAllVideoMessages),this.client.stop(this.getDevice().id).catch(e=>console.error(e)),super.dispose()}handleDisconnected(){this.trigger(`error`,Error(`The connection to the Apple TV has been lost and cannot be recovered`))}handleAllVideoMessages(e){if(e.deviceId!==this.getDevice().id)return;let t=this.localState.debounced;switch(e.event){case z.PlaybackStatusChange:this.handlePlaybackChange(t,e);break;case z.PositionChange:this.handlePositionChange(t,e);break}}handlePlaybackChange(e,t){e.playbackStatus!==t.params.playbackStatus&&(e.playbackStatus=t.params.playbackStatus,this.trigger(`playingchange`,F.void),e.playbackStatus===B.Stop&&this.dispose())}handlePositionChange(e,t){e.position!==t.params.position&&(e.position=t.params.position,this.trigger(`positionchange`,F.void))}async loadSource(){try{if(this.localState.locked)return;await this.client.lock(this.getDevice().id),this.localState.locked=!0,await this.client.loadVideo(this.getDevice().id),this.trigger(`sourceloaded`,F.void)}catch(e){console.error(e),this.trigger(`error`,Error(`Could not load video on Apple TV device`))}}play(){this.localState.locked&&this.localState.playbackStatus!==B.Play&&(this.localState.playbackStatus=B.Play,this.client.play(this.getDevice().id),this.trigger(`playingchange`,F.void))}pause(){this.localState.locked&&this.localState.playbackStatus!==B.Pause&&(this.localState.playbackStatus=B.Pause,this.client.pause(this.getDevice().id),this.trigger(`playingchange`,F.void))}seek(e){this.localState.locked&&this.localState.position!==e&&(this.localState.position=e,this.client.seek(this.getDevice().id,e),this.trigger(`positionchange`,F.void))}setVolume(){console.info(`Setting the volume is not supported on Apple TV`)}setMuted(){console.info(`Muting is not supported on Apple TV`)}setSubtitles(){console.info(`Subtitles are not supported on Apple TV`)}isPlaying(){return this.localState.playbackStatus===B.Play||this.localState.playbackStatus===B.Begin||this.localState.playbackStatus===B.Load}isPlaybackFinished(){return this.localState.playbackStatus===B.Stop}getPosition(){return this.localState.position}getDuration(){}getVolume(){return 1}getMuted(){return!1}getSubtitles(){}getDevice(){return this.localState.device}getTitle(){return this.localState.title}},ze=2e4,Be=500,Ve=`DeviceUserHub`,He=5e3,V=class e extends P{constructor(e){super(),this.options=e,this.accessToken=void 0,this.devices=[],this.heartbeat=new I,this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.connect=this.connect.bind(this),this.subscribe=this.subscribe.bind(this),this.tryFixConnection=this.tryFixConnection.bind(this),this.invoke=this.invoke.bind(this),this.invokeDebounced=b(this.invoke,Be,!0),this.handleDeviceList=this.handleDeviceList.bind(this),this.handleDeviceStateChange=this.handleDeviceStateChange.bind(this),this.handleDevicePaired=this.handleDevicePaired.bind(this),this.handleDeviceUnpaired=this.handleDeviceUnpaired.bind(this),this.handlePlayStatusChange=this.handlePlayStatusChange.bind(this),this.handleTimeSync=this.handleTimeSync.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.lock=this.lock.bind(this),this.loadVideo=this.loadVideo.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.stop=this.stop.bind(this),this.pair=this.pair.bind(this),this.unpair=this.unpair.bind(this),this.renameDevice=this.renameDevice.bind(this)}async initialize(){try{this.accessToken=await this.options.fetchAccessToken(),this.connection=(0,Me.hubConnection)(this.accessToken.host,{logging:!1}),this.hubProxy=this.connection.createHubProxy(Ve),this.hubProxy.on(`DeviceList`,this.handleDeviceList),this.hubProxy.on(`DeviceStateChange`,this.handleDeviceStateChange),this.hubProxy.on(`Paired`,this.handleDevicePaired),this.hubProxy.on(`Unpaired`,this.handleDeviceUnpaired),this.hubProxy.on(`PlayStatusChange`,this.handlePlayStatusChange),this.hubProxy.on(`TimeSync`,this.handleTimeSync),await this.connect(),await this.subscribe(this.accessToken.token),this.heartbeat.schedule(this.tryFixConnection).every(He).start()}catch(e){console.error(e),this.trigger(`error`,Error(`Could not connect to Online API`))}}async connect(){return new Promise((e,t)=>{this.connection.start({jsonp:!1,withCredentials:!1}).done(()=>e()).fail(()=>t(Error(`Could not connect to SignalR hub`)))})}async subscribe(e){if(!await this.invoke(`Subscribe`,e))throw Error(`The subscription request was rejected by Online API`)}async tryFixConnection(){if(this.connection.state===4)try{this.heartbeat.stop(),this.accessToken=await this.options.fetchAccessToken(),await this.connect(),await this.subscribe(this.accessToken.token)}catch(e){console.warn(e),console.warn(`Could not reconnect to Online API`)}finally{this.heartbeat.start()}}async invoke(e,...t){let n=new Promise((n,r)=>{(this.hubProxy?.invoke(e,...t)).done(n).fail(r)});return N.fromPromise(n).timeout(ze)}handleDeviceList(t){this.devices=t.filter(e=>e.type!==`vivi`).map(e.convertToGenericDevice),this.trigger(`deviceschange`,F.void)}handleDeviceStateChange(t){let n=this.devices.findIndex(e=>e.id===t.deviceId);n>=0&&(this.devices[n]=e.convertToGenericDevice(t),this.trigger(`deviceschange`,F.void))}handleDevicePaired(t){t.type!==`vivi`&&(this.devices.push(e.convertToGenericDevice(t)),this.trigger(`deviceschange`,F.void))}handleDeviceUnpaired(e){this.devices=this.devices.filter(t=>t.id!==e),this.trigger(`deviceschange`,F.void)}handlePlayStatusChange(e,t){this.trigger(`message`,{event:z.PlaybackStatusChange,deviceId:e,params:{playbackStatus:t.commandType}})}handleTimeSync(e,t){this.trigger(`message`,{event:z.PositionChange,deviceId:e,params:{position:t}})}dispose(){this.hubProxy.off(`DeviceList`,this.handleDeviceList),this.hubProxy.off(`DeviceStateChange`,this.handleDeviceStateChange),this.hubProxy.off(`Paired`,this.handleDevicePaired),this.hubProxy.off(`Unpaired`,this.handleDeviceUnpaired),this.hubProxy.off(`PlayStatusChange`,this.handlePlayStatusChange),this.hubProxy.off(`TimeSync`,this.handleTimeSync),this.hubProxy.connection.stop(!1,!0),this.heartbeat.stop(),super.dispose()}canCastToDevice(e){return e===j.AppleTv}getDevices(){return this.devices}startCastSession(e){return new Re(this,e)}async lock(e){if(!await this.invoke(`Lock`,e,this.options.userId,this.options.username??``))throw Error(`Could not lock device`)}async loadVideo(e){if(!this.options.trackingCode)throw Error(`Tracking code must be provided to cast videos`);await this.invoke(`Command`,{DeviceId:e,CommandType:B.Play,Data:this.options.trackingCode})}async play(e){await this.invoke(`Command`,{DeviceId:e,CommandType:B.Play})}async pause(e){await this.invoke(`Command`,{DeviceId:e,CommandType:B.Pause})}seek(e,t){this.invokeDebounced(`Command`,{DeviceId:e,CommandType:B.Play,Params:`1,${Math.trunc(t)}`})}async stop(e){await this.invoke(`Command`,{DeviceId:e,CommandType:B.Stop})}async pair(e){let t=await this.invoke(`Pair`,e);if(!t)throw Error(`Could not pair device`);return t}async unpair(e){await this.invoke(`Unpair`,e)}async renameDevice({deviceId:e,deviceName:t}){if(!await this.invoke(`Renamedevice`,e,t))throw Error(`Could not rename device`)}static convertToGenericDeviceStatus(e){switch(e){case R.Online:return M.Available;case R.Locked:return M.Busy;case R.Suspended:case R.Offline:return M.Offline}}static convertToGenericDevice(t){return{id:t.deviceId,name:t.name,type:j.AppleTv,status:e.convertToGenericDeviceStatus(t.status)}}},H={reconnectIntervalInMilliseconds:3e3,heartbeatEnabled:!1,heartbeatIntervalInMillseconds:1e4,heartbeatMessage:``},Ue=class{constructor(e,t=H){this.bindFunctions(),this.url=e,this.options={...H,...t},this.webSocket=this.connect(),this.heartbeat=new I().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()}},We=2e3,Ge=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=L.withDebouncedSetters(this,We),L.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}},U=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}({}),Ke=class extends P{constructor(e,t){super(),this.client=e,this.localState=new Ge(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 U.Update:this.handleUpdateMessage(t,n);break;case U.NewChapter:this.handleNewChapterMessage(t,n);break;case U.Volume:this.handleVolumeMessage(t,n);break;case U.Playing:this.handlePlayingMessage(t);break;case U.Paused:this.handlePausedMessage(t);break;case U.Finished:this.handleFinishedMessage(t);break;case U.Stopped:this.handleStoppedMessage();break}}handleUpdateMessage(e,t){e.duration!==t.duration&&(e.duration=t.duration,this.trigger(`durationchange`,F.void)),e.position!==t.position&&(e.position=t.position,this.trigger(`positionchange`,F.void)),e.subtitles!==t.subtitles&&(e.subtitles=t.subtitles,this.trigger(`subtitleschange`,F.void))}handleVolumeMessage(e,t){e.volume!==t.level&&(e.volume=t.level,e.mute=t.level===0,this.trigger(`volumechange`,F.void))}handlePlayingMessage(e){e.playing!==!0&&(e.playing=!0,e.playbackFinished=!1,this.trigger(`playingchange`,F.void))}handlePausedMessage(e){e.playing!==!1&&(e.playing=!1,this.trigger(`playingchange`,F.void))}handleFinishedMessage(e){e.playbackFinished!==!0&&(e.playing=!1,e.playbackFinished=!0,this.trigger(`playingchange`,F.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`,F.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`,F.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`,F.void))}pause(){this.localState.ready&&this.localState.playing!==!1&&(this.localState.playing=!1,this.client.pause(this.getDevice().id),this.trigger(`playingchange`,F.void))}seek(e){this.localState.ready&&this.localState.position!==e&&(this.localState.position=e,this.client.seek(this.getDevice().id,e),this.trigger(`positionchange`,F.void))}setVolume(e){this.localState.ready&&this.localState.volume!==e&&(this.localState.volume=e,this.client.setVolume(this.getDevice().id,e),this.trigger(`volumechange`,F.void))}setMuted(e){this.localState.ready&&this.localState.mute!==e&&(this.localState.mute=e,this.client.setMuted(this.getDevice().id,e),this.trigger(`volumechange`,F.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`,F.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}},W=1e4,qe=500,Je=1e4,G=class e extends P{constructor(e){super(),this.options=e,this.accessToken=``,this.devices=[],this.devicesFingerprint=``,this.deviceDiscovery=new I,this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendMessageDebounced=b(this.sendMessage,qe,!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 Ue(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`,F.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(Je).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:j.Vivi,status:M.Available})),this.devicesFingerprint=n,this.trigger(`deviceschange`,F.void)}catch(e){console.warn(e)}}).trigger().start()}dispose(){this.deviceDiscovery.stop(),this.webSocket?.dipose(),super.dispose()}canCastToDevice(e){return e===j.Vivi}getDevices(){return this.devices}startCastSession(e){return new Ke(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(W).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(W).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(W).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(W).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(W).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(W).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(W).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(W).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(W).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(W).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(W).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(W).catch(()=>{throw Error(`Failed to set subtitles`)})}static createAckId(){return A.generateRandomId()}static calculateFingerprint(e){return e.map(e=>e.id).sort().join(`,`)}},K=class e extends P{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}},Ye=g.getComponent(`MenuItem`),q=class extends Ye{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=g.dom.createEl(`div`,{className:`cv-device-menu-item-body`,innerHTML:`
|
|
@@ -15,4 +15,4 @@ import{a as e,an as t,c as n,ln as r,r as i,w as a}from"./BlDu0qdC.chunk.js";imp
|
|
|
15
15
|
</div>
|
|
16
16
|
<div class="cv-devices-background" style="background-image: url(${this.poster})"></div>
|
|
17
17
|
`;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(){}},at=g.getComponent(`Tech`),ot=class extends at{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=g(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 m.findTrackByPredicate(this.videojsPlayer.player_,e=>e.mode===`showing`&&!!e.src)}setSelectedTextTrack(e){m.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 it({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(y.getOriginalUrl(e.src),n?.src)}addRemoteTextTrack(e){return super.addRemoteTextTrack(e,!0)}getCastSession(){return K.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 g.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`&&!!K.getOrCreateInstance(t?.instanceId??``).getCastSession()}static isSupported(){return K.isActive()}};g.registerTech(`devices`,ot);var st=g.getPlugin(`plugin`),ct=class extends st{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:s.Select,workflowPhase:c.Complete,descriptor:l.ChangeDevice,entity:u.Device,eventVersion:o.V3})},i=this.options.ctaOptions,a=this.options.vivi,d=this.options.appleTv,f=[];d.enabled||f.push(j.AppleTv),(!a.enabled||!a.accountConnected)&&f.push(j.Vivi);let p={onClick:n,onDeviceMenuItemClick:r,ctaOptions:{...i,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-${j.AppleTv}`),this.player.removeClass(`cv-device-${j.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(G))return;let t=new G({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(V))return;let t=new V({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 K.getOrCreateInstance(this.instanceId)}dispose(){let e=this.getSessionManager();e&&(e.off(`deviceschange`,this.onDevicesChanged),e.off(`castsessionchange`,this.onCastSessionChanged),e.off(`error`,this.onDevicesError),K.disposeAndRemoveInstance(e),super.dispose())}};g.registerPlugin(`devicesPlugin`,ct);function lt(e){return(0,Y.jsx)(`div`,{className:`cv-resource-item`,children:(0,Y.jsx)(ie,{data:e.resource,imageCdnUrl:e.imageCdnUrl,titlePosition:`above`,hideTypeBadge:!0})})}var ut=C((e,t)=>(0,Y.jsx)(lt,{...t})),dt=g.getComponent(`MenuItem`),ft=class extends dt{constructor(e,t){super(e,t);let n=new ut(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)}},pt=g.getComponent(`MenuButton`),Q=class extends pt{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 h(this.player_,{label:`Resources`})),this.options_.resources.forEach(t=>{let n=new ft(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`){a.PageLoad(e.url,!0);return}this.getDownloadIframe().src=e.url}getDownloadIframe(){return this.downloadIframe?this.downloadIframe:(this.downloadIframe=g.dom.createEl(`iframe`),this.downloadIframe.style.display=`none`,g.dom.appendContent(g.dom.$(`body`),this.downloadIframe),this.downloadIframe)}getCollabsibleName(){return this.controlText_}getCollabsibleValue(){return``}showInCollabsibleMenu(){return!0}showCollapsibleMenu(){super.handleClick(null)}};Q.prototype.controlText_=`Resources`,g.registerComponent(`ResourcesButton`,Q);var mt=g.getPlugin(`plugin`),ht=class extends mt{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})}};g.registerPlugin(`resourcesPlugin`,ht);var gt=9e5,$=new class extends n{constructor(...e){super(...e),this.canReload=!0}get name(){return d.OldVersion}initialize(){this.onVisibilityChange=this.onVisibilityChange.bind(this),this.onInactivityTimeout=this.onInactivityTimeout.bind(this)}handleOldVersion(){document.addEventListener(`visibilitychange`,this.onVisibilityChange),this.onVisibilityChange()}onVisibilityChange(){if(!document.hidden){window.clearTimeout(this.timeout);return}this.setInactivityTimeout()}setInactivityTimeout(){this.timeout=window.setTimeout(this.onInactivityTimeout,gt)}onInactivityTimeout(){if(p.isLocked()){this.setInactivityTimeout();return}this.onInactive()}onInactive(){if(!this.canReload||p.isLocked()){this.setInactivityTimeout();return}a.Reload()}setCanReload(e){this.canReload=e}},_t=g.getPlugin(`plugin`),vt=class extends _t{constructor(e){super(e),this.player.dataLoaded(()=>this.initialize())}initialize(){$.setCanReload(!1)}dispose(){$.setCanReload(!0),super.dispose()}};g.registerPlugin(`oldVersionRefreshPlugin`,vt);function yt(e){let{className:t=``,playerApi:n,onReady:r,onDispose:i,...a}=e,o=w.useRef(null);return w.useEffect(()=>{if(!o)return;let e=new Te(o.current,{...a,playerApi:n});return r&&e.ready(()=>{r(re(e))}),i&&e.one(`dispose`,i),()=>{e?.dispose()}},[e.viewKey]),(0,Y.jsx)(`div`,{ref:o,className:t})}export{yt as t};
|
|
18
|
-
//# sourceMappingURL=
|
|
18
|
+
//# sourceMappingURL=eKSK4iyn.chunk.js.map
|