Write a function to find all pairs of elements in an array such that their sum equals a target value. The function should return all pairs in a 2D array, where each pair is sorted in ascending order. If no such pair exists, return an empty array. For example, if the input array is [1, 2, 3, 4, 5] and the target value is 7, the function should return [[2, 5], [3, 4]] because 2 + 5 = 7 and 3 + 4 = 7.
Write a function to find all pairs of elements in an array such that their sum equals a target value. The function should return all pairs in a 2D array, where each pair is sorted in ascending order. If no such pair exists, return an empty array. For example, if the input array is [1, 2, 3, 4, 5] and the target value is 7, the function should return [[2, 5], [3, 4]] because 2 + 5 = 7 and 3 + 4 = 7.
Example
Input: [1, 2, 3, 4, 5]
Output: [[2, 5], [3, 4]]