import { Component, inject } from '@angular/core';
import { BottomDrawerRef, PluginsService } from '@c8y/ngx-components';
import * as i0 from "@angular/core";
import * as i1 from "@c8y/ngx-components";
import * as i2 from "@angular/common";
export class ApplicationPluginReadmeComponent {
    constructor() {
        this.bottomDrawerRef = inject(BottomDrawerRef);
        this.pluginsService = inject(PluginsService);
    }
    async ngOnInit() {
        const baseUrl = `/apps/${this.plugin.id}/`;
        this.pluginBaseUrl = baseUrl;
        this.pluginMarkdown = await this.pluginsService.getReadmeFileContent(baseUrl);
    }
    close() {
        this.bottomDrawerRef.close();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApplicationPluginReadmeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: ApplicationPluginReadmeComponent, selector: "c8y-application-plugin-readme", host: { classAttribute: "d-contents" }, ngImport: i0, template: "<div class=\"card-header gap-8 d-col p-l-24 p-r-24 separator-bottom flex-no-shrink\">\n  <span class=\"card-title h4 text-center\">\n    {{ plugin.name }}\n  </span>\n</div>\n<div class=\"inner-scroll flex-grow\">\n  <div\n    class=\"markdown-content col-lg-8 p-24 m-l-auto m-r-auto\"\n    style=\"float: none\"\n    *ngIf=\"pluginMarkdown\"\n    [innerHTML]=\"pluginMarkdown | markdownToHtml: { baseUrl: pluginBaseUrl } | async\"\n  ></div>\n  <div class=\"d-flex\">\n    <c8y-ui-empty-state\n      class=\"col-lg-3 col-sm-4 m-l-auto m-r-auto\"\n      [icon]=\"'user-manual'\"\n      [title]=\"'No README.md found for plugin' | translate\"\n      [subtitle]=\"\n        'To view the contents of &quot;README&quot;, add the file &quot;README.md&quot; to the plugin.'\n          | translate\n      \"\n      *ngIf=\"!pluginMarkdown\"\n      [horizontal]=\"true\"\n    ></c8y-ui-empty-state>\n  </div>\n</div>\n<div class=\"text-center card-footer p-24 separator\">\n  <button\n    class=\"btn btn-default\"\n    (click)=\"close()\"\n  >\n    {{ 'Close' | translate }}\n  </button>\n</div>\n", dependencies: [{ kind: "component", type: i1.EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.MarkdownToHtmlPipe, name: "markdownToHtml" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: ApplicationPluginReadmeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'c8y-application-plugin-readme', host: { class: 'd-contents' }, template: "<div class=\"card-header gap-8 d-col p-l-24 p-r-24 separator-bottom flex-no-shrink\">\n  <span class=\"card-title h4 text-center\">\n    {{ plugin.name }}\n  </span>\n</div>\n<div class=\"inner-scroll flex-grow\">\n  <div\n    class=\"markdown-content col-lg-8 p-24 m-l-auto m-r-auto\"\n    style=\"float: none\"\n    *ngIf=\"pluginMarkdown\"\n    [innerHTML]=\"pluginMarkdown | markdownToHtml: { baseUrl: pluginBaseUrl } | async\"\n  ></div>\n  <div class=\"d-flex\">\n    <c8y-ui-empty-state\n      class=\"col-lg-3 col-sm-4 m-l-auto m-r-auto\"\n      [icon]=\"'user-manual'\"\n      [title]=\"'No README.md found for plugin' | translate\"\n      [subtitle]=\"\n        'To view the contents of &quot;README&quot;, add the file &quot;README.md&quot; to the plugin.'\n          | translate\n      \"\n      *ngIf=\"!pluginMarkdown\"\n      [horizontal]=\"true\"\n    ></c8y-ui-empty-state>\n  </div>\n</div>\n<div class=\"text-center card-footer p-24 separator\">\n  <button\n    class=\"btn btn-default\"\n    (click)=\"close()\"\n  >\n    {{ 'Close' | translate }}\n  </button>\n</div>\n" }]
        }] });
//# sourceMappingURL=data:application/json;base64,ey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