import * as i1 from '@angular/cdk/clipboard';
import { ClipboardModule } from '@angular/cdk/clipboard';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { input, numberAttribute, signal, effect, Component } from '@angular/core';
import * as i3 from '@angular/material/button';
import { MatButtonModule } from '@angular/material/button';
import * as i2 from '@angular/material/icon';
import { MatIconModule } from '@angular/material/icon';

class NgmPrismHighlightComponent {
    constructor() {
        this.code = input.required();
        this.language = input.required();
        this.maximum = input(0, {
            transform: numberAttribute
        });
        this.highlightedCode = signal('');
        this.#effRef = effect(async () => {
            const Prism = await import('prismjs');
            switch (this.language()) {
                case 'sql':
                    await import('prismjs/components/prism-sql');
                    break;
                case 'json':
                    await import('prismjs/components/prism-json');
                    break;
            }
            // await import('prismjs/plugins/toolbar/prism-toolbar')
            // await import('prismjs/plugins/copy-to-clipboard/prism-copy-to-clipboard')
            // await import('clipboard')
            this.highlightedCode.set(Prism.highlight(this.maximum() ? this.code().slice(0, this.maximum()) : this.code(), Prism.languages[this.language()], this.language()));
        }, { allowSignalWrites: true });
    }
    #effRef;
    copy() {
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NgmPrismHighlightComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.10", type: NgmPrismHighlightComponent, isStandalone: true, selector: "ngm-prism-highlight", inputs: { code: { classPropertyName: "code", publicName: "code", isSignal: true, isRequired: true, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: true, transformFunction: null }, maximum: { classPropertyName: "maximum", publicName: "maximum", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ngm-prism-highlight" }, ngImport: i0, template: `<pre class="m-0"><code [innerHTML]="highlightedCode()" class="m-0"></code></pre>
<button mat-icon-button (click)="copy()" [cdkCopyToClipboard]="code()">
  <mat-icon>content_copy</mat-icon>
</button>
`, isInline: true, styles: [":host{display:block;position:relative}.mdc-icon-button.mat-mdc-icon-button{position:absolute;top:0;right:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ClipboardModule }, { kind: "directive", type: i1.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NgmPrismHighlightComponent, decorators: [{
            type: Component,
            args: [{ standalone: true, imports: [CommonModule, ClipboardModule, MatIconModule, MatButtonModule], selector: 'ngm-prism-highlight', template: `<pre class="m-0"><code [innerHTML]="highlightedCode()" class="m-0"></code></pre>
<button mat-icon-button (click)="copy()" [cdkCopyToClipboard]="code()">
  <mat-icon>content_copy</mat-icon>
</button>
`, host: {
                        class: 'ngm-prism-highlight'
                    }, styles: [":host{display:block;position:relative}.mdc-icon-button.mat-mdc-icon-button{position:absolute;top:0;right:0}\n"] }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { NgmPrismHighlightComponent };
//# sourceMappingURL=metad-ocap-angular-prism.mjs.map
