try {
	let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
	n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "3cdb57a0-1305-4b0b-831b-a0721d21aa68", e._sentryDebugIdIdentifier = "sentry-dbid-3cdb57a0-1305-4b0b-831b-a0721d21aa68");
} catch (e) {}
function getTrustedFields(rootLegalEntity, apiMapping, provider) {
	return parseTrustedFieldsIntoReadOnlyFields(getApiTrustedFields(rootLegalEntity, provider), apiMapping);
}
function getTrustedFieldsProvider(rootLegalEntity) {
	return rootLegalEntity.trustedFields?.[0].provider;
}
var getApiTrustedFields = (rootLegalEntity, provider) => rootLegalEntity.trustedFields?.find((tf) => provider ? tf.provider === provider : true)?.fields ?? [];
function parseTrustedFieldsIntoReadOnlyFields(trustedFields, mapping) {
	const formFieldsMapped = [];
	trustedFields.forEach((field) => {
		for (const [key, value] of Object.entries(mapping)) if (value === field) formFieldsMapped.push(key);
	});
	const readOnlyFields = {};
	formFieldsMapped.forEach((field) => {
		const tokenizedField = field.split(".");
		const formField = tokenizedField.pop();
		const formId = tokenizedField.pop();
		if (formField && formId) if (formId in readOnlyFields) readOnlyFields[formId].push(formField);
		else readOnlyFields[formId] = [formField];
	});
	return readOnlyFields;
}
//#endregion
export { getTrustedFields as n, getTrustedFieldsProvider as r, getApiTrustedFields as t };
