def b64
import ezx@1.11.0.0/src/sha/nar.bend as Narimport Base
153# standard base64, padded with `=`
154def b64(text: String) -> String:
155 match text:
156 case SNil{}:
157 ""
158 case SCon{a, SNil{}}:
159 b64.one(Char.to_u32(a))
160 case SCon{a, SCon{b, SNil{}}}:
161 b64.two(Char.to_u32(a), Char.to_u32(b))
162 case SCon{a, SCon{b, SCon{c, t}}}:
163 b64.triple(Char.to_u32(a), Char.to_u32(b), Char.to_u32(c)) ++ b64(t)