import { Component, Input } from '@angular/core';
import { VIEWER_ROUTE_FROM_MIME } from '../../../../_services/viewer-route-util';
import { NsContent } from '@sunbird-cb/utils-v2';
import * as fileSaver from 'file-saver';
import * as i0 from "@angular/core";
import * as i1 from "@angular/router";
import * as i2 from "@angular/common";
import * as i3 from "@angular/material/icon";
export class AppTocReferenceNotesComponent {
    constructor(router) {
        this.router = router;
        this.primaryCategory = NsContent.EPrimaryCategory;
    }
    ngOnInit() { }
    downloadPDF(contentData) {
        fileSaver.saveAs(contentData.artifactUrl, contentData.name);
    }
    previewContent(contentData) {
        this.router.navigate([`/app/amrit-gyaan-kosh/player/${VIEWER_ROUTE_FROM_MIME(contentData.mimeType)}/${contentData.identifier}`], {
            queryParams: {
                primaryCategory: this.primaryCategory.RESOURCE,
                playerPreview: true,
                collectionId: this.content.identifier,
            },
        });
    }
    downloadAllContent() {
        this.content?.referenceNodes.forEach((ele) => {
            if (ele?.resourceCategory === 'Reference Resource') {
                fileSaver.saveAs(ele.artifactUrl, ele.name);
            }
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AppTocReferenceNotesComponent, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AppTocReferenceNotesComponent, selector: "ws-widget-app-toc-reference-notes", inputs: { content: "content" }, ngImport: i0, template: "<div class=\"flex justify-between\">\n  <div class=\"teachers-note-header pt-2\">Essential insights and guidance to enrich and standardize your teaching\n    experience.</div>\n  <div class=\"download-all\" (click)=\"downloadAllContent()\">Download All</div>\n</div>\n\n<div class=\"guide-container\" *ngIf=\"content?.referenceNodes\">\n  <ng-container *ngFor=\"let note of content?.referenceNodes\">\n    <div *ngIf=\"note?.resourceCategory === 'Reference Resource'\" class=\"guide-card flex gap-4 justify-between\">\n      <div>\n        <div class=\"note-title\">{{note?.name}}</div>\n        <div class=\"flex gap-2 pt-2\">\n          <mat-icon class=\"material-symbols-outlined\">\n            visibility\n          </mat-icon>\n          <a (click)=\"previewContent(note)\">\n            <span class=\"view-pdf\">View</span>\n          </a>\n        </div>\n      </div>\n      <div>\n        <div class=\"download-ind\">\n          <a download=\"{{note?.name}}\" (click)=\"downloadPDF(note)\">Download</a>\n        </div>\n      </div>\n    </div>\n  </ng-container>\n</div>", styles: [".teachers-note-header{font-family:Lato;font-size:14px;font-weight:400;line-height:16.8px;text-align:left;text-underline-position:from-font;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}.download-all{padding:12px 16px;font-family:Lato;font-size:14px;font-weight:700;line-height:16.8px;text-underline-position:from-font;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none;color:#1b4ca1;cursor:pointer}.guide-container .view-pdf{font-size:14px;cursor:pointer;opacity:.8;color:#000}.guide-container .note-title{font-family:Lato;font-size:16px;font-weight:700;line-height:24px;text-align:left;text-underline-position:from-font;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none;color:#1b4ca1}.guide-container .guide-card{border-radius:8px;background-color:#fff;padding:16px;margin:16px 0}.guide-container .download-ind{padding:12px 16px;font-family:Lato;font-size:14px;font-weight:700;line-height:16.8px;text-underline-position:from-font;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none;color:#1b4ca1;cursor:pointer;border-radius:40px;border-color:1px solid #c3c3c3}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AppTocReferenceNotesComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ws-widget-app-toc-reference-notes', template: "<div class=\"flex justify-between\">\n  <div class=\"teachers-note-header pt-2\">Essential insights and guidance to enrich and standardize your teaching\n    experience.</div>\n  <div class=\"download-all\" (click)=\"downloadAllContent()\">Download All</div>\n</div>\n\n<div class=\"guide-container\" *ngIf=\"content?.referenceNodes\">\n  <ng-container *ngFor=\"let note of content?.referenceNodes\">\n    <div *ngIf=\"note?.resourceCategory === 'Reference Resource'\" class=\"guide-card flex gap-4 justify-between\">\n      <div>\n        <div class=\"note-title\">{{note?.name}}</div>\n        <div class=\"flex gap-2 pt-2\">\n          <mat-icon class=\"material-symbols-outlined\">\n            visibility\n          </mat-icon>\n          <a (click)=\"previewContent(note)\">\n            <span class=\"view-pdf\">View</span>\n          </a>\n        </div>\n      </div>\n      <div>\n        <div class=\"download-ind\">\n          <a download=\"{{note?.name}}\" (click)=\"downloadPDF(note)\">Download</a>\n        </div>\n      </div>\n    </div>\n  </ng-container>\n</div>", styles: [".teachers-note-header{font-family:Lato;font-size:14px;font-weight:400;line-height:16.8px;text-align:left;text-underline-position:from-font;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}.download-all{padding:12px 16px;font-family:Lato;font-size:14px;font-weight:700;line-height:16.8px;text-underline-position:from-font;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none;color:#1b4ca1;cursor:pointer}.guide-container .view-pdf{font-size:14px;cursor:pointer;opacity:.8;color:#000}.guide-container .note-title{font-family:Lato;font-size:16px;font-weight:700;line-height:24px;text-align:left;text-underline-position:from-font;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none;color:#1b4ca1}.guide-container .guide-card{border-radius:8px;background-color:#fff;padding:16px;margin:16px 0}.guide-container .download-ind{padding:12px 16px;font-family:Lato;font-size:14px;font-weight:700;line-height:16.8px;text-underline-position:from-font;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none;color:#1b4ca1;cursor:pointer;border-radius:40px;border-color:1px solid #c3c3c3}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.Router }]; }, propDecorators: { content: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 