import type * as d from '../declarations' ; import { addHostEventListeners } from '@runtime' ; import { BUILD } from '@app-data' ; const hostRefs = new WeakMap ( ) ; export const getHostRef = ( ref ) => hostRefs . get ( ref ) ; export const registerInstance = ( lazyInstance , hostRef ) => hostRefs . set ( ( hostRef . $lazyInstance$ = lazyInstance ) , hostRef ) ; export const registerHost = ( elm , cmpMeta ) => { const hostRef = { $flags$ : 0 , $hostElement$ : elm , $cmpMeta$ : cmpMeta , $instanceValues$ : new Map ( ) , } ; if ( BUILD . isDev ) { hostRef . $renderCount$ = 0 ; } if ( BUILD . method && BUILD . lazyLoad ) { hostRef . $onInstancePromise$ = new Promise ( ( r ) => ( hostRef . $onInstanceResolve$ = r ) ) ; } if ( BUILD . asyncLoading ) { hostRef . $onReadyPromise$ = new Promise ( ( r ) => ( hostRef . $onReadyResolve$ = r ) ) ; elm [ 's-p' ] = [ ] ; elm [ 's-rc' ] = [ ] ; } addHostEventListeners ( elm , hostRef , cmpMeta . $listeners$ , false ) ; return hostRefs . set ( elm , hostRef ) ; } ; export const isMemberInElement = ( elm , memberName ) => memberName in elm ;