/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
v4.34.7 */
import e from"./IEWQL27P.js";import{a as v}from"./B7UYEEQJ.js";import{a as _}from"./2Z6ISORA.js";import b from"./PXNZ6E2J.js";import a from"./K2TY4WFO.js";import{g as m}from"./SRDD32D4.js";import"./EPSDPGVP.js";import{b as g}from"./IMJMO6DB.js";import{H as l,I as n,J as h,K as c,P as u,a as d,b as i,s}from"./RNRMSLW5.js";import"./G6QKOIC3.js";export default $arcgis.t(([p,{watch:t},,,f])=>{var w=d`:host{--arcgis-video-player-controls-spacing: 16px;width:531px;height:100%}.arcgis-video-player{height:100%}arcgis-video{display:flex;flex:1 1 auto;aspect-ratio:16 / 9;min-height:0}`,V={base:"arcgis-video-player"},M=f(p),a=class extends h{constructor(){super(...arguments),this.messages=v({blocking:!0}),this.viewModel=M(this),this._videoViewRef=l(),this._metadataVisible=!1,this._duration=0,this._currentTime=0,this._bufferedValue=0,this._currentValue=0,this._isBuffering=!1,this._videoViewReady=!1,this.icon="video-web",this.state=this.viewModel.state,this.layer=this.viewModel.layer,this.autoDestroyDisabled=!1,this.hideHeader=!1,this.view=this.viewModel.view,this.arcgisPropertyChange=m()("state","layer"),this.arcgisReady=s(),this.arcgisVideoReady=s()}static{this.properties={_metadataVisible:16,_duration:16,_currentTime:16,_bufferedValue:16,_currentValue:16,_isBuffering:16,_videoViewReady:16,_layerTitle:16,_isLive:16,referenceElement:1,position:3,icon:1,state:3,followingMode:1,layer:0,autoDestroyDisabled:5,messageOverrides:0,label:3,hideHeader:5,view:0}}static{this.styles=w}get followingMode(){return this.viewModel.followingMode}set followingMode(e){this.viewModel.followingMode=e}async destroy(){await this.manager.destroy()}loaded(){this.manager.onLifecycle(()=>[t(()=>[this.viewModel.currentTime,this.viewModel.duration,this.viewModel.duration,this.viewModel.ended],()=>{let{buffered:e,currentTime:o,duration:r,ended:y}=this.viewModel;this._duration=r,this._currentTime=o,this._bufferedValue=e/(r||1),this._currentValue=o/(r||1),this._isBuffering=!y&&this._bufferedValue<this._currentValue}),t(()=>this._videoViewRef.value?.ready,e=>{this._videoViewReady=!!e},{initial:!0}),t(()=>this.layer?.title,e=>{this._layerTitle=e??void 0},{initial:!0}),t(()=>this.layer?.isLive,e=>{this._isLive=e??void 0},{initial:!0}),t(()=>this.viewModel.view?.map,()=>this.requestUpdate())])}render(){return i`<div class=${c(g(V.base,_.widget))}><calcite-panel .heading=${this.hideHeader?void 0:this._layerTitle??this.messages.videoPlayer}>${this._renderLoadingScrim()}${this._renderBuffering()}${this._renderVideoSection()}${this._renderSlider()}${this._renderActionBar()}${this._renderMetadataSection()}</calcite-panel></div>`}_renderLoadingScrim(){return this._videoViewReady?null:i`<calcite-scrim .loading=${this.state!=="error"}>${this.state==="error"?this.messages.errorLoadingLayer:null}</calcite-scrim>`}_renderBuffering(){return this._isBuffering?i`<calcite-progress type=indeterminate></calcite-progress>`:null}_renderVideoSection(){return i`<arcgis-video .layer=${this.layer} .map=${this.viewModel.view?.map} @arcgisViewReadyChange=${()=>this.arcgisVideoReady.emit()} ${n(this._videoViewRef)}></arcgis-video>`}_renderSlider(){return this._isLive?null:i`<arcgis-video-player-slider .buffered=${this._bufferedValue} .value=${this._currentValue*100} .viewModel=${this.viewModel}></arcgis-video-player-slider>`}_renderActionBar(){return i`<arcgis-video-player-action-bar .currentTime=${this._currentTime} .duration=${this._duration} .messages=${this.messages} .toggleMetadata=${()=>this._metadataVisible=!this._metadataVisible} .viewModel=${this.viewModel}></arcgis-video-player-action-bar>`}_renderMetadataSection(){return this._metadataVisible?i`<arcgis-video-player-metadata .messages=${this.messages} .viewModel=${this.viewModel}></arcgis-video-player-metadata>`:null}};u("arcgis-video-player",a);return a},"widgets/VideoPlayer/VideoPlayerViewModel","core/reactiveUtils",a,b,e)