local export = {}
local m_langdata = require("Module:languages/data")
local m_str_utils = require("Module:string utilities")
local gsub = m_str_utils.gsub
local U = m_str_utils.char
local toNFD = mw.ustring.toNFD
local p = m_langdata.puaChars
local off = 0xF000
local initial_consonants = {
=U(off+1), =U(off+2), =U(off+3), =U(off+4), =U(off+5),
=U(off+6), =U(off+7), =U(off+8), =U(off+9), =U(off+10),
=U(off+11), =U(off+12), =U(off+13), =U(off+14), =U(off+15),
=U(off+16), =U(off+17), =U(off+18), =U(off+19), =U(off+20),
=U(off+21), =U(off+22), =U(off+23), =U(off+24), =U(off+25),
=U(off+26), =U(off+27), =U(off+28), =U(off+29), =U(off+30),
=U(off+31), =U(off+32), =U(off+33), =U(off+34), =U(off+35),
=U(off+36), =U(off+37), =U(off+38), =U(off+39), =U(off+40),
=U(off+41), =U(off+42), =U(off+43),
}
off = 0xF100
local medials = {
=U(off+1), =U(off+2), =U(off+3), =U(off+4), =U(off+5),
=U(off+6), =U(off+7), =U(off+8), =U(off+9), =U(off+10),
=U(off+11), =U(off+12), =U(off+13), =U(off+14), =U(off+15),
=U(off+16), =U(off+17), =U(off+18), =U(off+19), =U(off+20),
=U(off+21), =U(off+22), =U(off+23), =U(off+24), =U(off+25),
=U(off+26), =U(off+27), =U(off+28), =U(off+29),
}
off = 0xF200
local final_consonants = {
=U(off+1), =U(off+2), =U(off+3), =U(off+4), =U(off+5),
=U(off+6), =U(off+7), =U(off+8), =U(off+9), =U(off+10),
=U(off+11), =U(off+12), =U(off+13), =U(off+14), =U(off+15),
=U(off+16), =U(off+17), =U(off+18), =U(off+19), =U(off+20),
=U(off+21), =U(off+22), =U(off+23), =U(off+24), =U(off+25),
=U(off+26), =U(off+27), =U(off+28), =U(off+29), =U(off+30),
=U(off+31), =U(off+32), =U(off+33), =U(off+34), =U(off+35),
=U(off+36), =U(off+37), =U(off+38), =U(off+39), =U(off+40),
=U(off+41), =U(off+42), =U(off+43), =U(off+44), =U(off+45),
}
function export.makeSortKey(text, lang, sc)
text = toNFD(text)
text, _ = gsub(text, '.', initial_consonants)
text, _ = gsub(text, '.', medials)
text, _ = gsub(text, '.', final_consonants)
return text
end
return export