Equal out bracket types Based on  THIS question.

Given a string, replace each bracket ()[]{}&lt;&gt; with a bracket of the appropriate type so that the brackets match, and the nested brackets cycle as follows: 


Outermost ones are ()
Directly inside of () should be []
Directly inside of [] should be {}
Directly inside of {} should be &lt;&gt;
Directly inside of &lt;&gt; will be () again (cycles)


All non-bracket chars must remain exactly as they are. Open brackets may only be replaced with open brackets of some type, and close brackets with close brackets.

The input will always make this possible. This means its brackets matched correctly if their type is ignored. So, {ab&lt;)c] is a valid input, but ab)(cd or ab((cd are not.

Examples:

2#jd {¤&gt;. = 2#jd (¤).
abcdef    = abcdef
(3×5+(4-1)) = (3×5+[4-1])
&lt;&lt;&lt;&gt;&gt;&lt;&lt;&gt;&gt;&lt;&lt;&lt;&lt;&lt;&lt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; = ([{}][{}][{&lt;([{}])&gt;}])


The use of native transforming of input this way (auto syntax of language) is not allowed.

As always: shortest code wins.
JavaScript (ES6), 79 bytes

s=&gt;s.replace(/./g,c=&gt;~(p=l.indexOf(c))?l[p&amp;4?--k&amp;3|4:k++&amp;3]:c,l='([{&lt;)]}&gt;',k=0)


Test cases



let f =

s=&gt;s.replace(/./g,c=&gt;~(p=l.indexOf(c))?l[p&amp;4?--k&amp;3|4:k++&amp;3]:c,l='([{&lt;)]}&gt;',k=0)

console.log(f("2#jd {¤&gt;."));
console.log(f("abcdef"));
console.log(f("(3×5+(4-1))"));
console.log(f("&lt;&lt;&lt;&gt;&gt;&lt;&lt;&gt;&gt;&lt;&lt;&lt;&lt;&lt;&lt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"));