"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Graph_1 = require("../../../Class/Graph");
const RemoteRef_1 = require("../../../client/RemoteRef");
const makeRemoteUnitAPI_1 = require("../../../client/makeRemoteUnitAPI");
const _ids_1 = require("../../../system/_ids");
const RemoteGraph_1 = __importDefault(require("../../../system/f/meta/RemoteGraph"));
const system_1 = require("../../util/system");
const graph = new Graph_1.Graph({}, {}, system_1.system);
const post = (data) => {
    remote.pushInput('message', data);
};
const api = (0, makeRemoteUnitAPI_1.makeRemoteObjectAPI)(graph, ['U', 'G', 'C']);
const ref = new RemoteRef_1.RemoteRef(api, post);
graph.play();
const remote = new RemoteGraph_1.default(system_1.system);
remote.play();
remote.push('opt', {});
remote.getOutput('message').addListener('data', (message) => {
    ref.exec(message);
});
const local = remote.getOutput('graph').peak();
local.$watchGraph({
    events: [
        'input',
        'output',
        'ref_input',
        'ref_output',
        'err',
        'take_err',
        'catch_err',
    ],
}, (event) => {
    // console.log('event', event)
});
local.$addUnit({
    unitId: 'identity',
    bundle: { unit: { id: _ids_1.ID_IDENTITY } },
});
local.$setUnitPinData({
    unitId: 'identity',
    type: 'input',
    pinId: 'a',
    data: '1',
});
local.$addUnit({
    unitId: 'randomcolorbox',
    bundle: { unit: { id: _ids_1.ID_RANDOM_COLOR_BOX } },
});
//# sourceMappingURL=graph.js.map