import { ai12zManager } from "./ai12z-manager";
// Expose only a safe API — not the manager itself
export function exposeAi12zBridge() {
    globalThis.ai12zCtrl = {
        sendMessage: (...args) => { var _a, _b; return (_b = (_a = ai12zManager.active) === null || _a === void 0 ? void 0 : _a.sendMessage) === null || _b === void 0 ? void 0 : _b.call(_a, ...args); },
        sendJSON: (...args) => { var _a, _b; return (_b = (_a = ai12zManager.active) === null || _a === void 0 ? void 0 : _a.sendJSON) === null || _b === void 0 ? void 0 : _b.call(_a, ...args); },
        openModal: (...args) => { var _a, _b; return (_b = (_a = ai12zManager.active) === null || _a === void 0 ? void 0 : _a.openModal) === null || _b === void 0 ? void 0 : _b.call(_a, ...args); },
        closeModal: (...args) => { var _a, _b; return (_b = (_a = ai12zManager.active) === null || _a === void 0 ? void 0 : _a.closeModal) === null || _b === void 0 ? void 0 : _b.call(_a, ...args); },
        openBot: (...args) => { var _a, _b; return (_b = (_a = ai12zManager.active) === null || _a === void 0 ? void 0 : _a.openBot) === null || _b === void 0 ? void 0 : _b.call(_a, ...args); },
        action: (...args) => { var _a, _b; return (_b = (_a = ai12zManager.active) === null || _a === void 0 ? void 0 : _a.action) === null || _b === void 0 ? void 0 : _b.call(_a, ...args); },
        setActive: (tag) => ai12zManager.setActive(tag),
        getActiveTag: () => ai12zManager.active,
        // Fetch a specific instance by its instance-id attribute value
        getInstance: (instanceId) => ai12zManager.getById(instanceId),
        shadowRoot: () => { var _a, _b, _c, _d; return (_c = (_b = (_a = ai12zManager.active) === null || _a === void 0 ? void 0 : _a.el) === null || _b === void 0 ? void 0 : _b.shadowRoot) !== null && _c !== void 0 ? _c : (_d = ai12zManager.active) === null || _d === void 0 ? void 0 : _d.el; },
    };
}
