import { EventEmitter } from '@angular/core' ; export const define = ( tagName , clazz ) => { const isClient = typeof window !== 'undefined' ; if ( isClient && ! customElements . get ( tagName ) ) customElements . define ( tagName , clazz ) ; } ; export const proxyInputs = ( Component , inputs ) => { const Prototype = Component . prototype ; inputs . forEach ( input => { Object . defineProperty ( Prototype , input , { get ( ) { return this . el [ input ] ; } , set ( val ) { this . z . runOutsideAngular ( ( ) => ( this . el [ input ] = val ) ) ; } , } ) ; } ) ; } ; export const proxyMethods = ( Component , methods ) => { const Prototype = Component . prototype ; methods . forEach ( methodName => { Prototype [ methodName ] = function ( ) { const args = arguments ; return this . z . runOutsideAngular ( ( ) => this . el [ methodName ] . apply ( this . el , args ) ) ; } ; } ) ; } ; export const initOutputs = ( instance , events ) => { events . forEach ( eventName => ( instance [ eventName ] = new EventEmitter ( ) ) ) ; } ; export function ProxyCmp ( opts ) { return function ( Component ) { if ( opts . inputs ) proxyInputs ( Component , opts . inputs ) ; if ( opts . methods ) proxyMethods ( Component , opts . methods ) ; return Component ; } ; }