commit 5eb1c039a30cf0694dec765305b00affeb0a5e40
parent 34f5e033a44ac04388cd84bfecfbe6585de0dd41
Author: MTRNord <MTRNord@users.noreply.github.com>
Date: Mon, 18 Apr 2022 21:35:45 +0000
deploy: MTRNord/matrix-art@4c118ce05f9f9409ae594afbd6d55245ec755c92
Diffstat:
5 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/pr-121/assets/Join.00e6b69a.js b/pr-121/assets/Join.00e6b69a.js
@@ -1 +0,0 @@
-import{E as h,$ as u}from"./vendor.d127a5c1.js";import{j as r,a as t,H as g,C as p}from"./index.afea57c7.js";const l="inline-block p-4 w-full text-gray-900 bg-gray-100 hover:ring-blue-300 hover:ring-1 focus:ring-transparent focus:outline-none dark:bg-gray-700 dark:text-white",d="inline-block p-4 w-full bg-white hover:text-gray-700 hover:bg-gray-50 hover:ring-blue-300 hover:ring-1 focus:ring-transparent focus:outline-none dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700";class f extends h{constructor(){super();this.state={homeserver:"https://art.midnightthoughts.space",username:"",password:"",create_profile:!0,current_tab:"login"}}async onSubmit(s){s.preventDefault();const e=this.context;!e||this.state.homeserver===""||this.state.username===""||this.state.password===""||(this.state.current_tab==="login"&&!(e!=null&&e.isLoggedIn())?await e.login(this.state.homeserver,this.state.username,this.state.password,this.state.create_profile):this.state.current_tab==="register"&&!e.isLoggedIn()&&await e.register(this.state.homeserver,this.state.username,this.state.password,this.state.create_profile),u("/",!0))}onInput(s){s.preventDefault();const e=s.target,n=e.type==="checkbox"?e.checked:e.value,a=e.name;this.setState({[a]:n})}render(s,{homeserver:e,username:n,password:a,create_profile:c,current_tab:o}){return r("div",{class:"flex flex-col",children:[t("header",{children:t(g,{})}),r("main",{class:"m-12 mt-6",children:[t("h1",{class:"text-3xl font-bold mb-4 text-white",children:"Join"}),r("div",{class:"flex items-center flex-col",children:[r("ul",{class:"w-1/4 mb-8 hidden text-sm font-medium text-center text-gray-500 rounded-lg divide-x divide-gray-200 shadow sm:flex dark:divide-gray-700 dark:text-gray-400",children:[t("li",{class:"w-full",children:t("a",{href:"#",class:o==="login"?`${l} rounded-l-lg`:`${d} rounded-l-lg`,onClick:i=>{i.preventDefault(),this.setState({current_tab:"login"})},children:"Login"})}),t("li",{class:"w-full",children:t("a",{href:"#",class:o==="register"?`${l} rounded-r-lg`:`${d} rounded-r-lg`,onClick:i=>{i.preventDefault(),this.setState({current_tab:"register"})},children:"Register"})})]}),r("form",{onSubmit:this.onSubmit.bind(this),class:"flex flex-col items-start w-1/4",children:[t("input",{class:"search-bg shadow rounded-lg border-0 py-3 px-4 placeholder-data text-white mb-4 w-full",type:"url",placeholder:"Homeserver",name:"homeserver",value:e,onInput:this.onInput.bind(this)}),t("input",{class:"search-bg shadow rounded-lg border-0 py-3 px-4 placeholder-data text-white mb-4 w-full",autocomplete:"username",type:"text",placeholder:"Username",name:"username",value:n,onInput:this.onInput.bind(this)}),t("input",{class:"search-bg shadow rounded-lg border-0 py-3 px-4 placeholder-data text-white mb-4 w-full",autoComplete:"current-password",type:"password",placeholder:"Password",name:"password",value:a,onInput:this.onInput.bind(this)}),r("label",{class:"mb-4 flex items-center",children:[t("input",{class:"checked:bg-blue-600 checked:border-transparent checked:bg-no-repeat checked:bg-[url('/tick.svg')] outline-none focus:outline-offset-2 focus:ring-blue-600 focus:ring-offset-2 focus:ring-offset-white p-0 inline-block align-middle box-border select-none shrink-0 shadow h-5 w-5 appearance-none rounded bg-white border-none",type:"checkbox",name:"create_profile",checked:c,onInput:this.onInput.bind(this)}),t("span",{class:"ml-4 text-data text-base font-medium",children:"Create account"})]}),t("button",{type:"submit",class:"text-white font-bold text-lg logo-bg rounded-xl py-2 px-10 shadow transform transition-transform ease-in-out duration-300 hover:scale-105 w-1/2 self-center",children:o==="login"?"Login":"Register"})]})]})]})]})}}f.contextType=p;export{f as default};
diff --git a/pr-121/assets/Join.8bb5ecdb.js b/pr-121/assets/Join.8bb5ecdb.js
@@ -0,0 +1 @@
+import{E as h,$ as u}from"./vendor.d127a5c1.js";import{j as r,a as t,H as g,C as p}from"./index.27812ca8.js";const l="inline-block p-4 w-full text-gray-900 bg-gray-100 hover:ring-blue-300 hover:ring-1 focus:ring-transparent focus:outline-none dark:bg-gray-700 dark:text-white",d="inline-block p-4 w-full bg-white hover:text-gray-700 hover:bg-gray-50 hover:ring-blue-300 hover:ring-1 focus:ring-transparent focus:outline-none dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700";class f extends h{constructor(){super();this.state={homeserver:"https://art.midnightthoughts.space",username:"",password:"",create_profile:!0,current_tab:"login"}}async onSubmit(s){s.preventDefault();const e=this.context;!e||this.state.homeserver===""||this.state.username===""||this.state.password===""||(this.state.current_tab==="login"&&!(e!=null&&e.isLoggedIn())?await e.login(this.state.homeserver,this.state.username,this.state.password,this.state.create_profile):this.state.current_tab==="register"&&!e.isLoggedIn()&&await e.register(this.state.homeserver,this.state.username,this.state.password,this.state.create_profile),u("/",!0))}onInput(s){s.preventDefault();const e=s.target,n=e.type==="checkbox"?e.checked:e.value,a=e.name;this.setState({[a]:n})}render(s,{homeserver:e,username:n,password:a,create_profile:c,current_tab:o}){return r("div",{class:"flex flex-col",children:[t("header",{children:t(g,{})}),r("main",{class:"m-12 mt-6",children:[t("h1",{class:"text-3xl font-bold mb-4 text-white",children:"Join"}),r("div",{class:"flex items-center flex-col",children:[r("ul",{class:"w-1/4 mb-8 hidden text-sm font-medium text-center text-gray-500 rounded-lg divide-x divide-gray-200 shadow sm:flex dark:divide-gray-700 dark:text-gray-400",children:[t("li",{class:"w-full",children:t("a",{href:"#",class:o==="login"?`${l} rounded-l-lg`:`${d} rounded-l-lg`,onClick:i=>{i.preventDefault(),this.setState({current_tab:"login"})},children:"Login"})}),t("li",{class:"w-full",children:t("a",{href:"#",class:o==="register"?`${l} rounded-r-lg`:`${d} rounded-r-lg`,onClick:i=>{i.preventDefault(),this.setState({current_tab:"register"})},children:"Register"})})]}),r("form",{onSubmit:this.onSubmit.bind(this),class:"flex flex-col items-start w-1/4",children:[t("input",{class:"search-bg shadow rounded-lg border-0 py-3 px-4 placeholder-data text-white mb-4 w-full",type:"url",placeholder:"Homeserver",name:"homeserver",value:e,onInput:this.onInput.bind(this)}),t("input",{class:"search-bg shadow rounded-lg border-0 py-3 px-4 placeholder-data text-white mb-4 w-full",autocomplete:"username",type:"text",placeholder:"Username",name:"username",value:n,onInput:this.onInput.bind(this)}),t("input",{class:"search-bg shadow rounded-lg border-0 py-3 px-4 placeholder-data text-white mb-4 w-full",autoComplete:"current-password",type:"password",placeholder:"Password",name:"password",value:a,onInput:this.onInput.bind(this)}),r("label",{class:"mb-4 flex items-center",children:[t("input",{class:"checked:bg-blue-600 checked:border-transparent checked:bg-no-repeat checked:bg-[url('/tick.svg')] outline-none focus:outline-offset-2 focus:ring-blue-600 focus:ring-offset-2 focus:ring-offset-white p-0 inline-block align-middle box-border select-none shrink-0 shadow h-5 w-5 appearance-none rounded bg-white border-none",type:"checkbox",name:"create_profile",checked:c,onInput:this.onInput.bind(this)}),t("span",{class:"ml-4 text-data text-base font-medium",children:"Create account"})]}),t("button",{type:"submit",class:"text-white font-bold text-lg logo-bg rounded-xl py-2 px-10 shadow transform transition-transform ease-in-out duration-300 hover:scale-105 w-1/2 self-center",children:o==="login"?"Login":"Register"})]})]})]})]})}}f.contextType=p;export{f as default};
diff --git a/pr-121/assets/index.27812ca8.js b/pr-121/assets/index.27812ca8.js
@@ -0,0 +1 @@
+var U=Object.defineProperty,R=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var b=(a,e,t)=>e in a?U(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,P=(a,e)=>{for(var t in e||(e={}))G.call(e,t)&&b(a,t,e[t]);if(B)for(var t of B(e))X.call(e,t)&&b(a,t,e[t]);return a},j=(a,e)=>R(a,W(e));var d=(a,e,t)=>(b(a,typeof e!="symbol"?e+"":e,t),t);import{D as Q,j as V,a as Y,E as _,b as I,P as J,F as Z,L as $,c as q,l,d as s,W as M,M as E,e as K,f as ee,O as te,o as ne,g as ie,S as oe}from"./vendor.d127a5c1.js";const re=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const r of c.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function t(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerpolicy&&(c.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?c.credentials="include":o.crossorigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function n(o){if(o.ep)return;o.ep=!0;const c=t(o);fetch(o.href,c)}};re();const se="modulepreload",H={},ae="/pr-121/",le=function(e,t){return!t||t.length===0?e():Promise.all(t.map(n=>{if(n=`${ae}${n}`,n in H)return;H[n]=!0;const o=n.endsWith(".css"),c=o?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${n}"]${c}`))return;const r=document.createElement("link");if(r.rel=o?"stylesheet":se,o||(r.as="script",r.crossOrigin=""),r.href=n,document.head.appendChild(r),o)return new Promise((w,m)=>{r.addEventListener("load",w),r.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>e())},F=Q(void 0),i=V,h=Y;class A extends _{render(){const e=this.context;return h("div",{class:"m-12 flex flex-col lg:flex-row items-center justify-between",children:[i(I,{href:"/",children:i("img",{alt:"Matrix Art",src:"Logo_colored.svg",class:"ease-in-out hover:scale-105 trandform transition-transform duration-300"})}),h("div",{class:"flex items-center mt-8 lg:mt-0 flex-col sm:flex-row",children:[h("div",{class:"flex items-center justify-between w-80 max-w-80 mx-6 ease-in-out hover:scale-105 trandform transition-transform duration-300",children:[i("div",{class:"absolute ml-4",children:h("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#AAB3CF",children:[i("path",{d:"M0 0h24v24H0V0z",fill:"none"}),i("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"})]})}),i("input",{class:"search-bg shadow rounded-2xl border-0 py-3 px-4 pl-10 text-data",placeholder:"Search"})]}),e!=null&&e.isLoggedIn()?i(I,{class:"text-white font-bold text-1xl logo-bg rounded-2xl py-3 px-12 shadow mt-4 sm:mt-0 transform transition-transform ease-in-out duration-300 hover:scale-105",children:"Post"}):i(I,{href:"/join",class:"text-white font-bold text-1xl logo-bg rounded-2xl py-3 px-12 shadow mt-4 sm:mt-0 transform transition-transform ease-in-out duration-300 hover:scale-105",children:"Join"})]})]})}}A.contextType=F;class p extends _{constructor(e){super(e)}render({user:e,post:t}){return h("div",{class:"flex flex-col",children:[i("a",{id:"gallery_click",href:t.content.file.url,class:"w-full",target:"_blank",rel:"noreferrer",children:i("img",{decoding:"async",loading:"lazy",class:"rounded-3xl shadow object-cover transform transition-transform ease-in-out duration-300 hover:scale-105",src:t.content.file.url})}),h("div",{class:"flex items-center justify-between py-4",children:[h("a",{class:"flex items-center",href:"#",children:[i("img",{class:"w-11 h-11 rounded-full mr-4 border-2 border-[#AAB3CF]",src:e.avatar_url}),i("p",{class:"text-data shadow text-lg font-medium",children:e.display_name})]}),h("div",{class:"flex text-data text-lg items-center",children:[h("a",{class:"mr-4 flex items-center",href:"#",children:[i("span",{class:"mr-2",children:h("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#AAB3CF",children:[i("path",{d:"M0 0h24v24H0V0z",fill:"none"}),i("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"})]})}),i("span",{children:"5"})]}),h("a",{class:"flex items-center",href:"#",children:[i("span",{class:"mr-2",children:h("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#AAB3CF",children:[i("path",{d:"M0 0h24v24H0V0z",fill:"none"}),i("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"})]})}),i("span",{children:"11"})]})]})]})]})}}class y{constructor(e,t,n){d(this,"mxid");d(this,"display_name");d(this,"avatar_url");this.mxid=e,this.display_name=t,this.avatar_url=n}}class v{constructor(e,t){d(this,"event_id");d(this,"content");this.event_id=e,this.content=t}}class ce extends _{constructor(){super();this.state={columns:this.settingColumns()}}settingColumns(){return window.innerWidth>=1400?4:window.innerWidth>=800?3:window.innerWidth>=500?2:1}componentDidMount(){window.addEventListener("resize",()=>this.setState({columns:this.settingColumns()}))}componentWillUnmount(){window.removeEventListener("resize",()=>this.setState({columns:this.settingColumns()}))}render(){return h("div",{class:"flex flex-col",children:[i("header",{children:i(A,{})}),h("main",{class:"m-12 mt-6",children:[i("h1",{class:"text-3xl font-bold mb-4 text-white",children:"Explore"}),i("div",{class:"flex justify-center",id:"gallery",children:h(J,{gap:24,nColumns:this.state.columns,children:[i(p,{user:new y("","Person A","https://unsplash.com/photos/_cvwXhGqG-o/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8OHx8ZmFjZXxlbnwwfDJ8fHwxNjQ4Nzc5NzYx"),post:new v("",{file:{url:"https://unsplash.com/photos/UWmrTAQ75iA/download?ixid=MnwxMjA3fDB8MXxhbGx8Mnx8fHx8fDJ8fDE2NDg4MzI0Njg"}})}),i(p,{user:new y("","Person B","https://unsplash.com/photos/uJ8LNVCBjFQ/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MTN8fGZhY2V8ZW58MHwyfHx8MTY0ODc3OTc2MQ"),post:new v("",{file:{url:"https://unsplash.com/photos/7ptbiEPxKMQ/download?ixid=MnwxMjA3fDB8MXxhbGx8OXx8fHx8fDJ8fDE2NDg4MzI0Njg"}})}),i(p,{user:new y("","Person C","https://unsplash.com/photos/u3pi6HhSYew/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MTd8fGZhY2V8ZW58MHwyfHx8MTY0ODc3OTc2MQ"),post:new v("",{file:{url:"https://unsplash.com/photos/ZiPlVmmKEYA/download?ixid=MnwxMjA3fDB8MXxhbGx8Mzl8fHx8fHwyfHwxNjQ4ODM2MDIz"}})}),i(p,{user:new y("","Person D","https://unsplash.com/photos/TW_z_iUD_bQ/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8ODR8fHBvcnRyYWl0fGVufDB8Mnx8fDE2NDg4NDQ3MjQ"),post:new v("",{file:{url:"https://unsplash.com/photos/FTQJBGDxKXg/download?ixid=MnwxMjA3fDB8MXxhbGx8M3x8fHx8fDJ8fDE2NDg4NDMyNDY"}})}),i(p,{user:new y("","Person E","https://unsplash.com/photos/kYtN89E5ce4/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MTA0fHxwb3J0cmFpdHxlbnwwfDJ8fHwxNjQ4ODQ0NzQy"),post:new v("",{file:{url:"https://unsplash.com/photos/zfhxiaZO3JE/download?ixid=MnwxMjA3fDB8MXxhbGx8Mjl8fHx8fHwyfHwxNjQ4ODQzMjQ1"}})}),i(p,{user:new y("","Person E","https://unsplash.com/photos/kBonaevi3yA/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MTE5fHxwb3J0cmFpdHxlbnwwfDJ8fHwxNjQ4ODQ0NzQy"),post:new v("",{file:{url:"https://unsplash.com/photos/jm-JKqrAXsA/download?ixid=MnwxMjA3fDB8MXxhbGx8MTAyfHx8fHx8Mnx8MTY0ODg0MzI1NQ"}})})]})})]})]})}}const de=Z(()=>le(()=>import("./Join.8bb5ecdb.js"),["assets/Join.8bb5ecdb.js","assets/vendor.d127a5c1.js"]));class he extends _{render(){return i($,{fallback:h("div",{class:"flex flex-col",children:[i("header",{children:i(A,{})}),i("main",{class:"m-12 mt-6 flex items-center justify-center",children:i("p",{class:"text-lg text-data font-bold",children:"Loading..."})})]}),children:i(F.Provider,{value:window.client,children:h(q,{children:[i(ce,{path:"/pr-121//"}),i(de,{path:"/pr-121//join"})]})})})}}const S=new l.UnstableValue("m.image","org.matrix.msc1767.image"),N=new l.UnstableValue("m.file","org.matrix.msc1767.file"),O=new l.UnstableValue("m.thumbnail","org.matrix.msc1767.thumbnail"),L=new l.UnstableValue("blurhash","xyz.amorgan.blurhash"),me=new l.NamespacedValue("matrixart.description"),we=new l.NamespacedValue("matrixart.tags"),ue=new l.NamespacedValue("matrixart.nsfw"),xe=new l.NamespacedValue("matrixart.license");class fe extends l.ExtensibleEvent{constructor(e){super(e);d(this,"image");d(this,"text");d(this,"thumbnails");d(this,"blurhash");d(this,"file");d(this,"description");d(this,"tags");d(this,"nsfw",!1);d(this,"license");const t=S.findIn(this.wireContent),n=l.M_TEXT.findIn(this.wireContent),o=N.findIn(this.wireContent),c=O.findIn(this.wireContent),r=L.findIn(this.wireContent),w=me.findIn(this.wireContent),m=we.findIn(this.wireContent),x=ue.findIn(this.wireContent),u=xe.findIn(this.wireContent);if(l.isProvided(t)){if(!t)throw new l.InvalidEventError("m.image is required to be present");this.image=t}if(l.isProvided(o)){if(!o)throw new l.InvalidEventError("m.file is required to be present");this.file=o}if(l.isOptionalAString(n)){if(!t)throw new l.InvalidEventError("m.text is required to be present");this.text=n}if(l.isProvided(c)){if(!Array.isArray(c))throw new l.InvalidEventError("m.thumbnail contents must be an array");this.thumbnails=c}if(l.isOptionalAString(r)&&(this.blurhash=r),l.isOptionalAString(w)&&(this.description=w),l.isProvided(m)){if(!Array.isArray(m))throw new l.InvalidEventError("matrixart.tags contents must be an array");this.tags=m}if(l.isProvided(x)){if(typeof x!="boolean")throw new l.InvalidEventError("matrixart.tags contents must be an boolean");this.nsfw=x}l.isOptionalAString(u)&&(this.license=u)}isEquivalentTo(e){return l.isEventTypeSame(e,S)}serialize(){const e={[l.M_TEXT.name]:this.text,[N.name]:this.file,[S.name]:this.image,[O.name]:this.thumbnails,[L.name]:this.blurhash,["matrixart.description"]:this.description,["matrixart.tags"]:this.tags,["matrixart.nsfw"]:this.nsfw,["matrixart.license"]:this.license};return{type:"m.image",content:e}}}function ge(a){const e=a;return new fe(e)}l.ExtensibleEvents.registerInterpreter(S,ge);l.ExtensibleEvents.unknownInterpretOrder.push(S);function D(){return new Worker("/pr-121/assets/indexeddb.worker.0ae1a28d.js",{type:"module"})}class T{constructor(e){d(this,"events",[]);d(this,"currentUserDirectory");d(this,"rootDirectory");this.client=e}static async new(){var o,c,r,w,m,x;global.Olm||console.error("global.Olm does not seem to be present. Did you forget to add olm in the out directory?");let e;if(window.localStorage.getItem("server")!==null?e=window.localStorage.getItem("server"):e="https://matrix.art.midnightthoughts.space",!e)throw new Error("No matrix server URL defined");let t;if(window.localStorage.getItem("mxid_guest")!==null){const u=(o=window.localStorage.getItem("mxid_guest"))!=null?o:void 0,f=(c=window.localStorage.getItem("access_token_guest"))!=null?c:void 0,g=(r=window.localStorage.getItem("device_id_guest"))!=null?r:void 0;t=s.createClient({useAuthorizationHeader:!0,baseUrl:e,userId:u,accessToken:f,deviceId:g,sessionStore:new M(window.localStorage),store:new s.IndexedDBStore({indexedDB:window.indexedDB,dbName:"matrix-art-sync:guest",localStorage:window.localStorage,workerFactory:()=>new D}),cryptoStore:new s.IndexedDBCryptoStore(window.indexedDB,"matrix-art:crypto")}),t.setGuest(!0)}{const u=s.createClient("https://matrix.art.midnightthoughts.space"),{user_id:f,device_id:g,access_token:C}=await u.registerGuest();t=s.createClient({useAuthorizationHeader:!0,baseUrl:e,userId:f,accessToken:C,deviceId:g,sessionStore:new M(window.localStorage),store:new s.IndexedDBStore({indexedDB:window.indexedDB,dbName:"matrix-art-sync:guest",localStorage:window.localStorage,workerFactory:()=>new D}),cryptoStore:new s.IndexedDBCryptoStore(window.indexedDB,"matrix-art:crypto")}),t.setGuest(!0),window.localStorage.setItem("mxid_guest",f),window.localStorage.setItem("access_token_guest",C),window.localStorage.setItem("device_id_guest",g),window.localStorage.setItem("server",e)}let n;if(window.localStorage.getItem("mxid")!==null){const u=(w=window.localStorage.getItem("mxid"))!=null?w:void 0,f=(m=window.localStorage.getItem("access_token"))!=null?m:void 0,g=(x=window.localStorage.getItem("device_id"))!=null?x:void 0;n=s.createClient({useAuthorizationHeader:!0,baseUrl:e,userId:u,accessToken:f,deviceId:g,sessionStore:new M(window.localStorage),store:new s.IndexedDBStore({indexedDB:window.indexedDB,dbName:"matrix-art-sync:guest",localStorage:window.localStorage,workerFactory:()=>new D}),cryptoStore:new s.IndexedDBCryptoStore(window.indexedDB,"matrix-art:crypto")}),n.setGuest(!1)}return new T(n!=null?n:t)}isLoggedIn(){return this.client.isLoggedIn()&&!this.client.isGuest()}async start(){this.client.on(s.MatrixEventEvent.Decrypted,(t,n)=>{const o=t.unstableExtensibleEvent;o!=null&&o.isEquivalentTo(S)&&this.events.push(t)}),console.log("start"),await this.client.store.startup(),await this.client.initCrypto(),await this.client.startClient();const e=await this.client.joinRoom("#Matrix_Art:art.midnightthoughts.space");await z(1e3),this.rootDirectory=new E(this.client,e.roomId),console.log("started")}async register(e="https://matrix.art.midnightthoughts.space",t,n,o=!1){var c;if(this.client.stopClient(),this.client=s.createClient({useAuthorizationHeader:!0,baseUrl:e,userId:t,deviceId:"Matrix Art",sessionStore:new M(window.localStorage),store:new s.IndexedDBStore({indexedDB:window.indexedDB,dbName:"matrix-art-sync:loggedin",localStorage:window.localStorage,workerFactory:()=>new D}),cryptoStore:new s.IndexedDBCryptoStore(window.indexedDB,"matrix-art:crypto")}),await this.client.register(t,n,null,{type:"m.login.dummy"}),window.localStorage.setItem("server",e),window.localStorage.setItem("mxid",t),window.localStorage.setItem("access_token",this.client.getAccessToken()),window.localStorage.setItem("device_id","Matrix Art"),await this.start(),o){const r=(c=this.rootDirectory)==null?void 0:c.getDirectories(),w=this.client.getUserId().replace(":","_");r!=null&&r.some(m=>m.room.name===w)?this.rootDirectory=r==null?void 0:r.find(m=>m.room.name===w):await this.createProfileFolder()}}async login(e,t,n,o=!1){var c;if(this.client.stopClient(),this.client=s.createClient({useAuthorizationHeader:!0,baseUrl:e,userId:t,deviceId:"Matrix Art",sessionStore:new M(window.localStorage),store:new s.IndexedDBStore({indexedDB:window.indexedDB,dbName:"matrix-art-sync:loggedin",localStorage:window.localStorage,workerFactory:()=>new D}),cryptoStore:new s.IndexedDBCryptoStore(window.indexedDB,"matrix-art:crypto")}),await this.client.loginWithPassword(t,n),window.localStorage.setItem("server",e),window.localStorage.setItem("mxid",t),window.localStorage.setItem("access_token",this.client.getAccessToken()),window.localStorage.setItem("device_id","Matrix Art"),await this.start(),o){const r=(c=this.rootDirectory)==null?void 0:c.getDirectories();console.log(r);const w=this.client.getUserId().replace(":","_");r!=null&&r.some(m=>m.room.name===w)?this.rootDirectory=r==null?void 0:r.find(m=>m.room.name===w):await this.createProfileFolder()}}async createProfileFolder(){if(this.client.isGuest())throw new Error("Cannot create a file tree space as a guest");const e=await this.client.joinRoom("#Matrix_Art:art.midnightthoughts.space");await z(1e3),this.rootDirectory=new E(this.client,e.roomId);const t=this.client.getUserId().replace(":","_");this.currentUserDirectory=await this.createPublicSubDirectory(this.rootDirectory,t),await this.createPublicSubDirectory(this.currentUserDirectory,"Timeline")}async createPublicFileTree(e){if(this.client.isGuest())throw new Error("Cannot create a file tree space as a guest");const{room_id:t}=await this.client.createRoom({name:e,preset:s.Preset.PublicChat,power_level_content_override:j(P({},K),{users:{["@administrator:art.midnightthoughts.space"]:100,[this.client.getUserId()]:100}}),invite:["@administrator:art.midnightthoughts.space"],creation_content:{[s.RoomCreateTypeField]:s.RoomType.Space},initial_state:[{type:s.UNSTABLE_MSC3088_PURPOSE.name,state_key:s.UNSTABLE_MSC3089_TREE_SUBTYPE.name,content:{[s.UNSTABLE_MSC3088_ENABLED.name]:!0}},{type:s.EventType.RoomEncryption,state_key:"",content:{algorithm:ee}},{type:s.EventType.RoomGuestAccess,state_key:"",content:{guest_access:"can_join"}},{type:s.EventType.RoomHistoryVisibility,state_key:"",content:{history_visibility:"world_readable"}}]}),n=this.client.getRoom(t),o=n==null?void 0:n.getLiveTimeline().getState(s.EventTimeline.FORWARDS).getStateEvents(s.EventType.RoomPowerLevels,"");if(!o)throw new Error("Failed to find PL event");return await this.client.setPowerLevel(t,this.client.getUserId(),50,o),new E(this.client,t)}async createPublicSubDirectory(e,t){const n=await this.createPublicFileTree(t);return await this.client.sendStateEvent(e.roomId,s.EventType.SpaceChild,{via:[this.client.getDomain()]},n.roomId),await this.client.sendStateEvent(n.roomId,s.EventType.SpaceParent,{via:[this.client.getDomain()]},e.roomId),n}}function z(a){return new Promise(e=>setTimeout(e,a))}function pe(){return te.init({locateFile:()=>ne}).then(()=>{console.log("Using WebAssembly Olm")}).catch(a=>(console.log("Failed to load Olm: trying legacy version",a),new Promise((e,t)=>{const n=document.createElement("script");n.src=ie,n.onload=e,n.onerror=t,document.body.appendChild(n)}).then(()=>window.Olm.init()).then(()=>{console.log("Using legacy Olm")}).catch(e=>{console.log("Both WebAssembly and asm.js Olm failed!",e)})))}function k(){T.new().then(a=>{window.client=a,console.log("Client loaded"),a.start().then(()=>{console.log("Client started"),oe(i(he,{}),document.querySelector("#app"))})})}pe().then(()=>{console.log("Olm loaded"),k()}).catch(()=>{console.log("Olm not loaded"),k()});export{F as C,A as H,i as a,h as j};
diff --git a/pr-121/assets/index.afea57c7.js b/pr-121/assets/index.afea57c7.js
@@ -1 +0,0 @@
-var U=Object.defineProperty,R=Object.defineProperties;var W=Object.getOwnPropertyDescriptors;var B=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable;var b=(a,e,t)=>e in a?U(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,P=(a,e)=>{for(var t in e||(e={}))G.call(e,t)&&b(a,t,e[t]);if(B)for(var t of B(e))X.call(e,t)&&b(a,t,e[t]);return a},j=(a,e)=>R(a,W(e));var d=(a,e,t)=>(b(a,typeof e!="symbol"?e+"":e,t),t);import{D as Q,j as V,a as Y,E as _,b as I,P as J,F as Z,L as $,c as q,l,d as s,W as M,M as E,e as K,f as ee,O as te,o as ne,g as ie,S as oe}from"./vendor.d127a5c1.js";const re=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const r of c.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function t(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerpolicy&&(c.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?c.credentials="include":o.crossorigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function n(o){if(o.ep)return;o.ep=!0;const c=t(o);fetch(o.href,c)}};re();const se="modulepreload",H={},ae="/pr-121/",le=function(e,t){return!t||t.length===0?e():Promise.all(t.map(n=>{if(n=`${ae}${n}`,n in H)return;H[n]=!0;const o=n.endsWith(".css"),c=o?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${n}"]${c}`))return;const r=document.createElement("link");if(r.rel=o?"stylesheet":se,o||(r.as="script",r.crossOrigin=""),r.href=n,document.head.appendChild(r),o)return new Promise((w,m)=>{r.addEventListener("load",w),r.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>e())},F=Q(void 0),i=V,h=Y;class A extends _{render(){const e=this.context;return h("div",{class:"m-12 flex flex-col lg:flex-row items-center justify-between",children:[i(I,{href:"/",children:i("img",{alt:"Matrix Art",src:"Logo_colored.svg",class:"ease-in-out hover:scale-105 trandform transition-transform duration-300"})}),h("div",{class:"flex items-center mt-8 lg:mt-0 flex-col sm:flex-row",children:[h("div",{class:"flex items-center justify-between w-80 max-w-80 mx-6 ease-in-out hover:scale-105 trandform transition-transform duration-300",children:[i("div",{class:"absolute ml-4",children:h("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#AAB3CF",children:[i("path",{d:"M0 0h24v24H0V0z",fill:"none"}),i("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"})]})}),i("input",{class:"search-bg shadow rounded-2xl border-0 py-3 px-4 pl-10 text-data",placeholder:"Search"})]}),e!=null&&e.isLoggedIn()?i(I,{class:"text-white font-bold text-1xl logo-bg rounded-2xl py-3 px-12 shadow mt-4 sm:mt-0 transform transition-transform ease-in-out duration-300 hover:scale-105",children:"Post"}):i(I,{href:"/join",class:"text-white font-bold text-1xl logo-bg rounded-2xl py-3 px-12 shadow mt-4 sm:mt-0 transform transition-transform ease-in-out duration-300 hover:scale-105",children:"Join"})]})]})}}A.contextType=F;class p extends _{constructor(e){super(e)}render({user:e,post:t}){return h("div",{class:"flex flex-col",children:[i("a",{id:"gallery_click",href:t.content.file.url,class:"w-full",target:"_blank",rel:"noreferrer",children:i("img",{class:"rounded-3xl shadow object-cover transform transition-transform ease-in-out duration-300 hover:scale-105",src:t.content.file.url})}),h("div",{class:"flex items-center justify-between py-4",children:[h("a",{class:"flex items-center",href:"#",children:[i("img",{class:"w-11 h-11 rounded-full mr-4 border-2 border-[#AAB3CF]",src:e.avatar_url}),i("p",{class:"text-data shadow text-lg font-medium",children:e.display_name})]}),h("div",{class:"flex text-data text-lg items-center",children:[h("a",{class:"mr-4 flex items-center",href:"#",children:[i("span",{class:"mr-2",children:h("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#AAB3CF",children:[i("path",{d:"M0 0h24v24H0V0z",fill:"none"}),i("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"})]})}),i("span",{children:"5"})]}),h("a",{class:"flex items-center",href:"#",children:[i("span",{class:"mr-2",children:h("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#AAB3CF",children:[i("path",{d:"M0 0h24v24H0V0z",fill:"none"}),i("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"})]})}),i("span",{children:"11"})]})]})]})]})}}class y{constructor(e,t,n){d(this,"mxid");d(this,"display_name");d(this,"avatar_url");this.mxid=e,this.display_name=t,this.avatar_url=n}}class v{constructor(e,t){d(this,"event_id");d(this,"content");this.event_id=e,this.content=t}}class ce extends _{constructor(){super();this.state={columns:this.settingColumns()}}settingColumns(){return window.innerWidth>=1400?4:window.innerWidth>=800?3:window.innerWidth>=500?2:1}componentDidMount(){window.addEventListener("resize",()=>this.setState({columns:this.settingColumns()}))}componentWillUnmount(){window.removeEventListener("resize",()=>this.setState({columns:this.settingColumns()}))}render(){return h("div",{class:"flex flex-col",children:[i("header",{children:i(A,{})}),h("main",{class:"m-12 mt-6",children:[i("h1",{class:"text-3xl font-bold mb-4 text-white",children:"Explore"}),i("div",{class:"flex justify-center",id:"gallery",children:h(J,{gap:24,nColumns:this.state.columns,children:[i(p,{user:new y("","Person A","https://unsplash.com/photos/_cvwXhGqG-o/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8OHx8ZmFjZXxlbnwwfDJ8fHwxNjQ4Nzc5NzYx"),post:new v("",{file:{url:"https://unsplash.com/photos/UWmrTAQ75iA/download?ixid=MnwxMjA3fDB8MXxhbGx8Mnx8fHx8fDJ8fDE2NDg4MzI0Njg"}})}),i(p,{user:new y("","Person B","https://unsplash.com/photos/uJ8LNVCBjFQ/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MTN8fGZhY2V8ZW58MHwyfHx8MTY0ODc3OTc2MQ"),post:new v("",{file:{url:"https://unsplash.com/photos/7ptbiEPxKMQ/download?ixid=MnwxMjA3fDB8MXxhbGx8OXx8fHx8fDJ8fDE2NDg4MzI0Njg"}})}),i(p,{user:new y("","Person C","https://unsplash.com/photos/u3pi6HhSYew/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MTd8fGZhY2V8ZW58MHwyfHx8MTY0ODc3OTc2MQ"),post:new v("",{file:{url:"https://unsplash.com/photos/ZiPlVmmKEYA/download?ixid=MnwxMjA3fDB8MXxhbGx8Mzl8fHx8fHwyfHwxNjQ4ODM2MDIz"}})}),i(p,{user:new y("","Person D","https://unsplash.com/photos/TW_z_iUD_bQ/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8ODR8fHBvcnRyYWl0fGVufDB8Mnx8fDE2NDg4NDQ3MjQ"),post:new v("",{file:{url:"https://unsplash.com/photos/FTQJBGDxKXg/download?ixid=MnwxMjA3fDB8MXxhbGx8M3x8fHx8fDJ8fDE2NDg4NDMyNDY"}})}),i(p,{user:new y("","Person E","https://unsplash.com/photos/kYtN89E5ce4/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MTA0fHxwb3J0cmFpdHxlbnwwfDJ8fHwxNjQ4ODQ0NzQy"),post:new v("",{file:{url:"https://unsplash.com/photos/zfhxiaZO3JE/download?ixid=MnwxMjA3fDB8MXxhbGx8Mjl8fHx8fHwyfHwxNjQ4ODQzMjQ1"}})}),i(p,{user:new y("","Person E","https://unsplash.com/photos/kBonaevi3yA/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MTE5fHxwb3J0cmFpdHxlbnwwfDJ8fHwxNjQ4ODQ0NzQy"),post:new v("",{file:{url:"https://unsplash.com/photos/jm-JKqrAXsA/download?ixid=MnwxMjA3fDB8MXxhbGx8MTAyfHx8fHx8Mnx8MTY0ODg0MzI1NQ"}})})]})})]})]})}}const de=Z(()=>le(()=>import("./Join.00e6b69a.js"),["assets/Join.00e6b69a.js","assets/vendor.d127a5c1.js"]));class he extends _{render(){return i($,{fallback:h("div",{class:"flex flex-col",children:[i("header",{children:i(A,{})}),i("main",{class:"m-12 mt-6 flex items-center justify-center",children:i("p",{class:"text-lg text-data font-bold",children:"Loading..."})})]}),children:i(F.Provider,{value:window.client,children:h(q,{children:[i(ce,{path:"/pr-121//"}),i(de,{path:"/pr-121//join"})]})})})}}const S=new l.UnstableValue("m.image","org.matrix.msc1767.image"),N=new l.UnstableValue("m.file","org.matrix.msc1767.file"),O=new l.UnstableValue("m.thumbnail","org.matrix.msc1767.thumbnail"),L=new l.UnstableValue("blurhash","xyz.amorgan.blurhash"),me=new l.NamespacedValue("matrixart.description"),we=new l.NamespacedValue("matrixart.tags"),ue=new l.NamespacedValue("matrixart.nsfw"),xe=new l.NamespacedValue("matrixart.license");class fe extends l.ExtensibleEvent{constructor(e){super(e);d(this,"image");d(this,"text");d(this,"thumbnails");d(this,"blurhash");d(this,"file");d(this,"description");d(this,"tags");d(this,"nsfw",!1);d(this,"license");const t=S.findIn(this.wireContent),n=l.M_TEXT.findIn(this.wireContent),o=N.findIn(this.wireContent),c=O.findIn(this.wireContent),r=L.findIn(this.wireContent),w=me.findIn(this.wireContent),m=we.findIn(this.wireContent),x=ue.findIn(this.wireContent),u=xe.findIn(this.wireContent);if(l.isProvided(t)){if(!t)throw new l.InvalidEventError("m.image is required to be present");this.image=t}if(l.isProvided(o)){if(!o)throw new l.InvalidEventError("m.file is required to be present");this.file=o}if(l.isOptionalAString(n)){if(!t)throw new l.InvalidEventError("m.text is required to be present");this.text=n}if(l.isProvided(c)){if(!Array.isArray(c))throw new l.InvalidEventError("m.thumbnail contents must be an array");this.thumbnails=c}if(l.isOptionalAString(r)&&(this.blurhash=r),l.isOptionalAString(w)&&(this.description=w),l.isProvided(m)){if(!Array.isArray(m))throw new l.InvalidEventError("matrixart.tags contents must be an array");this.tags=m}if(l.isProvided(x)){if(typeof x!="boolean")throw new l.InvalidEventError("matrixart.tags contents must be an boolean");this.nsfw=x}l.isOptionalAString(u)&&(this.license=u)}isEquivalentTo(e){return l.isEventTypeSame(e,S)}serialize(){const e={[l.M_TEXT.name]:this.text,[N.name]:this.file,[S.name]:this.image,[O.name]:this.thumbnails,[L.name]:this.blurhash,["matrixart.description"]:this.description,["matrixart.tags"]:this.tags,["matrixart.nsfw"]:this.nsfw,["matrixart.license"]:this.license};return{type:"m.image",content:e}}}function ge(a){const e=a;return new fe(e)}l.ExtensibleEvents.registerInterpreter(S,ge);l.ExtensibleEvents.unknownInterpretOrder.push(S);function D(){return new Worker("/pr-121/assets/indexeddb.worker.0ae1a28d.js",{type:"module"})}class T{constructor(e){d(this,"events",[]);d(this,"currentUserDirectory");d(this,"rootDirectory");this.client=e}static async new(){var o,c,r,w,m,x;global.Olm||console.error("global.Olm does not seem to be present. Did you forget to add olm in the out directory?");let e;if(window.localStorage.getItem("server")!==null?e=window.localStorage.getItem("server"):e="https://matrix.art.midnightthoughts.space",!e)throw new Error("No matrix server URL defined");let t;if(window.localStorage.getItem("mxid_guest")!==null){const u=(o=window.localStorage.getItem("mxid_guest"))!=null?o:void 0,f=(c=window.localStorage.getItem("access_token_guest"))!=null?c:void 0,g=(r=window.localStorage.getItem("device_id_guest"))!=null?r:void 0;t=s.createClient({useAuthorizationHeader:!0,baseUrl:e,userId:u,accessToken:f,deviceId:g,sessionStore:new M(window.localStorage),store:new s.IndexedDBStore({indexedDB:window.indexedDB,dbName:"matrix-art-sync:guest",localStorage:window.localStorage,workerFactory:()=>new D}),cryptoStore:new s.IndexedDBCryptoStore(window.indexedDB,"matrix-art:crypto")}),t.setGuest(!0)}{const u=s.createClient("https://matrix.art.midnightthoughts.space"),{user_id:f,device_id:g,access_token:C}=await u.registerGuest();t=s.createClient({useAuthorizationHeader:!0,baseUrl:e,userId:f,accessToken:C,deviceId:g,sessionStore:new M(window.localStorage),store:new s.IndexedDBStore({indexedDB:window.indexedDB,dbName:"matrix-art-sync:guest",localStorage:window.localStorage,workerFactory:()=>new D}),cryptoStore:new s.IndexedDBCryptoStore(window.indexedDB,"matrix-art:crypto")}),t.setGuest(!0),window.localStorage.setItem("mxid_guest",f),window.localStorage.setItem("access_token_guest",C),window.localStorage.setItem("device_id_guest",g),window.localStorage.setItem("server",e)}let n;if(window.localStorage.getItem("mxid")!==null){const u=(w=window.localStorage.getItem("mxid"))!=null?w:void 0,f=(m=window.localStorage.getItem("access_token"))!=null?m:void 0,g=(x=window.localStorage.getItem("device_id"))!=null?x:void 0;n=s.createClient({useAuthorizationHeader:!0,baseUrl:e,userId:u,accessToken:f,deviceId:g,sessionStore:new M(window.localStorage),store:new s.IndexedDBStore({indexedDB:window.indexedDB,dbName:"matrix-art-sync:guest",localStorage:window.localStorage,workerFactory:()=>new D}),cryptoStore:new s.IndexedDBCryptoStore(window.indexedDB,"matrix-art:crypto")}),n.setGuest(!1)}return new T(n!=null?n:t)}isLoggedIn(){return this.client.isLoggedIn()&&!this.client.isGuest()}async start(){this.client.on(s.MatrixEventEvent.Decrypted,(t,n)=>{const o=t.unstableExtensibleEvent;o!=null&&o.isEquivalentTo(S)&&this.events.push(t)}),console.log("start"),await this.client.store.startup(),await this.client.initCrypto(),await this.client.startClient();const e=await this.client.joinRoom("#Matrix_Art:art.midnightthoughts.space");await z(1e3),this.rootDirectory=new E(this.client,e.roomId),console.log("started")}async register(e="https://matrix.art.midnightthoughts.space",t,n,o=!1){var c;if(this.client.stopClient(),this.client=s.createClient({useAuthorizationHeader:!0,baseUrl:e,userId:t,deviceId:"Matrix Art",sessionStore:new M(window.localStorage),store:new s.IndexedDBStore({indexedDB:window.indexedDB,dbName:"matrix-art-sync:loggedin",localStorage:window.localStorage,workerFactory:()=>new D}),cryptoStore:new s.IndexedDBCryptoStore(window.indexedDB,"matrix-art:crypto")}),await this.client.register(t,n,null,{type:"m.login.dummy"}),window.localStorage.setItem("server",e),window.localStorage.setItem("mxid",t),window.localStorage.setItem("access_token",this.client.getAccessToken()),window.localStorage.setItem("device_id","Matrix Art"),await this.start(),o){const r=(c=this.rootDirectory)==null?void 0:c.getDirectories(),w=this.client.getUserId().replace(":","_");r!=null&&r.some(m=>m.room.name===w)?this.rootDirectory=r==null?void 0:r.find(m=>m.room.name===w):await this.createProfileFolder()}}async login(e,t,n,o=!1){var c;if(this.client.stopClient(),this.client=s.createClient({useAuthorizationHeader:!0,baseUrl:e,userId:t,deviceId:"Matrix Art",sessionStore:new M(window.localStorage),store:new s.IndexedDBStore({indexedDB:window.indexedDB,dbName:"matrix-art-sync:loggedin",localStorage:window.localStorage,workerFactory:()=>new D}),cryptoStore:new s.IndexedDBCryptoStore(window.indexedDB,"matrix-art:crypto")}),await this.client.loginWithPassword(t,n),window.localStorage.setItem("server",e),window.localStorage.setItem("mxid",t),window.localStorage.setItem("access_token",this.client.getAccessToken()),window.localStorage.setItem("device_id","Matrix Art"),await this.start(),o){const r=(c=this.rootDirectory)==null?void 0:c.getDirectories();console.log(r);const w=this.client.getUserId().replace(":","_");r!=null&&r.some(m=>m.room.name===w)?this.rootDirectory=r==null?void 0:r.find(m=>m.room.name===w):await this.createProfileFolder()}}async createProfileFolder(){if(this.client.isGuest())throw new Error("Cannot create a file tree space as a guest");const e=await this.client.joinRoom("#Matrix_Art:art.midnightthoughts.space");await z(1e3),this.rootDirectory=new E(this.client,e.roomId);const t=this.client.getUserId().replace(":","_");this.currentUserDirectory=await this.createPublicSubDirectory(this.rootDirectory,t),await this.createPublicSubDirectory(this.currentUserDirectory,"Timeline")}async createPublicFileTree(e){if(this.client.isGuest())throw new Error("Cannot create a file tree space as a guest");const{room_id:t}=await this.client.createRoom({name:e,preset:s.Preset.PublicChat,power_level_content_override:j(P({},K),{users:{["@administrator:art.midnightthoughts.space"]:100,[this.client.getUserId()]:100}}),invite:["@administrator:art.midnightthoughts.space"],creation_content:{[s.RoomCreateTypeField]:s.RoomType.Space},initial_state:[{type:s.UNSTABLE_MSC3088_PURPOSE.name,state_key:s.UNSTABLE_MSC3089_TREE_SUBTYPE.name,content:{[s.UNSTABLE_MSC3088_ENABLED.name]:!0}},{type:s.EventType.RoomEncryption,state_key:"",content:{algorithm:ee}},{type:s.EventType.RoomGuestAccess,state_key:"",content:{guest_access:"can_join"}},{type:s.EventType.RoomHistoryVisibility,state_key:"",content:{history_visibility:"world_readable"}}]}),n=this.client.getRoom(t),o=n==null?void 0:n.getLiveTimeline().getState(s.EventTimeline.FORWARDS).getStateEvents(s.EventType.RoomPowerLevels,"");if(!o)throw new Error("Failed to find PL event");return await this.client.setPowerLevel(t,this.client.getUserId(),50,o),new E(this.client,t)}async createPublicSubDirectory(e,t){const n=await this.createPublicFileTree(t);return await this.client.sendStateEvent(e.roomId,s.EventType.SpaceChild,{via:[this.client.getDomain()]},n.roomId),await this.client.sendStateEvent(n.roomId,s.EventType.SpaceParent,{via:[this.client.getDomain()]},e.roomId),n}}function z(a){return new Promise(e=>setTimeout(e,a))}function pe(){return te.init({locateFile:()=>ne}).then(()=>{console.log("Using WebAssembly Olm")}).catch(a=>(console.log("Failed to load Olm: trying legacy version",a),new Promise((e,t)=>{const n=document.createElement("script");n.src=ie,n.onload=e,n.onerror=t,document.body.appendChild(n)}).then(()=>window.Olm.init()).then(()=>{console.log("Using legacy Olm")}).catch(e=>{console.log("Both WebAssembly and asm.js Olm failed!",e)})))}function k(){T.new().then(a=>{window.client=a,console.log("Client loaded"),a.start().then(()=>{console.log("Client started"),oe(i(he,{}),document.querySelector("#app"))})})}pe().then(()=>{console.log("Olm loaded"),k()}).catch(()=>{console.log("Olm not loaded"),k()});export{F as C,A as H,i as a,h as j};
diff --git a/pr-121/index.html b/pr-121/index.html
@@ -11,7 +11,7 @@
global = globalThis // fix for "global not defined" error
globalThis.OLM_OPTIONS = undefined; // Fix missing var for olm
</script>
- <script type="module" crossorigin src="/pr-121/assets/index.afea57c7.js"></script>
+ <script type="module" crossorigin src="/pr-121/assets/index.27812ca8.js"></script>
<link rel="modulepreload" href="/pr-121/assets/vendor.d127a5c1.js">
<link rel="stylesheet" href="/pr-121/assets/index.311ea642.css">
</head>