import { Injectable } from '@angular/core';
import * as i0 from "@angular/core";
export class AccordionRegistryService {
    constructor() {
        this.accordions = new Map();
    }
    register(id, element) {
        this.accordions.set(id, element);
    }
    get(id) {
        return this.accordions.get(id);
    }
    unregister(id) {
        this.accordions.delete(id);
    }
    getItem(accordionId, itemId) {
        const accordionObject = this.accordions.get(accordionId);
        return accordionObject.accordionItems.find(item => item.id === itemId);
    }
    openItem(accordionId, itemId) {
        this.getItem(accordionId, itemId)?.isOpen.next(true);
    }
    closeItem(accordionId, itemId) {
        this.getItem(accordionId, itemId)?.isOpen.next(false);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AccordionRegistryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AccordionRegistryService, providedIn: 'any' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AccordionRegistryService, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'any' }]
        }] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3JkaW9uLXJlZ2lzdHJ5LnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9jaXJjbGV0b25lL3NyYy9saWIvc2VydmljZXMvYWNjb3JkaW9uLXJlZ2lzdHJ5LnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFLM0MsTUFBTSxPQUFPLHdCQUF3QjtJQURyQztRQUVVLGVBQVUsR0FBRyxJQUFJLEdBQUcsRUFBOEIsQ0FBQztLQTBCNUQ7SUF4QkMsUUFBUSxDQUFDL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