/**
 * Copyright 2020 The Pennsylvania State University
 * @license Apache-2.0, see License.md for full text.
 */
import{LitElement as t,html as a,css as e}from"../../lit/index.js";import"../chartist-render/chartist-render.js";globalThis.DataViz=globalThis.DataViz||{},globalThis.DataViz.requestAvailability=()=>(!globalThis.DataViz.instance&&globalThis.document&&globalThis.document.body&&(globalThis.DataViz.instance=globalThis.document.createElement("data-viz"),globalThis.document.body.appendChild(globalThis.DataViz.instance)),globalThis.DataViz.instance);class DataViz extends t{static get styles(){return[e`
        :host {
          display: block;
        }

        :host([hidden]) {
          display: none;
        }
      `]}render(){return a` <chartist-render
      id="barchart"
      type="bar"
      scale="ct-major-twelfth"
      chart-title="Quiz Distribution"
      chart-desc="A bar graph of quizzes completed by student"
    >
    </chartist-render>`}static get properties(){return{...super.properties}}static get tag(){return"data-viz"}constructor(){super(),this.windowControllers=new AbortController}connectedCallback(){super.connectedCallback(),globalThis.addEventListener("pouch-db-show-data",this.showDataFunction.bind(this),{signal:this.windowControllers.signal})}showDataFunction(t){var a=t.detail,e={labels:a.labels,series:a.series};this.shadowRoot.querySelector("#barchart").data=e}disconnectedCallback(){this.windowControllers.abort(),super.disconnectedCallback()}hideDataViz(t){}showDataViz(t){}}customElements.define(DataViz.tag,DataViz);export{DataViz};