import { buildCustomEvent } from "../../../../utils/event-utils.js";
const itemDisplayConfigContextEventName = 'atomic/resolveResultDisplayConfig';
class ItemDisplayConfigContextController {
    get config() {
        return this._config;
    }
    hostConnected() {
        this._resolveDisplayConfig();
    }
    _resolveDisplayConfig() {
        const event = buildCustomEvent(itemDisplayConfigContextEventName, (config)=>{
            this._config = config;
            this.host.requestUpdate();
        });
        const canceled = this.host.dispatchEvent(event);
        if (canceled) this._config = null;
    }
    constructor(host){
        this._config = null;
        this.host = host;
        host.addController(this);
    }
}
export { ItemDisplayConfigContextController };
