SlackLite stores chat messages in order. Implement a function that processes a sequence of user actions and returns the copied text after each action while keeping message state consistent.
Each message has a unique integer id and a string text. An action is one of:
"long_press": if the message exists, copy its text and mark only that message as copied"delete": remove the message; if it was the copied message, clear the copied state"edit": update the message text; if it is currently copied, the clipboard should immediately reflect the new textReturn a list of clipboard values after every action. Use null when nothing is copied.
messages as a list of objects with keys id and text; actions as a list of objects with keys type, id, and optional textnullExample 1
Input: messages = [{"id": 1, "text": "hi"}, {"id": 2, "text": "bye"}], actions = [{"type": "long_press", "id": 1}, {"type": "long_press", "id": 2}]
Output: ["hi", "bye"]
Explanation: The first long press copies message 1. The second long press replaces the copied state with message 2.
Example 2
Input: messages = [{"id": 1, "text": "draft"}], actions = [{"type": "long_press", "id": 1}, {"type": "edit", "id": 1, "text": "final"}, {"type": "delete", "id": 1}]
Output: ["draft", "final", null]
Explanation: Editing a copied message updates the clipboard. Deleting it clears the copied state.
1 <= len(messages) <= 10^51 <= len(actions) <= 10^51 <= id <= 10^90 <= len(text) <= 10^4messages are unique