/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import i from"./S6XBCSKI.js";import{a as v}from"./P5EZZH6S.js";import{a as _}from"./DHVEHATY.js";import f from"./VZOMAMSZ.js";import b from"./7PXQ5F5K.js";import{g as m}from"./EH5576ZY.js";import"./7QZVR2UR.js";import a from"./KTDXN3YM.js";import{b as g}from"./ZNBKMZP7.js";import{M as n,N as d,O as h,P as c,U as u,a as o,b as e,x as r}from"./GRFF5Y4R.js";import"./ALDX5YZO.js";export default $arcgis.t(([p,{watch:t},,,,f])=>{var y=o`:host{--arcgis-internal-video-player-controls-spacing: 16px;width:531px;height:100%}:host([inline]){width:auto;height:auto}.root,.content{height:100%}.inline{display:flex;gap:var(--calcite-spacing-xs);background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-xxs)}.footer{flex:1}arcgis-video{display:flex;flex:1 1 auto;aspect-ratio:16 / 9;min-height:0}`,$=f(p),a=class extends h{constructor(){super(...arguments),this.messages=v({blocking:!0}),this.viewModel=$(this),this._videoViewRef=n(),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.inline=!1,this.showFullscreenToggle=!1,this.hideHeader=!1,this.view=this.viewModel.view,this.arcgisPropertyChange=m()("state","layer"),this.arcgisReady=r(),this.arcgisVideoReady=r()}static{this.properties={_metadataVisible:16,_duration:16,_currentTime:16,_bufferedValue:16,_currentValue:16,_isBuffering:16,_videoViewReady:16,_layerTitle:16,_isLive:16,referenceElement:1,icon:1,state:32,followingMode:1,layer:0,autoDestroyDisabled:5,messageOverrides:0,label:3,inline:7,showFullscreenToggle:5,hideHeader:5,view:0}}static{this.styles=y}get followingMode(){return this.viewModel.followingMode}set followingMode(i){this.viewModel.followingMode=i}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:i,currentTime:l,duration:s,ended:w}=this.viewModel;this._duration=s,this._currentTime=l,this._bufferedValue=i/(s||1),this._currentValue=l/(s||1),this._isBuffering=!w&&this._bufferedValue<this._currentValue}),t(()=>this.layer?.title,i=>{this._layerTitle=i??void 0},{initial:!0}),t(()=>this.layer?.isLive,i=>{this._isLive=i??void 0},{initial:!0}),t(()=>this.viewModel.view?.map,()=>this.requestUpdate())])}render(){return e`<div class=${c(g(this.inline?"inline":"root",_.widget))}><calcite-panel .heading=${this.hideHeader||this.inline?void 0:this._layerTitle??this.messages.videoPlayer}>${this.inline||this.hideHeader||!this.showFullscreenToggle?null:e`<calcite-action slot=header-actions-end icon=full-screen-exit text=minimize @click=${()=>this.inline=!this.inline}></calcite-action>`}${this.inline?e`<div class="inline">${this._renderActionBar()}${this._renderSlider()}${this.showFullscreenToggle?e`<calcite-action icon=full-screen text=maximize @click=${()=>this.inline=!this.inline}></calcite-action>`:null}</div>`:e`<div class="content">${this._renderLoadingScrim()}${this._renderBuffering()}${this._renderVideoSection()}</div>`}${this.inline?null:e`<div slot=footer class="footer">${this._renderSlider()}${this._renderActionBar()}${this._renderMetadataSection()}</div>`}</calcite-panel></div>`}_renderLoadingScrim(){return this._videoViewReady?null:e`<calcite-scrim .loading=${this.state!=="error"}>${this.state==="error"?this.messages.errorLoadingLayer:null}</calcite-scrim>`}_renderBuffering(){return this._isBuffering?e`<calcite-progress type=indeterminate></calcite-progress>`:null}_renderVideoSection(){return e`<arcgis-video .layer=${this.layer} .map=${this.viewModel.view?.map} @arcgisViewReadyChange=${()=>{this._videoViewReady=!0,this.arcgisVideoReady.emit()}} ${d(this._videoViewRef)}></arcgis-video>`}_renderSlider(){return this._isLive?null:e`<arcgis-video-player-slider .buffered=${this._bufferedValue} .value=${this._currentValue*100} .viewModel=${this.viewModel}></arcgis-video-player-slider>`}_renderActionBar(){return e`<arcgis-video-player-action-bar .currentTime=${this._currentTime} .duration=${this._duration} .messages=${this.messages} .toggleMetadata=${()=>this._metadataVisible=!this._metadataVisible} .viewModel=${this.viewModel} .inline=${this.inline}></arcgis-video-player-action-bar>`}_renderMetadataSection(){return this._metadataVisible?e`<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,f,i)