Design a simple document editor that contains layers. Each layer has a unique string id and a set of string key/value properties. You must support four operations:
Initialization: Build the document from an array of layers.
apply(layerId, property, value): Set property of the specified layer to value. This operation can be undone.
layer(id): Return the layer object with the given id (or null if it does not exist).
undo(): Undo the most recent apply, restoring the affected property to its value before that apply. If no applies remain, do nothing.
Follow-up: implement redo() which reverses the most recent undo.