Without looking into the details, my guess is that, because you’re using umd it will attach the global to the window object.
But you can also print the return value from your import_from line to see what you’re getting.
Typically a umd file would be put in native libraries and then you would use a window import in JavaScript.
from anvil.js.window import algoliasearch
If I wanted to use a module approach I would look at getting the JavaScript url from jspm.io or esm.sh. This would be my preference.
If those pointers don’t help I can take a look at it. But not at a computer right now.