"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._pinTypeMatch = void 0;
const parser_1 = require("../spec/parser");
const _typeMatchCache = {};
const __isTypeMatch = (specs, a, b) => {
    const cacheKey = `${a.value}/${b.value}`;
    if (_typeMatchCache[cacheKey]) {
        return _typeMatchCache[cacheKey];
    }
    else {
        const typeMatch = (0, parser_1._isTypeMatch)(specs, a, b);
        _typeMatchCache[cacheKey] = typeMatch;
        return typeMatch;
    }
};
const _pinTypeMatch = (specs, aType, aKind, bType, bKind) => {
    if (aKind === 'input' && bKind === 'input') {
        return (__isTypeMatch(specs, aType, bType) || __isTypeMatch(specs, bType, aType));
    }
    else if (aKind === 'input' && bKind === 'output') {
        return __isTypeMatch(specs, bType, aType);
    }
    else if (aKind === 'output' && bKind === 'input') {
        return __isTypeMatch(specs, aType, bType);
    }
    else {
        return true;
    }
};
exports._pinTypeMatch = _pinTypeMatch;
//# sourceMappingURL=parser.js.map