import json
import pathlib

from django.contrib.staticfiles import finders

def get_icons():
    with open(finders.find("main/icons/remixicon.glyph.json"), "r") as f:
        data = json.load(f)
    return [i.removesuffix("-line") for i in data.keys() if i.endswith("-line")]


def pdf_outline_to_str(outline):
    return " ".join(
        (
            dest.title if not isinstance(dest, list) else pdf_outline_to_str(dest)
            for dest in outline
        )
    )
