import{i as d,a as h,b as n,n as e}from"./property-ChPqBGW_.js";var f=Object.defineProperty,i=(c,t,o,r)=>{for(var s=void 0,l=c.length-1,u;l>=0;l--)(u=c[l])&&(s=u(t,o,s)||s);return s&&f(t,o,s),s};const p=class p extends d{constructor(){super(...arguments),this.audienceCount=0,this.likeCount=0,this.duration=0,this.onlinePeak=0,this.showDuration=!0,this.showPeak=!1,this.compact=!1,this.isLive=!1}handleClick(t){this.dispatchEvent(new CustomEvent("stats-click",{detail:{type:t},bubbles:!0,composed:!0}))}formatNumber(t){return t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e4?(t/1e4).toFixed(1)+"w":t>=1e3?(t/1e3).toFixed(1)+"k":t.toString()}formatDuration(t){const o=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60;return o>0?`${o}:${r.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`:`${r.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`}render(){return n`
      ${this.isLive?n`
        <div class="live-badge">
          <span class="live-indicator"></span>
          LIVE
        </div>
      `:""}

      <div class="stat-item" @click="${()=>this.handleClick("audience")}">
        <span class="stat-icon">👥</span>
        <span class="stat-value">${this.formatNumber(this.audienceCount)}</span>
        <span class="stat-label">Online</span>
      </div>

      <div class="stat-item" @click="${()=>this.handleClick("like")}">
        <span class="stat-icon">❤️</span>
        <span class="stat-value">${this.formatNumber(this.likeCount)}</span>
        <span class="stat-label">Likes</span>
      </div>

      ${this.showDuration&&this.duration>0?n`
        <div class="stat-item duration" @click="${()=>this.handleClick("duration")}">
          <span class="stat-icon">⏱️</span>
          <span class="stat-value">${this.formatDuration(this.duration)}</span>
          <span class="stat-label">Duration</span>
        </div>
      `:""}

      ${this.showPeak&&this.onlinePeak>0?n`
        <div class="stat-item">
          <span class="stat-icon">📈</span>
          <span class="stat-value">${this.formatNumber(this.onlinePeak)}</span>
          <span class="stat-label">Peak</span>
        </div>
      `:""}
    `}};p.styles=h`
    :host {
      display: flex;
      align-items: center;
      gap: 16px;
      font-size: 12px;
      color: rgba(255, 255, 255, 0.7);
    }

    :host([compact]) {
      gap: 8px;
    }

    .stat-item {
      display: flex;
      align-items: center;
      gap: 4px;
      cursor: pointer;
      transition: all 0.2s ease;
      padding: 4px 8px;
      border-radius: 4px;
    }

    .stat-item:hover {
      color: #fff;
      background: rgba(255, 255, 255, 0.1);
    }

    .stat-icon {
      font-size: 14px;
    }

    .stat-value {
      font-weight: 500;
    }

    .stat-label {
      font-size: 11px;
      opacity: 0.7;
    }

    :host([compact]) .stat-label {
      display: none;
    }

    .duration {
      font-family: 'SF Mono', Monaco, monospace;
      letter-spacing: 0.5px;
    }

    .live-badge {
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 2px 8px;
      background: #ff4757;
      color: #fff;
      border-radius: 4px;
      font-size: 11px;
      font-weight: 500;
    }

    .live-indicator {
      width: 6px;
      height: 6px;
      background: #fff;
      border-radius: 50%;
      animation: pulse 1.5s ease infinite;
    }

    @keyframes pulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.5; transform: scale(0.8); }
    }
  `;let a=p;i([e({type:Number,attribute:"audience-count"})],a.prototype,"audienceCount");i([e({type:Number,attribute:"like-count"})],a.prototype,"likeCount");i([e({type:Number})],a.prototype,"duration");i([e({type:Number,attribute:"online-peak"})],a.prototype,"onlinePeak");i([e({type:Boolean,attribute:"show-duration"})],a.prototype,"showDuration");i([e({type:Boolean,attribute:"show-peak"})],a.prototype,"showPeak");i([e({type:Boolean})],a.prototype,"compact");i([e({type:Boolean,attribute:"is-live"})],a.prototype,"isLive");customElements.get("m7s-live-stats")||customElements.define("m7s-live-stats",a);export{a as LiveStats};
