8 – Mark the selection box of the results-based autocomplete users

I have a drupal 8 site that uses the paragraph module. In one of the paragraphs there is a field that contains an autocomplete field. It is already configured to reference a small list of content types. For example, "News, Events, Product, Image" are four references for the autocomplete.

In another paragraph, includes this autocomplete but also has a field called "Select a content type", which lists ALL types of content. This is used in the content type. When someone adds new content, you are presented with a list of all types of content such as a check box and the autocomplete field.

My goal is to show only the selected results of the "select a content type" field in the autocomplete field.

Then, when a user selects a "news" / "events" / "Product" / "image" in the "Select a content type" field, the autocomplete only shows the nodes of what was selected. If I select news, only news appear when I start entering data. If I select News and events, both will appear. If I do not select any, a personalized message appears.

I have looked around and found how to overwrite the getReferenceable Entities, but I do not see a way to pass two variables: one from the field of the check box and the value entered from autocomplete.

I suspect there will be JS involved for the form to send both the check box and the search value, but I do not know where to start.