/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
v4.33.16 */
import{a as p,b as f}from"./VNI6FU5W.js";import e from"./OZHVOZJR.js";import{a as m}from"./JYDXZCEV.js";import{a as _}from"./NFZIPMDZ.js";import d from"./6CVZUPDX.js";import b from"./LPU7W35B.js";import{e as u}from"./UN4H7E6L.js";import"./AMHKFE57.js";import"./PMTZ5QWJ.js";import{B as s,E as h,P as c,Q as a,U as v,a as l,j as n,k as i}from"./MWSR363G.js";export default $arcgis.t(([M,{watch:t},,,g])=>{var $=n`@layer{.arcgis-video-player{--esri-video-player-view-height: 300px;--esri-video-player-view-aspect-ratio: 1.77;--esri-video-player-controls-spacing: 16px;min-width:calc(var(--esri-video-player-view-height) * var(--esri-video-player-view-aspect-ratio))}.arcgis-video-player .arcgis-video-player__video-view{display:flex;height:var(--esri-video-player-view-height)}}`,y="arcgis-video-player",w={base:y,videoView:`${y}__video-view`},b=g(M),o=class extends c{constructor(){super(...arguments),this.messages=m({blocking:!0}),this.viewModel=b(this),this._videoViewRef=p(),this._metadataVisible=!1,this._duration=0,this._currentTime=0,this._bufferedValue=0,this._currentValue=0,this._isBuffering=!1,this._videoViewReady=!1,this.position="top-left",this.icon="video-web",this.state=this.viewModel.state,this.layer=this.viewModel.layer,this.autoDestroyDisabled=!1,this.hideHeader=!1,this.arcgisPropertyChange=u()("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}}static{this.styles=$}static{this.shadowRootOptions=h}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:d,duration:r,ended:V}=this.viewModel;this._duration=r,this._currentTime=d,this._bufferedValue=e/(r||1),this._currentValue=d/(r||1),this._isBuffering=!V&&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=${a(l(w.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`<div class=${a(w.videoView)}><arcgis-video .layer=${this.layer} .map=${this.viewModel.view?.map} @arcgisViewReadyChange=${()=>this.arcgisVideoReady.emit()} ${f(this._videoViewRef)}></arcgis-video></div>`}_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}};v("arcgis-video-player",o);return o},"widgets/VideoPlayer/VideoPlayerViewModel","core/reactiveUtils",b,d,e)