How is it possible to extract this D3.js code?

Thank you for your answer! Observable seems to be wonderful, and obviously has a strong and active community, that’s great. Just for this thing, I would prefer to have the code completely independent from it and as pure/clean as possible. Does this explain what I need to know?