import { r as registerInstance, h, e as getElement } from './index-c04b9ed5.js';
import { E as EnvironmentConfigService } from './environment-config.service-b191f276.js';
import { A as AssetsService } from './assets.service-def1d63c.js';
import './auth.store-dba2c2da.js';

const sparkleDiscussionCss = "sparkle-discussion{border:1px solid var(--line-rule-color);display:block;padding:12px}";

const SparkleDiscussion = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.allowPostToFeed = false;
    this.feedStartingText = 'My suggestions are:';
    this.isTeacherMode = false;
    this.quizData = [];
  }
  async componentDidLoad() {
    this.isTeacherMode = this.isTeacherMode == false ? window.location.href.indexOf('/presentation/course') > -1 : this.isTeacherMode;
    const config = EnvironmentConfigService.getInstance().get('sparkle');
    let allQuizData = await AssetsService.getInstance().loadJsonFile(config.quizPath);
    if (allQuizData) {
      if (this.questionIds) {
        let questionIds = this.questionIds.split(',');
        this.quizData = [];
        questionIds.forEach(id => {
          this.quizData = [...this.quizData, allQuizData[+id]];
        });
        console.log('QUIZ Data', this.quizData);
      }
    }
  }
  render() {
    return this.isTeacherMode ? (h("sparkle-discussion-results", { allowPostToFeed: this.allowPostToFeed, feedStartingText: this.feedStartingText, isTeacherMode: this.isTeacherMode, questions: this.quizData })) : (h("sparkle-discussion-questions", { allowPostToFeed: this.allowPostToFeed, feedStartingText: this.feedStartingText, isTeacherMode: this.isTeacherMode, questions: this.quizData }));
  }
  get el() { return getElement(this); }
};
SparkleDiscussion.style = sparkleDiscussionCss;

export { SparkleDiscussion as sparkle_discussion };
