Librarian villagers sell max-level books, including Mending. Wrong trade? Break and replace the lectern before trading until it changes. With the Villager Trade Rebalance experiment on, what a librarian sells depends on their village's biome.
Every anvil use adds a work penalty to the result: 0, 1, 3, 7, 15, 31 levels after 0–5 uses. Any single step of 40+ levels is "Too Expensive!" in Survival. The orders here avoid that.
Combine books with each other first and put them on the item once, as the steps show. Adding books one by one costs far more.
Protection IV on all four armour pieces cuts damage by 64%. The cap is 80%.
Mending repairs 2 durability per XP point, only on items you're holding or wearing.
An enchanting table needs 15 bookshelves one block away for level 30 options.