import { c } from "../../chunks/runtime.js";
import { html as t } from "lit-html";
import { formatDate as n } from "@geoscene/core/intl.js";
import { LitElement as d, safeClassMap as i } from "@arcgis/lumina";
import { css as p } from "@lit/reactive-element/css-tag.js";
import { watch as g } from "@geoscene/core/core/reactiveUtils.js";
import { classes as v } from "@arcgis/components-utils";
/*! All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
v4.33.18 */
const y = p`.geoscene-video-player__toolbar{display:flex;align-items:center;background-color:var(--calcite-color-foreground-1);padding:0 calc(var(--geoscene-video-player-controls-spacing) / 2) calc(var(--geoscene-video-player-controls-spacing) / 2);font-size:var(--calcite-font-size--2)}.geoscene-video-player__toolbar-top-padding{padding-top:calc(var(--geoscene-video-player-controls-spacing) / 2)}.geoscene-video-player__timecode{display:flex;align-items:center;color:var(--calcite-color-text-3)}.geoscene-video-player__controls-group{display:flex;flex:1 0 auto;justify-content:flex-end}.geoscene-video-player__live-icon{color:var(--calcite-color-status-danger)}.geoscene-video-player__controls-container{display:flex;align-items:center;gap:var(--calcite-spacing-md)}`, e = "geoscene-video-player", o = {
  playerControlsGroup: `${e}__controls-group`,
  playerTimecode: `${e}__timecode`,
  playerToolbar: `${e}__toolbar`,
  playerToolbarTopPadding: `${e}__toolbar-top-padding`,
  playerLiveIcon: `${e}__live-icon`,
  playerControlsContainer: `${e}__controls-container`
};
function s(r) {
  return n(Math.round(r) * 1e3, { minute: "2-digit", second: "2-digit" });
}
class m extends d {
  static {
    this.properties = { _isLive: 16, viewModel: 0, messages: 0, currentTime: 9, duration: 9, toggleMetadata: 0 };
  }
  static {
    this.styles = y;
  }
  loaded() {
    this.manager.onLifecycle(() => [
      g(() => this.viewModel.layer?.isLive, (a) => {
        this._isLive = a ?? void 0;
      }, { initial: !0 })
    ]);
  }
  render() {
    const { messages: a } = this, l = this._isLive ? o.playerToolbarTopPadding : null;
    return t`<div class=${i(v(o.playerToolbar, l))}><div class=${i(o.playerControlsContainer)}><geoscene-video-player-actions-group .messages=${a} .viewModel=${this.viewModel}></geoscene-video-player-actions-group>${this._isLive ? t`<calcite-icon class=${i(o.playerLiveIcon)} icon=beacon></calcite-icon>` : null}<div class=${i(o.playerTimecode)}>${s(this.currentTime)} / ${s(this.duration)}</div></div><geoscene-video-player-controls-group class=${i(o.playerControlsGroup)} .messages=${a} .toggleMetadata=${() => this.toggleMetadata()} .viewModel=${this.viewModel}></geoscene-video-player-controls-group></div>`;
  }
}
c("geoscene-video-player-action-bar", m);
export {
  m as VideoPlayerActionBar
};