/**
 * For reasons unknown, some events come back without a name
 */
export function sanitizeEventsPlugin() {
    return {
        name: 'sanitize-events-plugin',
        moduleLinkPhase({ moduleDoc }) {
            for (const decl of moduleDoc.declarations ?? []) {
                switch (decl.kind) {
                    case 'class':
                    case 'mixin':
                        for (const event of decl.events ?? []) {
                            if (!event.name) {
                                decl.events =
                                    decl.events?.filter(x => x !== event);
                            }
                        }
                }
            }
        },
    };
}
//# sourceMappingURL=sanitize-events.js.map