matrix-art-preview

Page to land previews on for matrix art
git clone git://archive.git.mtrnord.blog/MTRNord/matrix-art-preview.git
Log | Files | Refs

index-96e8ccca.js.map (58790B)


      1 {"version":3,"file":"index-96e8ccca.js","sources":["../../src/context.ts","../../src/components/Logo_colored.svg","../../src/components/header.tsx","../../src/utils/resources.ts","../../src/utils/asyncImages.tsx","../../src/components/post.tsx","../../src/data/user.ts","../../src/data/post.ts","../../src/pages/Home.tsx","../../src/matrix/events/ImageEvent.ts","../../src/matrix/client.ts","../../src/app.tsx","../../src/i18n.ts","../../src/main.tsx"],"sourcesContent":["import { MatrixClient } from \"./matrix/client\";\nimport { createContext } from \"react\";\n\nexport const Client = createContext<MatrixClient | undefined>(undefined);","export default \"__VITE_ASSET__533003ef__\"","import { Link } from \"react-router-dom\";\nimport { useContext } from \"react\";\nimport { Client } from \"../context\";\nimport logo_url from \"./Logo_colored.svg\";\nimport { useTranslation } from \"react-i18next\";\n\nexport function Header() {\n    const client = useContext(Client);\n    const { t } = useTranslation();\n\n    return (\n        <div className=\"m-12 flex flex-col lg:flex-row items-center justify-between\">\n            <Link to=\"/\"><img alt=\"Matrix Art\" src={logo_url} /></Link>\n            <div className=\"flex items-center mt-8 lg:mt-0 flex-col sm:flex-row\">\n                <div className=\"flex items-center lg:justify-between w-80 mx-6 ease-in-out hover:scale-105 transition-transform duration-300\">\n                    <div className=\"absolute ml-4\">\n                        <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"#AAB3CF\">\n                            <path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n                            <path d=\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\" />\n                        </svg>\n                    </div>\n                    <input className=\"search-bg shadow rounded-2xl border-0 py-3 px-4 pl-12 text-data\" placeholder={t(\"Search\") as string}></input>\n                </div>\n                {\n\n                    client?.isLoggedIn() ? <Link to=\"/\" className=\"text-white font-bold logo-bg rounded-2xl py-3 px-12 shadow mt-4 sm:mt-0 transition-transform ease-in-out duration-300 hover:scale-105\">{t('Post')}</Link> :\n                        <Link to=\"/join\" className=\"text-white font-bold logo-bg rounded-2xl py-3 px-12 shadow mt-4 sm:mt-0 transition-transform ease-in-out duration-300 hover:scale-105\">{t('Join')}</Link>\n                }\n\n            </div>\n        </div>\n    );\n}","// A Resource is an object with a read method returning the payload\nexport interface Resource<Payload> {\n    read: () => Payload;\n}\n\nexport type status = \"pending\" | \"success\" | \"error\";\n\n// this function let us get a new function using the asyncFn we pass\n// this function also receives a payload and return us a resource with\n// that payload assigned as type\nexport function createResource<Payload>(\n    asyncFn: () => Promise<Payload>\n): Resource<Payload> {\n    // we start defining our resource is on a pending status\n    let status: status = \"pending\";\n    // and we create a variable to store the result\n    let result: Payload | Error;\n    // then we immediately start running the `asyncFn` function\n    // and we store the resulting promise\n    const promise = asyncFn().then(\n        (r: Payload) => {\n            // once it's fulfilled we change the status to success\n            // and we save the returned value as result\n            status = \"success\";\n            result = r;\n        },\n        (error: Error) => {\n            // once it's rejected we change the status to error\n            // and we save the returned error as result\n            status = \"error\";\n            result = error;\n        }\n    );\n    // lately we return an error object with the read method\n    return {\n        read(): Payload {\n            // here we will check the status value\n            switch (status) {\n                case \"pending\": {\n                    // if it's still pending we throw the promise\n                    // throwing a promise is how Suspense know our component is not ready\n                    throw promise;\n                }\n                case \"error\": {\n                    // if it's error we throw the error\n                    throw result as Error;\n                }\n                case \"success\": {\n                    // if it's success we return the result\n                    return result as Payload;\n                }\n            }\n        },\n    };\n}","// First we need a type of cache to avoid creating resources for images\nimport { ImgHTMLAttributes } from \"react\";\nimport { createResource, Resource } from \"./resources\";\n\n// we have already fetched in the past\nexport const cache = new Map<string, Resource<string>>();\n\n// then we create our loadImage function, this function receives the source\n// of the image and returns a resource\nexport function loadImage(source: string): Resource<string> {\n    // here we start getting the resource from the cache\n    let resource = cache.get(source);\n    // and if it's there we return it immediately\n    if (resource) return resource;\n    // but if it's not we create a new resource\n    resource = createResource<string>(\n        () =>\n            // in our async function we create a promise\n            new Promise((resolve, reject) => {\n                // then create a new image element\n                const img = new window.Image();\n                // set the src to our source\n                img.src = source;\n                // and start listening for the load event to resolve the promise\n                img.addEventListener(\"load\", () => resolve(source));\n                // and also the error event to reject the promise\n                img.addEventListener(\"error\", () =>\n                    reject(new Error(`Failed to load image ${source}`))\n                );\n            })\n    );\n    // before finishing we save the new resource in the cache\n    cache.set(source, resource);\n    // and return return it\n    return resource;\n}\n\nexport function SuspenseImage(\n    props: ImgHTMLAttributes<HTMLImageElement>\n): JSX.Element {\n    loadImage(props.src ?? \"undefined\").read();\n    return <img {...props} />;\n}","import { Suspense } from \"react\";\nimport { PostData } from \"../data/post\";\nimport { UserData } from \"../data/user\";\nimport { SuspenseImage } from \"../utils/asyncImages\";\nimport { BounceLoader } from \"react-spinners\";\nimport { Link } from \"react-router-dom\";\n\ntype Props = {\n    user: UserData;\n    post: PostData;\n};\n\nexport function Post({ user, post }: Props) {\n\n    return (\n        <Suspense fallback={<div className=\"flex flex-col w-full\"><BounceLoader color=\"#FEA500\" /></div>}>\n            <div className=\"flex flex-col\">\n                <Link aria-label={`Open post by ${user.display_name}`} to={`/post/${post.event_id}`} className=\"w-full\">\n                    <SuspenseImage className=\"rounded-3xl shadow object-cover transition-transform ease-in-out duration-300 hover:scale-105\" src={post.content.file.url} />\n                </Link>\n                <div className=\"flex items-center justify-between py-4\">\n                    <Link className=\"flex items-center\" to={`/profile/${user.mxid}`}>\n                        <img className=\"w-11 h-11 rounded-full mr-4 border-2 border-[#AAB3CF] hover:border-indigo-300 ease-in-out duration-150\" src={user.avatar_url} />\n                        <p className=\"text-data text-lg font-medium\">{user.display_name}</p>\n                    </Link>\n                    <div className=\"flex text-data text-lg items-center\">\n                        <a className=\"mr-4 flex items-center\" href=\"#\">\n                            <span className=\"mr-2 hover:fill-red-600 fill-[#AAB3CF] ease-in-out duration-150\">\n                                <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\">\n                                    <path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n                                    <path d=\"M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z\" />\n                                </svg>\n                            </span>\n                            <span>5</span>\n                        </a>\n                        <a className=\"flex items-center\" href=\"#\">\n                            <span className=\"mr-2 fill-[#AAB3CF] ease-in-out duration-150 hover:fill-orange-400\">\n                                <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\">\n                                    <path d=\"M0 0h24v24H0V0z\" fill=\"none\" />\n                                    <path d=\"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z\" />\n                                </svg>\n                            </span>\n                            <span>11</span>\n                        </a>\n                    </div>\n                </div>\n            </div>\n        </Suspense>\n    );\n}","export class UserData {\n    public readonly mxid: string;\n    public readonly display_name: string;\n    public readonly avatar_url: string;\n\n    constructor(mxid: string, display_name: string, avatar_url: string) {\n        this.mxid = mxid;\n        this.display_name = display_name;\n        this.avatar_url = avatar_url;\n    }\n}","import { ImageEvent } from \"../matrix/events/ImageEvent\";\n\nexport class PostData {\n    public readonly event_id: string;\n    public readonly content: ImageEvent;\n    constructor(event_id: string, content: ImageEvent) {\n        this.event_id = event_id;\n        this.content = content;\n    }\n}","import { Header } from \"../components/header\";\nimport { Post } from \"../components/post\";\nimport { Plock } from \"react-plock\";\nimport { UserData } from \"../data/user\";\nimport { PostData } from \"../data/post\";\nimport { useTranslation } from \"react-i18next\";\n\n\nconst BREAKPOINTS = [\n    { size: 500, columns: 1 },\n    { size: 800, columns: 2 },\n    { size: 1400, columns: 3 },\n    { size: 1401, columns: 4 },\n];\n\nexport function Home() {\n    const { t } = useTranslation();\n\n    return (\n        <div className=\"flex flex-col\">\n            <header>\n                <Header />\n            </header>\n            <main className=\"m-12 mt-6\">\n                <h1 className=\"text-3xl font-bold mb-4 text-white\">{t('Explore')}</h1>\n                <div className=\"flex justify-center\" id=\"gallery\">\n                    <Plock gap={\"24px\"} breakpoints={BREAKPOINTS}>\n                        {/* \n                            // @ts-ignore */}\n                        <Post user={new UserData(\"a\", \"Person A\", \"https://images.unsplash.com/photo-1519699047748-de8e457a634e?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=922&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3NzYyNA&ixlib=rb-4.0.3&q=80&w=922\")} post={new PostData(\"a\", { file: { url: \"https://images.unsplash.com/photo-1648773009733-1eab564f3330?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=922&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3Nzk0MA&ixlib=rb-4.0.3&q=80&w=614\" } })} />\n                        {/* \n                            // @ts-ignore */}\n                        <Post user={new UserData(\"b\", \"Person B\", \"https://images.unsplash.com/photo-1485893086445-ed75865251e0?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=80&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3Nzc2Ng&ixlib=rb-4.0.3&q=80&w=80\")} post={new PostData(\"b\", { file: { url: \"https://images.unsplash.com/photo-1648775933902-f633de370964?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=922&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3ODE1OQ&ixlib=rb-4.0.3&q=80&w=1383\" } })} />\n                        {/* \n                            // @ts-ignore */}\n                        <Post user={new UserData(\"c\", \"Person C\", \"https://images.unsplash.com/photo-1584997159889-8bb96d0a2217?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=80&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3ODAxNw&ixlib=rb-4.0.3&q=80&w=80\")} post={new PostData(\"c\", { file: { url: \"https://images.unsplash.com/photo-1648793633175-f3635585014b?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=922&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3ODIwNA&ixlib=rb-4.0.3&q=80&w=614\" } })} />\n                        {/* \n                            // @ts-ignore */}\n                        <Post user={new UserData(\"d\", \"Person D\", \"https://images.unsplash.com/photo-1543123820-ac4a5f77da38?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=80&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3ODA0Ng&ixlib=rb-4.0.3&q=80&w=80\")} post={new PostData(\"d\", { file: { url: \"https://images.unsplash.com/photo-1648775170273-dcbe48fb12a0?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=922&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3ODI1Ng&ixlib=rb-4.0.3&q=80&w=1229\" } })} />\n                        {/* \n                            // @ts-ignore */}\n                        <Post user={new UserData(\"e\", \"Person E\", \"https://images.unsplash.com/photo-1595687825617-10c4d36566e7?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=80&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3ODA3Mw&ixlib=rb-4.0.3&q=80&w=80\")} post={new PostData(\"e\", { file: { url: \"https://images.unsplash.com/photo-1648769244858-6e20b5999a6b?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=922&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3ODI5Nw&ixlib=rb-4.0.3&q=80&w=651\" } })} />\n                        {/* \n                            // @ts-ignore */}\n                        <Post user={new UserData(\"f\", \"Person E\", \"https://images.unsplash.com/photo-1609010586352-ce4e725aa565?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=80&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3ODA5Mg&ixlib=rb-4.0.3&q=80&w=80\")} post={new PostData(\"f\", { file: { url: \"https://images.unsplash.com/photo-1648750690732-f6eb85984ff8?crop=entropy&cs=tinysrgb&fit=crop&fm=jpg&h=921&ixid=MnwxfDB8MXxyYW5kb218MHx8fHx8fHx8MTY3Mjc3ODM1NQ&ixlib=rb-4.0.3&q=80&w=614\" } })} />\n                    </Plock>\n                </div>\n            </main>\n        </div>\n    );\n}","import {\n    ExtensibleEvents,\n    IPartialEvent,\n    Optional,\n    UnstableValue,\n    EventType,\n    isEventTypeSame,\n    isProvided,\n    M_TEXT,\n    InvalidEventError,\n    isOptionalAString,\n    NamespacedValue,\n    M_MESSAGE_EVENT_CONTENT,\n    EitherAnd,\n    M_TEXT_EVENT,\n    ExtensibleEvent\n} from \"matrix-events-sdk\";\n\nexport const M_IMAGE = new UnstableValue(\"m.image\", \"org.matrix.msc1767.image\");\nexport const M_FILE = new UnstableValue(\"m.file\", \"org.matrix.msc1767.file\");\nexport const M_THUMBNAIL = new UnstableValue(\"m.thumbnail\", \"org.matrix.msc1767.thumbnail\");\nexport const M_BLURHASH = new UnstableValue(\"blurhash\", \"xyz.amorgan.blurhash\");\nexport const MATRIX_ART_DESCRIPTION = new NamespacedValue(\"matrixart.description\");\nexport const MATRIX_ART_TAGS = new NamespacedValue(\"matrixart.tags\");\nexport const MATRIX_ART_NSFW = new NamespacedValue(\"matrixart.nsfw\");\nexport const MATRIX_ART_LICENSE = new NamespacedValue(\"matrixart.license\");\n\ntype ThumbnailFileEvent = ImageFields & {\n    url: string;\n    mimetype: string;\n    size: number;\n};\n\ntype ImageFields = {\n    width: number;\n    height: number;\n};\n\ntype FileEvent = {\n    url: string;\n    name: string;\n    mimetype: string;\n    size: number;\n};\n\nexport type M_IMAGE_EVENT = EitherAnd<{ [M_IMAGE.name]: ImageFields; }, { [M_IMAGE.altName]: ImageFields; }>;\nexport type M_FILE_EVENT = EitherAnd<{ [M_FILE.name]: FileEvent; }, { [M_FILE.altName]: FileEvent; }>;\nexport type M_THUMBNAIL_EVENT = EitherAnd<{ [M_THUMBNAIL.name]: ThumbnailFileEvent[]; }, { [M_THUMBNAIL.altName]: ThumbnailFileEvent[]; }>;\nexport type M_BLURHASH_EVENT = EitherAnd<{ [M_BLURHASH.name]: string; }, { [M_BLURHASH.altName]: string; }>;\nexport type MATRIX_ART_TAGS_EVENT = { [\"matrixart.tags\"]: string[]; };\nexport type MATRIX_ART_DESCRIPTION_EVENT = { [\"matrixart.description\"]: string; };\nexport type MATRIX_ART_NSFW_EVENT = { [\"matrixart.nsfw\"]: boolean; };\nexport type MATRIX_ART_LICENSE_EVENT = { [\"matrixart.license\"]: string; };\nexport type M_IMAGE_EVENT_CONTENT = M_MESSAGE_EVENT_CONTENT\n    & M_IMAGE_EVENT\n    & M_FILE_EVENT\n    & M_TEXT_EVENT\n    | M_BLURHASH_EVENT\n    | M_THUMBNAIL_EVENT\n    | MATRIX_ART_TAGS_EVENT\n    | MATRIX_ART_DESCRIPTION_EVENT\n    | MATRIX_ART_NSFW_EVENT\n    | MATRIX_ART_LICENSE_EVENT;\n\nexport class ImageEvent extends ExtensibleEvent<M_IMAGE_EVENT_CONTENT> {\n    public readonly image!: ImageFields;\n    public readonly text!: string;\n    public readonly thumbnails?: ThumbnailFileEvent[];\n    public readonly blurhash?: string;\n    public readonly file!: FileEvent;\n    public readonly description?: string;\n    public readonly tags?: string[];\n    public readonly nsfw: boolean = false;\n    public readonly license?: string;\n\n\n    public isEquivalentTo(primaryEventType: EventType): boolean {\n        return isEventTypeSame(primaryEventType, M_IMAGE);\n    }\n    public serialize(): IPartialEvent<object> {\n        const content: M_IMAGE_EVENT_CONTENT = {\n            [M_TEXT.name]: this.text,\n            [M_FILE.name]: this.file,\n            [M_IMAGE.name]: this.image,\n            [M_THUMBNAIL.name]: this.thumbnails,\n            [M_BLURHASH.name]: this.blurhash,\n            [\"matrixart.description\"]: this.description,\n            [\"matrixart.tags\"]: this.tags,\n            [\"matrixart.nsfw\"]: this.nsfw,\n            [\"matrixart.license\"]: this.license,\n        };\n\n        return {\n            type: \"m.image\",\n            content: content,\n        };\n    }\n\n    constructor(wireFormat: IPartialEvent<M_IMAGE_EVENT_CONTENT>) {\n        super(wireFormat);\n\n        const mimage = M_IMAGE.findIn<ImageFields>(this.wireContent);\n        // Probably wrong\n        const mtext = M_TEXT.findIn<string>(this.wireContent);\n        const mfile = M_FILE.findIn<FileEvent>(this.wireContent);\n        const mthumbnail = M_THUMBNAIL.findIn<ThumbnailFileEvent[]>(this.wireContent);\n        const mblurhash = M_BLURHASH.findIn<string>(this.wireContent);\n        const matrixart_description = MATRIX_ART_DESCRIPTION.findIn<string>(this.wireContent);\n        const matrixart_tags = MATRIX_ART_TAGS.findIn<string[]>(this.wireContent);\n        const matrixart_nsfw = MATRIX_ART_NSFW.findIn<boolean>(this.wireContent);\n        const matrixart_license = MATRIX_ART_LICENSE.findIn<string>(this.wireContent);\n\n        // Required fields\n        if (isProvided(mimage)) {\n            if (!mimage) {\n                throw new InvalidEventError(\"m.image is required to be present\");\n            }\n            this.image = mimage;\n        }\n        if (isProvided(mfile)) {\n            if (!mfile) {\n                throw new InvalidEventError(\"m.file is required to be present\");\n            }\n            this.file = mfile;\n        }\n        if (isOptionalAString(mtext)) {\n            if (!mimage) {\n                throw new InvalidEventError(\"m.text is required to be present\");\n            }\n            // Safe but ts is stupid here\n            this.text = mtext as string;\n        }\n\n        // Optional fields\n        if (isProvided(mthumbnail)) {\n            if (!Array.isArray(mthumbnail)) {\n                throw new InvalidEventError(\"m.thumbnail contents must be an array\");\n            }\n            this.thumbnails = mthumbnail;\n        }\n        if (isOptionalAString(mblurhash)) {\n            this.blurhash = mblurhash as string;\n        }\n        if (isOptionalAString(matrixart_description)) {\n            this.description = matrixart_description as string;\n        }\n        if (isProvided(matrixart_tags)) {\n            if (!Array.isArray(matrixart_tags)) {\n                throw new InvalidEventError(\"matrixart.tags contents must be an array\");\n            }\n            this.tags = matrixart_tags;\n        }\n        if (isProvided(matrixart_nsfw)) {\n            if (typeof matrixart_nsfw !== \"boolean\") {\n                throw new InvalidEventError(\"matrixart.tags contents must be an boolean\");\n            }\n            this.nsfw = matrixart_nsfw;\n        }\n        if (isOptionalAString(matrixart_license)) {\n            this.license = matrixart_license as string;\n        }\n    }\n}\n\nfunction parseImageEvent(wireEvent: IPartialEvent<object>): Optional<ImageEvent> {\n    const event = wireEvent as IPartialEvent<M_IMAGE_EVENT_CONTENT>;\n    return new ImageEvent(event);\n}\n\nExtensibleEvents.registerInterpreter(M_IMAGE, parseImageEvent);\nExtensibleEvents.unknownInterpretOrder.push(M_IMAGE);","import {\n    createClient,\n    EventTimeline,\n    EventType,\n    IndexedDBCryptoStore,\n    IndexedDBStore,\n    MatrixClient as MatrixClientSdk,\n    MatrixEvent, MatrixEventEvent,\n    Preset,\n    RoomCreateTypeField,\n    RoomType,\n    UNSTABLE_MSC3088_ENABLED,\n    UNSTABLE_MSC3088_PURPOSE,\n    UNSTABLE_MSC3089_TREE_SUBTYPE\n} from 'matrix-js-sdk';\nimport {\n    MEGOLM_ALGORITHM\n} from 'matrix-js-sdk/lib/crypto/olmlib';\nimport {\n    DEFAULT_TREE_POWER_LEVELS_TEMPLATE,\n    MSC3089TreeSpace\n} from 'matrix-js-sdk/lib/models/MSC3089TreeSpace';\nimport {\n    M_IMAGE\n} from './events/ImageEvent';\n// @ts-ignore - `.ts` is needed here to make TS happy\nimport IndexedDBWorker from \"./workers/indexeddb.worker.ts?worker\";\n\nexport class MatrixClient {\n    private events: MatrixEvent[] = [];\n    private currentUserDirectory?: MSC3089TreeSpace;\n    private rootDirectory?: MSC3089TreeSpace;\n    private constructor(private client: MatrixClientSdk) { }\n\n    public static async new(): Promise<MatrixClient> {\n        // @ts-ignore Known to be a thing\n        if (!global.Olm) {\n            console.error(\n                \"global.Olm does not seem to be present.\"\n                + \" Did you forget to add olm in the out directory?\"\n            );\n        }\n\n        let server;\n        if (window.localStorage.getItem(\"server\") === null) {\n            server = import.meta.env.VITE_MATRIX_SERVER_URL;\n        } else {\n            server = window.localStorage.getItem(\"server\");\n        }\n\n\n        // TODO user id and token if logged in instead of new guest all the time\n        if (!server) {\n            throw new Error(\"No matrix server URL defined\");\n        }\n\n        let guest_client;\n        if (window.localStorage.getItem(\"mxid_guest\") !== null) {\n            const mxid = window.localStorage.getItem(\"mxid_guest\") ?? undefined;\n            const token = window.localStorage.getItem(\"access_token_guest\") ?? undefined;\n            const device_id = window.localStorage.getItem(\"device_id_guest\") ?? undefined;\n\n            guest_client = createClient({\n                useAuthorizationHeader: true,\n                baseUrl: server,\n                userId: mxid,\n                accessToken: token,\n                deviceId: device_id,\n                // @ts-ignore - The function currently comes with incorrect types\n                store: new IndexedDBStore({\n                    indexedDB: window.indexedDB,\n                    dbName: \"matrix-art-sync:guest\",\n                    localStorage: window.localStorage,\n                    workerFactory: () => new IndexedDBWorker(),\n                }),\n                cryptoStore: new IndexedDBCryptoStore(\n                    window.indexedDB, \"matrix-art:crypto\",\n                ),\n            });\n            guest_client.setGuest(true);\n        } {\n\n            const tmpClient = createClient({ baseUrl: import.meta.env.VITE_MATRIX_SERVER_URL });\n            // @ts-ignore - The function currently comes with incorrect types\n            const { user_id, device_id, access_token } = await tmpClient.registerGuest();\n\n            guest_client = createClient({\n                useAuthorizationHeader: true,\n                baseUrl: server,\n                userId: user_id,\n                accessToken: access_token,\n                deviceId: device_id,\n                // @ts-ignore - The function currently comes with incorrect types\n                store: new IndexedDBStore({\n                    indexedDB: window.indexedDB,\n                    dbName: \"matrix-art-sync:guest\",\n                    localStorage: window.localStorage,\n                    workerFactory: () => new IndexedDBWorker(),\n                }),\n                cryptoStore: new IndexedDBCryptoStore(\n                    window.indexedDB, \"matrix-art:crypto\",\n                ),\n            });\n            guest_client.setGuest(true);\n            window.localStorage.setItem(\"mxid_guest\", user_id);\n            window.localStorage.setItem(\"access_token_guest\", access_token);\n            window.localStorage.setItem(\"device_id_guest\", device_id);\n            window.localStorage.setItem(\"server\", server);\n        }\n\n        let client;\n        if (window.localStorage.getItem(\"mxid\") !== null) {\n            const mxid = window.localStorage.getItem(\"mxid\") ?? undefined;\n            const token = window.localStorage.getItem(\"access_token\") ?? undefined;\n            const device_id = window.localStorage.getItem(\"device_id\") ?? undefined;\n\n            client = createClient({\n                useAuthorizationHeader: true,\n                baseUrl: server,\n                userId: mxid,\n                accessToken: token,\n                deviceId: device_id,\n                // @ts-ignore - The function currently comes with incorrect types\n                store: new IndexedDBStore({\n                    indexedDB: window.indexedDB,\n                    dbName: \"matrix-art-sync:guest\",\n                    localStorage: window.localStorage,\n                    workerFactory: () => new IndexedDBWorker(),\n                }),\n                cryptoStore: new IndexedDBCryptoStore(\n                    window.indexedDB, \"matrix-art:crypto\",\n                ),\n            });\n            client.setGuest(false);\n        }\n\n        return new MatrixClient(client ?? guest_client);\n    }\n\n    public isLoggedIn(): boolean {\n        return this.client.isLoggedIn() && !this.client.isGuest();\n    }\n\n    public async start(): Promise<void> {\n        //TODO Setup handlers\n        this.client.on(MatrixEventEvent.Decrypted, (event: MatrixEvent, _err?: Error) => {\n            const ext_ev = event.unstableExtensibleEvent;\n            if (ext_ev?.isEquivalentTo(M_IMAGE)) {\n                this.events.push(event);\n            }\n        });\n\n        console.log(\"start\");\n        await this.client.store.startup();\n        await this.client.initCrypto();\n        await this.client.startClient();\n\n        // Load the root\n        const room = await this.client.joinRoom(import.meta.env.VITE_MATRIX_ROOT_FOLDER);\n        // FIXME: This will break if the server is slower\n        await delay(1000);\n        this.rootDirectory = new MSC3089TreeSpace(this.client, room.roomId);\n        console.log(\"started\");\n    }\n\n    public async register(homeserver: string = import.meta.env.VITE_MATRIX_SERVER_URL, username: string, password: string, createProfile = false) {\n        this.client.stopClient();\n        this.client = createClient({\n            useAuthorizationHeader: true,\n            baseUrl: homeserver,\n            userId: username,\n            deviceId: \"Matrix Art\",\n            // @ts-ignore - The function currently comes with incorrect types\n            store: new IndexedDBStore({\n                indexedDB: window.indexedDB,\n                dbName: \"matrix-art-sync:loggedin\",\n                localStorage: window.localStorage,\n                workerFactory: () => new IndexedDBWorker(),\n            }),\n            cryptoStore: new IndexedDBCryptoStore(\n                window.indexedDB, \"matrix-art:crypto\",\n            ),\n        });\n\n        await this.client.register(username, password, null, { type: \"m.login.dummy\" });\n\n        window.localStorage.setItem(\"server\", homeserver);\n        window.localStorage.setItem(\"mxid\", username);\n        window.localStorage.setItem(\"access_token\", this.client.getAccessToken() ?? \"unknown\");\n        window.localStorage.setItem(\"device_id\", \"Matrix Art\");\n        await this.start();\n        if (createProfile) {\n            const subdirs = this.rootDirectory?.getDirectories();\n            const id = this.client.getUserId()?.replace(\":\", \"_\");\n            if (subdirs?.some((directory) => directory.room.name === id)) {\n                this.rootDirectory = subdirs?.find((directory) => directory.room.name === id);\n            } else {\n                await this.createProfileFolder();\n            }\n        }\n    }\n\n    // Login and create the profile if wanted\n    public async login(homeserver: string, username: string, password: string, createProfile = false): Promise<void> {\n        this.client.stopClient();\n        this.client = createClient({\n            useAuthorizationHeader: true,\n            baseUrl: homeserver,\n            userId: username,\n            deviceId: \"Matrix Art\",\n            // @ts-ignore - The function currently comes with incorrect types\n            store: new IndexedDBStore({\n                indexedDB: window.indexedDB,\n                dbName: \"matrix-art-sync:loggedin\",\n                localStorage: window.localStorage,\n                workerFactory: () => new IndexedDBWorker(),\n            }),\n            cryptoStore: new IndexedDBCryptoStore(\n                window.indexedDB, \"matrix-art:crypto\",\n            ),\n        });\n        await this.client.loginWithPassword(username, password);\n\n        window.localStorage.setItem(\"server\", homeserver);\n        window.localStorage.setItem(\"mxid\", username);\n        window.localStorage.setItem(\"access_token\", this.client.getAccessToken() ?? \"unknown\");\n        window.localStorage.setItem(\"device_id\", \"Matrix Art\");\n        await this.start();\n        if (createProfile) {\n            const subdirs = this.rootDirectory?.getDirectories();\n            console.log(subdirs);\n            const id = this.client.getUserId()?.replace(\":\", \"_\");\n            if (subdirs?.some((directory) => directory.room.name === id)) {\n                this.rootDirectory = subdirs?.find((directory) => directory.room.name === id);\n            } else {\n                await this.createProfileFolder();\n            }\n        }\n    }\n\n    // creates the profile\n    private async createProfileFolder() {\n        if (this.client.isGuest()) {\n            throw new Error(\"Cannot create a file tree space as a guest\");\n        }\n        // Load the root as client changed\n        const room = await this.client.joinRoom(import.meta.env.VITE_MATRIX_ROOT_FOLDER);\n        await delay(1000);\n        this.rootDirectory = new MSC3089TreeSpace(this.client, room.roomId);\n        // Create the user folder and add it to the top folder\n        const id = this.client.getUserId()?.replace(\":\", \"_\");\n        this.currentUserDirectory = await this.createPublicSubDirectory(this.rootDirectory, id ?? \"unknown\");\n        // Create the public timeline for the user. We dont need it saved as we can get it again later using the users dir.\n        await this.createPublicSubDirectory(this.currentUserDirectory, \"Timeline\");\n    }\n\n    /**\n     * Creates a new file tree space with the given name. The client will pick\n     * defaults for how it expects to be able to support the remaining API offered\n     * by the returned class.\n     *\n     * Note that this is UNSTABLE and may have breaking changes without notice.\n     * @param {string} name The name of the tree space.\n     * @returns {Promise<MSC3089TreeSpace>} Resolves to the created space.\n     * \n     * This is taken from https://github.com/matrix-org/matrix-js-sdk/blob/d6f1c6cfdc5a4f3d7b4ec67fe9f4d89d7319d8f7/src/client.ts#L8776\n     * License of the original file: Apache-2.0\n     */\n    public async createPublicFileTree(name: string): Promise<MSC3089TreeSpace> {\n        if (this.client.isGuest()) {\n            throw new Error(\"Cannot create a file tree space as a guest\");\n        }\n        const { room_id: roomId } = await this.client.createRoom({\n            name: name,\n            preset: Preset.PublicChat,\n            power_level_content_override: {\n                ...DEFAULT_TREE_POWER_LEVELS_TEMPLATE,\n                users: {\n                    // We want to be able to moderate this as the instance admin for legal reasons\n                    [import.meta.env.VITE_MATRIX_INSTANCE_ADMIN]: 100,\n                    // We initially need to use 100 to be able to create the room...\n                    [this.client.getUserId() ?? \"broken\"]: 100,\n                },\n            },\n            invite: [\n                import.meta.env.VITE_MATRIX_INSTANCE_ADMIN,\n            ],\n            creation_content: {\n                [RoomCreateTypeField]: RoomType.Space,\n            },\n            initial_state: [\n                {\n                    type: UNSTABLE_MSC3088_PURPOSE.name,\n                    state_key: UNSTABLE_MSC3089_TREE_SUBTYPE.name,\n                    content: {\n                        [UNSTABLE_MSC3088_ENABLED.name]: true,\n                    },\n                },\n                {\n                    type: EventType.RoomEncryption,\n                    state_key: \"\",\n                    content: {\n                        algorithm: MEGOLM_ALGORITHM,\n                    },\n                },\n                {\n                    type: EventType.RoomGuestAccess,\n                    state_key: \"\",\n                    content: {\n                        guest_access: \"can_join\",\n                    },\n                },\n                {\n                    type: EventType.RoomHistoryVisibility,\n                    state_key: \"\",\n                    content: {\n                        history_visibility: \"world_readable\",\n                    },\n                }\n            ],\n        });\n        // Demote ourself\n        const room = this.client.getRoom(roomId);\n        const powerLevelEvent = room?.getLiveTimeline().getState(EventTimeline.FORWARDS)?.getStateEvents(EventType.RoomPowerLevels, \"\");\n        if (!powerLevelEvent) {\n            throw new Error(\"Failed to find PL event\");\n        }\n        await this.client.setPowerLevel(roomId, this.client.getUserId() ?? \"unknown\", 50, powerLevelEvent);\n        return new MSC3089TreeSpace(this.client, roomId);\n    }\n\n    /**\n     * Creates a directory under this tree space, represented as another tree space.\n     * @param {string} name The name for the directory.\n     * @returns {Promise<MSC3089TreeSpace>} Resolves to the created directory.\n     * \n     * This is taken from https://github.com/matrix-org/matrix-js-sdk/blob/feb83ba161c32c0519613b88027f573e22efa3aa/src/models/MSC3089TreeSpace.ts#L226\n     * License of the original file: Apache-2.0\n     */\n    public async createPublicSubDirectory(topdirectory: MSC3089TreeSpace, name: string): Promise<MSC3089TreeSpace> {\n        const directory = await this.createPublicFileTree(name);\n\n        await this.client.sendStateEvent(topdirectory.roomId, EventType.SpaceChild, {\n            via: [this.client.getDomain()],\n        }, directory.roomId);\n\n        await this.client.sendStateEvent(directory.roomId, EventType.SpaceParent, {\n            via: [this.client.getDomain()],\n        }, topdirectory.roomId);\n\n        return directory;\n    }\n}\n\n/* Technical folder layout (https://github.com/matrix-org/matrix-spec-proposals/blob/travis/msc/trees/proposals/3089-file-tree-structures.md)\nIdea by TravisR\n\nNote that every user can create a user folder or delete themself from it again.\nEvery user owns their own user folder.\n\nIf possible users shall never remove relations to other users folders.\n\n+ πŸ“‚ Matrix Art User Dir (public, m.space)\n    + πŸ“‚ User A (public, m.space)\n        + πŸ“‚ Timeline (m.space)\n            - πŸ“„ Image A\n            = Room A (invite protected, <no type>)\n                - πŸ“„ Image B (counted as under the timeline)\n    + πŸ“‚ User B (public, m.space)\n        + πŸ“‚ Timeline (m.space)\n            - πŸ“„ Image C\n            = Room B (invite protected, <no type>)\n                - πŸ“„ Image D (counted as under the timeline)\n*/\n\nfunction delay(time: number): Promise<void> {\n    return new Promise(resolve => setTimeout(resolve, time));\n}","import { lazy, useEffect, Suspense, useState } from 'react';\nimport { Home } from './pages/Home';\nimport { Client } from './context';\nimport { Header } from './components/header';\nimport { MatrixClient } from './matrix/client';\n\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport olmWasmPath from \"@matrix-org/olm/olm.wasm?url\";\nimport OlmLegacy from '@matrix-org/olm/olm_legacy.js?url';\nimport Olm from '@matrix-org/olm';\nimport { Route, Routes } from 'react-router-dom';\nimport { useTranslation } from 'react-i18next';\n\nconst Join = lazy(() => import(\"./pages/Join\"));\nconst Post = lazy(() => import(\"./pages/Post\"));\nconst Profile = lazy(() => import(\"./pages/Profile\"));\n\n\nconst loadOlm = (): Promise<void> => {\n  /* Load Olm. We try the WebAssembly version first, and then the legacy */\n  return Olm.init({\n    locateFile: () => olmWasmPath,\n  }).then(() => {\n    console.log(\"Using WebAssembly Olm\");\n  }).catch((error) => {\n    console.log(\"Failed to load Olm: trying legacy version\", error);\n    return new Promise((resolve, reject) => {\n      const s = document.createElement('script');\n      s.src = OlmLegacy; // XXX: This should be cache-busted too\n      s.addEventListener('load', resolve);\n      s.addEventListener('error', reject);\n      document.body.append(s);\n    }).then(() => {\n      // Init window.Olm, ie. the one just loaded by the script tag,\n      // not 'Olm' which is still the failed wasm version.\n      return window.Olm.init();\n    }).then(() => {\n      console.log(\"Using legacy Olm\");\n    }).catch((error) => {\n      console.log(\"Both WebAssembly and asm.js Olm failed!\", error);\n    });\n  });\n};\n\n\nexport function App() {\n  // eslint-disable-next-line unicorn/no-useless-undefined\n  const [client, setClient] = useState<MatrixClient | undefined>(undefined);\n\n  const loadMatrixClient = async () => {\n    const client = await MatrixClient.new();\n    setClient(client);\n    console.log(\"Client loaded\");\n    await client?.start();\n    console.log(\"Client started\");\n  }\n\n  useEffect(() => {\n    async function loadMatrix() {\n      try {\n        await loadOlm();\n        console.log(\"Olm loaded\");\n      } catch {\n        console.log(\"Olm not loaded\");\n      }\n      await loadMatrixClient();\n    }\n\n    if (client == undefined) {\n      loadMatrix();\n    }\n  }, []);\n\n  return (\n    <Client.Provider value={\n      client\n    }>\n      <Routes>\n        <Route path=\"/\" element={<Home />} />\n        <Route path=\"join\" element={\n          <Suspense fallback={<LoadingPage />}>\n            <Join />\n          </Suspense>\n        } />\n        <Route path=\"/post/:postId\" element={\n          <Suspense fallback={<LoadingPage />}>\n            <Post />\n          </Suspense>\n        } />\n        <Route path=\"/profile/:userId\" element={\n          <Suspense fallback={<LoadingPage />}>\n            <Profile />\n          </Suspense>\n        } />\n      </Routes>\n    </Client.Provider >\n  );\n}\n\nfunction LoadingPage() {\n  const { t } = useTranslation();\n\n  return (\n    <div className=\"flex flex-col\">\n      <header>\n        <Header />\n      </header>\n      <main className=\"m-12 mt-6 flex items-center justify-center\">\n        <p className=\"text-lg text-data font-bold\">{t('Loading…')}</p>\n      </main>\n    </div>\n  );\n}","import i18n from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nimport Backend from 'i18next-http-backend';\nimport LanguageDetector from 'i18next-browser-languagedetector';\n\n// don't want to use this?\n// have a look at the Quick start guide \n// for passing in lng and translations on init\n\ni18n\n    // load translation using http -> see /public/locales (i.e. https://github.com/i18next/react-i18next/tree/master/example/react/public/locales)\n    // learn more: https://github.com/i18next/i18next-http-backend\n    // want your translations to be loaded from a professional CDN? => https://github.com/locize/react-tutorial#step-2---use-the-locize-cdn\n    .use(Backend)\n    // detect user language\n    // learn more: https://github.com/i18next/i18next-browser-languageDetector\n    .use(LanguageDetector)\n    // pass the i18n instance to react-i18next.\n    .use(initReactI18next)\n    // init i18next\n    // for all options read: https://www.i18next.com/overview/configuration-options\n    .init({\n        fallbackLng: 'en',\n        debug: true,\n\n        interpolation: {\n            escapeValue: false, // not needed for react as it escapes by default\n        }\n    });\n\nexport { default } from 'i18next';","import React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { BrowserRouter } from 'react-router-dom';\nimport { App } from './app';\nimport './index.css';\nimport './i18n';\n\n\nReactDOM.createRoot(document.querySelector('#app') as HTMLElement).render(\n    <React.StrictMode>\n        <BrowserRouter basename={`${import.meta.env.BASE_URL}`}>\n            <App />\n        </BrowserRouter>\n    </React.StrictMode>,\n);"],"names":["Client","createContext","logo_url","Header","client","useContext","useTranslation","jsxs","jsx","Link","createResource","asyncFn","status","result","promise","r","error","cache","loadImage","source","resource","resolve","reject","img","SuspenseImage","props","Post","user","post","Suspense","BounceLoader","UserData","mxid","display_name","avatar_url","__publicField","PostData","event_id","content","BREAKPOINTS","Home","t","Plock","M_IMAGE","UnstableValue","M_FILE","M_THUMBNAIL","M_BLURHASH","MATRIX_ART_DESCRIPTION","NamespacedValue","MATRIX_ART_TAGS","MATRIX_ART_NSFW","MATRIX_ART_LICENSE","ImageEvent","ExtensibleEvent","wireFormat","mimage","mtext","M_TEXT","mfile","mthumbnail","mblurhash","matrixart_description","matrixart_tags","matrixart_nsfw","matrixart_license","isProvided","InvalidEventError","isOptionalAString","primaryEventType","isEventTypeSame","parseImageEvent","wireEvent","event","ExtensibleEvents","MatrixClient","server","guest_client","token","device_id","createClient","IndexedDBStore","IndexedDBWorker","IndexedDBCryptoStore","tmpClient","user_id","access_token","MatrixEventEvent","_err","ext_ev","room","delay","MSC3089TreeSpace","homeserver","username","password","createProfile","subdirs","_a","id","_b","directory","name","roomId","Preset","DEFAULT_TREE_POWER_LEVELS_TEMPLATE","RoomCreateTypeField","RoomType","UNSTABLE_MSC3088_PURPOSE","UNSTABLE_MSC3089_TREE_SUBTYPE","UNSTABLE_MSC3088_ENABLED","EventType","MEGOLM_ALGORITHM","powerLevelEvent","EventTimeline","topdirectory","time","Join","lazy","__vitePreload","Profile","loadOlm","Olm","olmWasmPath","OlmLegacy","App","setClient","useState","loadMatrixClient","useEffect","loadMatrix","Routes","Route","LoadingPage","i18n","Backend","LanguageDetector","initReactI18next","ReactDOM","React","BrowserRouter"],"mappings":"+vDAGaA,EAASC,gBAAwC,MAAS,ECHxDC,GAAA,2CCMR,SAASC,GAAS,CACf,MAAAC,EAASC,aAAWL,CAAM,EAC1B,CAAE,GAAMM,IAGV,OAAAC,EAAA,KAAC,MAAI,CAAA,UAAU,8DACX,SAAA,CAACC,EAAAA,IAAAC,EAAA,CAAK,GAAG,IAAI,SAAAD,EAAA,IAAC,OAAI,IAAI,aAAa,IAAKN,EAAA,CAAU,CAAE,CAAA,EACpDK,EAAAA,KAAC,MAAI,CAAA,UAAU,sDACX,SAAA,CAACA,EAAAA,KAAA,MAAA,CAAI,UAAU,+GACX,SAAA,CAAAC,MAAC,MAAI,CAAA,UAAU,gBACX,SAAAD,EAAA,KAAC,OAAI,MAAM,6BAA6B,OAAO,OAAO,QA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