Issues on loading a js asset from a Theme Component

Your actual problem is trying to use inline JS, which is prohibited by CSP.

Put this code in a helper function in your theme component code, and do not inject it inside posts.

Uploading your current theme to GitHub and we can take a look too.