"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContentRights = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const react_native_1 = require("react-native");
const __1 = require("../..");
const metadata_constants_1 = require("../../lib/metadata-constants");
const text_1 = require("../ui/text");
const { layout, gap, mt, text: textStyles } = __1.zero;
exports.ContentRights = (0, react_1.forwardRef)(({ contentRights, compact, ...rest }, ref) => {
    const { zero } = (0, __1.useTheme)();
    if (!contentRights || Object.keys(contentRights).length === 0) {
        return null;
    }
    const formatLicense = (license) => {
        return metadata_constants_1.LICENSE_URL_LABELS[license] || license;
    };
    // Display rights in bottom metadata view
    const elements = [];
    // TODO: Map DID to handle creator
    // if (contentRights.creator) {
    //   elements.push(`Creator: ${contentRights.creator}`);
    // }
    if (contentRights.copyrightYear) {
        elements.push(`© ${contentRights.copyrightYear.toString()}${contentRights.creditLine ? " " + contentRights.creditLine : ""}`);
    }
    else if (contentRights.creditLine) {
        elements.push(contentRights.creditLine);
    }
    if (contentRights.license) {
        elements.push(formatLicense(contentRights.license));
    }
    if (contentRights.copyrightNotice) {
        elements.push(contentRights.copyrightNotice);
    }
    if (elements.length > 0) {
        elements[0] = "Stream content is " + elements[0];
    }
    if (elements.length == 0) {
        return null;
    }
    return ((0, jsx_runtime_1.jsx)(text_1.Text, { ref: ref, style: [
            zero.text.mutedForeground,
            mt[1],
            react_native_1.StyleSheet.flatten(rest.style),
        ], ...rest, children: elements.join(" • ") }));
});
exports.ContentRights.displayName = "ContentRights";
//# sourceMappingURL=content-rights.js.map