Implement a Reentrant-Safe Once Wrapper for Frontend Initialization — Hard JavaScript/TypeScript Practice Problem