solid-ui 3.1.1 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import*as e from"rdflib";import*as t from"solid-logic";var n={6466(e,t,n){n.d(t,{v:()=>p});var i=n(5619),a=n(4961),o=n(1214),s=n(7367),r=n(52),c=n(7423),l=n(675);class p{mainCombo;defaultsCombo;isContainer;defaultsDiffer;rootElement;isUsingDefaults;constructor(e,t,n,a,s,r,c,p,u,d,m,f){if(this.subject=e,this.noun=t,this.context=n,this.statusElement=a,this.targetIsProtected=s,this.targetDoc=r,this.targetACLDoc=c,this.defaultHolder=p,this.defaultACLDoc=u,this.prospectiveDefaultHolder=d,this.store=m,this.dom=f,this.rootElement=f.createElement("div"),this.rootElement.setAttribute("style",l.i.aclGroupContent),this.isContainer="/"===r.uri.slice(-1),p&&u){this.isUsingDefaults=!0;const e=(0,i._E)(this.targetDoc,c,p,u);this.mainCombo=new o.h(r,c,this,e,{defaults:this.isContainer}),this.defaultsCombo=null,this.defaultsDiffer=!1}else this.isUsingDefaults=!1,this.mainCombo=new o.h(r,c,this,m),this.defaultsCombo=new o.h(r,c,this,m,{defaults:this.isContainer}),this.defaultsDiffer=!(0,i.P3)(this.mainCombo.aclMap,this.defaultsCombo.aclMap)}get isEditable(){return!this.isUsingDefaults}render(){if(this.rootElement.innerHTML="",this.isUsingDefaults){if(this.renderStatus(`The sharing for this ${this.noun} is the default for folder `),this.defaultHolder){const e=this.statusElement.appendChild(this.dom.createElement("a"));e.href=this.defaultHolder.uri,e.innerText=(0,s.DR)(this.defaultHolder)}}else!this.defaultsDiffer&&this.isContainer?this.renderStatus("This is also the default for things in this folder."):this.renderStatus("");return this.rootElement.appendChild(this.mainCombo.render()),this.defaultsCombo&&this.defaultsDiffer?(this.rootElement.appendChild(this.renderRemoveDefaultsController()),this.rootElement.appendChild(this.defaultsCombo.render())):this.isEditable&&this.isContainer&&this.rootElement.appendChild(this.renderAddDefaultsController()),!this.targetIsProtected&&this.isUsingDefaults?this.rootElement.appendChild(this.renderAddAclsController()):this.targetIsProtected||this.rootElement.appendChild(this.renderRemoveAclsController()),this.rootElement}renderRemoveAclsController(){const e=this.dom.createElement("button");return e.innerText=`Remove custom sharing settings for this ${this.noun} -- just use default${this.prospectiveDefaultHolder?` for ${r.label(this.prospectiveDefaultHolder)}`:""}`,e.setAttribute("style",l.i.bigButton),e.addEventListener("click",()=>this.removeAcls().then(()=>this.render()).catch(e=>this.renderStatus(e))),e}renderAddAclsController(){const e=this.dom.createElement("button");return e.innerText=`Set specific sharing for this ${this.noun}`,e.setAttribute("style",l.i.bigButton),e.addEventListener("click",()=>this.addAcls().then(()=>this.render()).catch(e=>this.renderStatus(e))),e}renderAddDefaultsController(){const e=this.dom.createElement("div");e.setAttribute("style",l.i.defaultsController);const t=e.appendChild(this.dom.createElement("div"));t.innerText="Sharing for things within the folder currently tracks sharing for the folder.",t.setAttribute("style",l.i.defaultsControllerNotice);const n=e.appendChild(this.dom.createElement("button"));return n.innerText="Set the sharing of folder contents separately from the sharing for the folder",n.setAttribute("style",l.i.bigButton),n.addEventListener("click",()=>this.addDefaults().then(()=>this.render())),e}renderRemoveDefaultsController(){const e=this.dom.createElement("div");e.setAttribute("style",l.i.defaultsController);const t=e.appendChild(this.dom.createElement("div"));t.innerText="Access to things within this folder:",t.setAttribute("style",l.i.defaultsControllerNotice);const n=e.appendChild(this.dom.createElement("button"));return n.innerText="Set default for folder contents to just track the sharing for the folder",n.setAttribute("style",l.i.bigButton),n.addEventListener("click",()=>this.removeDefaults().then(()=>this.render()).catch(e=>this.renderStatus(e))),e}renderTemporaryStatus(e){this.statusElement.setAttribute("style",l.i.aclControlBoxStatusRevealed),this.statusElement.innerText=e,this.statusElement.setAttribute("style",l.i.temporaryStatusInit),setTimeout(()=>{this.statusElement.setAttribute("style",l.i.temporaryStatusEnd)}),setTimeout(()=>{this.statusElement.innerText=""},5e3)}renderStatus(e){e||this.statusElement.setAttribute("style",l.i.aclControlBoxStatusRevealed),this.statusElement.innerText=e}async addAcls(){if(!this.defaultHolder||!this.defaultACLDoc){const e="Unable to find defaults to copy";return c.z3(e),Promise.reject(e)}(0,i._E)(this.targetDoc,this.targetACLDoc,this.defaultHolder,this.defaultACLDoc).statements.forEach(e=>this.store.add(e.subject,e.predicate,e.object,this.targetACLDoc));try{return await this.store.fetcher.putBack(this.targetACLDoc),this.isUsingDefaults=!1,Promise.resolve()}catch(e){const t=` Error writing back access control file! ${e}`;return c.z3(t),Promise.reject(t)}}async addDefaults(){this.defaultsCombo=new o.h(this.targetDoc,this.targetACLDoc,this,this.store,{defaults:!0}),this.defaultsDiffer=!0}async removeAcls(){try{await this.store.fetcher.delete(this.targetACLDoc.uri,{}),this.isUsingDefaults=!0;try{this.prospectiveDefaultHolder=await(0,i.L$)(this.targetDoc.uri)}catch(e){c.R8(e)}}catch(e){const t=`Error deleting access control file: ${this.targetACLDoc}: ${e}`;return c.z3(t),Promise.reject(t)}}async removeDefaults(){const e=this.defaultsCombo;try{this.defaultsCombo=null,this.defaultsDiffer=!1,await this.save()}catch(t){return this.defaultsCombo=e,this.defaultsDiffer=!0,c.z3(t),Promise.reject(t)}}save(){const e=(0,a.graph)();this.isContainer?this.defaultsCombo&&this.defaultsDiffer?((0,i.cl)(e,this.targetDoc,this.mainCombo.byCombo,this.targetACLDoc,!0),(0,i.cl)(e,this.targetDoc,this.defaultsCombo.byCombo,this.targetACLDoc,!1,!0)):(0,i.cl)(e,this.targetDoc,this.mainCombo.byCombo,this.targetACLDoc,!0,!0):(0,i.cl)(e,this.targetDoc,this.mainCombo.byCombo,this.targetACLDoc,!0),e.fetcher=(0,a.fetcher)(e,{fetch:this.store.fetcher._fetch});const t=e.updater||new a.UpdateManager(e);return new Promise((n,a)=>{t.put(this.targetACLDoc,e.statementsMatching(void 0,void 0,void 0,this.targetACLDoc),"text/turtle",(t,o,s)=>{if(!o)return a(new Error(`ACL file save failed: ${s}`));this.store.fetcher.unload(this.targetACLDoc),this.store.add(e.statements),this.store.fetcher.requested[this.targetACLDoc.uri]="done",this.mainCombo.store=this.store,this.defaultsCombo&&(this.defaultsCombo.store=this.store),this.defaultsDiffer=!!this.defaultsCombo&&!(0,i.P3)(this.mainCombo.aclMap,this.defaultsCombo.aclMap),c.Rm("ACL modification: success!"),n()})})}}},1214(e,t,n){n.d(t,{h:()=>f});var i=n(4961),a=n(5619),o=n(4608),s=n(1795),r=n(1928),c=n(7423),l=n(675);const p=s.A.acl,u={13:"Owners",9:"Owners (write locked)",5:"Editors",3:"Posters",2:"Submitters",1:"Viewers"},d={13:!0,5:!0,3:!0,2:!0,1:!0},m={13:"can read, write, and control sharing.",9:"can read and control sharing, currently write-locked.",5:"can read and change information",3:"can add new information, and read but not change existing information",2:"can add new information but not read any",1:"can read but not change information"};class f{defaults;byCombo;aclMap;addAgentButton;rootElement;_store;constructor(e,t,n,i,o={}){this.doc=e,this.aclDoc=t,this.controller=n,this._options=o,this.defaults=this._options.defaults||!1,this._store=i,this.aclMap=(0,a.fg)(e,t,i,this.defaults),this.byCombo=(0,a.xw)(this.aclMap),this.addAgentButton=new r.g(this),this.rootElement=this.controller.dom.createElement("div"),this.rootElement.setAttribute("style",l.i.accessGroupList)}get store(){return this._store}set store(e){this._store=e,this.aclMap=(0,a.fg)(this.doc,this.aclDoc,e,this.defaults),this.byCombo=(0,a.xw)(this.aclMap)}render(){return this.rootElement.innerHTML="",this.renderGroups().forEach(e=>this.rootElement.appendChild(e)),this.controller.isEditable&&this.rootElement.appendChild(this.addAgentButton.render()),this.rootElement}renderGroups(){const e=[];for(let t=15;t>0;t--){const n=h(t);(this.controller.isEditable&&d[t]||this.byCombo[n])&&e.push(this.renderGroup(t,n))}return e}renderGroup(e,t){const n=this.controller.dom.createElement("div");n.setAttribute("style",l.i.accessGroupListItem),o.makeDropTarget(n,e=>this.handleDroppedUris(e,t).then(()=>this.controller.render()).catch(e=>this.controller.renderStatus(e)));return this.renderGroupElements(e,t).forEach(e=>n.appendChild(e)),n}renderGroupElements(e,t){const n=this.controller.dom.createElement("div");if(n.setAttribute("style",l.i.group),this.controller.isEditable)switch(e){case 1:n.setAttribute("style",l.i.group1);break;case 2:n.setAttribute("style",l.i.group2);break;case 3:n.setAttribute("style",l.i.group3);break;case 5:n.setAttribute("style",l.i.group5);break;case 9:n.setAttribute("style",l.i.group9);break;case 13:n.setAttribute("style",l.i.group13);break;default:n.setAttribute("style",l.i.group)}n.innerText=u[e]||function(e){let t="";const n=["Read","Append","Write","Control"];for(let i=0;i<4;i++)e&1<<i&&(t+=n[i]);return t}(e);const i=this.controller.dom.createElement("div");if(i.setAttribute("style",l.i.group),this.controller.isEditable)switch(e){case 1:i.setAttribute("style",l.i.group1);break;case 2:i.setAttribute("style",l.i.group2);break;case 3:i.setAttribute("style",l.i.group3);break;case 5:i.setAttribute("style",l.i.group5);break;case 9:i.setAttribute("style",l.i.group9);break;case 13:i.setAttribute("style",l.i.group13);break;default:i.setAttribute("style",l.i.group)}const a=i.appendChild(this.controller.dom.createElement("table"));(this.byCombo[t]||[]).map(([e,n])=>this.renderAgent(a,t,e,n)).forEach(e=>a.appendChild(e));const o=this.controller.dom.createElement("div");if(o.setAttribute("style",l.i.group),this.controller.isEditable)switch(e){case 1:o.setAttribute("style",l.i.group1);break;case 2:o.setAttribute("style",l.i.group2);break;case 3:o.setAttribute("style",l.i.group3);break;case 5:o.setAttribute("style",l.i.group5);break;case 9:o.setAttribute("style",l.i.group9);break;case 13:o.setAttribute("style",l.i.group13);break;default:o.setAttribute("style",l.i.group)}return o.innerText=m[e]||"Unusual combination",[n,i,o]}renderAgent(e,t,n,a){const s=o.personTR(this.controller.dom,p(n),(0,i.sym)(a),this.controller.isEditable?{deleteFunction:()=>this.deleteAgent(t,n,a).then(()=>e.removeChild(s)).catch(e=>this.controller.renderStatus(e))}:{});return s}async deleteAgent(e,t,n){const i=this.byCombo[e]||[],a=i.find(([e,i])=>e===t&&i===n);a&&i.splice(i.indexOf(a),1),await this.controller.save()}async addNewURI(e){await this.handleDroppedUri(e,h(1)),await this.controller.save()}async handleDroppedUris(e,t){try{await Promise.all(e.map(e=>this.handleDroppedUri(e,t))),await this.controller.save()}catch(e){return Promise.reject(e)}}async handleDroppedUri(e,t,n=!1){const a=function(e,t){const n=(0,i.sym)(e),a=t.findTypeURIs(n);for(const e in a)c.Rm(" drop object type includes: "+e);if(e.startsWith("http")&&3===e.split("/").length)return{pred:"origin",obj:n};if(e.startsWith("http")&&4===e.split("/").length&&e.endsWith("/"))return c.Rm("Assuming final slash on dragged origin URI was unintended!"),{pred:"origin",obj:(0,i.sym)(e.slice(0,-1))};if(s.A.vcard("WebID").uri in a)return{pred:"agent",obj:n};if(s.A.vcard("Group").uri in a)return{pred:"agentGroup",obj:n};if(n.sameTerm(s.A.foaf("Agent"))||n.sameTerm(s.A.acl("AuthenticatedAgent"))||n.sameTerm(s.A.rdf("Resource"))||n.sameTerm(s.A.owl("Thing")))return{pred:"agentClass",obj:n};if(s.A.vcard("Individual").uri in a||s.A.foaf("Person").uri in a||s.A.foaf("Agent").uri in a){const e=t.any(n,s.A.foaf("preferredURI"));return e?{pred:"agent",obj:(0,i.sym)(e)}:{pred:"agent",obj:n}}if(s.A.solid("AppProvider").uri in a)return{pred:"origin",obj:n};if(s.A.solid("AppProviderClass").uri in a)return{pred:"originClass",obj:n};return c.Rm(" Triage fails for "+e),null}(e,this.store),o=(0,i.sym)(e);if(!a&&!n){c.Rm(` Not obvious: looking up dropped thing ${o}`);try{await(this._store?.fetcher?.load(o.doc()))}catch(e){const t=`Ignore error looking up dropped thing: ${e}`;return c.z3(t),Promise.reject(new Error(t))}return this.handleDroppedUri(e,t,!0)}if(!a){const t=Object.keys(this.store.findTypeURIs(o)),n=`Error: Failed to add access target: ${e} is not a recognized ACL target type. Expected one of: vcard:WebID, vcard:Group, foaf:Person, foaf:Agent, solid:AppProvider, solid:AppProviderClass, or recognized ACL classes. Hint: try dropping a WebID profile URI, a vcard:Group URI, or a web app origin.`+(t.length>0?`Detected RDF types: ${t.join(", ")}`:"No RDF type was detected for this URI.");return c.z3(n),Promise.reject(new Error(n))}this.setACLCombo(t,e,a,this.controller.subject)}setACLCombo(e,t,n,i){e in this.byCombo||(this.byCombo[e]=[]),this.removeAgentFromCombos(t),this.byCombo[e].push([n.pred,n.obj.uri]),c.Rm(`ACL: setting access to ${i} by ${n.pred}: ${n.obj}`)}removeAgentFromCombos(e){for(let t=0;t<16;t++){const n=this.byCombo[h(t)];if(n)for(let t=0;t<n.length;t++)for(;t<n.length&&n[t][1]===e;)n.splice(t,1)}}}function h(e){const t=["Read","Append","Write","Control"],n=[];for(let i=0;i<4;i++)e&1<<i&&n.push("http://www.w3.org/ns/auth/acl#"+t[i]);return n.sort(),n.join("\n")}},7367(e,t,n){n.d(t,{DR:()=>f,Fp:()=>u,wR:()=>h});var i=n(1795),a=n(52),o=n(5619),s=n(6466),r=n(675),c=n(7423);let l=window;const p=Symbol("prevent double triggering of drop event");function u(e){if((0,c.Rm)("preventBrowserDropEvents called."),void 0!==l){if(l[p])return;l[p]=!0}e.addEventListener("drop",m,!1),e.addEventListener("dragenter",d,!1),e.addEventListener("dragover",d,!1)}function d(e){e.stopPropagation(),e.preventDefault()}function m(e){e.dataTransfer.files.length>0&&(l.confirm("Are you sure you want to drop this file here? (Cancel opens it in a new tab)")||(e.stopPropagation(),e.preventDefault(),(0,c.Rm)("@@@@ document-level DROP suppressed: "+e.dataTransfer.dropEffect)))}function f(e){let t=e.uri;"/"===t.slice(-1)&&(t=t.slice(0,-1));const n=t.lastIndexOf("/");return n>=0&&(t=t.slice(n+1)),t||"/"}function h(e,t,n,l){const p=t.dom,u=e.doc(),d=p.createElement("div");d.setAttribute("style",r.i.aclControlBoxContainer);const m=d.appendChild(p.createElement("h1"));m.textContent=`Sharing for ${n} ${a.label(e)}`,m.setAttribute("style",r.i.aclControlBoxHeader);const f=d.appendChild(p.createElement("div"));f.setAttribute("style",r.i.aclControlBoxStatus);try{(async function(e,t,n,a,r,l,p){return new Promise((u,d)=>(0,o.VM)(e,async(e,m,f,h,g,b)=>{if(!e)return d(new Error(`Error reading ${m?"":" default "}ACL. status ${f}: ${h}`));const v=function(e){const t=e.uri.split("#")[0],n=t.slice(0,-1).lastIndexOf("/"),i=t.indexOf("//");return i>=0&&n<i+2||n<0?null:t.slice(0,n+1)}(f),x=function(e,t,n){return n.holds(e,i.A.rdf("type"),i.A.space("Storage"),t)}(f,h,t)||function(e){return e.uri===e.site().uri}(f);if(!x&&v)try{const e=await(0,o.L$)(v);return u(y(e))}catch(e){(0,c.R8)(e)}return u(y());function y(e){return new s.v(n,a,r,p,x,f,h,g,b,e,t,l)}}))})(u,l,e,n,t,p,f).then(e=>d.appendChild(e.render()))}catch(e){f.innerText=e}return d}},5619(e,t,n){n.d(t,{D9:()=>v,H0:()=>w,L$:()=>T,Lu:()=>b,P3:()=>u,Tm:()=>h,Uf:()=>m,VM:()=>k,_7:()=>d,_E:()=>l,cH:()=>x,cl:()=>g,fb:()=>E,fg:()=>p,n1:()=>C,pe:()=>_,pp:()=>A,xo:()=>y,xw:()=>f});var i=n(1795),a=n(3138),o=n(52),s=n(7423),r=n(4961);const c=a.solidLogicSingleton.store;function l(e,t,n,a){const o=i.A.acl,s="/"===e.uri.slice(-1),l=c.each(void 0,o("default"),n,a).concat(c.each(void 0,o("defaultForNew"),n,a)).reduce((t,n)=>t.concat(c.statementsMatching(n,i.A.rdf("type"),o("Authorization"),a)).concat(c.statementsMatching(n,o("agent"),void 0,a)).concat(c.statementsMatching(n,o("agentClass"),void 0,a)).concat(c.statementsMatching(n,o("agentGroup"),void 0,a)).concat(c.statementsMatching(n,o("origin"),void 0,a)).concat(c.statementsMatching(n,o("originClass"),void 0,a)).concat(c.statementsMatching(n,o("mode"),void 0,a)).concat((0,r.st)(n,o("accessTo"),e,a)).concat(s?(0,r.st)(n,o("default"),e,a):[]),[]),p=(0,r.graph)();return l.forEach(e=>p.add(u(e.subject),u(e.predicate),u(e.object),(0,r.sym)(t.uri))),p;function u(e){const n=a.uri.length;return(0,r.sym)(e.uri.slice(0,n)===a.uri?t.uri+e.uri.slice(n):e.uri)}}function p(e,t,n=c,a=!1){const o=a?function(t,n){return t.each(void 0,n.acl("default"),e).concat(t.each(void 0,n.acl("defaultForNew"),e))}(n,i.A):n.each(void 0,i.A.acl("accessTo"),e),s=i.A.acl,r={agent:{},agentClass:{},agentGroup:{},origin:{},originClass:{}};return Object.keys(r).forEach(e=>{o.forEach(function(t){n.each(t,s("mode")).forEach(function(i){n.each(t,s(e)).forEach(function(n){r[e][n.uri]=r[e][n.uri]||{},r[e][n.uri][i.uri]=t})})})}),r}function u(e,t){const n=function(e,t){for(const n in{agent:!0,agentClass:!0,agentGroup:!0,origin:!0,originClass:!0})if(e[n])for(const i in e[n])for(const a in e[n][i])if(!t[n][i]||!t[n][i][a])return!1;return!0};return n(e,t)&&n(t,e)}function d(e){const t=e[0];let n,i;for(let a=1;a<e.length;a++)["agent","agentClass","agentGroup","origin","originClass"].forEach(function(o){if(n=e[a],n[o])for(i in n[o])for(const e in n[o][i])t[o][i]||(t[o][i]=[]),t[o][i][e]=!0});return t}function m(e,t){const n=[],i=function(e){if(e.length){k(e.shift().doc(),function(a,o,s,r,c,l){const u=!o;if(!a||!c||!l)return t(a,r);const d=p(u?c:s);n.push(d),i(e.slice(1))})}else t(!0,d(n))};i(e)}function f(e){const t={};return["agent","agentClass","agentGroup","origin","originClass"].forEach(function(n){for(const i in e[n]){const a=[];for(const t in e[n][i])a.push(t);a.sort();const o=a.join("\n");t[o]||(t[o]=[]),t[o].push([n,i])}}),t}function h(e,t,n,i){return g(e,t,f(n),i)}function g(e,t,n,a,o,s){const r=i.A.acl;for(const c in n){const l=n[c];if(!l.length)continue;const p=c.split("\n");let u=p.map(function(e){return e.split("#")[1]}).join("");s&&!o&&(u+="Default");const d=e.sym(a.uri+"#"+u);e.add(d,i.A.rdf("type"),r("Authorization"),a),o&&e.add(d,r("accessTo"),t,a),s&&e.add(d,r("default"),t,a);for(let t=0;t<p.length;t++)e.add(d,r("mode"),e.sym(p[t]),a);for(let t=0;t<l.length;t++){const n=l[t][0],i=l[t][1];e.add(d,r(n),e.sym(i),a)}}}function b(e){return v(f(e))}function v(e){let t="";for(const n in e){t+=n.split("\n").map(function(e){return e.split("#")[1][0]}).join("")+":";const a=e[n];for(let e=0;e<a.length;e++){const n=a[e][0],s=(0,r.sym)(a[e][1]);t+="agent"===n?"@":"",t+=s.sameTerm(i.A.foaf("Agent"))?"*":o.label(s),e<a.length-1&&(t+=",")}t+=";"}return"{"+t.slice(0,-1)+"}"}function x(e,t,n){const i=(0,r.graph)();return h(i,e,t,n),(0,r.serialize)(n,i,n.uri,"text/turtle")||""}function y(e,t,n,i,a){return w(e,t,f(n),i,a)}function w(e,t,n,i,a){const o=(0,r.graph)();g(o,t,n,i,!0),e.updater?.put(i,o.statementsMatching(void 0,void 0,void 0,i),"text/turtle",function(o,s,r){s?(e.fetcher?.unload(i),g(e,t,n,i,!0),e.fetcher.requested[i.uri]="done",a(s)):a(s,r)})}function A(e,t,n){const a=c.each(void 0,i.A.vcard("hasMember"),e);a?C(e,a,t,n):(t("This card is in no groups"),n(!0))}function C(e,t,n,i){n=n||s.Rm;const a=e.doc();k(a,function(s,r,l,d,f,h){if(!s||!f||!h)return i(!1,d);const g=p(r?l:f);m(t,function(t,s){if(!t)return i(!1,s);u(s,g)?n("Nice - same ACL. no change "+o.label(e)+" "+a):(n("Group ACLs differ for "+o.label(e)+" "+a),y(c,l,s,d,i))})})}function E(e,t,n){const i=c.any(e,a.ACL_LINK);if(!c.fetcher)throw new Error("Store has no fetcher");i?c.fetcher.webOperation("PUT",i.value,{data:t,contentType:"text/turtle"}).then(e=>{n(e.ok,e.error||"")}):c.fetcher.nowOrWhenFetched(e,void 0,function(i,o){if(!i)return n(i,"Gettting headers for ACL: "+o);const s=c.any(e,a.ACL_LINK);if(s){if(!c.fetcher)throw new Error("Store has no fetcher");c.fetcher.webOperation("PUT",s.value,{data:t,contentType:"text/turtle"}).then(e=>{n(e.ok,e.error||"")})}else n(!1,"No Link rel=ACL header for "+e)})}function k(e,t){_(e,function(n,a,o,s){const l=i.A.acl;if(!n)return t(!1,!1,a,s);const p=function(n){"/"===n.slice(-1)&&(n=n.slice(0,-1));const i=n.lastIndexOf("/");if(n.indexOf("/",n.indexOf("//")+2)>i)return t(!1,!0,404,"Found no ACL resource");n=n.slice(0,i+1);const a=(0,r.sym)(n);_(a,function(i,s,r){if(!i)return t(!1,!0,s,`( No ACL pointer ${n} ${s})${r}`);if(403===s)return t(!1,!0,s,`( default ACL file FORBIDDEN. Stop.${n})`);if(404===s)return p(n);if(200!==s)return t(!1,!0,s,`Error status '${s}' searching for default for ${a}`);if(!c.each(void 0,l("default"),c.sym(n),r).concat(c.each(void 0,l("defaultForNew"),c.sym(n),r)).length)return p(n);const u=c.sym(n);return t(!0,!1,e,o,u,r)})};return n?404!==a?403===a?t(!1,!1,a,`(Sharing not available to you)${s}`):200!==a?t(!1,!1,a,`Error ${a} accessing Access Control information for ${e}: ${s}`):t(!0,!0,e,o):void p(e.uri):t(!1,!1,a,`Error accessing Access Control information for ${e}) ${s}`)})}function _(e,t){if(!c.fetcher)throw new Error("kb has no fetcher");c.fetcher.nowOrWhenFetched(e,void 0,function(n,i){if(!n)return t(n,`Can't get headers to find ACL for ${e}: ${i}`);const o=c.any(e,a.ACL_LINK);if(o){if(!c.fetcher)throw new Error("kb has no fetcher");if(c.fetcher.nonexistent[o.value])return t(!0,404,o,`ACL file ${o} does not exist.`);c.fetcher.nowOrWhenFetched(o,void 0,function(e,n,i){e?t(!0,200,o):t(!0,i.status,o,`Can't read Access Control File ${o}: ${n}`)})}else t(!1,900,`No Link rel=ACL header for ${e}`)})}async function T(e){return new Promise((t,n)=>k((0,r.sym)(e),(i,a,o,s,r)=>i?t(a?o:r):n(new Error(`Error loading ${e}`))))}},1928(e,t,n){n.d(t,{g:()=>p});var i=n(7423),a=n(3378),o=n(967),s=n(1795),r=n(52),c=n(4608),l=n(675);class p{rootElement;barElement;isExpanded=!1;constructor(e){this.groupList=e,this.rootElement=e.controller.dom.createElement("div"),this.barElement=e.controller.dom.createElement("div")}render(){return this.rootElement.innerHTML="",this.rootElement.appendChild(this.renderAddButton()),this.rootElement.appendChild(this.barElement),this.rootElement}renderAddButton(){return c.button(this.groupList.controller.dom,`${a.Pt.iconBase}noun_34653_green.svg`,"Add ...",()=>{this.toggleBar(),this.renderBar()})}renderBar(){this.barElement.innerHTML="",this.isExpanded&&(this.barElement.appendChild(this.renderPersonButton()),this.barElement.appendChild(this.renderGroupButton()),this.barElement.appendChild(this.renderPublicButton()),this.barElement.appendChild(this.renderAuthenticatedAgentButton()),this.barElement.appendChild(this.renderBotButton()),this.barElement.appendChild(this.renderAppsButton()))}renderSimplifiedBar(e){Array.from(this.barElement.children).filter(t=>t!==e).forEach(e=>this.barElement.removeChild(e))}renderPersonButton(){return c.button(this.groupList.controller.dom,a.Pt.iconBase+c.iconForClass["vcard:Individual"],"Add Person",e=>{this.renderSimplifiedBar(e.target),this.renderNameForm(s.A.vcard("Individual"),"person").then(e=>this.addPerson(e)).then(()=>this.renderCleanup()).catch(e=>this.groupList.controller.renderStatus(e))})}renderGroupButton(){return c.button(this.groupList.controller.dom,a.Pt.iconBase+c.iconForClass["vcard:Group"],"Add Group",e=>{this.renderSimplifiedBar(e.target),this.renderNameForm(s.A.vcard("Group"),"group").then(e=>this.addGroup(e)).then(()=>this.renderCleanup()).catch(e=>this.groupList.controller.renderStatus(e))})}renderNameForm(e,t){return c.askName(this.groupList.controller.dom,this.groupList.store,this.barElement,s.A.vcard("URI"),e,t)}renderPublicButton(){return c.button(this.groupList.controller.dom,a.Pt.iconBase+c.iconForClass["foaf:Agent"],"Add Everyone",()=>this.addAgent(s.A.foaf("Agent").uri).then(()=>this.groupList.controller.renderTemporaryStatus("Adding the general public to those who can read. Drag the globe to a different level to give them more access.")).then(()=>this.renderCleanup()))}renderAuthenticatedAgentButton(){return c.button(this.groupList.controller.dom,`${a.Pt.iconBase}noun_99101.svg`,"Anyone logged In",()=>this.addAgent(s.A.acl("AuthenticatedAgent").uri).then(()=>this.groupList.controller.renderTemporaryStatus("Adding anyone logged in to those who can read. Drag the ID icon to a different level to give them more access.")).then(()=>this.renderCleanup()))}renderBotButton(){return c.button(this.groupList.controller.dom,a.Pt.iconBase+"noun_Robot_849764.svg","A Software Agent (bot)",e=>{this.renderSimplifiedBar(e.target),this.renderNameForm(s.A.schema("Application"),"bot").then(e=>this.addBot(e)).then(()=>this.renderCleanup())})}renderAppsButton(){return c.button(this.groupList.controller.dom,`${a.Pt.iconBase}noun_15177.svg`,"A Web App (origin)",e=>{this.renderSimplifiedBar(e.target);const t={div:this.barElement,dom:this.groupList.controller.dom},n=this.renderAppsTable(t).catch(e=>this.groupList.controller.renderStatus(e));this.renderAppsView();const i=this.renderNameForm(s.A.schema("WebApplication"),"webapp domain").then(e=>this.getOriginFromName(e));Promise.race([n,i]).then(e=>{e&&this.groupList.addNewURI(e)}).then(()=>this.renderCleanup())})}renderAppsView(){const e=this.groupList.controller.context.session.paneRegistry.byName("trustedApplications");if(e){const t=e.render(null,this.groupList.controller.context);t.setAttribute("style",l.i.trustedAppController);const n=c.cancelButton(this.groupList.controller.dom,()=>this.renderCleanup());n.setAttribute("style",l.i.trustedAppCancelButton),t.insertBefore(n,t.firstChild),this.barElement.appendChild(t)}}async renderAppsTable(e){await(0,o.ensureLoadedProfile)(e);const t=this.groupList.store.each(e.me,s.A.acl("trustedApp")),n=t.flatMap(e=>this.groupList.store.each(e,s.A.acl("origin")));return this.barElement.appendChild(this.groupList.controller.dom.createElement("p")).textContent=`You have ${n.length} selected web apps.`,new Promise((e,n)=>{const i=this.barElement.appendChild(this.groupList.controller.dom.createElement("table"));i.setAttribute("style",l.i.trustedAppAddApplicationsTable),t.forEach(t=>{const a=this.groupList.store.any(t,s.A.acl("origin"));a||n(new Error(`Unable to pick app: ${t.value}`));const o=c.personTR(this.groupList.controller.dom,s.A.acl("origin"),a,{}),l=this.groupList.controller.dom.createElement("table"),p=l.appendChild(this.groupList.controller.dom.createElement("tr"));p.appendChild(this.groupList.controller.dom.createElement("td")).appendChild(o);p.appendChild(this.groupList.controller.dom.createElement("td")).textContent=`Give access to ${this.groupList.controller.noun} ${r.label(this.groupList.controller.subject)}?`;p.appendChild(this.groupList.controller.dom.createElement("td")).appendChild(c.continueButton(this.groupList.controller.dom,()=>e(a.value))),i.appendChild(l)})})}renderCleanup(){this.renderBar(),this.groupList.render()}async addPerson(e){if(!e)return this.toggleBar();if(!e.match(/^https?:/i))return Promise.reject(new Error("Not a http URI"));i.Rm(`Adding to ACL person: ${e}`),await this.groupList.addNewURI(e),this.toggleBar()}async addGroup(e){if(!e)return this.toggleBar();if(!e.match(/^https?:/i))return Promise.reject(new Error("Not a http URI"));i.Rm("Adding to ACL group: "+e),await this.groupList.addNewURI(e),this.toggleBar()}async addAgent(e){await this.groupList.addNewURI(e),this.toggleBar()}async addBot(e){if(!e)return this.toggleBar();if(!e.match(/^https?:/i))return Promise.reject(new Error("Not a http URI"));i.Rm("Adding to ACL bot: "+e),await this.groupList.addNewURI(e),this.toggleBar()}async getOriginFromName(e){if(!e)return Promise.resolve();if(!e.match(/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i))return Promise.reject(new Error("Not a domain name"));const t="https://"+e;return i.Rm("Adding to ACL origin: "+t),this.toggleBar(),t}toggleBar(){this.isExpanded=!this.isExpanded}}},5923(e,t,n){n.d(t,{B:()=>o,u:()=>s});var i=n(5619),a=n(7367);const o={adoptACLDefault:i._E,readACL:i.fg,sameACL:i.P3,ACLunion:i._7,loadUnionACL:i.Uf,ACLbyCombination:i.xw,makeACLGraph:i.Tm,makeACLGraphbyCombo:i.cl,ACLToString:i.Lu,comboToString:i.D9,makeACLString:i.cH,putACLObject:i.xo,putACLbyCombo:i.H0,fixIndividualCardACL:i.pp,fixIndividualACL:i.n1,setACL:i.fb,getACLorDefault:i.VM,getACL:i.pe},s={preventBrowserDropEvents:a.Fp,shortNameForFolder:a.DR,ACLControlBox5:a.wR}},7236(e,t,n){n.d(t,{eD:()=>w,z6:()=>x});var i=n(7423),a=n(3378),o=n(6127),s=n(1795),r=n(8153),c=n(4961),l=n(675),p=n(52),u=n(4608),d=n(3138),m=n(967);const f={icons:a.Pt,ns:s.A,media:o.$,pad:r,style:l.i,utils:p,widgets:u},h=c.Namespace("http://www.w3.org/2002/01/bookmark#"),g=p.label,b=window.document||null;function v(e,t){return new Promise(function(n,i){d.store.updater.update(e,t,function(e,t,a){t?n():i(new Error(a))})})}async function x(e){const t=h("Bookmark");if(await(0,m.findAppInstances)(e,t,!0),e.instances&&e.instances.length>0)e.bookmarkDocument=e.instances[0],e.instances.length>1&&i.R8("More than one bookmark file! "+e.instances);else if(e.publicProfile){const n=c.sym(e.publicProfile.dir().uri+"bookmarks.ttl");try{i.Rm("Creating new bookmark file "+n),await d.store.fetcher.createIfNotExists(n)}catch(t){return i.R8("Can't make fresh bookmark file:"+t),e}await d.createTypeIndexLogic.registerInTypeIndex(n,e.index,t),e.bookmarkDocument=n}else i.R8("You seem to have no bookmark file, nor even a profile file!");return e}async function y(e,t,n){await d.store.fetcher.load(e.bookmarkDocument);const a=d.store.each(null,h("recalls"),t,e.bookmarkDocument);if(a.length){if(!confirm("Delete bookmark on this?"+a.length))return;for(let e=0;e<a.length;e++)try{await v(d.store.connectedStatements(a[e]),[]),n.style.backgroundColor="white",i.Rm("Bookmark deleted: "+a[e])}catch(e){i.z3("Cant delete bookmark:"+e),i.R8("Cannot delete bookmark:"+e)}}else{const a=await async function(e,t){let n="";const a=d.authn.currentUser();if(!a)throw new Error("Must be logged on to add Bookmark");const o=d.store.any(t,s.A.foaf("maker"));n=g(o)+": "+d.store.anyValue(t,s.A.sioc("content")).slice(0,80);const r=e.bookmarkDocument,l=f.widgets.newThing(r,n),p=[c.st(r,f.ns.dct("references"),l,r),c.st(l,f.ns.rdf("type"),h("Bookmark"),r),c.st(l,f.ns.dct("created"),new Date,r),c.st(l,h("recalls"),t,r),c.st(l,f.ns.foaf("maker"),a,r),c.st(l,f.ns.dct("title"),n,r)];try{await v([],p)}catch(e){const t="Making bookmark: "+e;return i.R8(t),null}return l}(e,t);n.style.backgroundColor="yellow",i.Rm("Bookmark added: "+a)}}async function w(e,t){let n;if(e.bookmarkDocument)return n=f.widgets.button(b,f.icons.iconBase+"noun_45961.svg",g(h("Bookmark")),()=>{y(e,t,n)}),n.target=t,await async function(t){await d.store.fetcher.load(e.bookmarkDocument);const n=d.store.any(null,h("recalls"),t.target,e.bookmarkDocument);t.style=f.style.buttonStyle,n&&(t.style.backgroundColor="yellow")}(n),n}},2465(e,t,n){n.d(t,{YM:()=>p,n6:()=>m,oQ:()=>d,oy:()=>f,x6:()=>u});var i=n(7423),a=n(2893),o=n(3138),s=n(1795),r=n(4961),c=(n(52),n(630)),l=n(6855);class p{constructor(e,t){this.channel=e,this.channelRoot=e.doc(),this.options=t,this.dateFolder=new a.J(this.channelRoot,"chat.ttl"),this.div=null}async createMessage(e){return this.updateMessage(e)}async updateMessage(e,t=null,n,a=null){const p=[],u=new Date,d=""+u.getTime(),f=r.term(u),h=t?t.doc():this.dateFolder.leafDocumentFromDate(u),g=o.store.sym(h.uri+"#Msg"+d),b=o.authn.currentUser(),v=(0,c.YJ)();if(v.id=g.uri,t){const e=o.store.any(t,s.A.foaf("maker"));if(e.uri!==b.uri){const t="Error you cannot delete/edit a message from someone else : \n"+e.uri;throw i.R8(t),alert(t),new Error(t)}{const e=await m(t);p.push(r.st(e,s.A.dct("isReplacedBy"),g,h));const i=o.store.any(e,s.A.sioc("has_reply"));i&&p.push(r.st(g,s.A.sioc("has_reply"),i,h)),n&&p.push(r.st(g,s.A.schema("dateDeleted"),f,h))}}else p.push(r.st(this.channel,s.A.wf("message"),g,h));if(p.push(r.st(g,s.A.sioc("content"),o.store.literal(e),h)),v.content=e,p.push(r.st(g,s.A.dct("created"),f,h)),v.created=f.value,b){p.push(r.st(g,s.A.foaf("maker"),b,h)),v.maker=b.uri;const e=await(0,l.Tn)(b),t=(0,c.vt)(v,e);p.push(r.st(g,r.sym(`${c.yv}proofValue`),r.lit(t),h))}a&&(p.push(r.st(a,s.A.sioc("has_member"),g,h)),a.doc().sameTerm(g.doc())||p.push(r.st(a,s.A.sioc("has_member"),g,a.doc())));try{await o.store.updater.updateMany([],p)}catch(e){const t="Error saving chat message: "+e;throw i.R8(t),alert(t),new Error(t)}return g}async deleteMessage(e){return this.updateMessage("(message deleted)",e,!0)}async createThread(e){const t=o.store.each(e,s.A.sioc("has_reply"),null,e.doc()).filter(e=>o.store.holds(e,s.A.rdf("type"),s.A.sioc("Thread"),e.doc()));if(t.length>0)return t[0];const n=r.sym(e.uri+"-thread"),i=[r.st(n,s.A.rdf("type"),s.A.sioc("Thread"),n.doc()),r.st(e,s.A.sioc("has_reply"),n,n.doc())];return await o.store.updater.update([],i),n}}async function u(e){const t=[e],n={};n[e.uri]=!0;let i=e;for(;;){const e=o.store.any(null,s.A.dct("isReplacedBy"),i,i.doc());if(!e||n[e.uri])break;await o.store.fetcher.load(e),t.unshift(e),n[e.uri]=!0,i=e}for(i=e;;){const e=o.store.any(i,s.A.dct("isReplacedBy"),null,i.doc());if(!e||n[e.uri])break;t.push(e),n[e.uri]=!0,i=e}return t}async function d(e){let t=e;const n={};for(;t;){if(n[t.uri])return i.z3("originalVersion: verion loop"+e),e;n[t.uri]=!0,e=t,await o.store.fetcher.load(e),t=o.store.any(null,s.A.dct("isReplacedBy"),e,e.doc())}return e}async function m(e){let t=e;const n={};for(;t;){if(n[t.uri])return i.z3("mostRecentVersion: verion loop"+e),e;n[t.uri]=!0,e=t,await o.store.fetcher.load(e),t=o.store.any(e,s.A.dct("isReplacedBy"),null,e.doc())}return e}function f(e){return o.store.holds(e,s.A.schema("dateDeleted"),null,e.doc())}},2893(e,t,n){n.d(t,{J:()=>c});var i=n(7423),a=n(3138),o=n(1795),s=n(4961);async function r(e){return await a.store.fetcher.load(e),!(a.store.statementsMatching(null,o.A.dct("created"),null,e).length>0)}class c{constructor(e,t,n){this.root=e,this.rootFolder=e.dir(),this.leafFileName=t||"index.ttl",this.membershipProperty=n||o.A.wf("leafObject")}leafDocumentFromDate(e){let t=e.toISOString().split("T")[0].replace(/-/g,"/");return t=this.root.dir().uri+t+"/"+this.leafFileName,a.store.sym(t)}dateFromLeafDocument(e){const t=this.rootFolder.uri.length,n=e.uri.slice(t,t+10).replace(/\//g,"-");return new Date(n)}async loadPrevious(e,t){async function n(e,s){function r(e){const t=e.uri.slice(0,-1).split("/").slice(-1)[0];return!!"0123456789".includes(t[0])}function c(e){return(e=e.filter(r)).sort(),t||e.reverse(),e.pop()}const l=e.dir();try{await a.store.fetcher.load(l);let n=a.store.each(l,o.A.ldp("contains"));n=n.filter(function(n){return!(t?n.uri>=e.uri:n.uri<=e.uri)});const i=c(n);if(i)return i}catch(e){if(!e.response||!e.response.status||404!==e.response.status)throw i.Rm("*** Error NON 404 for chat parent file "+l),new Error(`*** ${e.message} for chat folder ${l}`);i.Rm("Error 404 for chat parent file "+l)}if(0===s)return null;const p=await n(l,s-1);if(!p)return null;await a.store.fetcher.load(p);return c(a.store.each(p,o.A.ldp("contains")))}let s=this.leafDocumentFromDate(e).dir();for(;;){const t=await n(s,3);if(!t)return null;{const n=a.store.sym(t.uri+this.leafFileName),i=this.dateFromLeafDocument(n);if(!await r(n))return i;e=i,s=this.leafDocumentFromDate(e).dir()}}}async firstLeaf(e){const t=s.graph(),n=new s.Fetcher(t);async function a(i){delete n.requested[i.uri],await n.load(i,{force:!0});let a=t.each(i,o.A.ldp("contains"));if(a=a.filter(function(e){const t=e.uri.slice(0,-1).split("/").slice(-1)[0];return!!"0123456789".includes(t[0])}),0===a.length)throw new Error(" @@@ No children to parent2 "+i);return a.sort(),e&&a.reverse(),a[0]}const r=await a(this.root.dir()),c=await a(r),l=await a(c),p=s.sym(l.uri+"chat.ttl");await n.load(p);const u=t.each(this.root,this.membershipProperty,null,p);if(0===u.length){const e=" INCONSISTENCY -- no chat leafObject in file "+p;throw i.uP(e),new Error(e)}const d=u.map(e=>[t.any(e,o.A.dct("created")),e]);return d.sort(),e&&d.reverse(),d[0][1]}}},9509(e,t,n){n.d(t,{r5:()=>u,rg:()=>p});var i=n(4961),a=n(3138),o=n(7423),s=(n(3378),n(1795)),r=n(4608),c=n(2465),l=n(3262);async function p(e,t,n,i,a,o){const s=await(0,l.Uh)(e,n,i,a,o);a.selectedMessage&&a.selectedMessage.sameTerm(n)&&(s.style.backgroundColor="yellow",a.selectedElement=s,t.selectedElement=s);let r=!1;for(let e=t.firstChild;e;e=e.nextSibling){const n=!0===a.newestfirst,i=s.AJAR_date;if(i>e.AJAR_date&&n||i<e.AJAR_date&&!n){t.insertBefore(s,e),r=!0;break}}r||t.appendChild(s)}async function u(e,t,n,u){async function d(e,t){if((0,c.oy)(e)&&!u.showDeletedMessages)return;let n=a.store.any(null,s.A.sioc("has_member"),e,e.doc());const i=a.store.any(e,s.A.sioc("id"),null,e.doc());if(i&&!n&&(n=a.store.any(null,s.A.sioc("has_member"),i,e.doc())),u.thread){if(a.store.holds(e,s.A.sioc("has_reply"),u.thread));else if(!n||!n.sameTerm(u.thread))return}else if(n)return;t.fresh||await p(x,t,e,t.fresh,u,C)}async function m(e){const t=e?_:T;let n=t.messageTable.date;if(e&&_.limit&&n<=_.limit)return E||await g(),!0;if(n=await y.loadPrevious(n,e),n||e||E||await g(),!n)return!0;let i=!1;if(!e){const e=y.leafDocumentFromDate(new Date);i=y.leafDocumentFromDate(n).sameTerm(e)}const a=await f(n,i);return t.messageTable=a,(e?v:!v)?w.appendChild(a):w.insertBefore(a,w.firstChild),i}async function f(t,n){const i=y.leafDocumentFromDate(t);try{await a.store.fetcher.createIfNotExists(i)}catch(a){const s=e.createElement("table").appendChild(e.createElement("tr"));return a.response&&a.response.status&&404===a.response.status?await h(t,n):(o.Rm("*** Error NON 404 for chat file "+i),s.appendChild(r.errorMessageBlock(e,a,"pink")),s)}return await h(t,n)}async function h(t,n){async function i(){return await m(!1)}const o=e.createElement("table");o.style.width="100%",o.extendBackwards=async function(){const e=await m(!0);return e?o.initial=!0:o.extendedBack=!0,e},o.extendForwards=i,o.date=t;const c=y.leafDocumentFromDate(t);if(o.chatDocument=c,o.fresh=!1,o.setAttribute("style","width: 100%;"),n){o.final=!0,E=o,T.messageTable=o;const e=(0,l.LV)(x,o,C,u);v?o.insertBefore(e,o.firstChild):o.appendChild(e),o.inputRow=e}{const n=e.createElement("tr"),i=n.appendChild(e.createElement("td"));i.style="text-align: center; vertical-align: middle; color: #888; font-style: italic;",i.textContent=r.shortDate(t.toISOString(),!0);const a=n.appendChild(e.createElement("td"));u.includeRemoveButton&&a.appendChild(r.cancelButton(e,e=>{w.parentNode.removeChild(w)})),o.extendedForwards=!1,v?o.appendChild(n):o.insertBefore(n,o.firstChild)}const p=a.store.statementsMatching(null,s.A.wf("message"),null,c);!n&&p.length;for(const e of p)await d(e.object,o);return o.fresh=!0,o}async function g(){const e=new Date,t=y.leafDocumentFromDate(e),c=await f(e,!0);return w.appendChild(c),w.refresh=async function(){var e;await async function(){const e=y.leafDocumentFromDate(new Date);if(!e.sameTerm(T.messageTable.chatDocument)){E.inputRow&&(E.removeChild(E.inputRow),delete E.inputRow);const t=T.messageTable.chatDocument;if(await g(),!a.store.holds(t,s.A.rdfs("seeAlso"),e,t)){const n=[i.st(t,s.A.rdfs("seeAlso"),e,t)];try{a.store.updater.update([],n)}catch(e){alert("Unable to link old chat file to new one:"+e)}}}}(new Date),await async function(e,t){const n={};let i,o;for(i=t.firstChild;i;i=i.nextSibling)i.AJAR_subject&&(n[i.AJAR_subject.uri]=!0);const c=a.store.each(e,s.A.wf("message"),null,t.chatDocument),l={};for(const e of c)l[e.uri]=!0,n[e.uri]||await d(e,t);for(i=t.firstChild;i;)o=i.nextSibling,i.AJAR_subject&&!l[i.AJAR_subject.uri]&&t.removeChild(i),i=o;for(i=t.firstChild;i;i=i.nextSibling)i.AJAR_subject&&r.refreshTree(i)}(n,c),e=n,"Notification"in window?"granted"===Notification.permission?new Notification(e):"denied"!==Notification.permission&&Notification.requestPermission().then(function(t){"granted"===t&&new Notification(e)}):o.R8("This browser does no t support desktop notification")},a.store.updater.addDownstreamChangeListener(t,w.refresh),E=c,T.messageTable=E,c}async function b(e,t){if(S)return;S=!0;const n=!t;let i;for(;w.scrollTop<150&&_.messageTable&&!_.messageTable.initial&&_.messageTable.extendBackwards;){if(0===w.scrollHeight)return setTimeout(b,2e3),void(S=!1);const e=w.scrollHeight-w.scrollTop;if(i=await _.messageTable.extendBackwards(),n&&(w.scrollTop=w.scrollHeight-e),t&&t(),i)break}for(;u.selectedMessage&&w.scrollHeight-w.scrollTop-w.clientHeight<150&&T.messageTable&&!T.messageTable.final&&T.messageTable.extendForwards;){const e=w.scrollTop;if(i=await T.messageTable.extendForwards(),n&&(w.scrollTop=e),t&&t(),i)break}S=!1}(u=u||{}).authorDateOnLeft=!1;const v="1"===u.newestFirst||!0===u.newestFirst,x=new c.YM(n,u),y=x.dateFolder,w=e.createElement("div");x.div=w;const A=w.appendChild(e.createElement("div")),C={dom:e,statusArea:A,div:A};let E,k;const _={messageTable:null},T={messageTable:null};if(u.thread){const e=u.thread;if(k=a.store.any(null,s.A.sioc("has_reply"),e,e.doc()),k){const e=a.store.any(k,s.A.dct("created"),null,k.doc());e&&(_.limit=new Date(e.value))}}let S=!1;return await async function(){function e(){o&&o.selectedElement&&o.selectedElement.scrollIntoView({block:"center"})}let t,n,i;u.selectedMessage&&(n=u.selectedMessage.doc()),k&&(i=k.doc());const a=n||i;if(a){const e=new Date;t=y.leafDocumentFromDate(e).sameTerm(a)}let o;if(a&&!t){const n=y.dateFromLeafDocument(a);o=await f(n,t),w.appendChild(o),_.messageTable=o,T.messageTable=o,e(),setTimeout(e,1e3)}else await g(),_.messageTable=E,T.messageTable=E;await b(0,function(){u.selectedElement?u.selectedElement.scrollIntoView({block:"center"}):E.inputRow.scrollIntoView&&E.inputRow.scrollIntoView(v)}),w.addEventListener("scroll",b),u.solo&&document.body.addEventListener("scroll",b)}(),w}},6855(e,t,n){n.d(t,{Tn:()=>m,lG:()=>d});var i=n(7423),a=n(6885),o=n(508),s=n(1795),r=n(3138),c=n(4961),l=n(8425),p=n(3907);function u(e){return(0,o.My)(a.ko.getPublicKey((0,o.aT)(e)))}async function d(e){await r.store.fetcher.load(e);const t=await(0,l.AB)(e);try{await r.store.fetcher.load(t);const n=r.store.any(e,s.A.solid("publicKey"));return n?.value}catch(e){return}}async function m(e){await r.store.fetcher.load(e);const t=await(0,l.AB)(e),n=await(0,l.ED)(e),d=await(0,l.S3)(e,t);let m=await(0,l.cX)(e,n),h=!0;if(m&&d!==u(m)&&confirm("This is strange the publicKey is not valid for\n"+e?.uri+"'shall we repair keeping the private key ?")&&(h=!1),!m||!d||!h){let l=[],g=[];if(m||(m=(0,o.My)(a.ko.utils.randomSecretKey()),g=[c.st(e,s.A.solid("privateKey"),c.literal(m),r.store.sym(n))],await f(n,[],g,e.uri)),!d||!h){l=[],d&&(l=[c.st(e,s.A.solid("publicKey"),c.lit(d),r.store.sym(t))],i.Rm("delete invalid publicKey "+l));const n=u(m);g=[c.st(e,s.A.solid("publicKey"),c.literal(n),r.store.sym(t))],await f(t,l,g)}const b=n.substring(0,n.lastIndexOf("/")+1);await(0,p.lO)(b,(0,p.vb)(e.uri))}return m}async function f(e,t,n,a=""){await(async e=>{await r.store.fetcher.load(e);const t=r.store.any(r.store.sym(e),r.store.sym("http://www.iana.org/assignments/link-relations/acl"));if(t)try{const e=await r.store.fetcher.webOperation("DELETE",t.value);i.Rm("delete keyAcl"+t.value+" "+e.status)}catch(e){if(404!==e.response.status)throw new Error(e);i.Rm("delete keyAcl"+t.value+" "+e.response.status)}})(e),await r.store.updater.updateMany(t,n);const o=(0,p.G2)(e,a);await(0,p.lO)(e,o)}},3262(e,t,n){n.d(t,{LV:()=>T,Uh:()=>k,zt:()=>_});var i=n(9509),a=n(5187),o=n(7236),s=n(2465),r=n(7423),c=n(3378),l=n(3138),p=n(967),u=n(6127),d=n(1795),m=n(8153),f=n(675),h=n(52),g=n(4608),b=n(630),v=n(6855);const x=window.document,y=f.i.messageBodyStyle,w=h.label;const A=function(e,t){const n=x.createElement("a");return t&&t.uri&&(n.setAttribute("href",t.uri),n.addEventListener("click",g.openHrefInOutlineMode,!0),n.setAttribute("style","color: #3B5998; text-decoration: none; ")),n.textContent=e,n};function C(e){const t=l.store.any(e,d.A.foaf("nick"));return t?""+t.value:""+w(e)}function E(e,t,n,i){const a=e.appendChild(A(C(t),t));t.uri&&l.store.fetcher.nowOrWhenFetched(t.doc(),void 0,function(e,n){a.textContent=C(t)}),e.appendChild(x.createElement("br")),e.appendChild(A(n,i))}async function k(e,t,n,i,o){let p=!1;const u="1"===i.colorizeByAuthor||!0===i.colorizeByAuthor,f=l.store.any(t,d.A.foaf("maker")),h=l.store.any(t,d.A.dct("created")),k=await(0,s.n6)(t),_=l.store.any(k,d.A.foaf("maker")),T=f.uri===_?.uri?k:t,S=l.store.any(T,d.A.sioc("content")),L=await(0,s.x6)(T);L.length>1&&r.Rm("renderMessageRow versions: ",L.join(", "));const j=L.map(e=>l.store.each(e,d.A.sioc("has_reply"))).flat();let R=null;const N=[];for(const e of j)l.store.holds(e,d.A.rdf("type"),d.A.sioc("Thread"))?(R=e,r.Rm("renderMessageRow: found thread: "+R)):N.push(e);N.length>1&&r.Rm("renderMessageRow: found normal replies: ",N),R||(R=l.store.any(null,d.A.sioc("has_member"),t));const B=l.store.any(T,$rdf.sym(`${b.yv}proofValue`)),I=(0,b.YJ)();I.id=T.uri,I.created=l.store.any(T,d.A.dct("created")).value,I.content=S.value,I.maker=f.uri,B?.value?(0,v.lG)(f).then(e=>{e||r.R8("message is signed but "+f.uri+" is missing publicKey");e?.match(/[0-9A-Fa-f]{6}/g)?B?.value&&!(0,b.Od)(B?.value,I,e)&&r.R8("invalid signature\n"+I.id):r.R8("invalid publicKey hex string\n"+f.uri+"\n"+e)}):(p=!0,r.R8(T.uri+" is unsigned"));const O=await(0,s.oQ)(t),D=!t.sameTerm(O),$=l.store.the(O,d.A.dct("created"),null,O.doc())||l.store.the(t,d.A.dct("created"),null,t.doc()),M=x.createElement("tr");p&&M.setAttribute("style","background-color: red"),M.AJAR_date=$.value,M.AJAR_subject=t;const F=x.createElement("td");if(M.appendChild(F),i.authorDateOnLeft)E(F,f,g.shortDate($.value),t);else{const e=x.createElement("img");e.setAttribute("style","max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;"),g.setImage(e,f),F.appendChild(e)}let P=g.shortDate($.value);D&&(P+=" ... "+g.shortDate(h.value));const U=M.appendChild(x.createElement("td"));i.authorDateOnLeft||function(e,t,n,i){const a=e.appendChild(A(w(t),t));t.uri&&l.store.fetcher.nowOrWhenFetched(t.doc(),void 0,function(e,n){a.textContent=C(t)});const o=e.appendChild(A(n,i));o.style.fontSize="80%",o.style.marginLeft="1em",e.appendChild(x.createElement("br"))}(U,f,P,t);const z=S?S.value.trim():"??? no content?";let q=null;if(/^https?:\/[^ <>]*$/i.test(z)){if(/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(z)&&i.expandImagesInline){const e=function(e,t){const n=x.createElement("img");let i="10";t.inlineImageHeightEms&&(i=(""+t.inlineImageHeightEms).trim()),n.setAttribute("style","max-height: "+i+"em; border-radius: 1em; margin: 0.7em;"),e&&n.setAttribute("src",e);const a=x.createElement("a");return a.setAttribute("href",e),a.setAttribute("target","images"),a.appendChild(n),g.makeDraggable(n,$rdf.sym(e)),a}(z,i);U.appendChild(e)}else{const e=U.appendChild(x.createElement("a"));q=e.appendChild(x.createElement("p")),e.href=z,q.textContent=z,U.appendChild(e)}}else q=x.createElement("p"),U.appendChild(q),q.textContent=z;if(q){const e=u?m.lightColorHash(f):function(e){return e?"#e8ffe8":"white"}(n);q.setAttribute("style",y+"background-color: "+e+";")}const H=await(0,a.lk)(t,t.doc());H.children.length&&(U.appendChild(x.createElement("br")),U.appendChild(H));const W=x.createElement("td");M.appendChild(W);const V=g.button(x,c.Pt.iconBase+"noun_243787.svg","...");return W.appendChild(V),V.addEventListener("click",async function(n){if(M.toolTR)return M.parentNode.removeChild(M.toolTR),void delete M.toolTR;const s=x.createElement("tr"),r=await(0,a.tJ)(t,M,{...o,chatOptions:i},e);r.style="border: 0.05em solid #888; border-radius: 0 0 0.7em 0.7em; border-top: 0; height:3.5em; background-color: #fff;",M.nextSibling?M.parentElement.insertBefore(s,M.nextSibling):M.parentElement.appendChild(s),M.toolTR=s,s.appendChild(x.createElement("td"));const c=s.appendChild(x.createElement("td"));s.appendChild(x.createElement("td")),c.appendChild(r)}),R&&i.showThread&&W.appendChild(g.button(x,c.Pt.iconBase+"noun_1180164.svg","see thread",e=>{i.showThread(R,i)})),M}async function _(e,t,n,i){const a=e.parentNode,o=T(n,a,i,n.options,await(0,s.n6)(t));a.insertBefore(o,e),o.originalRow=e,e.style.visibility="hidden"}function T(e,t,n,a,s){async function h(e){await b(L.value,!0)}async function b(o,c){let l;c&&(L.setAttribute("style",y+"color: #bbb;"),L.disabled=!0);try{l=await e.updateMessage(o,s,null,a.thread)}catch(e){return void(n.statusArea||k).appendChild(g.errorMessageBlock(x,"Error writing message: "+e))}await async function(o){if(await(0,i.rg)(e,t,o,!1,a,n),s){const e=k.originalRow;e.parentNode?e.parentNode.removeChild(e):(r.R8("No parentNode on old message "+e.textContent),e.style.backgroundColor="#fee",e.style.visibility="hidden"),k.parentNode.removeChild(k)}else c&&(L.value="",L.setAttribute("style",y),L.disabled=!1,L.scrollIntoView(a.newestFirst),L.focus(),L.select())}(l)}function v(e){const n=t.chatDocument.dir().uri;g.uploadFiles(l.store.fetcher,e,n+"Files",n+"Pictures",async function(e,t){await b(t)})}const w=async function(e){for(const t of e)await b(t)};let A,C;s?(A=l.store.anyValue(s,d.A.dct("created"),null,s.doc()),C=c.Pt.iconBase+"noun_1180158.svg"):(C=c.Pt.iconBase+"noun_383448.svg",A="9999-01-01T00:00:00Z");const k=x.createElement("tr"),_=x.createElement("td"),T=x.createElement("td"),S=x.createElement("td");let L,j;k.appendChild(_),k.appendChild(T),k.appendChild(S),k.AJAR_date=A;const R={div:T,dom:x};return(0,p.ensureLoggedIn)(R).then(t=>{!function(){if(a.menuHandler){const e=g.button(x,c.Pt.iconBase+"noun_243787.svg","More");e.setAttribute("style",f.i.buttonStyle+"float: right;"),S.appendChild(e)}a.menuHandler;const t=l.authn.currentUser();if(E(_,t,"",null),L=x.createElement("textarea"),T.innerHTML="",T.appendChild(L),L.rows=3,s&&(L.value=l.store.anyValue(s,d.A.sioc("content"),null,s.doc())),L.setAttribute("style",y+"background-color: #eef;"),L.addEventListener("keydown",async function(e){"Enter"===e.code&&(!e.shiftKey&&!a.shiftEnterSendsMessage||e.shiftKey&&a.shiftEnterSendsMessage)&&await h()},!1),g.makeDropTarget(L,w,v),S.innerHTML="",j=g.button(x,C,"Send"),j.style.float="right",j.addEventListener("click",e=>h(),!1),S.appendChild(j),s){const e=S.appendChild(g.cancelButton(x));e.style.float="left",e.addEventListener("click",e=>function(e){e.originalRow.style.visibility="visible",e.parentNode.removeChild(e)}(k),!1),S.appendChild(e)}const n=e.dateFolder.leafDocumentFromDate(new Date);let i;T.appendChild(u.$.cameraButton(x,l.store,function(){return i=$rdf.sym(n.dir().uri+"Image_"+Date.now()+".png"),i},async function(e){e&&await b(e.uri)})),m.recordParticipation(e.channel,e.channel.doc())}(),Object.assign(t,n),(0,o.z6)(t).then(e=>{})}),k}},5187(e,t,n){n.d(t,{lk:()=>h,tJ:()=>g});var i=n(7423),a=n(3378),o=n(1795),s=n(4961),r=n(52),c=n(4608),l=n(7236),p=n(3138),u=n(2465),d=n(3262);const m=window.document,f={};async function h(e,t){const n=m.createElement("span");async function a(){if(n.innerHTML="",(0,u.oy)(e))return n;const i=(await(0,u.x6)(e)).map(e=>p.store.each(null,o.A.schema("target"),e,t)).flat();if(0===i.length)return n;const a=i.map(e=>[p.store.any(e,o.A.rdf("type"),null,t),p.store.any(e,o.A.sioc("content"),null,t),p.store.any(e,o.A.schema("agent"),null,t)]);a.sort(),a.forEach(e=>{const[t,i,a]=e;let o;a?(o=m.createElement("a"),o.setAttribute("href",a.uri)):o=m.createTextNode(""),o.textContent=i||f[t]||"⬜️",n.appendChild(o)})}return a().then(i.Rm("sentimentStripLinked: sentimentStripLinked async refreshed")),n.refresh=a,n}async function g(e,t,n,f){const h=m.createElement("div");if(await(0,u.n6)(e).value===o.A.schema("dateDeleted").value)return h;function g(){h.parentElement.parentElement.removeChild(h.parentElement)}async function b(e){await p.store.updater.update(p.store.connectedStatements(e),[])}let v=p.authn.currentUser();function x(e,n,i,a,l,u){function d(){f.style.backgroundColor=v?"yellow":"white"}const f=c.button(m,i,r.label(a),async function(i){if(v)await b(v),v=null,d();else{v=c.newThing(l);const i=[s.st(v,o.A.schema("agent"),e.me,l),s.st(v,o.A.rdf("type"),a,l),s.st(v,o.A.schema("target"),n,l)];if(await p.store.updater.update([],i),d(),u){let e=!1;for(let t=0;t<u.length;t++){const n=h(u[t]);n&&(await b(n),e=!0)}e&&c.refreshTree(t)}}});function h(t){const i=p.store.each(null,o.A.schema("agent"),e.me,l).filter(e=>p.store.holds(e,o.A.rdf("type"),t,l)).filter(e=>p.store.holds(e,o.A.schema("target"),n,l));return i.length?i[0]:null}function g(){v=h(a),d()}let v;return f.refresh=g,g(),f}if(v&&p.store.holds(e,o.A.foaf("maker"),v)&&(h.appendChild(c.deleteButtonWithCheck(m,h,"message",async function(){const a=p.store.any(e,o.A.foaf("maker"));if(v)if(v.sameTerm(a)){try{await f.deleteMessage(e)}catch(e){const a="Error deleting messaage "+e;i.R8(a),alert(a),(n.statusArea||t.parentNode).appendChild(c.errorMessageBlock(m,a))}t.parentNode.removeChild(t)}else alert("You can't delete the message, you are not logged in as the author, "+a);else alert("You can't delete the message, you are not logged in.");g()})),h.appendChild(c.button(m,a.Pt.iconBase+"noun_253504.svg","edit",()=>async function(t){v.value===p.store.any(e,o.A.foaf("maker")).value&&(g(),await(0,d.zt)(t,e,f,n))}(t)))),(0,l.eD)(n).then(e=>{e&&h.appendChild(e)}),v=p.authn.currentUser(),v&&await(0,u.n6)(e).value!==o.A.schema("dateDeleted").value){const t={me:v,dom:m,div:h};h.appendChild(x(t,e,a.Pt.iconBase+"noun_1384132.svg",o.A.schema("AgreeAction"),e.doc(),[o.A.schema("DisagreeAction")])),h.appendChild(x(t,e,a.Pt.iconBase+"noun_1384135.svg",o.A.schema("DisagreeAction"),e.doc(),[o.A.schema("AgreeAction")]))}p.store.any(e,o.A.dct("created"))&&h.appendChild(c.button(m,a.Pt.iconBase+"noun-reply-5506924.svg","Reply in thread",async()=>{await async function(){const t=await f.createThread(e),i=n.chatOptions;if(!i)throw new Error("replyInThread: missing options");i.showThread(t,i),g()}()}));const y=h.appendChild(c.cancelButton(m));return y.style.float="right",y.firstChild.style.opacity="0.3",y.addEventListener("click",g),h}f[o.A.schema("AgreeAction")]="👍",f[o.A.schema("DisagreeAction")]="👎",f[o.A.schema("EndorseAction")]="⭐️",f[o.A.schema("LikeAction")]="❤️"},630(e,t,n){n.d(t,{Od:()=>p,YJ:()=>c,vt:()=>u,yv:()=>r});var i=n(6885),a=n(508),o=n(4721);new TextDecoder("utf-8");const s=new TextEncoder,r="https://w3id.org/security#";function c(){return{id:"",created:"",dateDeleted:"",content:"",maker:"",sig:""}}function l(e){const t=(0,o.sc)(s.encode((n=e,JSON.stringify(n))));var n;return(0,a.My)(t)}function p(e,t,n){return i.ko.verify((0,a.aT)(e),(0,a.aT)(l(t)),(0,a.aT)(n))}function u(e,t){return(0,a.My)(i.ko.sign((0,a.aT)(l(e)),(0,a.aT)(t)))}},8613(e,t,n){n.d(t,{T:()=>u});var i=n(3138),a=n(7423),o=n(3378),s=n(967),r=n(1795),c=n(52),l=n(4608);const p=i.solidLogicSingleton.store;function u(e,t,n){const i=e.dom,u=e.div;if(e.me&&!e.me.uri)throw new Error("newThingUI: Invalid userid: "+e.me);const d="padding: 0.7em; width: 2em; height: 2em;",m=u.appendChild(i.createElement("img"));let f=!1;m.setAttribute("src",o.Pt.iconBase+"noun_34653_green.svg"),m.setAttribute("style",d),m.setAttribute("title","Add another tool");const h=function(e){const t=u.appendChild(i.createElement("pre"));t.setAttribute("style","background-color: pink"),t.appendChild(i.createTextNode(e))};function g(e){for(let t=0;t<v.length;t++){let n=d+e;v[t].disabled&&(n+="opacity: 0.3;"),v[t].setAttribute("style",n)}}function b(e){f=!f,m.setAttribute("style",d+(f?"background-color: yellow;":"")),g(f?"":"display: none;")}m.addEventListener("click",b);const v=[],x=Object.values(n).filter(e=>e.mintNew),y=x.reduce((e,t)=>(t.mintClass&&(e[t.mintClass.uri]=(e[t.mintClass.uri]||0)+1),e),{});x.forEach(n=>{const o=e.div.appendChild(i.createElement("img"));o.setAttribute("src",n.icon);const u=n.mintClass?y[n.mintClass.uri]>1?`${c.label(n.mintClass)} (using ${n.name} pane)`:c.label(n.mintClass):n.name+" @@";o.setAttribute("title","Make new "+u),o.setAttribute("style",d+"display: none;"),v.push(o),o.disabled||o.addEventListener("click",function(m){var f;!function(e){g("display: none;"),e.setAttribute("style",d+"background-color: yellow;")}(o),f={event:m,folder:e.folder||null,iconEle:o,pane:n,noun:u,noIndexHTML:!0,div:e.div,me:e.me,dom:e.dom,refreshTarget:e.refreshTarget},new Promise(function(n,o){let u;function d(n,c){(0,s.ensureLoadedProfile)(e).then(e=>{const s=Object.assign({newBase:c,folder:f.folder||void 0,workspace:n},f);for(const e in f)s[e]=f[e];a.Rm(`newThingUI: Minting new ${s.pane.name} at ${s.newBase}`),f.pane.mintNew(t,s).then(function(e){if(!e||!e.newInstance)throw new Error("Cannot mint new - missing newInstance");if(e.folder){const t=e.newInstance.uri.slice(e.folder.uri.length).includes("/");a.Rm(" new thing is packge? "+t),t?p.add(e.folder,r.A.ldp("contains"),p.sym(e.newBase),e.folder.doc()):p.add(e.folder,r.A.ldp("contains"),e.newInstance,e.folder.doc()),e.refreshTarget&&e.refreshTarget.refresh&&e.refreshTarget.refresh()}else{const t=f.div.appendChild(i.createElement("p"));t.setAttribute("style","font-size: 120%;"),t.innerHTML="Your <a target='_blank' href='"+e.newInstance.uri+"'><b>new "+f.noun+"</b></a> is ready to be set up. <br/><br/><a target='_blank' href='"+e.newInstance.uri+"'>Go to your new "+f.noun+".</a>"}b()}).catch(function(e){h(e),o(e)})},e=>{h("Error logging on: "+e)})}const m=f.pane;if(f.noun=m.mintClass?c.label(m.mintClass):m.name,f.appPathSegment=f.noun.slice(0,1).toUpperCase()+f.noun.slice(1),f.folder){const e=function(e){if(e){let t=f.folder.uri;t.endsWith("/")||(t+="/"),t=t+encodeURIComponent(e)+"/",d(null,t)}else b()};l.askName(i,p,f.div,r.A.foaf("name"),null,f.noun).then(e)}else u=(0,s.selectWorkspace)(i,{noun:f.noun,appPathSegment:f.appPathSegment},d),f.div.appendChild(u)})})})}},6589(e,t,n){n.d(t,{v:()=>i});const i={newThingUI:n(8613).T}},5912(e,t,n){n.r(t)},7423(e,t,n){function i(...e){console.log(...e)}function a(...e){console.warn(...e)}function o(...e){console.error(...e)}function s(...e){console.trace(...e)}n.d(t,{R8:()=>a,Rm:()=>i,uP:()=>s,z3:()=>o})},7134(e,t,n){n.d(t,{Ux:()=>c});var i=n(3138),a=n(675),o=n(8565);const s="https://solidproject.org",r="solidproject.org";async function c(e,t){const n=document.getElementById("PageFooter");if(!n)return;const a=(0,o.E6)(),s=await(0,o.bB)(a,e);l(n,e,a,s,t)(),i.authSession.events.on("login",l(n,e,a,s,t)),i.authSession.events.on("logout",l(n,e,a,s,t))}function l(e,t,n,c,l){return async()=>{const p=i.authn.currentUser();e.innerHTML="",e.appendChild(await function(e,t,n,i,c){const l=document.createElement("div");l.setAttribute("style",a.i.footer);const p=document.createElement("a");if(p.href=c&&c.solidProjectUrl?c.solidProjectUrl:s,p.innerText=c&&c.solidProjectName?c.solidProjectName:r,!n||!i||t&&t.equals(i)){const e=document.createElement("span");return e.innerText="Powered by ",l.appendChild(e),l.appendChild(p),l}const u=document.createElement("span");u.innerText="You're visiting ";const d=document.createElement("a");d.href=n.uri,d.innerText="the Pod";const m=document.createElement("span");m.innerText=" controlled by ";const f=document.createElement("a");f.href=i.uri,f.innerText=(0,o.mG)(e,i);const h=document.createElement("span");h.innerText=". For more info, check out ";const g=document.createElement("span");return g.innerText=".",l.appendChild(u),l.appendChild(d),l.appendChild(m),l.appendChild(f),l.appendChild(h),l.appendChild(p),l.appendChild(g),l}(t,p,n,c,l))}}},2825(e,t,n){n.d(t,{j:()=>i});const i='\n<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26" fill="none">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13 25C19.6274 25 25 19.6274 25 13C25 6.37258 19.6274 1 13 1C6.37258 1 1 6.37258 1 13C1 19.6274 6.37258 25 13 25Z" fill="#D8D8D8" stroke="#8B8B8B"/>\n <mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="26" height="26">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13 25C19.6274 25 25 19.6274 25 13C25 6.37258 19.6274 1 13 1C6.37258 1 1 6.37258 1 13C1 19.6274 6.37258 25 13 25Z" fill="white" stroke="white"/>\n </mask>\n <g mask="url(#mask0)">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M17.0468 10.4586C17.0468 14.4979 15.4281 16.9214 12.9999 16.9214C10.5718 16.9214 8.95298 14.4979 8.95298 10.4586C8.95298 6.41931 12.9999 6.41931 12.9999 6.41931C12.9999 6.41931 17.0468 6.41931 17.0468 10.4586ZM4.09668 23.3842C6.52483 17.7293 12.9999 17.7293 12.9999 17.7293C12.9999 17.7293 19.475 17.7293 21.9031 23.3842C21.9031 23.3842 17.8481 25 12.9999 25C8.15169 25 4.09668 23.3842 4.09668 23.3842Z" fill="#8B8B8B"/>\n </g>\n</svg>'},1648(e,t,n){n.d(t,{Of:()=>d});var i=n(4356),a=n(3138),o=n(967),s=n(4608),r=n(675),c=n(2825),l=n(8565);const p=i.Pt.iconBase+"noun_help.svg",u="https://solidproject.org/assets/img/solid-emblem.svg";async function d(e,t,n){const i=document.getElementById("PageHeader");if(!i)return;const o=(0,l.E6)();m(i,e,o,t,n)(),a.authSession.events.on("logout",m(i,e,o,t,n)),a.authSession.events.on("login",m(i,e,o,t,n))}function m(e,t,n,d,m){return async()=>{const v=a.authn.currentUser();e.innerHTML="",e.appendChild(await async function(e,t,n,a,d){const m=document.createElement("a");m.href=t.uri,m.setAttribute("style",r.i.headerBannerLink);const v=document.createElement("img");d&&(v.src=d.logo?d.logo:u);v.setAttribute("style",r.i.headerBannerIcon),m.appendChild(v);const x=n?await async function(e,t,n){const i=e.fetcher;i&&await i.load(t);const a=document.createElement("ul");a.setAttribute("style",r.i.headerUserMenuList),n&&n.forEach(function(e){"url"===(e.url?"url":"onclick")?a.appendChild(g(h(e.label,e.url,e.target))):a.appendChild(g(f(e.label,e.onclick)))});const o=document.createElement("nav");o.setAttribute("style",r.i.headerUserMenuNavigationMenuNotDisplayed),o.setAttribute("aria-hidden","true"),o.setAttribute("id","loggedInNav"),o.appendChild(a);const p=document.createElement("button");p.setAttribute("style",r.i.headerUserMenuTrigger),p.type="button";const u=function(e,t){let n=null;try{if(n=s.findImage(t),!n)return c.j}catch{return c.j}const i=document.createElement("div");return i.setAttribute("style",r.i.headerUserMenuPhoto),i.style.backgroundImage=`url(${n})`,i}(0,t);"string"==typeof u?p.innerHTML=u:p.appendChild(u);const d=document.createElement("div");d.setAttribute("style",r.i.headerBannerUserMenuNotDisplayed),d.appendChild(p),d.appendChild(o);const m=(0,l.nF)(e=>b(e,p,o),50);p.addEventListener("click",m);let v=setTimeout(()=>null,0);return d.addEventListener("mouseover",e=>{clearTimeout(v),m(e);const t=document.getElementById("loggedInNav");t?.setAttribute("style",r.i.headerUserMenuNavigationMenu)}),d.addEventListener("mouseout",e=>{v=setTimeout(()=>m(e),200);const t=document.getElementById("loggedInNav");t?.setAttribute("style",r.i.headerUserMenuNavigationMenuNotDisplayed)}),d}(e,n,a):function(){const e=document.createElement("div");return e.setAttribute("style",r.i.headerBannerLogin),e.appendChild((0,o.loginStatusBox)(document,null,{})),e}(),y=document.createElement("div");y.setAttribute("style",r.i.headerBanner),y.appendChild(m);const w=document.createElement("div");if(w.setAttribute("style",r.i.headerBannerRightMenu),w.appendChild(x),d&&d.helpMenuList){const e=function(e,t){if(!t)return;const n=document.createElement("ul");n.setAttribute("style",r.i.headerUserMenuList),t.forEach(function(e){"url"===(e.url?"url":"onclick")?n.appendChild(g(h(e.label,e.url,e.target))):n.appendChild(g(f(e.label,e.onclick)))});const a=document.createElement("nav");a.setAttribute("style",r.i.headerUserMenuNavigationMenuNotDisplayed),a.setAttribute("aria-hidden","true"),a.setAttribute("id","helperNav"),a.appendChild(n);const o=document.createElement("div");o.setAttribute("style",r.i.headerBannerUserMenu),o.appendChild(a);const s=document.createElement("button");s.setAttribute("style",r.i.headerUserMenuTrigger),s.type="button";const c=document.createElement("img");c.src=e&&e.helpIcon?e.helpIcon:i.Pt.iconBase+p,c.setAttribute("style",r.i.headerUserMenuTriggerImg),o.appendChild(s),s.appendChild(c);const u=(0,l.nF)(e=>b(e,s,a),50);s.addEventListener("click",u);let d=setTimeout(()=>null,0);return o.addEventListener("mouseover",e=>{clearTimeout(d),u(e);const t=document.getElementById("helperNav");t?.setAttribute("style",r.i.headerUserMenuNavigationMenu)}),o.addEventListener("mouseout",e=>{d=setTimeout(()=>u(e),200);const t=document.getElementById("helperNav");t?.setAttribute("style",r.i.headerUserMenuNavigationMenuNotDisplayed)}),o}(d,d.helpMenuList);w.appendChild(e)}return y.appendChild(w),y}(t,n,v,d,m))}}function f(e,t){const n=document.createElement("button");return n.setAttribute("style",r.i.headerUserMenuButton),n.onmouseover=function(){n.setAttribute("style",r.i.headerUserMenuButtonHover)},n.onmouseout=function(){n.setAttribute("style",r.i.headerUserMenuButton)},n.addEventListener("click",t),n.innerText=e,n}function h(e,t,n){const i=document.createElement("a");return i.setAttribute("style",r.i.headerUserMenuLink),i.onmouseover=function(){i.setAttribute("style",r.i.headerUserMenuLinkHover)},i.onmouseout=function(){i.setAttribute("style",r.i.headerUserMenuLink)},i.href=t,i.innerText=e,n&&(i.target=n),i}function g(e){const t=document.createElement("li");return t.setAttribute("style",r.i.headerUserMenuListItem),t.appendChild(e),t}function b(e,t,n){const i="true"===t.getAttribute("aria-expanded"),a="mouseover"===e.type,o="mouseout"===e.type;i&&a||!i&&o||(t.setAttribute("aria-expanded",(!i).toString()),n.setAttribute("aria-hidden",i.toString()))}},3378(e,t,n){n.d(t,{LN:()=>s,Pt:()=>o,i1:()=>r});var i=n(7423);const a="https://solidos.github.io/solid-ui/src",o=(e=n.hmd(e)).scriptURI?{iconBase:e.scriptURI.slice(0,e.scriptURI.lastIndexOf("/"))+"/icons/",originalIconBase:e.scriptURI.slice(0,e.scriptURI.lastIndexOf("/"))+"/originalIcons/"}:"undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.iconBase?{iconBase:$SolidTestEnvironment.iconBase,originalIconBase:$SolidTestEnvironment.originalIconBase}:{iconBase:a+"/icons/",originalIconBase:a+"/originalIcons/"};(0,i.Rm)(" icons.iconBase is set to : "+o.iconBase);const s=o.iconBase,r=o.originalIconBase},4356(e,t,n){n.d(t,{Pt:()=>s.Pt,ns:()=>i.A});var i=n(1795),a=n(5923),o=n(6589),s=n(3378),r=n(8677),c=n(4158),l=n(7580),p=n(6127),u=n(8516),d=n(9509),m=n(8153),f=n(3605),h=n(5148),g=n(675),b=n(2174),v=n(6670),x=n(52),y=n(967),w=n(4608),A=n(1648),C=n(7134),E=n(5912);const k=window?window.document:null;"undefined"!=typeof window&&(window.UI={ns:i.A,acl:a.B,aclControl:a.u,create:o.v,createTypes:E,dom:k,icons:s.Pt,language:r,log:c,login:y,matrix:l.U,media:p.$,messageArea:u.v,infiniteMessageArea:d.r5,pad:m,participation:f,preferences:h,style:g.i,table:b.I,tabs:v,utils:x,widgets:w,initHeader:A.Of,initFooter:C.Ux})},4158(e,t,n){n.r(t),n.d(t,{LogLevel:()=>i,alert:()=>h,clear:()=>g,debug:()=>u,dumpHTML:()=>v,error:()=>m,escapeForXML:()=>w,info:()=>d,logAscending:()=>x,logDescending:()=>y,msg:()=>l,setInternals:()=>A,setLevel:()=>b,success:()=>f,warn:()=>p});let i=function(e){return e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Message=4]="Message",e[e.Success=8]="Success",e[e.Info=16]="Info",e[e.Debug=32]="Debug",e[e.All=63]="All",e}({}),a=7,o=!1,s=document,r=window;function c(e,t=4,n="mesg"){if(a&t)if(void 0!==s){const t=s.getElementById("status");if(!t)return;const i=s.createElement("span");i.setAttribute("class",n);const a=new Date;i.innerHTML=`${a.getHours()}:${a.getMinutes()}:${a.getSeconds()} [${n}] ${w(e)}<br/>`,o?t.insertBefore(i,t.firstChild):t.appendChild(i)}else"undefined"!=typeof console&&console.log(e)}function l(e){c(e)}function p(e){c(e,2,"warn")}function u(e){c(e,32,"dbug")}function d(e){c(e,16,"info")}function m(e){c(e,1,"eror")}function f(e){c(e,8,"good")}function h(e){r&&void 0!==r.alert?r.alert(e):p(e)}function g(){const e=s?.getElementById("status");e&&(e.innerHTML="")}function b(e){a=63,u("Log level is now "+e),a=e}function v(){if(!s)return;const e=a;a=63,u(s?.body?.innerHTML||""),a=e}function x(){o=!0}function y(){o=!1}function w(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A(e,t){r=e,s=t}},967(e,t,n){n.r(t),n.d(t,{ensureLoadedPreferences:()=>y,ensureLoadedProfile:()=>w,ensureLoggedIn:()=>x,filterAvailablePanes:()=>N,findAppInstances:()=>A,getUserRoles:()=>R,loginStatusBox:()=>S,newAppInstance:()=>j,registrationControl:()=>E,registrationList:()=>_,renderScopeHeadingRow:()=>k,renderSignInPopup:()=>T,scopeLabel:()=>C,selectWorkspace:()=>L});var i=n(4961),a=n(3138),o=n(7423),s=n(675),r=n(4158),c=n(1795),l=n(6247),p=n(52),u=n(4608);a.solidLogicSingleton.store;const{loadPreferences:d,loadProfile:m}=a.solidLogicSingleton.profile,{getScopedAppInstances:f,getRegistrations:h,loadAllTypeIndexes:g,getScopedAppsFromIndex:b,deleteTypeIndexRegistration:v}=a.solidLogicSingleton.typeIndex;function x(e){const t=a.authn.currentUser();return t?(a.authn.saveUser(t,e),Promise.resolve(e)):new Promise(t=>{a.authn.checkUser().then(n=>{if(n)return o.Rm(`logIn: Already logged in as ${n}`),t(e);if(!e.div||!e.dom)return t(e);const i=S(e.dom,n=>{a.authn.saveUser(n,e),t(e)});e.div.appendChild(i)})})}async function y(e){if(e.preferencesFile)return Promise.resolve(e);let t;try{e=await w(e);const n=await d(e.me);t,e.preferencesFile=n}catch(t){let n;if(t instanceof a.UnauthorizedError)n="Oops — you are not authenticated (properly logged in), so SolidOS cannot read your preferences file. Try logging out and then logging back in.",(0,r.alert)(n);else{if(t instanceof a.CrossOriginForbiddenError)return n=`Unauthorized: Assuming preference file blocked for origin ${window.location.origin}`,e.preferencesFileError=n,e;if(t instanceof a.SameOriginForbiddenError)return n="You are not authorized to read your preference file. This may be because you are using an untrusted web app.",o.R8(n),e;if(t instanceof a.NotEditableError)return n="You are not authorized to edit your preference file. This may be because you are using an untrusted web app.",o.R8(n),e;if(t instanceof a.WebOperationError)n="You are not authorized to edit your preference file. This may be because you are using an untrusted web app.",o.R8(n);else{if(!(t instanceof a.FetchError))throw new Error(`(via loadPrefs) ${t}`);n=`Strange: Error ${t.status} trying to read your preference file.${t.message}`,(0,r.alert)(n)}}}return e}async function w(e){if(e.publicProfile)return e;try{const t=await x(e);if(!t.me)throw new Error("Could not log in");e.publicProfile=await m(t.me)}catch(t){throw e.div&&e.dom&&e.div.appendChild(u.errorMessageBlock(e.dom,t.message)),new Error(`Can't log in: ${t}`)}return e}async function A(e,t,n){let i=e.me?await f(t,e.me):[];return!0===n?i=i.filter(e=>"public"===e.scope.label):!1===n&&(i=i.filter(e=>"private"===e.scope.label)),e.instances=i.map(e=>e.instance),e}function C(e,t){return`${e.me&&e.me.sameTerm(t.agent)?"":p.label(t.agent)+" "}${t.label}`}async function E(e,t,n){function s(o){const s=function(e){const a=h(t,n),o=a.length?a[0]:u.newThing(e);return[(0,i.st)(o,c.A.solid("instance"),t,e),(0,i.st)(o,c.A.solid("forClass"),n,e)]}(o.index),r=`${C(e,o)} link to this ${e.noun}`;return u.buildCheckboxForm(e.dom,a.solidLogicSingleton.store,r,null,s,f,o.index)}const r=e.dom;if(!r||!e.div)throw new Error("registrationControl: need dom and div");const l=r.createElement("div");e.div.appendChild(l),e.me=a.authn.currentUser();const p=e.me;if(!p)return l.innerHTML='<p style="margin:2em;">(Log in to save a link to this)</p>',e;let d;try{d=await g(p)}catch(t){let n;return e.div&&e.preferencesFileError?(n="(Lists of stuff not available)",e.div.appendChild(r.createElement("p")).textContent=n):e.div&&(n=`registrationControl: Type indexes not available: ${t}`,e.div.appendChild(u.errorMessageBlock(e.dom,t))),o.Rm(n),e}l.innerHTML="<table><tbody></tbody></table>",l.setAttribute("style","font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;");const m=l.children[0].children[0],f=new i.BlankNode;for(const e of d){m.appendChild(r.createElement("tr")).appendChild(s(e))}return e}function k(e,t,n){const{dom:i}=e,a=C(e,n),o=i.createElement("tr"),s=o.appendChild(i.createElement("td"));s.setAttribute("colspan","3"),s.style.backgoundColor={private:"#fee",public:"#efe"}[n.label]||"white";const r=s.appendChild(i.createElement("h3"));return r.textContent=a+" links",r.style.textAlign="left",o}async function _(e,t){const n=e.dom,i=e.div,o=n.createElement("div");if(i.appendChild(o),e.me=a.authn.currentUser(),!e.me)return o.innerHTML='<p style="margin:2em;">(Log in list your stuff)</p>',e;const s=await g(e.me);o.innerHTML="<table><tbody></tbody></table>",o.setAttribute("style","font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;");const r=o.firstChild.firstChild;for(const i of s){const a=k(e,0,i);r.appendChild(a);const o=await b(i,t.type||null);0===o.length&&(a.style.display="none");for(const e of o){const t=u.personTR(n,c.A.solid("instance"),e.instance,{deleteFunction:async()=>{await v(e),r.removeChild(t)}});t.children[0].style.paddingLeft="3em",r.appendChild(t)}}return e}function T(e){const t=e.createElement("div");t.setAttribute("style","position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center;"),e.body.appendChild(t);const n=e.createElement("div");n.setAttribute("style","\n background-color: white;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -o-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n min-width: 400px;\n padding: 10px;\n z-index : 10;\n "),t.appendChild(n);const i=e.createElement("div");i.setAttribute("style","\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n "),n.appendChild(i);const o=e.createElement("label");o.setAttribute("style","margin-right: 5px; font-weight: 800"),o.innerText="Select an identity provider";const s=e.createElement("button");s.innerHTML='<img src="https://solidos.github.io/solid-ui/src/icons/noun_1180156.svg" style="width: 2em; height: 2em;" title="Cancel">',s.setAttribute("style","background-color: transparent; border: none;"),s.addEventListener("click",()=>{t.remove()}),i.appendChild(o),i.appendChild(s);const c=async e=>{try{a.solidLogicSingleton.store.updater.flagAuthorizationMetadata();const t=new URL(window.location.href).hash;t&&window.localStorage.setItem("preLoginRedirectHash",t),window.localStorage.setItem("loginIssuer",e);const n=new URL(window.location.href);n.hash="",await a.authSession.login({redirectUrl:n.href,oidcIssuer:e})}catch(e){(0,r.alert)(e.message)}},l=e.createElement("div");l.setAttribute("style","\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n ");const p=e.createElement("div");p.setAttribute("style","\n display: flex;\n flex-direction: row;\n ");const u=e.createElement("label");u.innerText="Enter the URL of your identity provider:",u.setAttribute("style","color: #888");const d=e.createElement("input");d.setAttribute("type","text"),d.setAttribute("style","margin-left: 0 !important; flex: 1; margin-right: 5px !important"),d.setAttribute("placeholder","https://example.com"),d.value=localStorage.getItem("loginIssuer")||"";const m=e.createElement("button");m.innerText="Go",m.setAttribute("style","margin-top: 12px; margin-bottom: 12px;"),m.addEventListener("click",()=>{c(d.value)}),l.appendChild(u),p.appendChild(d),p.appendChild(m),l.appendChild(p),n.appendChild(l);const f=e.createElement("div");f.setAttribute("style","\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n ");const h=e.createElement("label");h.innerText="Or pick an identity provider from the list below:",h.setAttribute("style","color: #888"),f.appendChild(h),(0,a.getSuggestedIssuers)().forEach(t=>{const n=e.createElement("button");n.innerText=t.name,n.setAttribute("style","height: 38px; margin-top: 10px"),n.addEventListener("click",()=>{c(t.uri)}),f.appendChild(n)}),n.appendChild(f)}function S(e,t=null,n={}){let i=(0,a.offlineTestID)();const p=e.createElement("div");function d(e){e&&(i=a.authn.saveUser(e),p.refresh(),t&&t(i.uri))}function m(e){const n=i;a.authSession.logout().then(function(){const e=`Your WebID was ${n}. It has been forgotten.`;i=null;try{(0,r.alert)(e)}catch(t){window.alert(e)}p.refresh(),t&&t(null)},e=>{(0,r.alert)("Fail to log out:"+e)})}function f(){i=a.authn.currentUser(),p.refresh()}return p.refresh=function(){const t=a.authSession.info;i=t&&t.webId&&t.isLoggedIn?a.solidLogicSingleton.store.sym(t.webId):null,(i&&p.me!==i.uri||!i&&p.me)&&(u.clearElement(p),i?p.appendChild(function(t,n){const i=n.buttonStyle||s.i.signInAndUpButtonStyle;let o="WebID logout";if(t){const e=a.solidLogicSingleton.store.any(t,c.A.foaf("nick"))||a.solidLogicSingleton.store.any(t,c.A.foaf("name"));e&&(o="Logout "+e.value)}const r=e.createElement("input");return r.setAttribute("type","button"),r.setAttribute("value",o),r.setAttribute("style",`${i}`),r.addEventListener("click",m,!1),r}(i,n)):p.appendChild(function(e,t,n={}){const i=(n=n||{}).buttonStyle||s.i.signInAndUpButtonStyle,r=e.createElement("div"),c="SolidSignInOrSignUpBox";o.Rm("widgets.signInOrSignUpBox"),r.setUserCallback=t,r.setAttribute("class",c),r.setAttribute("style","display:flex;");const p=e.createElement("input");r.appendChild(p),p.setAttribute("type","button"),p.setAttribute("value","Log in"),p.setAttribute("style",`${i}${s.i.headerBannerLoginInput}`+s.i.signUpBackground),a.authSession.events.on("login",()=>{const t=a.authn.currentUser();if(t){const n=t.uri,i=e.getElementsByClassName(c);o.Rm(`Logged in, ${i.length} panels to be serviced`);for(let t=0;t<i.length;t++){const a=i[t];if(a.setUserCallback)try{a.setUserCallback(n);const e=a.parentNode;e&&e.removeChild(a)}catch(t){o.Rm(`## Error satisfying login box: ${t}`),a.appendChild(u.errorMessageBlock(e,t))}}}}),p.addEventListener("click",()=>{const n=(0,a.offlineTestID)();if(n)return t(n.uri);T(e)},!1);const d=e.createElement("input");return r.appendChild(d),d.setAttribute("type","button"),d.setAttribute("value","Sign Up for Solid"),d.setAttribute("style",`${i}${s.i.headerBannerLoginInput}`+s.i.signInBackground),d.addEventListener("click",function(e){(new l.l).signup().then(function(e){o.Rm("signInOrSignUpBox signed up "+e),t(e)})},!1),r}(e,d,n))),p.me=i?i.uri:null},p.refresh(),f(),a.authSession.events.on("login",f),a.authSession.events.on("logout",f),p.me="99999",p.refresh(),p}function L(e,t,n){const r=t.noun,l=t.appPathSegment,p=(0,a.offlineTestID)(),d=e.createElement("div"),m={me:p,dom:e,div:d};function f(t,n){d.appendChild(u.errorMessageBlock(e,t,n))}function h(e){const t=a.solidLogicSingleton.store.any(e,c.A.space("uriPrefix"));let n;n=t?t.value:e.uri.split("#")[0],"/"!==n.slice(-1)&&(o.Rm(`${l}: No / at end of uriPrefix ${n}`),n=`${n}/`);const i=new Date;return n+=`${l}/id${i.getTime()}/`,n}return y(m).then(function(t){const o=t.me,l=t.preferencesFile;let p=null,m=a.solidLogicSingleton.store.each(o,c.A.space("workspace"),void 0,l);const g=a.solidLogicSingleton.store.each(o,c.A.space("storage"));0===m.length&&g&&(f(`You don't seem to have any workspaces. You have ${g.length} storage spaces.`,"white"),g.map(function(e){return m=m.concat(a.solidLogicSingleton.store.each(e,c.A.ldp("contains"))),m}).filter(e=>e.id?["public","private"].includes(e.id().toLowerCase()):"")),1===m.length&&(f(`Workspace used: ${m[0].uri}`,"white"),p=h(m[0]));const b=e.createElement("table");b.setAttribute("style","border-collapse:separate; border-spacing: 0.5em;"),d.appendChild(b),d.appendChild(e.createElement("hr"));const v=d.appendChild(e.createElement("p"));v.setAttribute("style",s.i.commentStyle),v.textContent=`Where would you like to store the data for the ${r}?\n Give the URL of the folder where you would like the data stored.\n It can be anywhere in solid world - this URI is just an idea.`;const x=d.appendChild(e.createElement("input"));x.setAttribute("type","text"),x.setAttribute("style",s.i.textInputStyle),x.size=80,x.label="base URL",x.autocomplete="on",p&&(x.value=p),t.baseField=x,d.appendChild(e.createElement("br"));const y=d.appendChild(e.createElement("button"));let w,A,C,E,k,_,T;y.setAttribute("style",s.i.buttonStyle),y.textContent=`Start new ${r} at this URI`,y.addEventListener("click",function(e){let t=x.value.replace(" ","%20");"/"!==t.slice(-1)&&(t+="/"),n(null,t)}),m=m.filter(function(e){return!a.solidLogicSingleton.store.holds(e,c.A.rdf("type"),c.A.space("MasterWorkspace"))});const S="height: 3em; margin: 1em; padding: 1em white; border-radius: 0.3em;",L=`${S}border: 0px;`;for(let t=0;t<m.length;t++){if(k=m[t],E=e.createElement("tr"),0===t&&(w=e.createElement("td"),w.setAttribute("rowspan",`${m.length}`),w.textContent="Choose a workspace for this:",w.setAttribute("style","vertical-align:middle;"),E.appendChild(w)),A=e.createElement("td"),_=a.solidLogicSingleton.store.anyValue(k,c.A.ui("style")),!_){const e=`#${(16777215&function(e){return e.split("").reduce(function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e},0)}(k.uri)|12632256).toString(16)}`;_=`color: black ; background-color: ${e};`}A.setAttribute("style",L+_),E.target=k.uri;let i=a.solidLogicSingleton.store.any(k,c.A.rdfs("label"));i||(i=k.uri.split("/").slice(-1)[0]||k.uri.split("/").slice(-2)[0]),A.textContent=i||"???",E.appendChild(A),0===t&&(C=e.createElement("td"),C.setAttribute("rowspan",`${m.length}1`),C.setAttribute("style","width:50%;"),E.appendChild(C)),b.appendChild(E),T=a.solidLogicSingleton.store.any(k,c.A.rdfs("comment")),T=T?T.value:"Use this workspace",A.addEventListener("click",function(t){C.textContent=T?T.value:"",C.setAttribute("style",L+_);const i=e.createElement("button");i.textContent="Continue";const a=h(k);x.value=a,i.addEventListener("click",function(e){i.disabled=!0,n(k,a),i.textContent="----\x3e"},!0),C.appendChild(i)},!0)}const j=e.createElement("tr");A=e.createElement("td"),A.setAttribute("style",S),A.textContent="+ Make a new workspace",A.addEventListener("click",async function(n){const o=b.appendChild(e.createElement("tr")).appendChild(e.createElement("td"));o.setAttribute("colspan","3"),o.style.padding="0.5em";const s=encodeURI(await u.askName(e,a.solidLogicSingleton.store,o,c.A.solid("URL"),c.A.space("Workspace"),"Workspace")),r=u.newThing(t.preferencesFile),l=[(0,i.st)(t.me,c.A.space("workspace"),r,t.preferencesFile),(0,i.st)(r,c.A.space("uriPrefix"),s,t.preferencesFile)];if(!a.solidLogicSingleton.store.updater)throw new Error("store has no updater");await a.solidLogicSingleton.store.updater.update([],l)}),j.appendChild(A),b.appendChild(j)}).catch(e=>{d.appendChild(u.errorMessageBlock(m.dom,e))}),d}function j(e,t,n){const i=function(e,t){n(e,t)},a=e.createElement("div"),o=e.createElement("button");return o.setAttribute("type","button"),a.appendChild(o),o.innerHTML=`Make new ${t.noun}`,o.addEventListener("click",n=>{a.appendChild(L(e,t,i))},!1),a.appendChild(o),a}async function R(){const e=a.authSession.info;if(!e?.isLoggedIn||!e?.webId)return[];const t=a.authn.currentUser();if(!t)return[];try{const{me:e,preferencesFile:n,preferencesFileError:i}=await y({me:t});if(!n||i)throw new Error(i||"Unable to load user preferences file.");return a.solidLogicSingleton.store.each(e,c.A.rdf("type"),null,n.doc())}catch(e){o.R8("Unable to fetch your preferences - this was the error: ",e)}return[]}async function N(e){const t=await R();return e.filter(e=>function(e,t){const n=e.audience||[];return n.reduce((e,n)=>e&&!!t.find(e=>e.equals(n)),!0)}(e,t))}a.authSession.events.on("logout",async()=>{const e=window.localStorage.getItem("loginIssuer");if(e)try{a.solidLogicSingleton.store.updater.flagAuthorizationMetadata();const t=new URL(e);t.pathname="/.well-known/openid-configuration";const n=await fetch(t.toString());if(200===n.status){const e=await n.json();e&&e.end_session_endpoint&&await fetch(e.end_session_endpoint,{credentials:"include"})}}catch(e){}window.location.reload()})},7580(e,t,n){n.d(t,{U:()=>i});const i={matrixForQuery:n(7659).p}},7659(e,t,n){n.d(t,{p:()=>s});var i=n(52),a=n(4961);const o=n(3138).solidLogicSingleton.store;function s(e,t,n,s,r,c,l){const p=e.createElement("table"),u=e.createElement("tr");u.appendChild(e.createElement("td")).setAttribute("class","MatrixCorner"),p.appendChild(u),p.lastHeader=u;let d=[];const m=[],f=function(e,t,n,a){for(;e.firstChild;)e.removeChild(e.firstChild);e.setAttribute("style",""),e.style.textAlign="center",c.cellFunction?c.cellFunction(e,t,n,a):(e.textContent=i.label(a),e.setAttribute("style","padding: 0.3em")),delete e.old},h=function(t){const n=t.toNT();if(m[n])return m[n];const s=e.createElement("tr"),r=s.appendChild(e.createElement("td"));r.setAttribute("style","padding: 0.3em;"),r.textContent=i.label(t),"NamedNode"===t.termType&&o.fetcher.nowOrWhenFetched(t.uri.split("#")[0],void 0,function(e,n,a){e&&(r.textContent=i.label(t))});for(let n=0;n<d.length;n++)f(s.appendChild(e.createElement("td")),a.fromNT(d[n]),t,null);s.dataValueNT=n,m[n]=s;for(let e=p.lastHeader.nextSibling;e;e=e.nextSibling)if(n>e.dataValueNT&&c&&c.yDecreasing||n<e.dataValueNT&&(!c||!c.yDecreasing))return p.insertBefore(s,e);return p.appendChild(s)},g=function(t){const n=t.toNT();let o=null;for(let e=0;e<d.length;e++){if(d[e]===n)return e;if(n>d[e]&&c.xDecreasing||n<d[e]&&!c.xDecreasing){d=d.slice(0,e).concat([n]).concat(d.slice(e)),o=e;break}}null===o&&(o=d.length,d.push(n));for(let n=p.firstChild;n;n=n.nextSibling){const s=n.dataValueNT,r=e.createElement("td");if(r.style.textAlign="center",n===p.firstChild?r.textContent=i.label(t):f(r,t,a.fromNT(s),null),o===d.length-1)n.appendChild(r);else{let e=n.firstChild;for(let t=0;t<o+1;t++)e=e.nextSibling;n.insertBefore(r,e)}}return o},b=function(){let e,t;const n=[],i=[];if(c.set_y)for(let e=0;e<c.set_y.length;e++)i[c.set_y[e]]=!0;if(c.set_x)for(let e=0;e<c.set_x.length;e++)n[g(c.set_x[e])+1]=!0;for(let o=1;o<p.children.length;o++){e=p.children[o];for(let o=1;o<e.children.length;o++)if(t=e.children[o],t.old){const n=a.fromNT(e.dataValueNT),i=a.fromNT(d[o-1]);f(t,i,n,null)}else i[e.dataValueNT]=!0,n[o]=!0}for(let t=0;t<p.children.length;t++)if(e=p.children[t],t>0&&!i[e.dataValueNT])delete m[e.dataValueNT],p.removeChild(e);else for(let t=e.children.length-1;t>0;t--){const i=e.children[t];n[t]||e.removeChild(i)}const o=[];for(let e=0;e<d.length;e++)n[e+1]&&o.push(d[e]);d=o};p.refresh=function(){!function(){for(let e=1;e<p.children.length;e++){const t=p.children[e];for(let e=1;e<t.children.length;e++)t.children[e].old=!0}}(),o.query(t,v,void 0,b)};const v=function(e){const t=e[n.toString()],i=e[s.toString()],a=e[r.toString()],o=h(i),c=g(t),l=o.children[c+1];f(l,t,i,a)};if(c.set_y)for(let e=0;e<c.set_y.length;e++)h(c.set_y[e]);if(c.set_x)for(let e=0;e<c.set_x.length;e++)g(c.set_x[e]);return o.query(t,v,void 0,l),p}},6127(e,t,n){n.d(t,{$:()=>a});var i=n(7008);const a={cameraCaptureControl:i.V,cameraButton:i.Y}},7008(e,t,n){n.d(t,{V:()=>l,Y:()=>p});var i=n(7423),a=n(3378),o=n(675),s=n(4608);const r=a.Pt.iconBase+"noun_Camera_1618446_000000.svg",c=a.Pt.iconBase+"noun_479395.svg";function l(e,t,n,r){const l=e.createElement("div");let p,u,d,m;const f=l.appendChild(e.createElement("table")),h=f.appendChild(e.createElement("tr")).appendChild(e.createElement("td"));h.setAttribute("colspan","4");const g=f.appendChild(e.createElement("tr"));g.appendChild(e.createElement("td")).appendChild(s.cancelButton(e)).addEventListener("click",e=>{A(),r(null)});const b=g.appendChild(e.createElement("td")).appendChild(s.button(e,c,"Retake"));b.addEventListener("click",e=>{h.removeChild(m),y()}),b.style.visibility="collapse";const v=g.appendChild(e.createElement("td")).appendChild(s.button(e,a.Pt.iconBase+"noun_10636.svg","Snap"));v.addEventListener("click",function(){m=e.createElement("canvas"),m.setAttribute("width",o.i.canvasWidth),m.setAttribute("height",o.i.canvasHeight),m.setAttribute("style",o.i.controlStyle),h.appendChild(m);m.getContext("2d").drawImage(d,0,0,m.width,m.height),d.parentNode.removeChild(d),m.toBlob(e=>{const t=`got blob type ${e.type} size ${e.size}`;i.Rm(t),p=n(),u=e,x.style.visibility="visible",b.style.visibility="visible",v.style.visibility="collapse"},"image/png")}),v.style.visibility="collapse";const x=g.appendChild(e.createElement("td")).appendChild(s.continueButton(e));function y(){if(d=h.appendChild(e.createElement("video")),d.setAttribute("controls","1"),d.setAttribute("autoplay","1"),d.setAttribute("style",o.i.controlStyle),!navigator.mediaDevices)throw new Error("navigator.mediaDevices not available");navigator.mediaDevices.getUserMedia(w).then(e=>{d.srcObject=e,v.style.visibility="visible",x.style.visibility="collapse",b.style.visibility="collapse"})}x.addEventListener("click",e=>{!function(e,n){const a=e.type;i.Rm("Putting "+e.size+" bytes of "+a+" to "+n),t.fetcher.webOperation("PUT",n.uri,{data:e,contentType:a}).then(e=>{i.Rm("ok saved "+n),A(),r(n)},e=>{A(),alert(e)})}(u,p)}),x.style.visibility="collapse";const w={video:!0};function A(){d&&d.srcObject&&d.srcObject.getVideoTracks().forEach(e=>e.stop())}return y(),l}function p(e,t,n,i){const a=e.createElement("div"),o=s.button(e,r,"Take picture");let c;async function p(e){a.removeChild(c),a.appendChild(o),i(e)}return a.appendChild(o),o.addEventListener("click",i=>{a.removeChild(o),c=l(e,t,n,p),a.appendChild(c)}),a}},8516(e,t,n){n.d(t,{v:()=>d});var i=n(3378),a=n(967),o=n(3138),s=n(1795),r=n(4961),c=n(675),l=n(52),p=n(4608);const u={icons:i.Pt,ns:s.A,rdf:r,style:c.i,widgets:p};function d(e,t,n,i,s){t=t||o.solidLogicSingleton.store,i=i.doc();const c=u.ns,p=r.Namespace("http://www.w3.org/2005/01/wf/flow#"),d=r.Namespace("http://purl.org/dc/terms/"),m=!!(s=s||{}).newestFirst,f="white-space: pre-wrap; width: 90%; font-size:100%; border: 0.07em solid #eee; padding: .2em 0.5em; margin: 0.1em 1em 0.1em 1em;",h=e.createElement("div");let g,b;const v=o.solidLogicSingleton.store.updater,x=function(t,n){const i=e.createElement("a");return n&&n.uri&&(i.setAttribute("href",n.uri),i.addEventListener("click",u.widgets.openHrefInOutlineMode,!0),i.setAttribute("style","color: #3B5998; text-decoration: none; ")),i.textContent=t,i},y=function(t,n){const i=e.createElement("pre");return i.setAttribute("style",n||"color: grey"),h.appendChild(i),i.appendChild(e.createTextNode(t)),i},w=function(e){y(e,"color: #800;")};function A(e){const t=o.solidLogicSingleton.store.any(e,u.ns.foaf("nick"));return t?""+t.value:""+l.label(e)}function C(t,n,i,a){const s=t.appendChild(x(A(n),n));n.uri&&o.solidLogicSingleton.store.fetcher.nowOrWhenFetched(n.doc(),void 0,function(e,t){s.textContent=A(n)}),t.appendChild(e.createElement("br")),t.appendChild(x(i,a))}function E(e,n){const i={};let a,o;for(a=n.firstChild;a;a=a.nextSibling)a.AJAR_subject&&(i[a.AJAR_subject.uri]=!0);const s=t.each(e,c.wf("message")),r={};for(s.forEach(function(e){r[e.uri]=!0,i[e.uri]||k(e)}),a=n.firstChild;a;)o=a.nextSibling,a.AJAR_subject&&!r[a.AJAR_subject.uri]&&n.removeChild(a),a=o}const k=function(e){const n={"?msg":e,"?creator":t.any(e,c.foaf("maker")),"?date":t.any(e,d("created")),"?content":t.any(e,c.sioc("content"))};_(n,!0)},_=function(i,a){const o=i["?creator"],s=i["?msg"],r=i["?date"],c=i["?content"],l=r.value,p=e.createElement("tr");p.AJAR_date=l,p.AJAR_subject=s;let d=!1;for(let e=g.firstChild;e;e=e.nextSibling)if(l>e.AJAR_date&&m||l<e.AJAR_date&&!m){g.insertBefore(p,e),d=!0;break}d||g.appendChild(p);const h=e.createElement("td");p.appendChild(h),C(h,o,u.widgets.shortDate(l),s);const b=e.createElement("td");p.appendChild(b);const x=e.createElement("p");x.setAttribute("style",f+(a?"background-color: #e8ffe8;":"background-color: #white;")),b.appendChild(x),x.textContent=c.value;const y=e.createElement("td");p.appendChild(y);const A=e.createElement("button");y.appendChild(A),A.textContent="-",p.setAttribute("class","hoverControl"),A.setAttribute("class","hoverControlHide"),A.setAttribute("style","color: red;"),A.addEventListener("click",function(i){y.removeChild(A);const a=e.createElement("button");a.textContent="cancel",y.appendChild(a).addEventListener("click",function(e){y.removeChild(o),y.removeChild(a),y.appendChild(A)},!1);const o=e.createElement("button");o.textContent="Delete message",y.appendChild(o).addEventListener("click",function(e){y.removeChild(o),y.removeChild(a),function(e){const i=t.statementsMatching(e).concat(t.statementsMatching(void 0,void 0,e));v.update(i,[],function(e,t,i){t?E(n,g):w("Cant delete messages:"+i)})}(s)},!1)},!1)};g=e.createElement("table"),g.fresh=!1,h.appendChild(g),g.setAttribute("style","width: 100%;");const T=function(){const o=e.createElement("tr"),s=e.createElement("td"),l=e.createElement("td"),p=e.createElement("td");o.appendChild(s),o.appendChild(l),o.appendChild(p),o.AJAR_date="9999-01-01T00:00:00Z";const m=function(){h.setAttribute("class","pendingedit"),h.disabled=!0;const a=[],s=new Date,l=""+s.getTime(),p=r.term(s),m=t.sym(i.uri+"#Msg"+l);a.push(new r.Statement(n,c.wf("message"),m,i)),a.push(new r.Statement(m,c.sioc("content"),t.literal(h.value),i)),a.push(new r.Statement(m,d("created"),p,i)),b&&a.push(new r.Statement(m,c.foaf("maker"),b,i));v.update([],a,function(n,i,a){if(i){const e={"?msg":m,"?content":t.literal(h.value),"?date":p,"?creator":b};_(e,!1),h.value="",h.setAttribute("class",""),h.disabled=!1}else o.appendChild(u.widgets.errorMessageBlock(e,"Error writing message: "+a))})};let h,g;o.appendChild(e.createElement("br"));const x={div:l,dom:e};return a.ensureLoggedIn(x).then(t=>{b=t.me,C(s,b,"",null),h=e.createElement("textarea"),l.innerHTML="",l.appendChild(h),h.rows=3,h.setAttribute("style",f+"background-color: #eef;"),h.addEventListener("keyup",function(e){13===e.keyCode&&(e.altKey||m())},!1),p.innerHTML="",g=u.widgets.button(e,u.icons.iconBase+"noun_383448.svg","Send"),g.setAttribute("style",u.style.buttonStyle+"float: right;"),g.addEventListener("click",m,!1),p.appendChild(g)}),o}();let S;if(m?g.insertBefore(T,g.firstChild):g.appendChild(T),s.query)S=s.query;else{S=new r.Query("Messages");const e={};["msg","date","creator","content"].forEach(function(t){S.vars.push(e[t]=r.variable(t))}),S.pat.add(n,p("message"),e.msg),S.pat.add(e.msg,c.dct("created"),e.date),S.pat.add(e.msg,c.foaf("maker"),e.creator),S.pat.add(e.msg,c.sioc("content"),e.content)}return t.query(S,_,void 0,function(){g.fresh=!0}),h.refresh=function(){E(n,g)},h}},6105(e,t,n){n.d(t,{A:()=>i});const i="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEzLjAxNTcgOS4yNzM2M0MxNC4yOTU0IDguMzQwMzEgMTUuMTI4OCA2LjgyOTg0IDE1LjEyODggNS4xMjgyQzE1LjEyODggMi4zMDA1MSAxMi44MjgzIDAgMTAuMDAwNiAwQzcuMTcyODkgMCA0Ljg3MjM4IDIuMzAwNTEgNC44NzIzOCA1LjEyODJDNC44NzIzOCA2LjgyOTg0IDUuNzA1NyA4LjM0MDMxIDYuOTg1NDcgOS4yNzM2M0MzLjgwNDIyIDEwLjQ5MSAxLjUzOTA2IDEzLjU3NTQgMS41MzkwNiAxNy4xNzk1QzEuNTM5MDYgMTguNzM0NyAyLjgwNDM0IDIwIDQuMzU5NTcgMjBIMTUuNjQxNkMxNy4xOTY4IDIwIDE4LjQ2MjEgMTguNzM0NyAxOC40NjIxIDE3LjE3OTVDMTguNDYyMSAxMy41NzU0IDE2LjE5NyAxMC40OTEgMTMuMDE1NyA5LjI3MzYzWk02LjQxMDg2IDUuMTI4MkM2LjQxMDg2IDMuMTQ4ODMgOC4wMjEyMSAxLjUzODQ4IDEwLjAwMDYgMS41Mzg0OEMxMS45OCAxLjUzODQ4IDEzLjU5MDMgMy4xNDg4MyAxMy41OTAzIDUuMTI4MkMxMy41OTAzIDcuMTA3NTggMTEuOTggOC43MTc5NyAxMC4wMDA2IDguNzE3OTdDOC4wMjEyMSA4LjcxNzk3IDYuNDEwODYgNy4xMDc1OCA2LjQxMDg2IDUuMTI4MlpNMTUuNjQxNiAxOC40NjE1SDQuMzU5NTdDMy42NTI2NiAxOC40NjE1IDMuMDc3NTQgMTcuODg2NCAzLjA3NzU0IDE3LjE3OTVDMy4wNzc1NCAxMy4zNjIgNi4xODMxNiAxMC4yNTY0IDEwLjAwMDYgMTAuMjU2NEMxMy44MTgxIDEwLjI1NjQgMTYuOTIzNyAxMy4zNjIgMTYuOTIzNyAxNy4xNzk1QzE2LjkyMzcgMTcuODg2NCAxNi4zNDg2IDE4LjQ2MTUgMTUuNjQxNiAxOC40NjE1WiIgZmlsbD0iIzMxNDE1OCIvPgo8L3N2Zz4K"},1795(e,t,n){n.d(t,{A:()=>s});var i=n(5386),a=n.n(i),o=n(4961);const s=a()(o)},8153(e,t,n){n.r(t),n.d(t,{getChunks:()=>h,lightColorHash:()=>m,manageParticipation:()=>p.manageParticipation,notepad:()=>f,notepadToHTML:()=>b,participationObject:()=>p.participationObject,recordParticipation:()=>p.recordParticipation,renderParticipants:()=>p.renderParticipants,xmlEncode:()=>g});var i=n(1795),a=n(4961),o=n(4608),s=n(52),r=n(7423),c=n(3138),l=n(675),p=n(3605);const u=c.solidLogicSingleton.store,d=(0,a.Namespace)("http://www.w3.org/ns/pim/pad#");function m(e){return e&&e.uri?"#"+(16777215&(t=e.uri,t.split("").reduce(function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e},0))|12632256).toString(16):"#ffffff";var t}function f(e,t,n,c,p){const d=(p=p||{}).exists,f=e.createElement("table"),h=u;if(c&&!c.uri)throw new Error("UI.pad.notepad: Invalid userid");const g=u.updater,b=(0,a.Namespace)("http://www.w3.org/ns/pim/pad#");f.setAttribute("style",l.i.notepadStyle);let v=null,x=null;if(p.statusArea){const t=p.statusArea.appendChild(e.createElement("table")).appendChild(e.createElement("tr"));v=t.appendChild(e.createElement("td")),x=t.appendChild(e.createElement("td")),v&&v.setAttribute("style",l.i.upstreamStatus),x&&x.setAttribute("style",l.i.downstreamStatus)}const y=function(t,n=!1){(0,r.Rm)(t),p.statusArea&&(n?v:x).appendChild((0,o.errorMessageBlock)(e,t,"pink"))},w=function(e){p.statusArea&&(p.statusArea.innerHTML="")},A=function(e,t,n){const a=e.subject;t=t||"";const o=l.i.baseStyle,s=l.i.headingCore,r=l.i.headingStyle,c=h.any(a,i.A.dc("author"));if(!t&&c){t="color: "+(n?"#888":"black")+"; background-color: "+m(c)+";"}let p=h.any(a,b("indent"));p=p?p.value:0;const u=p>=0?o+"text-indent: "+3*p+"em;":s+r[-1-p];e.setAttribute("style",u+t)},C=function(e){const i=e.subject;if(!i)throw new Error("No chunk for line to be deleted!");const o=h.any(void 0,b("next"),i),c=h.any(i,b("next"));if(o.sameTerm(n)&&c.sameTerm(n))return void(0,r.Rm)("You can't delete the only line.");const l=h.statementsMatching(i,void 0,void 0,t).concat(h.statementsMatching(void 0,void 0,i,t)),p=[(0,a.st)(o,b("next"),c,t)];if(i instanceof a.NamedNode){const e=i.uri.slice(-4);(0,r.Rm)("Deleting line "+e)}if(!g)throw new Error("have no updater");g.update(l,p,function(t,n,a,o){if(n){const t=e.parentNode;if(t){const e=t.previousSibling;t.parentNode&&t.parentNode.removeChild(t),e&&e.firstChild&&e.firstChild.focus()}}else if(o&&409===o.status)A(e,"color: black; background-color: #ffd;"),e.state=0,(0,s.beep)(.5,512),setTimeout(function(){R()},1e3);else{(0,r.Rm)(" removePart FAILED "+i+": "+a),(0,r.Rm)(" removePart was deleting :'"+l),A(e,"color: black; background-color: #fdd;");const t=o?o.status:" [no response field] ";y("Error "+t+" saving changes: "+String(a))}})},E=function(e,n){let o=null;e.addEventListener("keydown",function(i){if(!g)throw new Error("no updater");let o,s;switch(i.keyCode){case 13:{const t=i.shiftKey;if((0,r.Rm)("enter"),t?(s=h.any(void 0,b("next"),n),o="newlinesAfter"):(s=h.any(n,b("next")),o="newlinesBefore"),s[o]=s[o]||0,s[o]+=1,s[o]>1)return void(0,r.Rm)(" queueing newline queue = "+s[o]);(0,r.Rm)(" go ahead line before "+s[o]),_(e,t);break}case 8:if(0===e.value.length)switch((0,r.Rm)("Delete key line "+n.uri.slice(-4)+" state "+e.state),e.state){case 1:case 2:return void(e.state=4);case 3:case 4:return;case void 0:case 0:e.state=3,C(e),i.preventDefault();break;default:throw new Error("pad: Unexpected state "+e)}break;case 9:{const o=i.shiftKey?-1:1;!function(e,n,i){const o=h.statementsMatching(n,b("indent")),s=o.length?Number(o[0].object.value):0;if(s+i<-3)return;const c=s+i,l=(0,a.st)(n,b("indent"),c,t);if(!g)throw new Error("no updater");g.update(o,l,function(n,i,a){i?A(e):((0,r.Rm)("Indent change FAILED '"+c+"' for "+t+": "+a),A(e,"color: black; background-color: #fdd;"),g.requestDownstreamAction(t,R))})}(e,n,o),i.preventDefault();break}case 27:(0,r.Rm)("escape"),g.requestDownstreamAction(t,R),i.preventDefault();break;case 38:e.parentNode.previousSibling&&(e.parentNode.previousSibling.firstChild.focus(),i.preventDefault());break;case 40:e.parentNode.nextSibling&&(e.parentNode.nextSibling.firstChild.focus(),i.preventDefault())}});const c=function(e){const n=e.subject;A(e,void 0,!0);const o=h.any(n,i.A.sioc("content")).value,l=[(0,a.st)(n,i.A.sioc("content"),o,t)];let p;e.value&&(p=[(0,a.st)(n,i.A.sioc("content"),e.value,t)]);const u=e.value;if(e.lastSent&&o!==e.lastSent&&console.warn("Out of order, last sent expected '"+o+"' but found '"+e.lastSent+"'"),e.lastSent=u,!g)throw new Error("no updater");g.update(l,p,function(n,i,a,l){if(i)w(),A(e),(0,r.Rm)(" Patch ok '"+o+"' -> '"+u+"' "),4===e.state?(e.state=3,C(e)):3===e.state||(2===e.state?(e.state=1,c(e)):e.state=0);else if((0,r.Rm)(" patch FAILED "+l.status+" for '"+o+"' -> '"+u+"': "+a),409===l.status)A(e,"color: black; background-color: #fdd;"),e.state=0,(0,s.beep)(.5,512),setTimeout(function(){g.requestDownstreamAction(t,R)},1e3);else{A(e,"color: black; background-color: #fdd;");const t=l?.status;t&&502!==t&&503!==t?(e.state=0,y(" Error "+t+" sending data: "+a,!0),(0,s.beep)(1,128)):(e.lastSent=void 0,e.state=0,setTimeout(()=>{0!==e.state&&void 0!==e.state||(e.state=1,c(e))},2e3))}})};e.addEventListener("input",function(t){switch(A(e,void 0,!0),(0,r.Rm)("Input event state "+e.state+" value '"+e.value+"'"),e.state){case 3:case 4:case 2:return;case 1:return void(e.state=2);case 0:case void 0:null!==o&&clearTimeout(o),o=setTimeout(()=>{o=null,0!==e.state&&void 0!==e.state||(e.state=1,c(e))},400)}})},k=function(t,n,a){let o=h.any(n,i.A.sioc("content"));o=o?o.value:"";const s=e.createElement("tr");a?f.insertBefore(s,t):t&&t.nextSibling?f.insertBefore(s,t.nextSibling):f.appendChild(s);const l=s.appendChild(e.createElement("input"));return l.subject=n,l.setAttribute("type","text"),l.value=o,c?(A(l,""),E(l,n)):(A(l,"color: #222; background-color: #fff"),(0,r.Rm)("Note can't add listeners - not logged in")),l},_=function(e,s){const l=u;let p,d,m,f,h,v=0,x=null;e?("input"!==e.tagName.toLowerCase()&&(0,r.Rm)("return pressed when current document is: "+e.tagName),p=e.subject,v=l.any(p,b("indent")),v=v?Number(v.value):0,s?(d=l.any(void 0,b("next"),p),m=p,f=d,x="newlinesAfter"):(d=p,m=l.any(p,b("next")),f=m,x="newlinesBefore"),h=e.parentNode):(d=n,m=n,h=void 0);const y=(0,o.newThing)(t),w=y.uri.slice(-4),C=[(0,a.st)(d,b("next"),m,t)],E=[(0,a.st)(d,b("next"),y,t),(0,a.st)(y,b("next"),m,t),(0,a.st)(y,i.A.dc("author"),c,t),(0,a.st)(y,i.A.sioc("content"),"",t)];if(v>0&&E.push((0,a.st)(y,b("indent"),v,t)),(0,r.Rm)(" Fresh chunk "+w+" proposed"),!g)throw new Error("no updater");g.update(C,E,function(e,t,n,i){if(t){const e=k(h,y,s);A(e),e.focus(),x&&((0,r.Rm)(" Fresh chunk "+w+" updated, queue = "+f[x]),f[x]-=1,f[x]>0&&((0,r.Rm)(" Implementing queued newlines = "+m.newLinesBefore),_(e,s)))}else(0,r.Rm)(" ERROR writing new line "+w+": "+n)})},T=function(){const e={};let t=0;function a(e){y(e),t++}if(!h.the(n,b("next")))return a("No initial next pointer"),!1;let o,s=n;for(;o=h.the(s,b("next")),o||a("No next pointer from "+s),!o.sameTerm(n);){s=o;const t=o.uri.split("#")[1];if(e[o.uri])return a("Loop!"),!1;e[o.uri]=!0;let n=h.each(o,b("next")).length;1!==n&&a("Should be 1 not "+n+" next pointer for "+t),n=h.each(o,b("indent")).length,n>1&&a("Should be 0 or 1 not "+n+" indent for "+t),n=h.each(o,i.A.sioc("content")).length,1!==n&&a("Should be 1 not "+n+" contents for "+t),n=h.each(o,i.A.dc("author")).length,1!==n&&a("Should be 1 not "+n+" author for "+t);h.statementsMatching(void 0,i.A.sioc("contents")).forEach(function(t){e[t.subject.value]||a("Loose chunk! "+t.subject.value)})}return!t},S=function(){if(1!==h.each(n,b("next")).length){const e="Pad: Inconsistent data - NEXT pointers: "+h.each(n,b("next")).length;return(0,r.Rm)(e),void(p.statusArea&&(p.statusArea.textContent+=e))}let e;const t=[];for(let e=h.the(n,b("next"));!e.sameTerm(n);e=h.the(e,b("next")))for(let n=0;n<f.children.length;n++){const i=f.children[n];i.firstChild&&i.firstChild.subject.sameTerm(e)&&(t[e.uri]=i.firstChild)}for(let n=f.children.length-1;n>=0;n--)e=f.children[n],t[e.firstChild.subject.uri]||f.removeChild(e);e=f.firstChild;for(let a=h.the(n,b("next"));!a.sameTerm(n);a=h.the(a,b("next"))){const n=h.any(a,i.A.sioc("content")).value;if(e&&t[a.uri]){const t=e.firstChild;n!==t.value&&(t.value=n),A(t),t.state=0,delete t.lastSent,e=e.nextSibling}else k(e,a,!0)}},L=function(e){if(e.refresh)e.refresh();else for(let t=0;t<e.children.length;t++)L(e.children[t])};let j=!1;const R=function(){if(j)return void(0,r.Rm)(" Already reloading - stop");j=!0;let e=1e3;const n=function(){if((0,r.Rm)("try reload - timeout = "+e),!g)throw new Error("no updater");g.reload(g.store,t,function(i,a,o){j=!1,i?((0,r.Rm)(" reloaded OK"),w(),T()?L(f):y("CONSISTENCY CHECK FAILED")):0===o.status?(y("Network error refreshing the pad. Retrying in "+e/1e3),j=!0,e*=2,setTimeout(n,e)):y("Error "+o.status+"refreshing the pad:"+a+". Stopped. "+t)})};n()};if(f.refresh=S,f.reloadAndSync=R,c||(0,r.Rm)("Warning: must be logged in for pad to be edited"),d)(0,r.Rm)("Existing pad."),T()?(S(),h.holds(n,b("next"),n)&&_()):(0,r.Rm)(f.textContent="Inconsistent data. Abort");else{(0,r.Rm)("No pad exists - making new one.");const e=[(0,a.st)(n,i.A.rdf("type"),b("Notepad"),t),(0,a.st)(n,i.A.dc("author"),c,t),(0,a.st)(n,i.A.dc("created"),new Date,t),(0,a.st)(n,b("next"),n,t)];if(!g)throw new Error("no updater");g.update([],e,function(e,t,n){t?((0,r.Rm)("Initial pad created"),_()):y(n||"")})}return f}function h(e,t){const n=[];for(let i=t.the(e,d("next"));!i.sameTerm(e);i=t.the(i,d("next")))n.push(i);return n}function g(e){return e.replace("&","&amp;").replace("<","&lt;").replace(">","&gt;")}function b(e,t){const n=h(e,t);let a="<html>\n <head>\n";const o=t.anyValue(e,i.A.dct("title"));o&&(a+=` <title>${g(o)}</title>\n`),a+=" </head>\n <body>\n";let s=0;function r(e){for(;s>e;s--)a+="</ul>\n"}return n.forEach(e=>{const n=t.anyJS(e,d("indent")),o=t.anyJS(e,i.A.sioc("content"));if(!o)return;const c=g(o);if(n<0){r(0);const e=n>=-3?4+n:1;a+=`\n<h${e}>${c}</h${e}>\n`}else n>0?(r(n),function(e){for(;s<e;s++)a+="<ul>\n"}(n),a+=`<li>${c}</li>\n`):(r(n),a+=`<p>${c}</p>\n`)}),r(0),a+=" </body>\n</html>\n",a}},3605(e,t,n){n.r(t),n.d(t,{manageParticipation:()=>g,participationObject:()=>f,recordParticipation:()=>h,renderParticipants:()=>m});var i=n(7423),a=n(4961),o=n(1795),s=n(4608),r=n(52),c=n(8153),l=n(675),p=n(4762),u=n(3138);const d=u.solidLogicSingleton.store;function m(e,t,n,a,c,u){t.setAttribute("style",l.i.participantsStyle);const m=function(n){const i=d.any(n,o.A.wf("participant"));let a;if(!i)return a=e.createElement("tr"),a.textContent="???",a;const r=d.anyValue(n,o.A.ui("backgroundColor"))||p.A.participationDefaultBackground,c=e.createElement("div");c.setAttribute("style",l.i.participantsBlock),c.style.backgroundColor=r,a=(0,s.personTR)(e,null,i,u),t.appendChild(a);const m=e.createElement("td");return m.setAttribute("style",l.i.personTableTD),m.appendChild(c),a.insertBefore(m,a.firstChild),a},f=function(){const e=d.each(a,o.A.wf("participation")).map(function(e){return(0,i.Rm)("in participants"),[d.anyValue(e,o.A.cal("dtstart"))||"9999-12-31",e]});e.sort();const n=e.map(function(e){return e[1]});(0,r.syncTableToArray)(t,n,m)};return t.refresh=f,f(),t}function f(e,t,n){return new Promise(function(r,l){if(!n)throw new Error("No user id");const p=d.each(e,o.A.wf("participation")).filter(function(e){return d.holds(e,o.A.wf("participant"),n)});if(p.length>1){const e=[];for(const t of p){const n=d.anyValue(t,o.A.cal("dtstart"));n&&e.push([n,t])}e.sort(),i.R8("Multiple participation objects, picking earliest, in "+t),r(e[0][1])}if(p.length)r(p[0]);else{const i=(0,s.newThing)(t),p=[(0,a.st)(e,o.A.wf("participation"),i,t),(0,a.st)(i,o.A.wf("participant"),n,t),(0,a.st)(i,o.A.cal("dtstart"),new Date,t),(0,a.st)(i,o.A.ui("backgroundColor"),(0,c.lightColorHash)(n),t)];d.updater.update([],p,function(e,t,n){t?r(i):l(new Error("Error recording your participation: "+n))}),r(i)}})}function h(e,t,n){const r=u.authn.currentUser();if(!r)return;const l=d.each(e,o.A.wf("participation")).filter(function(e){return d.holds(e,o.A.wf("participant"),r)});if(l.length>1)throw new Error("Multiple records of your participation");if(l.length)return l[0];{if(!d.updater.editable(t))return i.Rm("Not recording participation, as no write access as "+r+" to "+t),null;const l=(0,s.newThing)(t),p=[(0,a.st)(e,o.A.wf("participation"),l,t),(0,a.st)(l,o.A.wf("participant"),r,t),(0,a.st)(l,o.A.cal("dtstart"),new Date,t),(0,a.st)(l,o.A.ui("backgroundColor"),(0,c.lightColorHash)(r),t)];return d.updater.update([],p,function(e,t,i){if(!t)throw new Error("Error recording your participation: "+i);n&&n.refresh&&n.refresh()}),l}}function g(e,t,n,i,a,o){const r=e.createElement("table");t.appendChild(r),m(e,r,0,i,0,o);try{h(i,n,r)}catch(n){t.appendChild((0,s.errorMessageBlock)(e,"Error recording your participation: "+n))}return r}},5148(e,t,n){n.r(t),n.d(t,{get:()=>d,getPreferencesForClass:()=>v,recordPersonalDefaults:()=>h,recordSharedPreferences:()=>f,renderPreferencesForm:()=>g,set:()=>m,value:()=>u});var i=n(4961),a=n(3138),o=n(7423),s=n(967),r=n(1795),c=n(3605),l=n(4608);const p=a.store,u=[];function d(e){return u[e]}function m(e,t){if("string"!=typeof t)throw o.Rm("Non-string value of preference "+e+": "+t),new Error("Non-string value of preference "+e+": "+t);this.value[e]=t}function f(e,t){return new Promise(function(n,a){const s=p.any(e,r.A.ui("sharedPreferences"));if(s)t.sharedPreferences=s,n(t);else{p.updater.editable(e.doc())||(o.Rm(` Cant make shared preferences, may not change ${e.doc}`),n(t));const s=i.sym(e.doc().uri+"#SharedPreferences"),c=[i.st(e,r.A.ui("sharedPreferences"),s,e.doc())];o.Rm("Creating shared preferences "+s),p.updater.update([],c,function(e,i,o){i?(t.sharedPreferences=s,n(t)):a(new Error("Error creating shared prefs: "+o))})}})}function h(e,t){return new Promise(function(n,a){(0,s.ensureLoadedPreferences)(t).then(t=>{if(!t.preferencesFile)return void o.Rm("Not doing private class preferences as no access to preferences file. "+t.preferencesFileError);const s=p.each(null,r.A.solid("forClass"),e,t.preferencesFile);let c,u,d=[];if(s.length){if(s.forEach(e=>{c=c||p.any(e,r.A.solid("personalDefaults"))}),c)return t.personalDefaults=c,void n(t);c=l.newThing(t.preferencesFile),u=s[0]}else u=l.newThing(t.preferencesFile),d=[i.st(u,r.A.rdf("type"),r.A.solid("TypeRegistration"),t.preferencesFile),i.st(u,r.A.solid("forClass"),e,t.preferencesFile)];c=l.newThing(t.preferencesFile),d.push(i.st(u,r.A.solid("personalDefaults"),c,t.preferencesFile)),p.updater.update([],d,function(i,o,s){o?(t.personalDefaults=c,n(t)):a(new Error("Setting preferences for "+e+": "+s))})},e=>{a(e)})})}function g(e,t,n,i){const a=i.dom.createElement("div");return c.participationObject(e,e.doc(),i.me).then(o=>{const s=i.dom;function r(e){a.appendChild(s.createElement("h5")).textContent=e}r("My view of this "+i.noun),l.appendForm(s,a,{},o,n,e.doc(),(e,t)=>{e||l.complain(i,t)}),r("Everyone's view of this "+i.noun),f(e,i).then(i=>{const o=i.sharedPreferences;l.appendForm(s,a,{},o,n,e.doc(),(e,t)=>{e||l.complain(i,t)}),r("My default view of any "+i.noun),h(t,i).then(e=>{l.appendForm(s,a,{},e.personalDefaults,n,e.preferencesFile,(t,n)=>{t||l.complain(e,n)})},e=>{l.complain(i,e)})})},e=>{a.appendChild(l.errorMessageBlock(i.dom,e))}),a}function b(e){return e.datatype?e.datatype.equals(r.A.xsd("boolean"))?"1"===e.value:e.datatype.equals(r.A.xsd("dateTime"))||e.datatype.equals(r.A.xsd("date"))?new Date(e.value):e.datatype.equals(r.A.xsd("integer"))||e.datatype.equals(r.A.xsd("float"))||e.datatype.equals(r.A.xsd("decimal"))?Number(e.value):e.value:e}function v(e,t,n,i){return new Promise(function(a,o){f(e,i).then(i=>{const s=i.sharedPreferences;if(i.me)c.participationObject(e,e.doc(),i.me).then(e=>{h(t,i).then(t=>{const i=[],o=t.personalDefaults;n.forEach(t=>{const n=p.any(e,t)||p.any(s,t)||p.any(o,t);n&&(i[t.uri]=b(n))}),a(i)},o)},o);else{const e=[];n.forEach(t=>{const n=p.any(s,t);n&&(e[t.uri]=b(n))}),a(e)}})})}},9417(e,t,n){n.d(t,{A:()=>i});const i={authEndpoint:"",fallbackAuthEndpoint:"https://databox.me/",signupEndpoint:"https://solidproject.org/get_a_pod",signupWindowHeight:600,signupWindowWidth:1024,key:"",cert:""}},6247(e,t,n){n.d(t,{l:()=>a});var i=n(9417);function a(e){this.config=e||i.A}a.prototype.listen=function(){return new Promise(function(e,t){const n=window.addEventListener?"addEventListener":"attachEvent";(0,window[n])("attachEvent"===n?"onmessage":"message",function(n){const i=n.data;if("User:"===i.slice(0,5)){const n=i.slice(5,i.length);return n&&n.length>0&&"http"===n.slice(0,4)?e(n):t(n)}},!0)})},a.prototype.signup=function(e){e=e||this.config.signupEndpoint;const t=this.config.signupWindowWidth,n=this.config.signupWindowHeight,i=window.screen.width/2-(t/2+10),a=window.screen.height/2-(n/2+50),o=e+"?origin="+encodeURIComponent(window.location.origin),s="resizable,scrollbars,status,width="+t+",height="+n+",left="+i+",top="+a;window.open(o,"Solid signup",s);const r=this;return new Promise(function(e){r.listen().then(function(t){return e(t)})})}},675(e,t,n){n.d(t,{i:()=>a});var i=n(4762);const a={checkboxStyle:"color: black; font-size: 100%; padding-left: 0.5 em; padding-right: 0.5 em;",checkboxInputStyle:"font-size: 150%; height: 1.2em; width: 1.2em; background-color: #eef; border-radius:0.2em; margin: 0.1em;",fieldLabelStyle:"color: #3B5998; text-decoration: none;",formSelectStyle:"background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;",textInputStyle:"background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;",textInputStyleUneditable:"background-color: white; padding: 0.5em; border: .05em solid white; border-radius:0.2em; font-size: 100%; margin:0.4em;",buttonStyle:"background-color: #fff; padding: 0.7em; border: .01em solid white; border-radius:0.2em; font-size: 100%; margin: 0.3em;",commentStyle:"padding: 0.7em; border: none; font-size: 100%; white-space: pre-wrap;",iconStyle:"width: 3em; height: 3em; margin: 0.1em; border-radius: 1em;",smallButtonStyle:"margin: 0.2em; width: 1em; height:1em;",classIconStyle:"width: 3em; height: 3em; margin: 0.1em; border-radius: 0.2em; border: 0.1em solid green; padding: 0.2em; background-color: #efe;",confirmPopupStyle:"padding: 0.7em; border-radius: 0.2em; border: 0.1em solid orange; background-color: white; box-shadow: 0.5em 0.9em #888;",messageBodyStyle:"white-space: pre-wrap; width: 99%; font-size:100%; border: 0.07em solid #eee; border-radius:0.2em; padding: .3em 0.5em; margin: 0.1em;",pendingeditModifier:"color: #bbb;",personaBarStyle:"width: 100%; height: 4em; background-color: #eee; vertical-align: middle;",searchInputStyle:"border: 0.1em solid #444; border-radius: 0.2em; width: 100%; font-size: 100%; padding: 0.1em 0.6em; margin 0.2em;",autocompleteRowStyle:"border: 0.2em solid straw;",signInAndUpButtonStyle:"padding: 1em; border-radius:0.2em; font-size: 100%;",headerBannerLoginInput:"margin: 0.75em 0 0.75em 0.5em !important; padding: 0.5em !important;",signUpBackground:"background-color: #eef;",signInBackground:"background-color: #efe;",heading1Style:"font-size: 180%; font-weight: bold; color: #888888; padding: 0.5em; margin: 0.7em 0.0m;",heading2Style:"font-size: 130%; font-weight: bold; color: #888888; padding: 0.4em; margin: 0.7em 0.0em;",heading3Style:"font-size: 120%; font-weight: bold; color: #888888; padding: 0.3em; margin: 0.7em 0.0em;",heading4Style:"font-size: 110%; font-weight: bold; color: #888888; padding: 0.2em; margin: 0.7em 0.0em;",formHeadingStyle:"font-size: 110%; font-weight: bold; color: #888888; padding: 0.2em; margin: 0.7em 0.0em;",formTextInput:"font-size: 100%; margin: 0.1em; padding: 0.1em;",formGroupStyle:[`padding-left: 0em; border: 0.0em solid ${i.A.formBorderColor}; border-radius: 0.2em;`,`padding-left: 2em; border: 0.05em solid ${i.A.formBorderColor}; border-radius: 0.2em;`,`padding-left: 2em; border: 0.1em solid ${i.A.formBorderColor}; border-radius: 0.2em;`,`padding-left: 2em; border: 0.2em solid ${i.A.formBorderColor}; border-radius: 0.2em;`],formFieldLabelStyle:`color: ${i.A.lowProfileLinkColor}; text-decoration: none;`,formFieldNameBoxStyle:`padding: 0.3em; vertical-align: middle; width:${i.A.formFieldNameBoxWidth};`,multilineTextInputStyle:"font-size:100%; white-space: pre-wrap; background-color: #eef; border: 0.07em solid gray; padding: 1em 0.5em; margin: 1em 1em;",renderAsDivStyle:"display: flex; align-items: center; justify-content: space-between; height: 2.5em; padding: 1em;",imageDivStyle:"width:2.5em; padding:0.5em; height: 2.5em;",linkDivStyle:"width:2em; padding:0.5em; height: 4em;",aclControlBoxContainer:"margin: 1em;",aclControlBoxHeader:"font-size: 120%; margin: 0 0 1rem;",aclControlBoxStatus:"display: none; margin: 1rem 0;",aclControlBoxStatusRevealed:"display: block;",aclGroupContent:"maxWidth: 650;",accessGroupList:"display: grid; grid-template-columns: 1fr; margin: 1em; width: 100%;",accessGroupListItem:"display: grid; grid-template-columns: 100px auto 30%;",defaultsController:"display: flex;",defaultsControllerNotice:"color: #888; flexGrow: 1; fontSize: 80%;",bigButton:"background-color: white; border: 0.1em solid #888; border-radius: 0.3em; max-width: 50%; padding-bottom: 1em; padding-top: 1em;",group:"color: #888;",group1:"color: green;",group2:"color: #cc0;",group3:"color: orange;",group5:"color: red;",group9:"color: blue;",group13:"color: purple;",trustedAppAddApplicationsTable:"background-color: #eee;",trustedAppCancelButton:"float: right;",trustedAppControllerI:"border-color: orange; border-radius: 1em; border-width: 0.1em;",temporaryStatusInit:"background: green;",temporaryStatusEnd:"background: transparent; transition: background 5s linear;",headerUserMenuLink:"background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none;",headerUserMenuLinkHover:"background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%);",headerUserMenuTrigger:"background: none; border: 0; cursor: pointer; width: 60px; height: 60px;",headerUserMenuTriggerImg:"border-radius: 50%; height: 56px; width: 28px !important;",headerUserMenuButton:"background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%;",headerUserMenuButtonHover:"background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%);",headerUserMenuList:"list-style: none; margin: 0; padding: 0;",headerUserMenuListDisplay:"list-style: none; margin: 0; padding: 0; display:true;",headerUserMenuNavigationMenu:"background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: true;",headerUserMenuNavigationMenuNotDisplayed:"background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: none;",headerUserMenuListItem:"border-bottom: solid 1px #000000;",headerUserMenuPhoto:"border-radius: 50%; background-position: center; background-repeat: no-repeat; background-size: cover; height: 50px; width: 50px;",headerBanner:"box-shadow: 0px 1px 4px #000000; display: flex; justify-content: space-between; padding: 0 1.5em; margin-bottom: 4px;",headerBannerLink:"display: block;",headerBannerRightMenu:"display: flex;",headerBannerLogin:"margin-left: auto;",allChildrenVisible:"display:true;",headerBannerUserMenu:"border-left: solid 1px #000000; margin-left: auto;",headerBannerHelpMenu:"border-left: solid 1px #000000; margin-left: auto;",headerBannerIcon:"background-size: 65px 60px !important; height: 60px !important; width: 65px !important;",footer:"border-top: solid 1px $divider-color; font-size: 0.9em; padding: 0.5em 1.5em;",primaryButton:"background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;",primaryButtonHover:"background-color: #9f7dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;",primaryButtonNoBorder:"background-color: #ffffff; color: #7c4dff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;",primaryButtonNoBorderHover:"background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;",secondaryButton:"background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;",secondaryButtonHover:"background-color: #37cde6; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;",secondaryButtonNoBorder:"background-color: #ffffff; color: #01c9ea; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;",secondaryButtonNoBorderHover:"background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;",controlStyle:`border-radius: 0.5em; margin: 0.8em; width:${i.A.mediaModuleCanvasWidth}; height:${i.A.mediaModuleCanvasHeight};`,dragEvent:"background-color: #ccc; border: 0.25em dashed black; border-radius: 0.3em;",dropEvent:"background-color: white; border: 0em solid black;",restoreStyle:"background-color: white;",errorCancelButton:"width: 2em; height: 2em; align: right;",errorMessageBlockStyle:"margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; color:black;",notepadStyle:"padding: 1em; overflow: auto; resize: horizontal; min-width: 40em;",upstreamStatus:"width: 50%;",downstreamStatus:"width: 50%;",baseStyle:"font-size: 100%; font-family: monospace; width: 100%; border: none; white-space: pre-wrap;",headingCore:"font-family: sans-serif; font-weight: bold; border: none;",headingStyle:["font-size: 110%; padding-top: 0.5em; padding-bottom: 0.5em; width: 100%;","font-size: 120%; padding-top: 1em; padding-bottom: 1em; width: 100%;","font-size: 150%; padding-top: 1em; padding-bottom: 1em; width: 100%;"],participantsStyle:"margin: 0.8em;",participantsBlock:"height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888;",personTableTD:"vertical-align: middle;",tabsNavElement:"margin: 0;",tabsRootElement:"display: flex; height: 100%; width: 100%;",tabsMainElement:"margin: 0; width:100%; height: 100%;",tabContainer:"list-style-type: none; display: flex; height: 100%; width: 100%; margin: 0; padding: 0;",makeNewSlot:"background: none; border: none; font: inherit; cursor: pointer;",ellipsis:"position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;",setStyle:function(e,t){e.style=a[t]}}},4762(e,t,n){n.d(t,{A:()=>i});const i={highlightColor:"#7C4DFF",formBorderColor:"#888888",formHeadingColor:"#888888",lowProfileLinkColor:"#3B5998",formFieldNameBoxWidth:"8em",mediaModuleCanvasWidth:"640",mediaModuleCanvasHeight:"480",textInputSize:20,tabBorderRadius:"0.2em",textInputBackgroundColor:"#eef",textInputBackgroundColorUneditable:"#fff",textInputColor:"#000",textInputColorPending:"#888",defaultErrorBackgroundColor:"#fee",participationDefaultBackground:"white",basicMaxLength:"4096"}},5561(e,t,n){n.d(t,{i:()=>i});
1
+ import*as e from"rdflib";import*as t from"solid-logic";var n={6466(e,t,n){n.d(t,{v:()=>p});var i=n(5619),a=n(4961),o=n(1214),s=n(7367),r=n(52),c=n(7423),l=n(675);class p{mainCombo;defaultsCombo;isContainer;defaultsDiffer;rootElement;isUsingDefaults;constructor(e,t,n,a,s,r,c,p,u,d,m,f){if(this.subject=e,this.noun=t,this.context=n,this.statusElement=a,this.targetIsProtected=s,this.targetDoc=r,this.targetACLDoc=c,this.defaultHolder=p,this.defaultACLDoc=u,this.prospectiveDefaultHolder=d,this.store=m,this.dom=f,this.rootElement=f.createElement("div"),this.rootElement.setAttribute("style",l.i.aclGroupContent),this.isContainer="/"===r.uri.slice(-1),p&&u){this.isUsingDefaults=!0;const e=(0,i._E)(this.targetDoc,c,p,u);this.mainCombo=new o.h(r,c,this,e,{defaults:this.isContainer}),this.defaultsCombo=null,this.defaultsDiffer=!1}else this.isUsingDefaults=!1,this.mainCombo=new o.h(r,c,this,m),this.defaultsCombo=new o.h(r,c,this,m,{defaults:this.isContainer}),this.defaultsDiffer=!(0,i.P3)(this.mainCombo.aclMap,this.defaultsCombo.aclMap)}get isEditable(){return!this.isUsingDefaults}render(){if(this.rootElement.innerHTML="",this.isUsingDefaults){if(this.renderStatus(`The sharing for this ${this.noun} is the default for folder `),this.defaultHolder){const e=this.statusElement.appendChild(this.dom.createElement("a"));e.href=this.defaultHolder.uri,e.innerText=(0,s.DR)(this.defaultHolder)}}else!this.defaultsDiffer&&this.isContainer?this.renderStatus("This is also the default for things in this folder."):this.renderStatus("");return this.rootElement.appendChild(this.mainCombo.render()),this.defaultsCombo&&this.defaultsDiffer?(this.rootElement.appendChild(this.renderRemoveDefaultsController()),this.rootElement.appendChild(this.defaultsCombo.render())):this.isEditable&&this.isContainer&&this.rootElement.appendChild(this.renderAddDefaultsController()),!this.targetIsProtected&&this.isUsingDefaults?this.rootElement.appendChild(this.renderAddAclsController()):this.targetIsProtected||this.rootElement.appendChild(this.renderRemoveAclsController()),this.rootElement}renderRemoveAclsController(){const e=this.dom.createElement("button");return e.innerText=`Remove custom sharing settings for this ${this.noun} -- just use default${this.prospectiveDefaultHolder?` for ${r.label(this.prospectiveDefaultHolder)}`:""}`,e.setAttribute("style",l.i.bigButton),e.addEventListener("click",()=>this.removeAcls().then(()=>this.render()).catch(e=>this.renderStatus(e))),e}renderAddAclsController(){const e=this.dom.createElement("button");return e.innerText=`Set specific sharing for this ${this.noun}`,e.setAttribute("style",l.i.bigButton),e.addEventListener("click",()=>this.addAcls().then(()=>this.render()).catch(e=>this.renderStatus(e))),e}renderAddDefaultsController(){const e=this.dom.createElement("div");e.setAttribute("style",l.i.defaultsController);const t=e.appendChild(this.dom.createElement("div"));t.innerText="Sharing for things within the folder currently tracks sharing for the folder.",t.setAttribute("style",l.i.defaultsControllerNotice);const n=e.appendChild(this.dom.createElement("button"));return n.innerText="Set the sharing of folder contents separately from the sharing for the folder",n.setAttribute("style",l.i.bigButton),n.addEventListener("click",()=>this.addDefaults().then(()=>this.render())),e}renderRemoveDefaultsController(){const e=this.dom.createElement("div");e.setAttribute("style",l.i.defaultsController);const t=e.appendChild(this.dom.createElement("div"));t.innerText="Access to things within this folder:",t.setAttribute("style",l.i.defaultsControllerNotice);const n=e.appendChild(this.dom.createElement("button"));return n.innerText="Set default for folder contents to just track the sharing for the folder",n.setAttribute("style",l.i.bigButton),n.addEventListener("click",()=>this.removeDefaults().then(()=>this.render()).catch(e=>this.renderStatus(e))),e}renderTemporaryStatus(e){this.statusElement.setAttribute("style",l.i.aclControlBoxStatusRevealed),this.statusElement.innerText=e,this.statusElement.setAttribute("style",l.i.temporaryStatusInit),setTimeout(()=>{this.statusElement.setAttribute("style",l.i.temporaryStatusEnd)}),setTimeout(()=>{this.statusElement.innerText=""},5e3)}renderStatus(e){e||this.statusElement.setAttribute("style",l.i.aclControlBoxStatusRevealed),this.statusElement.innerText=e}async addAcls(){if(!this.defaultHolder||!this.defaultACLDoc){const e="Unable to find defaults to copy";return c.z3(e),Promise.reject(e)}(0,i._E)(this.targetDoc,this.targetACLDoc,this.defaultHolder,this.defaultACLDoc).statements.forEach(e=>this.store.add(e.subject,e.predicate,e.object,this.targetACLDoc));try{return await this.store.fetcher.putBack(this.targetACLDoc),this.isUsingDefaults=!1,Promise.resolve()}catch(e){const t=` Error writing back access control file! ${e}`;return c.z3(t),Promise.reject(t)}}async addDefaults(){this.defaultsCombo=new o.h(this.targetDoc,this.targetACLDoc,this,this.store,{defaults:!0}),this.defaultsDiffer=!0}async removeAcls(){try{await this.store.fetcher.delete(this.targetACLDoc.uri,{}),this.isUsingDefaults=!0;try{this.prospectiveDefaultHolder=await(0,i.L$)(this.targetDoc.uri)}catch(e){c.R8(e)}}catch(e){const t=`Error deleting access control file: ${this.targetACLDoc}: ${e}`;return c.z3(t),Promise.reject(t)}}async removeDefaults(){const e=this.defaultsCombo;try{this.defaultsCombo=null,this.defaultsDiffer=!1,await this.save()}catch(t){return this.defaultsCombo=e,this.defaultsDiffer=!0,c.z3(t),Promise.reject(t)}}save(){const e=(0,a.graph)();this.isContainer?this.defaultsCombo&&this.defaultsDiffer?((0,i.cl)(e,this.targetDoc,this.mainCombo.byCombo,this.targetACLDoc,!0),(0,i.cl)(e,this.targetDoc,this.defaultsCombo.byCombo,this.targetACLDoc,!1,!0)):(0,i.cl)(e,this.targetDoc,this.mainCombo.byCombo,this.targetACLDoc,!0,!0):(0,i.cl)(e,this.targetDoc,this.mainCombo.byCombo,this.targetACLDoc,!0),e.fetcher=(0,a.fetcher)(e,{fetch:this.store.fetcher._fetch});const t=e.updater||new a.UpdateManager(e);return new Promise((n,a)=>{t.put(this.targetACLDoc,e.statementsMatching(void 0,void 0,void 0,this.targetACLDoc),"text/turtle",(t,o,s)=>{if(!o)return a(new Error(`ACL file save failed: ${s}`));this.store.fetcher.unload(this.targetACLDoc),this.store.add(e.statements),this.store.fetcher.requested[this.targetACLDoc.uri]="done",this.mainCombo.store=this.store,this.defaultsCombo&&(this.defaultsCombo.store=this.store),this.defaultsDiffer=!!this.defaultsCombo&&!(0,i.P3)(this.mainCombo.aclMap,this.defaultsCombo.aclMap),c.Rm("ACL modification: success!"),n()})})}}},1214(e,t,n){n.d(t,{h:()=>f});var i=n(4961),a=n(5619),o=n(4608),s=n(1795),r=n(1928),c=n(7423),l=n(675);const p=s.A.acl,u={13:"Owners",9:"Owners (write locked)",5:"Editors",3:"Posters",2:"Submitters",1:"Viewers"},d={13:!0,5:!0,3:!0,2:!0,1:!0},m={13:"can read, write, and control sharing.",9:"can read and control sharing, currently write-locked.",5:"can read and change information",3:"can add new information, and read but not change existing information",2:"can add new information but not read any",1:"can read but not change information"};class f{defaults;byCombo;aclMap;addAgentButton;rootElement;_store;constructor(e,t,n,i,o={}){this.doc=e,this.aclDoc=t,this.controller=n,this._options=o,this.defaults=this._options.defaults||!1,this._store=i,this.aclMap=(0,a.fg)(e,t,i,this.defaults),this.byCombo=(0,a.xw)(this.aclMap),this.addAgentButton=new r.g(this),this.rootElement=this.controller.dom.createElement("div"),this.rootElement.setAttribute("style",l.i.accessGroupList)}get store(){return this._store}set store(e){this._store=e,this.aclMap=(0,a.fg)(this.doc,this.aclDoc,e,this.defaults),this.byCombo=(0,a.xw)(this.aclMap)}render(){return this.rootElement.innerHTML="",this.renderGroups().forEach(e=>this.rootElement.appendChild(e)),this.controller.isEditable&&this.rootElement.appendChild(this.addAgentButton.render()),this.rootElement}renderGroups(){const e=[];for(let t=15;t>0;t--){const n=h(t);(this.controller.isEditable&&d[t]||this.byCombo[n])&&e.push(this.renderGroup(t,n))}return e}renderGroup(e,t){const n=this.controller.dom.createElement("div");n.setAttribute("style",l.i.accessGroupListItem),o.makeDropTarget(n,e=>this.handleDroppedUris(e,t).then(()=>this.controller.render()).catch(e=>this.controller.renderStatus(e)));return this.renderGroupElements(e,t).forEach(e=>n.appendChild(e)),n}renderGroupElements(e,t){const n=this.controller.dom.createElement("div");if(n.setAttribute("style",l.i.group),this.controller.isEditable)switch(e){case 1:n.setAttribute("style",l.i.group1);break;case 2:n.setAttribute("style",l.i.group2);break;case 3:n.setAttribute("style",l.i.group3);break;case 5:n.setAttribute("style",l.i.group5);break;case 9:n.setAttribute("style",l.i.group9);break;case 13:n.setAttribute("style",l.i.group13);break;default:n.setAttribute("style",l.i.group)}n.innerText=u[e]||function(e){let t="";const n=["Read","Append","Write","Control"];for(let i=0;i<4;i++)e&1<<i&&(t+=n[i]);return t}(e);const i=this.controller.dom.createElement("div");if(i.setAttribute("style",l.i.group),this.controller.isEditable)switch(e){case 1:i.setAttribute("style",l.i.group1);break;case 2:i.setAttribute("style",l.i.group2);break;case 3:i.setAttribute("style",l.i.group3);break;case 5:i.setAttribute("style",l.i.group5);break;case 9:i.setAttribute("style",l.i.group9);break;case 13:i.setAttribute("style",l.i.group13);break;default:i.setAttribute("style",l.i.group)}const a=i.appendChild(this.controller.dom.createElement("table"));(this.byCombo[t]||[]).map(([e,n])=>this.renderAgent(a,t,e,n)).forEach(e=>a.appendChild(e));const o=this.controller.dom.createElement("div");if(o.setAttribute("style",l.i.group),this.controller.isEditable)switch(e){case 1:o.setAttribute("style",l.i.group1);break;case 2:o.setAttribute("style",l.i.group2);break;case 3:o.setAttribute("style",l.i.group3);break;case 5:o.setAttribute("style",l.i.group5);break;case 9:o.setAttribute("style",l.i.group9);break;case 13:o.setAttribute("style",l.i.group13);break;default:o.setAttribute("style",l.i.group)}return o.innerText=m[e]||"Unusual combination",[n,i,o]}renderAgent(e,t,n,a){const s=o.personTR(this.controller.dom,p(n),(0,i.sym)(a),this.controller.isEditable?{deleteFunction:()=>this.deleteAgent(t,n,a).then(()=>e.removeChild(s)).catch(e=>this.controller.renderStatus(e))}:{});return s}async deleteAgent(e,t,n){const i=this.byCombo[e]||[],a=i.find(([e,i])=>e===t&&i===n);a&&i.splice(i.indexOf(a),1),await this.controller.save()}async addNewURI(e){await this.handleDroppedUri(e,h(1)),await this.controller.save()}async handleDroppedUris(e,t){try{await Promise.all(e.map(e=>this.handleDroppedUri(e,t))),await this.controller.save()}catch(e){return Promise.reject(e)}}async handleDroppedUri(e,t,n=!1){const a=function(e,t){const n=(0,i.sym)(e),a=t.findTypeURIs(n);for(const e in a)c.Rm(" drop object type includes: "+e);if(e.startsWith("http")&&3===e.split("/").length)return{pred:"origin",obj:n};if(e.startsWith("http")&&4===e.split("/").length&&e.endsWith("/"))return c.Rm("Assuming final slash on dragged origin URI was unintended!"),{pred:"origin",obj:(0,i.sym)(e.slice(0,-1))};if(s.A.vcard("WebID").uri in a)return{pred:"agent",obj:n};if(s.A.vcard("Group").uri in a)return{pred:"agentGroup",obj:n};if(n.sameTerm(s.A.foaf("Agent"))||n.sameTerm(s.A.acl("AuthenticatedAgent"))||n.sameTerm(s.A.rdf("Resource"))||n.sameTerm(s.A.owl("Thing")))return{pred:"agentClass",obj:n};if(s.A.vcard("Individual").uri in a||s.A.foaf("Person").uri in a||s.A.foaf("Agent").uri in a){const e=t.any(n,s.A.foaf("preferredURI"));return e?{pred:"agent",obj:(0,i.sym)(e)}:{pred:"agent",obj:n}}if(s.A.solid("AppProvider").uri in a)return{pred:"origin",obj:n};if(s.A.solid("AppProviderClass").uri in a)return{pred:"originClass",obj:n};return c.Rm(" Triage fails for "+e),null}(e,this.store),o=(0,i.sym)(e);if(!a&&!n){c.Rm(` Not obvious: looking up dropped thing ${o}`);try{await(this._store?.fetcher?.load(o.doc()))}catch(e){const t=`Ignore error looking up dropped thing: ${e}`;return c.z3(t),Promise.reject(new Error(t))}return this.handleDroppedUri(e,t,!0)}if(!a){const t=Object.keys(this.store.findTypeURIs(o)),n=`Error: Failed to add access target: ${e} is not a recognized ACL target type. Expected one of: vcard:WebID, vcard:Group, foaf:Person, foaf:Agent, solid:AppProvider, solid:AppProviderClass, or recognized ACL classes. Hint: try dropping a WebID profile URI, a vcard:Group URI, or a web app origin.`+(t.length>0?`Detected RDF types: ${t.join(", ")}`:"No RDF type was detected for this URI.");return c.z3(n),Promise.reject(new Error(n))}this.setACLCombo(t,e,a,this.controller.subject)}setACLCombo(e,t,n,i){e in this.byCombo||(this.byCombo[e]=[]),this.removeAgentFromCombos(t),this.byCombo[e].push([n.pred,n.obj.uri]),c.Rm(`ACL: setting access to ${i} by ${n.pred}: ${n.obj}`)}removeAgentFromCombos(e){for(let t=0;t<16;t++){const n=this.byCombo[h(t)];if(n)for(let t=0;t<n.length;t++)for(;t<n.length&&n[t][1]===e;)n.splice(t,1)}}}function h(e){const t=["Read","Append","Write","Control"],n=[];for(let i=0;i<4;i++)e&1<<i&&n.push("http://www.w3.org/ns/auth/acl#"+t[i]);return n.sort(),n.join("\n")}},7367(e,t,n){n.d(t,{DR:()=>f,Fp:()=>u,wR:()=>h});var i=n(1795),a=n(52),o=n(5619),s=n(6466),r=n(675),c=n(7423);let l=window;const p=Symbol("prevent double triggering of drop event");function u(e){if((0,c.Rm)("preventBrowserDropEvents called."),void 0!==l){if(l[p])return;l[p]=!0}e.addEventListener("drop",m,!1),e.addEventListener("dragenter",d,!1),e.addEventListener("dragover",d,!1)}function d(e){e.stopPropagation(),e.preventDefault()}function m(e){e.dataTransfer.files.length>0&&(l.confirm("Are you sure you want to drop this file here? (Cancel opens it in a new tab)")||(e.stopPropagation(),e.preventDefault(),(0,c.Rm)("@@@@ document-level DROP suppressed: "+e.dataTransfer.dropEffect)))}function f(e){let t=e.uri;"/"===t.slice(-1)&&(t=t.slice(0,-1));const n=t.lastIndexOf("/");return n>=0&&(t=t.slice(n+1)),t||"/"}function h(e,t,n,l){const p=t.dom,u=e.doc(),d=p.createElement("div");d.setAttribute("style",r.i.aclControlBoxContainer);const m=d.appendChild(p.createElement("h1"));m.textContent=`Sharing for ${n} ${a.label(e)}`,m.setAttribute("style",r.i.aclControlBoxHeader);const f=d.appendChild(p.createElement("div"));f.setAttribute("style",r.i.aclControlBoxStatus);try{(async function(e,t,n,a,r,l,p){return new Promise((u,d)=>(0,o.VM)(e,async(e,m,f,h,g,b)=>{if(!e)return d(new Error(`Error reading ${m?"":" default "}ACL. status ${f}: ${h}`));const v=function(e){const t=e.uri.split("#")[0],n=t.slice(0,-1).lastIndexOf("/"),i=t.indexOf("//");return i>=0&&n<i+2||n<0?null:t.slice(0,n+1)}(f),x=function(e,t,n){return n.holds(e,i.A.rdf("type"),i.A.space("Storage"),t)}(f,h,t)||function(e){return e.uri===e.site().uri}(f);if(!x&&v)try{const e=await(0,o.L$)(v);return u(y(e))}catch(e){(0,c.R8)(e)}return u(y());function y(e){return new s.v(n,a,r,p,x,f,h,g,b,e,t,l)}}))})(u,l,e,n,t,p,f).then(e=>d.appendChild(e.render()))}catch(e){f.innerText=e}return d}},5619(e,t,n){n.d(t,{D9:()=>v,H0:()=>w,L$:()=>T,Lu:()=>b,P3:()=>u,Tm:()=>h,Uf:()=>m,VM:()=>k,_7:()=>d,_E:()=>l,cH:()=>x,cl:()=>g,fb:()=>E,fg:()=>p,n1:()=>C,pe:()=>_,pp:()=>A,xo:()=>y,xw:()=>f});var i=n(1795),a=n(3138),o=n(52),s=n(7423),r=n(4961);const c=a.solidLogicSingleton.store;function l(e,t,n,a){const o=i.A.acl,s="/"===e.uri.slice(-1),l=c.each(void 0,o("default"),n,a).concat(c.each(void 0,o("defaultForNew"),n,a)).reduce((t,n)=>t.concat(c.statementsMatching(n,i.A.rdf("type"),o("Authorization"),a)).concat(c.statementsMatching(n,o("agent"),void 0,a)).concat(c.statementsMatching(n,o("agentClass"),void 0,a)).concat(c.statementsMatching(n,o("agentGroup"),void 0,a)).concat(c.statementsMatching(n,o("origin"),void 0,a)).concat(c.statementsMatching(n,o("originClass"),void 0,a)).concat(c.statementsMatching(n,o("mode"),void 0,a)).concat((0,r.st)(n,o("accessTo"),e,a)).concat(s?(0,r.st)(n,o("default"),e,a):[]),[]),p=(0,r.graph)();return l.forEach(e=>p.add(u(e.subject),u(e.predicate),u(e.object),(0,r.sym)(t.uri))),p;function u(e){const n=a.uri.length;return(0,r.sym)(e.uri.slice(0,n)===a.uri?t.uri+e.uri.slice(n):e.uri)}}function p(e,t,n=c,a=!1){const o=a?function(t,n){return t.each(void 0,n.acl("default"),e).concat(t.each(void 0,n.acl("defaultForNew"),e))}(n,i.A):n.each(void 0,i.A.acl("accessTo"),e),s=i.A.acl,r={agent:{},agentClass:{},agentGroup:{},origin:{},originClass:{}};return Object.keys(r).forEach(e=>{o.forEach(function(t){n.each(t,s("mode")).forEach(function(i){n.each(t,s(e)).forEach(function(n){r[e][n.uri]=r[e][n.uri]||{},r[e][n.uri][i.uri]=t})})})}),r}function u(e,t){const n=function(e,t){for(const n in{agent:!0,agentClass:!0,agentGroup:!0,origin:!0,originClass:!0})if(e[n])for(const i in e[n])for(const a in e[n][i])if(!t[n][i]||!t[n][i][a])return!1;return!0};return n(e,t)&&n(t,e)}function d(e){const t=e[0];let n,i;for(let a=1;a<e.length;a++)["agent","agentClass","agentGroup","origin","originClass"].forEach(function(o){if(n=e[a],n[o])for(i in n[o])for(const e in n[o][i])t[o][i]||(t[o][i]=[]),t[o][i][e]=!0});return t}function m(e,t){const n=[],i=function(e){if(e.length){k(e.shift().doc(),function(a,o,s,r,c,l){const u=!o;if(!a||!c||!l)return t(a,r);const d=p(u?c:s);n.push(d),i(e.slice(1))})}else t(!0,d(n))};i(e)}function f(e){const t={};return["agent","agentClass","agentGroup","origin","originClass"].forEach(function(n){for(const i in e[n]){const a=[];for(const t in e[n][i])a.push(t);a.sort();const o=a.join("\n");t[o]||(t[o]=[]),t[o].push([n,i])}}),t}function h(e,t,n,i){return g(e,t,f(n),i)}function g(e,t,n,a,o,s){const r=i.A.acl;for(const c in n){const l=n[c];if(!l.length)continue;const p=c.split("\n");let u=p.map(function(e){return e.split("#")[1]}).join("");s&&!o&&(u+="Default");const d=e.sym(a.uri+"#"+u);e.add(d,i.A.rdf("type"),r("Authorization"),a),o&&e.add(d,r("accessTo"),t,a),s&&e.add(d,r("default"),t,a);for(let t=0;t<p.length;t++)e.add(d,r("mode"),e.sym(p[t]),a);for(let t=0;t<l.length;t++){const n=l[t][0],i=l[t][1];e.add(d,r(n),e.sym(i),a)}}}function b(e){return v(f(e))}function v(e){let t="";for(const n in e){t+=n.split("\n").map(function(e){return e.split("#")[1][0]}).join("")+":";const a=e[n];for(let e=0;e<a.length;e++){const n=a[e][0],s=(0,r.sym)(a[e][1]);t+="agent"===n?"@":"",t+=s.sameTerm(i.A.foaf("Agent"))?"*":o.label(s),e<a.length-1&&(t+=",")}t+=";"}return"{"+t.slice(0,-1)+"}"}function x(e,t,n){const i=(0,r.graph)();return h(i,e,t,n),(0,r.serialize)(n,i,n.uri,"text/turtle")||""}function y(e,t,n,i,a){return w(e,t,f(n),i,a)}function w(e,t,n,i,a){const o=(0,r.graph)();g(o,t,n,i,!0),e.updater?.put(i,o.statementsMatching(void 0,void 0,void 0,i),"text/turtle",function(o,s,r){s?(e.fetcher?.unload(i),g(e,t,n,i,!0),e.fetcher.requested[i.uri]="done",a(s)):a(s,r)})}function A(e,t,n){const a=c.each(void 0,i.A.vcard("hasMember"),e);a?C(e,a,t,n):(t("This card is in no groups"),n(!0))}function C(e,t,n,i){n=n||s.Rm;const a=e.doc();k(a,function(s,r,l,d,f,h){if(!s||!f||!h)return i(!1,d);const g=p(r?l:f);m(t,function(t,s){if(!t)return i(!1,s);u(s,g)?n("Nice - same ACL. no change "+o.label(e)+" "+a):(n("Group ACLs differ for "+o.label(e)+" "+a),y(c,l,s,d,i))})})}function E(e,t,n){const i=c.any(e,a.ACL_LINK);if(!c.fetcher)throw new Error("Store has no fetcher");i?c.fetcher.webOperation("PUT",i.value,{data:t,contentType:"text/turtle"}).then(e=>{n(e.ok,e.error||"")}):c.fetcher.nowOrWhenFetched(e,void 0,function(i,o){if(!i)return n(i,"Gettting headers for ACL: "+o);const s=c.any(e,a.ACL_LINK);if(s){if(!c.fetcher)throw new Error("Store has no fetcher");c.fetcher.webOperation("PUT",s.value,{data:t,contentType:"text/turtle"}).then(e=>{n(e.ok,e.error||"")})}else n(!1,"No Link rel=ACL header for "+e)})}function k(e,t){_(e,function(n,a,o,s){const l=i.A.acl;if(!n)return t(!1,!1,a,s);const p=function(n){"/"===n.slice(-1)&&(n=n.slice(0,-1));const i=n.lastIndexOf("/");if(n.indexOf("/",n.indexOf("//")+2)>i)return t(!1,!0,404,"Found no ACL resource");n=n.slice(0,i+1);const a=(0,r.sym)(n);_(a,function(i,s,r){if(!i)return t(!1,!0,s,`( No ACL pointer ${n} ${s})${r}`);if(403===s)return t(!1,!0,s,`( default ACL file FORBIDDEN. Stop.${n})`);if(404===s)return p(n);if(200!==s)return t(!1,!0,s,`Error status '${s}' searching for default for ${a}`);if(!c.each(void 0,l("default"),c.sym(n),r).concat(c.each(void 0,l("defaultForNew"),c.sym(n),r)).length)return p(n);const u=c.sym(n);return t(!0,!1,e,o,u,r)})};return n?404!==a?403===a?t(!1,!1,a,`(Sharing not available to you)${s}`):200!==a?t(!1,!1,a,`Error ${a} accessing Access Control information for ${e}: ${s}`):t(!0,!0,e,o):void p(e.uri):t(!1,!1,a,`Error accessing Access Control information for ${e}) ${s}`)})}function _(e,t){if(!c.fetcher)throw new Error("kb has no fetcher");c.fetcher.nowOrWhenFetched(e,void 0,function(n,i){if(!n)return t(n,`Can't get headers to find ACL for ${e}: ${i}`);const o=c.any(e,a.ACL_LINK);if(o){if(!c.fetcher)throw new Error("kb has no fetcher");if(c.fetcher.nonexistent[o.value])return t(!0,404,o,`ACL file ${o} does not exist.`);c.fetcher.nowOrWhenFetched(o,void 0,function(e,n,i){e?t(!0,200,o):t(!0,i.status,o,`Can't read Access Control File ${o}: ${n}`)})}else t(!1,900,`No Link rel=ACL header for ${e}`)})}async function T(e){return new Promise((t,n)=>k((0,r.sym)(e),(i,a,o,s,r)=>i?t(a?o:r):n(new Error(`Error loading ${e}`))))}},1928(e,t,n){n.d(t,{g:()=>p});var i=n(7423),a=n(3378),o=n(967),s=n(1795),r=n(52),c=n(4608),l=n(675);class p{rootElement;barElement;isExpanded=!1;constructor(e){this.groupList=e,this.rootElement=e.controller.dom.createElement("div"),this.barElement=e.controller.dom.createElement("div")}render(){return this.rootElement.innerHTML="",this.rootElement.appendChild(this.renderAddButton()),this.rootElement.appendChild(this.barElement),this.rootElement}renderAddButton(){return c.button(this.groupList.controller.dom,`${a.Pt.iconBase}noun_34653_green.svg`,"Add ...",()=>{this.toggleBar(),this.renderBar()})}renderBar(){this.barElement.innerHTML="",this.isExpanded&&(this.barElement.appendChild(this.renderPersonButton()),this.barElement.appendChild(this.renderGroupButton()),this.barElement.appendChild(this.renderPublicButton()),this.barElement.appendChild(this.renderAuthenticatedAgentButton()),this.barElement.appendChild(this.renderBotButton()),this.barElement.appendChild(this.renderAppsButton()))}renderSimplifiedBar(e){Array.from(this.barElement.children).filter(t=>t!==e).forEach(e=>this.barElement.removeChild(e))}renderPersonButton(){return c.button(this.groupList.controller.dom,a.Pt.iconBase+c.iconForClass["vcard:Individual"],"Add Person",e=>{this.renderSimplifiedBar(e.target),this.renderNameForm(s.A.vcard("Individual"),"person").then(e=>this.addPerson(e)).then(()=>this.renderCleanup()).catch(e=>this.groupList.controller.renderStatus(e))})}renderGroupButton(){return c.button(this.groupList.controller.dom,a.Pt.iconBase+c.iconForClass["vcard:Group"],"Add Group",e=>{this.renderSimplifiedBar(e.target),this.renderNameForm(s.A.vcard("Group"),"group").then(e=>this.addGroup(e)).then(()=>this.renderCleanup()).catch(e=>this.groupList.controller.renderStatus(e))})}renderNameForm(e,t){return c.askName(this.groupList.controller.dom,this.groupList.store,this.barElement,s.A.vcard("URI"),e,t)}renderPublicButton(){return c.button(this.groupList.controller.dom,a.Pt.iconBase+c.iconForClass["foaf:Agent"],"Add Everyone",()=>this.addAgent(s.A.foaf("Agent").uri).then(()=>this.groupList.controller.renderTemporaryStatus("Adding the general public to those who can read. Drag the globe to a different level to give them more access.")).then(()=>this.renderCleanup()))}renderAuthenticatedAgentButton(){return c.button(this.groupList.controller.dom,`${a.Pt.iconBase}noun_99101.svg`,"Anyone logged In",()=>this.addAgent(s.A.acl("AuthenticatedAgent").uri).then(()=>this.groupList.controller.renderTemporaryStatus("Adding anyone logged in to those who can read. Drag the ID icon to a different level to give them more access.")).then(()=>this.renderCleanup()))}renderBotButton(){return c.button(this.groupList.controller.dom,a.Pt.iconBase+"noun_Robot_849764.svg","A Software Agent (bot)",e=>{this.renderSimplifiedBar(e.target),this.renderNameForm(s.A.schema("Application"),"bot").then(e=>this.addBot(e)).then(()=>this.renderCleanup())})}renderAppsButton(){return c.button(this.groupList.controller.dom,`${a.Pt.iconBase}noun_15177.svg`,"A Web App (origin)",e=>{this.renderSimplifiedBar(e.target);const t={div:this.barElement,dom:this.groupList.controller.dom},n=this.renderAppsTable(t).catch(e=>this.groupList.controller.renderStatus(e));this.renderAppsView();const i=this.renderNameForm(s.A.schema("WebApplication"),"webapp domain").then(e=>this.getOriginFromName(e));Promise.race([n,i]).then(e=>{e&&this.groupList.addNewURI(e)}).then(()=>this.renderCleanup())})}renderAppsView(){const e=this.groupList.controller.context.session.paneRegistry.byName("trustedApplications");if(e){const t=e.render(null,this.groupList.controller.context);t.setAttribute("style",l.i.trustedAppController);const n=c.cancelButton(this.groupList.controller.dom,()=>this.renderCleanup());n.setAttribute("style",l.i.trustedAppCancelButton),t.insertBefore(n,t.firstChild),this.barElement.appendChild(t)}}async renderAppsTable(e){await(0,o.ensureLoadedProfile)(e);const t=this.groupList.store.each(e.me,s.A.acl("trustedApp")),n=t.flatMap(e=>this.groupList.store.each(e,s.A.acl("origin")));return this.barElement.appendChild(this.groupList.controller.dom.createElement("p")).textContent=`You have ${n.length} selected web apps.`,new Promise((e,n)=>{const i=this.barElement.appendChild(this.groupList.controller.dom.createElement("table"));i.setAttribute("style",l.i.trustedAppAddApplicationsTable),t.forEach(t=>{const a=this.groupList.store.any(t,s.A.acl("origin"));a||n(new Error(`Unable to pick app: ${t.value}`));const o=c.personTR(this.groupList.controller.dom,s.A.acl("origin"),a,{}),l=this.groupList.controller.dom.createElement("table"),p=l.appendChild(this.groupList.controller.dom.createElement("tr"));p.appendChild(this.groupList.controller.dom.createElement("td")).appendChild(o);p.appendChild(this.groupList.controller.dom.createElement("td")).textContent=`Give access to ${this.groupList.controller.noun} ${r.label(this.groupList.controller.subject)}?`;p.appendChild(this.groupList.controller.dom.createElement("td")).appendChild(c.continueButton(this.groupList.controller.dom,()=>e(a.value))),i.appendChild(l)})})}renderCleanup(){this.renderBar(),this.groupList.render()}async addPerson(e){if(!e)return this.toggleBar();if(!e.match(/^https?:/i))return Promise.reject(new Error("Not a http URI"));i.Rm(`Adding to ACL person: ${e}`),await this.groupList.addNewURI(e),this.toggleBar()}async addGroup(e){if(!e)return this.toggleBar();if(!e.match(/^https?:/i))return Promise.reject(new Error("Not a http URI"));i.Rm("Adding to ACL group: "+e),await this.groupList.addNewURI(e),this.toggleBar()}async addAgent(e){await this.groupList.addNewURI(e),this.toggleBar()}async addBot(e){if(!e)return this.toggleBar();if(!e.match(/^https?:/i))return Promise.reject(new Error("Not a http URI"));i.Rm("Adding to ACL bot: "+e),await this.groupList.addNewURI(e),this.toggleBar()}async getOriginFromName(e){if(!e)return Promise.resolve();if(!e.match(/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i))return Promise.reject(new Error("Not a domain name"));const t="https://"+e;return i.Rm("Adding to ACL origin: "+t),this.toggleBar(),t}toggleBar(){this.isExpanded=!this.isExpanded}}},5923(e,t,n){n.d(t,{B:()=>o,u:()=>s});var i=n(5619),a=n(7367);const o={adoptACLDefault:i._E,readACL:i.fg,sameACL:i.P3,ACLunion:i._7,loadUnionACL:i.Uf,ACLbyCombination:i.xw,makeACLGraph:i.Tm,makeACLGraphbyCombo:i.cl,ACLToString:i.Lu,comboToString:i.D9,makeACLString:i.cH,putACLObject:i.xo,putACLbyCombo:i.H0,fixIndividualCardACL:i.pp,fixIndividualACL:i.n1,setACL:i.fb,getACLorDefault:i.VM,getACL:i.pe},s={preventBrowserDropEvents:a.Fp,shortNameForFolder:a.DR,ACLControlBox5:a.wR}},7236(e,t,n){n.d(t,{eD:()=>w,z6:()=>x});var i=n(7423),a=n(3378),o=n(6127),s=n(1795),r=n(8153),c=n(4961),l=n(675),p=n(52),u=n(4608),d=n(3138),m=n(967);const f={icons:a.Pt,ns:s.A,media:o.$,pad:r,style:l.i,utils:p,widgets:u},h=c.Namespace("http://www.w3.org/2002/01/bookmark#"),g=p.label,b=window.document||null;function v(e,t){return new Promise(function(n,i){d.store.updater.update(e,t,function(e,t,a){t?n():i(new Error(a))})})}async function x(e){const t=h("Bookmark");if(await(0,m.findAppInstances)(e,t,!0),e.instances&&e.instances.length>0)e.bookmarkDocument=e.instances[0],e.instances.length>1&&i.R8("More than one bookmark file! "+e.instances);else if(e.publicProfile){const n=c.sym(e.publicProfile.dir().uri+"bookmarks.ttl");try{i.Rm("Creating new bookmark file "+n),await d.store.fetcher.createIfNotExists(n)}catch(t){return i.R8("Can't make fresh bookmark file:"+t),e}await d.createTypeIndexLogic.registerInTypeIndex(n,e.index,t),e.bookmarkDocument=n}else i.R8("You seem to have no bookmark file, nor even a profile file!");return e}async function y(e,t,n){await d.store.fetcher.load(e.bookmarkDocument);const a=d.store.each(null,h("recalls"),t,e.bookmarkDocument);if(a.length){if(!confirm("Delete bookmark on this?"+a.length))return;for(let e=0;e<a.length;e++)try{await v(d.store.connectedStatements(a[e]),[]),n.style.backgroundColor="white",i.Rm("Bookmark deleted: "+a[e])}catch(e){i.z3("Cant delete bookmark:"+e),i.R8("Cannot delete bookmark:"+e)}}else{const a=await async function(e,t){let n="";const a=d.authn.currentUser();if(!a)throw new Error("Must be logged on to add Bookmark");const o=d.store.any(t,s.A.foaf("maker"));n=g(o)+": "+d.store.anyValue(t,s.A.sioc("content")).slice(0,80);const r=e.bookmarkDocument,l=f.widgets.newThing(r,n),p=[c.st(r,f.ns.dct("references"),l,r),c.st(l,f.ns.rdf("type"),h("Bookmark"),r),c.st(l,f.ns.dct("created"),new Date,r),c.st(l,h("recalls"),t,r),c.st(l,f.ns.foaf("maker"),a,r),c.st(l,f.ns.dct("title"),n,r)];try{await v([],p)}catch(e){const t="Making bookmark: "+e;return i.R8(t),null}return l}(e,t);n.style.backgroundColor="yellow",i.Rm("Bookmark added: "+a)}}async function w(e,t){let n;if(e.bookmarkDocument)return n=f.widgets.button(b,f.icons.iconBase+"noun_45961.svg",g(h("Bookmark")),()=>{y(e,t,n)}),n.target=t,await async function(t){await d.store.fetcher.load(e.bookmarkDocument);const n=d.store.any(null,h("recalls"),t.target,e.bookmarkDocument);t.style=f.style.buttonStyle,n&&(t.style.backgroundColor="yellow")}(n),n}},2465(e,t,n){n.d(t,{YM:()=>p,n6:()=>m,oQ:()=>d,oy:()=>f,x6:()=>u});var i=n(7423),a=n(2893),o=n(3138),s=n(1795),r=n(4961),c=(n(52),n(630)),l=n(6855);class p{constructor(e,t){this.channel=e,this.channelRoot=e.doc(),this.options=t,this.dateFolder=new a.J(this.channelRoot,"chat.ttl"),this.div=null}async createMessage(e){return this.updateMessage(e)}async updateMessage(e,t=null,n,a=null){const p=[],u=new Date,d=""+u.getTime(),f=r.term(u),h=t?t.doc():this.dateFolder.leafDocumentFromDate(u),g=o.store.sym(h.uri+"#Msg"+d),b=o.authn.currentUser(),v=(0,c.YJ)();if(v.id=g.uri,t){const e=o.store.any(t,s.A.foaf("maker"));if(e.uri!==b.uri){const t="Error you cannot delete/edit a message from someone else : \n"+e.uri;throw i.R8(t),alert(t),new Error(t)}{const e=await m(t);p.push(r.st(e,s.A.dct("isReplacedBy"),g,h));const i=o.store.any(e,s.A.sioc("has_reply"));i&&p.push(r.st(g,s.A.sioc("has_reply"),i,h)),n&&p.push(r.st(g,s.A.schema("dateDeleted"),f,h))}}else p.push(r.st(this.channel,s.A.wf("message"),g,h));if(p.push(r.st(g,s.A.sioc("content"),o.store.literal(e),h)),v.content=e,p.push(r.st(g,s.A.dct("created"),f,h)),v.created=f.value,b){p.push(r.st(g,s.A.foaf("maker"),b,h)),v.maker=b.uri;const e=await(0,l.Tn)(b),t=(0,c.vt)(v,e);p.push(r.st(g,r.sym(`${c.yv}proofValue`),r.lit(t),h))}a&&(p.push(r.st(a,s.A.sioc("has_member"),g,h)),a.doc().sameTerm(g.doc())||p.push(r.st(a,s.A.sioc("has_member"),g,a.doc())));try{await o.store.updater.updateMany([],p)}catch(e){const t="Error saving chat message: "+e;throw i.R8(t),alert(t),new Error(t)}return g}async deleteMessage(e){return this.updateMessage("(message deleted)",e,!0)}async createThread(e){const t=o.store.each(e,s.A.sioc("has_reply"),null,e.doc()).filter(e=>o.store.holds(e,s.A.rdf("type"),s.A.sioc("Thread"),e.doc()));if(t.length>0)return t[0];const n=r.sym(e.uri+"-thread"),i=[r.st(n,s.A.rdf("type"),s.A.sioc("Thread"),n.doc()),r.st(e,s.A.sioc("has_reply"),n,n.doc())];return await o.store.updater.update([],i),n}}async function u(e){const t=[e],n={};n[e.uri]=!0;let i=e;for(;;){const e=o.store.any(null,s.A.dct("isReplacedBy"),i,i.doc());if(!e||n[e.uri])break;await o.store.fetcher.load(e),t.unshift(e),n[e.uri]=!0,i=e}for(i=e;;){const e=o.store.any(i,s.A.dct("isReplacedBy"),null,i.doc());if(!e||n[e.uri])break;t.push(e),n[e.uri]=!0,i=e}return t}async function d(e){let t=e;const n={};for(;t;){if(n[t.uri])return i.z3("originalVersion: verion loop"+e),e;n[t.uri]=!0,e=t,await o.store.fetcher.load(e),t=o.store.any(null,s.A.dct("isReplacedBy"),e,e.doc())}return e}async function m(e){let t=e;const n={};for(;t;){if(n[t.uri])return i.z3("mostRecentVersion: verion loop"+e),e;n[t.uri]=!0,e=t,await o.store.fetcher.load(e),t=o.store.any(e,s.A.dct("isReplacedBy"),null,e.doc())}return e}function f(e){return o.store.holds(e,s.A.schema("dateDeleted"),null,e.doc())}},2893(e,t,n){n.d(t,{J:()=>c});var i=n(7423),a=n(3138),o=n(1795),s=n(4961);async function r(e){return await a.store.fetcher.load(e),!(a.store.statementsMatching(null,o.A.dct("created"),null,e).length>0)}class c{constructor(e,t,n){this.root=e,this.rootFolder=e.dir(),this.leafFileName=t||"index.ttl",this.membershipProperty=n||o.A.wf("leafObject")}leafDocumentFromDate(e){let t=e.toISOString().split("T")[0].replace(/-/g,"/");return t=this.root.dir().uri+t+"/"+this.leafFileName,a.store.sym(t)}dateFromLeafDocument(e){const t=this.rootFolder.uri.length,n=e.uri.slice(t,t+10).replace(/\//g,"-");return new Date(n)}async loadPrevious(e,t){async function n(e,s){function r(e){const t=e.uri.slice(0,-1).split("/").slice(-1)[0];return!!"0123456789".includes(t[0])}function c(e){return(e=e.filter(r)).sort(),t||e.reverse(),e.pop()}const l=e.dir();try{await a.store.fetcher.load(l);let n=a.store.each(l,o.A.ldp("contains"));n=n.filter(function(n){return!(t?n.uri>=e.uri:n.uri<=e.uri)});const i=c(n);if(i)return i}catch(e){if(!e.response||!e.response.status||404!==e.response.status)throw i.Rm("*** Error NON 404 for chat parent file "+l),new Error(`*** ${e.message} for chat folder ${l}`);i.Rm("Error 404 for chat parent file "+l)}if(0===s)return null;const p=await n(l,s-1);if(!p)return null;await a.store.fetcher.load(p);return c(a.store.each(p,o.A.ldp("contains")))}let s=this.leafDocumentFromDate(e).dir();for(;;){const t=await n(s,3);if(!t)return null;{const n=a.store.sym(t.uri+this.leafFileName),i=this.dateFromLeafDocument(n);if(!await r(n))return i;e=i,s=this.leafDocumentFromDate(e).dir()}}}async firstLeaf(e){const t=s.graph(),n=new s.Fetcher(t);async function a(i){delete n.requested[i.uri],await n.load(i,{force:!0});let a=t.each(i,o.A.ldp("contains"));if(a=a.filter(function(e){const t=e.uri.slice(0,-1).split("/").slice(-1)[0];return!!"0123456789".includes(t[0])}),0===a.length)throw new Error(" @@@ No children to parent2 "+i);return a.sort(),e&&a.reverse(),a[0]}const r=await a(this.root.dir()),c=await a(r),l=await a(c),p=s.sym(l.uri+"chat.ttl");await n.load(p);const u=t.each(this.root,this.membershipProperty,null,p);if(0===u.length){const e=" INCONSISTENCY -- no chat leafObject in file "+p;throw i.uP(e),new Error(e)}const d=u.map(e=>[t.any(e,o.A.dct("created")),e]);return d.sort(),e&&d.reverse(),d[0][1]}}},9509(e,t,n){n.d(t,{r5:()=>u,rg:()=>p});var i=n(4961),a=n(3138),o=n(7423),s=(n(3378),n(1795)),r=n(4608),c=n(2465),l=n(3262);async function p(e,t,n,i,a,o){const s=await(0,l.Uh)(e,n,i,a,o);a.selectedMessage&&a.selectedMessage.sameTerm(n)&&(s.style.backgroundColor="yellow",a.selectedElement=s,t.selectedElement=s);let r=!1;for(let e=t.firstChild;e;e=e.nextSibling){const n=!0===a.newestfirst,i=s.AJAR_date;if(i>e.AJAR_date&&n||i<e.AJAR_date&&!n){t.insertBefore(s,e),r=!0;break}}r||t.appendChild(s)}async function u(e,t,n,u){async function d(e,t){if((0,c.oy)(e)&&!u.showDeletedMessages)return;let n=a.store.any(null,s.A.sioc("has_member"),e,e.doc());const i=a.store.any(e,s.A.sioc("id"),null,e.doc());if(i&&!n&&(n=a.store.any(null,s.A.sioc("has_member"),i,e.doc())),u.thread){if(a.store.holds(e,s.A.sioc("has_reply"),u.thread));else if(!n||!n.sameTerm(u.thread))return}else if(n)return;t.fresh||await p(x,t,e,t.fresh,u,C)}async function m(e){const t=e?_:T;let n=t.messageTable.date;if(e&&_.limit&&n<=_.limit)return E||await g(),!0;if(n=await y.loadPrevious(n,e),n||e||E||await g(),!n)return!0;let i=!1;if(!e){const e=y.leafDocumentFromDate(new Date);i=y.leafDocumentFromDate(n).sameTerm(e)}const a=await f(n,i);return t.messageTable=a,(e?v:!v)?w.appendChild(a):w.insertBefore(a,w.firstChild),i}async function f(t,n){const i=y.leafDocumentFromDate(t);try{await a.store.fetcher.createIfNotExists(i)}catch(a){const s=e.createElement("table").appendChild(e.createElement("tr"));return a.response&&a.response.status&&404===a.response.status?await h(t,n):(o.Rm("*** Error NON 404 for chat file "+i),s.appendChild(r.errorMessageBlock(e,a,"pink")),s)}return await h(t,n)}async function h(t,n){async function i(){return await m(!1)}const o=e.createElement("table");o.style.width="100%",o.extendBackwards=async function(){const e=await m(!0);return e?o.initial=!0:o.extendedBack=!0,e},o.extendForwards=i,o.date=t;const c=y.leafDocumentFromDate(t);if(o.chatDocument=c,o.fresh=!1,o.setAttribute("style","width: 100%;"),n){o.final=!0,E=o,T.messageTable=o;const e=(0,l.LV)(x,o,C,u);v?o.insertBefore(e,o.firstChild):o.appendChild(e),o.inputRow=e}{const n=e.createElement("tr"),i=n.appendChild(e.createElement("td"));i.style="text-align: center; vertical-align: middle; color: #888; font-style: italic;",i.textContent=r.shortDate(t.toISOString(),!0);const a=n.appendChild(e.createElement("td"));u.includeRemoveButton&&a.appendChild(r.cancelButton(e,e=>{w.parentNode.removeChild(w)})),o.extendedForwards=!1,v?o.appendChild(n):o.insertBefore(n,o.firstChild)}const p=a.store.statementsMatching(null,s.A.wf("message"),null,c);!n&&p.length;for(const e of p)await d(e.object,o);return o.fresh=!0,o}async function g(){const e=new Date,t=y.leafDocumentFromDate(e),c=await f(e,!0);return w.appendChild(c),w.refresh=async function(){var e;await async function(){const e=y.leafDocumentFromDate(new Date);if(!e.sameTerm(T.messageTable.chatDocument)){E.inputRow&&(E.removeChild(E.inputRow),delete E.inputRow);const t=T.messageTable.chatDocument;if(await g(),!a.store.holds(t,s.A.rdfs("seeAlso"),e,t)){const n=[i.st(t,s.A.rdfs("seeAlso"),e,t)];try{a.store.updater.update([],n)}catch(e){alert("Unable to link old chat file to new one:"+e)}}}}(new Date),await async function(e,t){const n={};let i,o;for(i=t.firstChild;i;i=i.nextSibling)i.AJAR_subject&&(n[i.AJAR_subject.uri]=!0);const c=a.store.each(e,s.A.wf("message"),null,t.chatDocument),l={};for(const e of c)l[e.uri]=!0,n[e.uri]||await d(e,t);for(i=t.firstChild;i;)o=i.nextSibling,i.AJAR_subject&&!l[i.AJAR_subject.uri]&&t.removeChild(i),i=o;for(i=t.firstChild;i;i=i.nextSibling)i.AJAR_subject&&r.refreshTree(i)}(n,c),e=n,"Notification"in window?"granted"===Notification.permission?new Notification(e):"denied"!==Notification.permission&&Notification.requestPermission().then(function(t){"granted"===t&&new Notification(e)}):o.R8("This browser does no t support desktop notification")},a.store.updater.addDownstreamChangeListener(t,w.refresh),E=c,T.messageTable=E,c}async function b(e,t){if(S)return;S=!0;const n=!t;let i;for(;w.scrollTop<150&&_.messageTable&&!_.messageTable.initial&&_.messageTable.extendBackwards;){if(0===w.scrollHeight)return setTimeout(b,2e3),void(S=!1);const e=w.scrollHeight-w.scrollTop;if(i=await _.messageTable.extendBackwards(),n&&(w.scrollTop=w.scrollHeight-e),t&&t(),i)break}for(;u.selectedMessage&&w.scrollHeight-w.scrollTop-w.clientHeight<150&&T.messageTable&&!T.messageTable.final&&T.messageTable.extendForwards;){const e=w.scrollTop;if(i=await T.messageTable.extendForwards(),n&&(w.scrollTop=e),t&&t(),i)break}S=!1}(u=u||{}).authorDateOnLeft=!1;const v="1"===u.newestFirst||!0===u.newestFirst,x=new c.YM(n,u),y=x.dateFolder,w=e.createElement("div");x.div=w;const A=w.appendChild(e.createElement("div")),C={dom:e,statusArea:A,div:A};let E,k;const _={messageTable:null},T={messageTable:null};if(u.thread){const e=u.thread;if(k=a.store.any(null,s.A.sioc("has_reply"),e,e.doc()),k){const e=a.store.any(k,s.A.dct("created"),null,k.doc());e&&(_.limit=new Date(e.value))}}let S=!1;return await async function(){function e(){o&&o.selectedElement&&o.selectedElement.scrollIntoView({block:"center"})}let t,n,i;u.selectedMessage&&(n=u.selectedMessage.doc()),k&&(i=k.doc());const a=n||i;if(a){const e=new Date;t=y.leafDocumentFromDate(e).sameTerm(a)}let o;if(a&&!t){const n=y.dateFromLeafDocument(a);o=await f(n,t),w.appendChild(o),_.messageTable=o,T.messageTable=o,e(),setTimeout(e,1e3)}else await g(),_.messageTable=E,T.messageTable=E;await b(0,function(){u.selectedElement?u.selectedElement.scrollIntoView({block:"center"}):E.inputRow.scrollIntoView&&E.inputRow.scrollIntoView(v)}),w.addEventListener("scroll",b),u.solo&&document.body.addEventListener("scroll",b)}(),w}},6855(e,t,n){n.d(t,{Tn:()=>m,lG:()=>d});var i=n(7423),a=n(6885),o=n(508),s=n(1795),r=n(3138),c=n(4961),l=n(8425),p=n(3907);function u(e){return(0,o.My)(a.ko.getPublicKey((0,o.aT)(e)))}async function d(e){await r.store.fetcher.load(e);const t=await(0,l.AB)(e);try{await r.store.fetcher.load(t);const n=r.store.any(e,s.A.solid("publicKey"));return n?.value}catch(e){return}}async function m(e){await r.store.fetcher.load(e);const t=await(0,l.AB)(e),n=await(0,l.ED)(e),d=await(0,l.S3)(e,t);let m=await(0,l.cX)(e,n),h=!0;if(m&&d!==u(m)&&confirm("This is strange the publicKey is not valid for\n"+e?.uri+"'shall we repair keeping the private key ?")&&(h=!1),!m||!d||!h){let l=[],g=[];if(m||(m=(0,o.My)(a.ko.utils.randomSecretKey()),g=[c.st(e,s.A.solid("privateKey"),c.literal(m),r.store.sym(n))],await f(n,[],g,e.uri)),!d||!h){l=[],d&&(l=[c.st(e,s.A.solid("publicKey"),c.lit(d),r.store.sym(t))],i.Rm("delete invalid publicKey "+l));const n=u(m);g=[c.st(e,s.A.solid("publicKey"),c.literal(n),r.store.sym(t))],await f(t,l,g)}const b=n.substring(0,n.lastIndexOf("/")+1);await(0,p.lO)(b,(0,p.vb)(e.uri))}return m}async function f(e,t,n,a=""){await(async e=>{await r.store.fetcher.load(e);const t=r.store.any(r.store.sym(e),r.store.sym("http://www.iana.org/assignments/link-relations/acl"));if(t)try{const e=await r.store.fetcher.webOperation("DELETE",t.value);i.Rm("delete keyAcl"+t.value+" "+e.status)}catch(e){if(404!==e.response.status)throw new Error(e);i.Rm("delete keyAcl"+t.value+" "+e.response.status)}})(e),await r.store.updater.updateMany(t,n);const o=(0,p.G2)(e,a);await(0,p.lO)(e,o)}},3262(e,t,n){n.d(t,{LV:()=>T,Uh:()=>k,zt:()=>_});var i=n(9509),a=n(5187),o=n(7236),s=n(2465),r=n(7423),c=n(3378),l=n(3138),p=n(967),u=n(6127),d=n(1795),m=n(8153),f=n(675),h=n(52),g=n(4608),b=n(630),v=n(6855);const x=window.document,y=f.i.messageBodyStyle,w=h.label;const A=function(e,t){const n=x.createElement("a");return t&&t.uri&&(n.setAttribute("href",t.uri),n.addEventListener("click",g.openHrefInOutlineMode,!0),n.setAttribute("style","color: #3B5998; text-decoration: none; ")),n.textContent=e,n};function C(e){const t=l.store.any(e,d.A.foaf("nick"));return t?""+t.value:""+w(e)}function E(e,t,n,i){const a=e.appendChild(A(C(t),t));t.uri&&l.store.fetcher.nowOrWhenFetched(t.doc(),void 0,function(e,n){a.textContent=C(t)}),e.appendChild(x.createElement("br")),e.appendChild(A(n,i))}async function k(e,t,n,i,o){let p=!1;const u="1"===i.colorizeByAuthor||!0===i.colorizeByAuthor,f=l.store.any(t,d.A.foaf("maker")),h=l.store.any(t,d.A.dct("created")),k=await(0,s.n6)(t),_=l.store.any(k,d.A.foaf("maker")),T=f.uri===_?.uri?k:t,S=l.store.any(T,d.A.sioc("content")),L=await(0,s.x6)(T);L.length>1&&r.Rm("renderMessageRow versions: ",L.join(", "));const j=L.map(e=>l.store.each(e,d.A.sioc("has_reply"))).flat();let R=null;const N=[];for(const e of j)l.store.holds(e,d.A.rdf("type"),d.A.sioc("Thread"))?(R=e,r.Rm("renderMessageRow: found thread: "+R)):N.push(e);N.length>1&&r.Rm("renderMessageRow: found normal replies: ",N),R||(R=l.store.any(null,d.A.sioc("has_member"),t));const B=l.store.any(T,$rdf.sym(`${b.yv}proofValue`)),I=(0,b.YJ)();I.id=T.uri,I.created=l.store.any(T,d.A.dct("created")).value,I.content=S.value,I.maker=f.uri,B?.value?(0,v.lG)(f).then(e=>{e||r.R8("message is signed but "+f.uri+" is missing publicKey");e?.match(/[0-9A-Fa-f]{6}/g)?B?.value&&!(0,b.Od)(B?.value,I,e)&&r.R8("invalid signature\n"+I.id):r.R8("invalid publicKey hex string\n"+f.uri+"\n"+e)}):(p=!0,r.R8(T.uri+" is unsigned"));const O=await(0,s.oQ)(t),D=!t.sameTerm(O),$=l.store.the(O,d.A.dct("created"),null,O.doc())||l.store.the(t,d.A.dct("created"),null,t.doc()),M=x.createElement("tr");p&&M.setAttribute("style","background-color: red"),M.AJAR_date=$.value,M.AJAR_subject=t;const F=x.createElement("td");if(M.appendChild(F),i.authorDateOnLeft)E(F,f,g.shortDate($.value),t);else{const e=x.createElement("img");e.setAttribute("style","max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;"),g.setImage(e,f),F.appendChild(e)}let P=g.shortDate($.value);D&&(P+=" ... "+g.shortDate(h.value));const U=M.appendChild(x.createElement("td"));i.authorDateOnLeft||function(e,t,n,i){const a=e.appendChild(A(w(t),t));t.uri&&l.store.fetcher.nowOrWhenFetched(t.doc(),void 0,function(e,n){a.textContent=C(t)});const o=e.appendChild(A(n,i));o.style.fontSize="80%",o.style.marginLeft="1em",e.appendChild(x.createElement("br"))}(U,f,P,t);const z=S?S.value.trim():"??? no content?";let q=null;if(/^https?:\/[^ <>]*$/i.test(z)){if(/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(z)&&i.expandImagesInline){const e=function(e,t){const n=x.createElement("img");let i="10";t.inlineImageHeightEms&&(i=(""+t.inlineImageHeightEms).trim()),n.setAttribute("style","max-height: "+i+"em; border-radius: 1em; margin: 0.7em;"),e&&n.setAttribute("src",e);const a=x.createElement("a");return a.setAttribute("href",e),a.setAttribute("target","images"),a.appendChild(n),g.makeDraggable(n,$rdf.sym(e)),a}(z,i);U.appendChild(e)}else{const e=U.appendChild(x.createElement("a"));q=e.appendChild(x.createElement("p")),e.href=z,q.textContent=z,U.appendChild(e)}}else q=x.createElement("p"),U.appendChild(q),q.textContent=z;if(q){const e=u?m.lightColorHash(f):function(e){return e?"#e8ffe8":"white"}(n);q.setAttribute("style",y+"background-color: "+e+";")}const H=await(0,a.lk)(t,t.doc());H.children.length&&(U.appendChild(x.createElement("br")),U.appendChild(H));const W=x.createElement("td");M.appendChild(W);const V=g.button(x,c.Pt.iconBase+"noun_243787.svg","...");return W.appendChild(V),V.addEventListener("click",async function(n){if(M.toolTR)return M.parentNode.removeChild(M.toolTR),void delete M.toolTR;const s=x.createElement("tr"),r=await(0,a.tJ)(t,M,{...o,chatOptions:i},e);r.style="border: 0.05em solid #888; border-radius: 0 0 0.7em 0.7em; border-top: 0; height:3.5em; background-color: #fff;",M.nextSibling?M.parentElement.insertBefore(s,M.nextSibling):M.parentElement.appendChild(s),M.toolTR=s,s.appendChild(x.createElement("td"));const c=s.appendChild(x.createElement("td"));s.appendChild(x.createElement("td")),c.appendChild(r)}),R&&i.showThread&&W.appendChild(g.button(x,c.Pt.iconBase+"noun_1180164.svg","see thread",e=>{i.showThread(R,i)})),M}async function _(e,t,n,i){const a=e.parentNode,o=T(n,a,i,n.options,await(0,s.n6)(t));a.insertBefore(o,e),o.originalRow=e,e.style.visibility="hidden"}function T(e,t,n,a,s){async function h(e){await b(L.value,!0)}async function b(o,c){let l;c&&(L.setAttribute("style",y+"color: #bbb;"),L.disabled=!0);try{l=await e.updateMessage(o,s,null,a.thread)}catch(e){return void(n.statusArea||k).appendChild(g.errorMessageBlock(x,"Error writing message: "+e))}await async function(o){if(await(0,i.rg)(e,t,o,!1,a,n),s){const e=k.originalRow;e.parentNode?e.parentNode.removeChild(e):(r.R8("No parentNode on old message "+e.textContent),e.style.backgroundColor="#fee",e.style.visibility="hidden"),k.parentNode.removeChild(k)}else c&&(L.value="",L.setAttribute("style",y),L.disabled=!1,L.scrollIntoView(a.newestFirst),L.focus(),L.select())}(l)}function v(e){const n=t.chatDocument.dir().uri;g.uploadFiles(l.store.fetcher,e,n+"Files",n+"Pictures",async function(e,t){await b(t)})}const w=async function(e){for(const t of e)await b(t)};let A,C;s?(A=l.store.anyValue(s,d.A.dct("created"),null,s.doc()),C=c.Pt.iconBase+"noun_1180158.svg"):(C=c.Pt.iconBase+"noun_383448.svg",A="9999-01-01T00:00:00Z");const k=x.createElement("tr"),_=x.createElement("td"),T=x.createElement("td"),S=x.createElement("td");let L,j;k.appendChild(_),k.appendChild(T),k.appendChild(S),k.AJAR_date=A;const R={div:T,dom:x};return(0,p.ensureLoggedIn)(R).then(t=>{!function(){if(a.menuHandler){const e=g.button(x,c.Pt.iconBase+"noun_243787.svg","More");e.setAttribute("style",f.i.buttonStyle+"float: right;"),S.appendChild(e)}a.menuHandler;const t=l.authn.currentUser();if(E(_,t,"",null),L=x.createElement("textarea"),T.innerHTML="",T.appendChild(L),L.rows=3,s&&(L.value=l.store.anyValue(s,d.A.sioc("content"),null,s.doc())),L.setAttribute("style",y+"background-color: #eef;"),L.addEventListener("keydown",async function(e){"Enter"===e.code&&(!e.shiftKey&&!a.shiftEnterSendsMessage||e.shiftKey&&a.shiftEnterSendsMessage)&&await h()},!1),g.makeDropTarget(L,w,v),S.innerHTML="",j=g.button(x,C,"Send"),j.style.float="right",j.addEventListener("click",e=>h(),!1),S.appendChild(j),s){const e=S.appendChild(g.cancelButton(x));e.style.float="left",e.addEventListener("click",e=>function(e){e.originalRow.style.visibility="visible",e.parentNode.removeChild(e)}(k),!1),S.appendChild(e)}const n=e.dateFolder.leafDocumentFromDate(new Date);let i;T.appendChild(u.$.cameraButton(x,l.store,function(){return i=$rdf.sym(n.dir().uri+"Image_"+Date.now()+".png"),i},async function(e){e&&await b(e.uri)})),m.recordParticipation(e.channel,e.channel.doc())}(),Object.assign(t,n),(0,o.z6)(t).then(e=>{})}),k}},5187(e,t,n){n.d(t,{lk:()=>h,tJ:()=>g});var i=n(7423),a=n(3378),o=n(1795),s=n(4961),r=n(52),c=n(4608),l=n(7236),p=n(3138),u=n(2465),d=n(3262);const m=window.document,f={};async function h(e,t){const n=m.createElement("span");async function a(){if(n.innerHTML="",(0,u.oy)(e))return n;const i=(await(0,u.x6)(e)).map(e=>p.store.each(null,o.A.schema("target"),e,t)).flat();if(0===i.length)return n;const a=i.map(e=>[p.store.any(e,o.A.rdf("type"),null,t),p.store.any(e,o.A.sioc("content"),null,t),p.store.any(e,o.A.schema("agent"),null,t)]);a.sort(),a.forEach(e=>{const[t,i,a]=e;let o;a?(o=m.createElement("a"),o.setAttribute("href",a.uri)):o=m.createTextNode(""),o.textContent=i||f[t]||"⬜️",n.appendChild(o)})}return a().then(i.Rm("sentimentStripLinked: sentimentStripLinked async refreshed")),n.refresh=a,n}async function g(e,t,n,f){const h=m.createElement("div");if(await(0,u.n6)(e).value===o.A.schema("dateDeleted").value)return h;function g(){h.parentElement.parentElement.removeChild(h.parentElement)}async function b(e){await p.store.updater.update(p.store.connectedStatements(e),[])}let v=p.authn.currentUser();function x(e,n,i,a,l,u){function d(){f.style.backgroundColor=v?"yellow":"white"}const f=c.button(m,i,r.label(a),async function(i){if(v)await b(v),v=null,d();else{v=c.newThing(l);const i=[s.st(v,o.A.schema("agent"),e.me,l),s.st(v,o.A.rdf("type"),a,l),s.st(v,o.A.schema("target"),n,l)];if(await p.store.updater.update([],i),d(),u){let e=!1;for(let t=0;t<u.length;t++){const n=h(u[t]);n&&(await b(n),e=!0)}e&&c.refreshTree(t)}}});function h(t){const i=p.store.each(null,o.A.schema("agent"),e.me,l).filter(e=>p.store.holds(e,o.A.rdf("type"),t,l)).filter(e=>p.store.holds(e,o.A.schema("target"),n,l));return i.length?i[0]:null}function g(){v=h(a),d()}let v;return f.refresh=g,g(),f}if(v&&p.store.holds(e,o.A.foaf("maker"),v)&&(h.appendChild(c.deleteButtonWithCheck(m,h,"message",async function(){const a=p.store.any(e,o.A.foaf("maker"));if(v)if(v.sameTerm(a)){try{await f.deleteMessage(e)}catch(e){const a="Error deleting messaage "+e;i.R8(a),alert(a),(n.statusArea||t.parentNode).appendChild(c.errorMessageBlock(m,a))}t.parentNode.removeChild(t)}else alert("You can't delete the message, you are not logged in as the author, "+a);else alert("You can't delete the message, you are not logged in.");g()})),h.appendChild(c.button(m,a.Pt.iconBase+"noun_253504.svg","edit",()=>async function(t){v.value===p.store.any(e,o.A.foaf("maker")).value&&(g(),await(0,d.zt)(t,e,f,n))}(t)))),(0,l.eD)(n).then(e=>{e&&h.appendChild(e)}),v=p.authn.currentUser(),v&&await(0,u.n6)(e).value!==o.A.schema("dateDeleted").value){const t={me:v,dom:m,div:h};h.appendChild(x(t,e,a.Pt.iconBase+"noun_1384132.svg",o.A.schema("AgreeAction"),e.doc(),[o.A.schema("DisagreeAction")])),h.appendChild(x(t,e,a.Pt.iconBase+"noun_1384135.svg",o.A.schema("DisagreeAction"),e.doc(),[o.A.schema("AgreeAction")]))}p.store.any(e,o.A.dct("created"))&&h.appendChild(c.button(m,a.Pt.iconBase+"noun-reply-5506924.svg","Reply in thread",async()=>{await async function(){const t=await f.createThread(e),i=n.chatOptions;if(!i)throw new Error("replyInThread: missing options");i.showThread(t,i),g()}()}));const y=h.appendChild(c.cancelButton(m));return y.style.float="right",y.firstChild.style.opacity="0.3",y.addEventListener("click",g),h}f[o.A.schema("AgreeAction")]="👍",f[o.A.schema("DisagreeAction")]="👎",f[o.A.schema("EndorseAction")]="⭐️",f[o.A.schema("LikeAction")]="❤️"},630(e,t,n){n.d(t,{Od:()=>p,YJ:()=>c,vt:()=>u,yv:()=>r});var i=n(6885),a=n(508),o=n(4721);new TextDecoder("utf-8");const s=new TextEncoder,r="https://w3id.org/security#";function c(){return{id:"",created:"",dateDeleted:"",content:"",maker:"",sig:""}}function l(e){const t=(0,o.sc)(s.encode((n=e,JSON.stringify(n))));var n;return(0,a.My)(t)}function p(e,t,n){return i.ko.verify((0,a.aT)(e),(0,a.aT)(l(t)),(0,a.aT)(n))}function u(e,t){return(0,a.My)(i.ko.sign((0,a.aT)(l(e)),(0,a.aT)(t)))}},8613(e,t,n){n.d(t,{T:()=>u});var i=n(3138),a=n(7423),o=n(3378),s=n(967),r=n(1795),c=n(52),l=n(4608);const p=i.solidLogicSingleton.store;function u(e,t,n){const i=e.dom,u=e.div;if(e.me&&!e.me.uri)throw new Error("newThingUI: Invalid userid: "+e.me);const d="padding: 0.7em; width: 2em; height: 2em;",m=u.appendChild(i.createElement("img"));let f=!1;m.setAttribute("src",o.Pt.iconBase+"noun_34653_green.svg"),m.setAttribute("style",d),m.setAttribute("title","Add another tool");const h=function(e){const t=u.appendChild(i.createElement("pre"));t.setAttribute("style","background-color: pink"),t.appendChild(i.createTextNode(e))};function g(e){for(let t=0;t<v.length;t++){let n=d+e;v[t].disabled&&(n+="opacity: 0.3;"),v[t].setAttribute("style",n)}}function b(e){f=!f,m.setAttribute("style",d+(f?"background-color: yellow;":"")),g(f?"":"display: none;")}m.addEventListener("click",b);const v=[],x=Object.values(n).filter(e=>e.mintNew),y=x.reduce((e,t)=>(t.mintClass&&(e[t.mintClass.uri]=(e[t.mintClass.uri]||0)+1),e),{});x.forEach(n=>{const o=e.div.appendChild(i.createElement("img"));o.setAttribute("src",n.icon);const u=n.mintClass?y[n.mintClass.uri]>1?`${c.label(n.mintClass)} (using ${n.name} pane)`:c.label(n.mintClass):n.name+" @@";o.setAttribute("title","Make new "+u),o.setAttribute("style",d+"display: none;"),v.push(o),o.disabled||o.addEventListener("click",function(m){var f;!function(e){g("display: none;"),e.setAttribute("style",d+"background-color: yellow;")}(o),f={event:m,folder:e.folder||null,iconEle:o,pane:n,noun:u,noIndexHTML:!0,div:e.div,me:e.me,dom:e.dom,refreshTarget:e.refreshTarget},new Promise(function(n,o){let u;function d(n,c){(0,s.ensureLoadedProfile)(e).then(e=>{const s=Object.assign({newBase:c,folder:f.folder||void 0,workspace:n},f);for(const e in f)s[e]=f[e];a.Rm(`newThingUI: Minting new ${s.pane.name} at ${s.newBase}`),f.pane.mintNew(t,s).then(function(e){if(!e||!e.newInstance)throw new Error("Cannot mint new - missing newInstance");if(e.folder){const t=e.newInstance.uri.slice(e.folder.uri.length).includes("/");a.Rm(" new thing is packge? "+t),t?p.add(e.folder,r.A.ldp("contains"),p.sym(e.newBase),e.folder.doc()):p.add(e.folder,r.A.ldp("contains"),e.newInstance,e.folder.doc()),e.refreshTarget&&e.refreshTarget.refresh&&e.refreshTarget.refresh()}else{const t=f.div.appendChild(i.createElement("p"));t.setAttribute("style","font-size: 120%;"),t.innerHTML="Your <a target='_blank' href='"+e.newInstance.uri+"'><b>new "+f.noun+"</b></a> is ready to be set up. <br/><br/><a target='_blank' href='"+e.newInstance.uri+"'>Go to your new "+f.noun+".</a>"}b()}).catch(function(e){h(e),o(e)})},e=>{h("Error logging on: "+e)})}const m=f.pane;if(f.noun=m.mintClass?c.label(m.mintClass):m.name,f.appPathSegment=f.noun.slice(0,1).toUpperCase()+f.noun.slice(1),f.folder){const e=function(e){if(e){let t=f.folder.uri;t.endsWith("/")||(t+="/"),t=t+encodeURIComponent(e)+"/",d(null,t)}else b()};l.askName(i,p,f.div,r.A.foaf("name"),null,f.noun).then(e)}else u=(0,s.selectWorkspace)(i,{noun:f.noun,appPathSegment:f.appPathSegment},d),f.div.appendChild(u)})})})}},6589(e,t,n){n.d(t,{v:()=>i});const i={newThingUI:n(8613).T}},5912(e,t,n){n.r(t)},7423(e,t,n){function i(...e){console.log(...e)}function a(...e){console.warn(...e)}function o(...e){console.error(...e)}function s(...e){console.trace(...e)}n.d(t,{R8:()=>a,Rm:()=>i,uP:()=>s,z3:()=>o})},7134(e,t,n){n.d(t,{Ux:()=>c});var i=n(3138),a=n(675),o=n(8565);const s="https://solidproject.org",r="solidproject.org";async function c(e,t){const n=document.getElementById("PageFooter");if(!n)return;const a=(0,o.E6)(),s=await(0,o.bB)(a,e);l(n,e,a,s,t)(),i.authSession.events.on("login",l(n,e,a,s,t)),i.authSession.events.on("logout",l(n,e,a,s,t))}function l(e,t,n,c,l){return async()=>{const p=i.authn.currentUser();e.innerHTML="",e.appendChild(await function(e,t,n,i,c){const l=document.createElement("div");l.setAttribute("style",a.i.footer);const p=document.createElement("a");if(p.href=c&&c.solidProjectUrl?c.solidProjectUrl:s,p.innerText=c&&c.solidProjectName?c.solidProjectName:r,!n||!i||t&&t.equals(i)){const e=document.createElement("span");return e.innerText="Powered by ",l.appendChild(e),l.appendChild(p),l}const u=document.createElement("span");u.innerText="You're visiting ";const d=document.createElement("a");d.href=n.uri,d.innerText="the Pod";const m=document.createElement("span");m.innerText=" controlled by ";const f=document.createElement("a");f.href=i.uri,f.innerText=(0,o.mG)(e,i);const h=document.createElement("span");h.innerText=". For more info, check out ";const g=document.createElement("span");return g.innerText=".",l.appendChild(u),l.appendChild(d),l.appendChild(m),l.appendChild(f),l.appendChild(h),l.appendChild(p),l.appendChild(g),l}(t,p,n,c,l))}}},2825(e,t,n){n.d(t,{j:()=>i});const i='\n<svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 26 26" fill="none">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13 25C19.6274 25 25 19.6274 25 13C25 6.37258 19.6274 1 13 1C6.37258 1 1 6.37258 1 13C1 19.6274 6.37258 25 13 25Z" fill="#D8D8D8" stroke="#8B8B8B"/>\n <mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="26" height="26">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13 25C19.6274 25 25 19.6274 25 13C25 6.37258 19.6274 1 13 1C6.37258 1 1 6.37258 1 13C1 19.6274 6.37258 25 13 25Z" fill="white" stroke="white"/>\n </mask>\n <g mask="url(#mask0)">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M17.0468 10.4586C17.0468 14.4979 15.4281 16.9214 12.9999 16.9214C10.5718 16.9214 8.95298 14.4979 8.95298 10.4586C8.95298 6.41931 12.9999 6.41931 12.9999 6.41931C12.9999 6.41931 17.0468 6.41931 17.0468 10.4586ZM4.09668 23.3842C6.52483 17.7293 12.9999 17.7293 12.9999 17.7293C12.9999 17.7293 19.475 17.7293 21.9031 23.3842C21.9031 23.3842 17.8481 25 12.9999 25C8.15169 25 4.09668 23.3842 4.09668 23.3842Z" fill="#8B8B8B"/>\n </g>\n</svg>'},1648(e,t,n){n.d(t,{Of:()=>d});var i=n(4356),a=n(3138),o=n(967),s=n(4608),r=n(675),c=n(2825),l=n(8565);const p=i.Pt.iconBase+"noun_help.svg",u="https://solidproject.org/assets/img/solid-emblem.svg";async function d(e,t,n){const i=document.getElementById("PageHeader");if(!i)return;const o=(0,l.E6)();m(i,e,o,t,n)(),a.authSession.events.on("logout",m(i,e,o,t,n)),a.authSession.events.on("login",m(i,e,o,t,n))}function m(e,t,n,d,m){return async()=>{const v=a.authn.currentUser();e.innerHTML="",e.appendChild(await async function(e,t,n,a,d){const m=document.createElement("a");m.href=t.uri,m.setAttribute("style",r.i.headerBannerLink);const v=document.createElement("img");d&&(v.src=d.logo?d.logo:u);v.setAttribute("style",r.i.headerBannerIcon),m.appendChild(v);const x=n?await async function(e,t,n){const i=e.fetcher;i&&await i.load(t);const a=document.createElement("ul");a.setAttribute("style",r.i.headerUserMenuList),n&&n.forEach(function(e){"url"===(e.url?"url":"onclick")?a.appendChild(g(h(e.label,e.url,e.target))):a.appendChild(g(f(e.label,e.onclick)))});const o=document.createElement("nav");o.setAttribute("style",r.i.headerUserMenuNavigationMenuNotDisplayed),o.setAttribute("aria-hidden","true"),o.setAttribute("id","loggedInNav"),o.appendChild(a);const p=document.createElement("button");p.setAttribute("style",r.i.headerUserMenuTrigger),p.type="button";const u=function(e,t){let n=null;try{if(n=s.findImage(t),!n)return c.j}catch{return c.j}const i=document.createElement("div");return i.setAttribute("style",r.i.headerUserMenuPhoto),i.style.backgroundImage=`url(${n})`,i}(0,t);"string"==typeof u?p.innerHTML=u:p.appendChild(u);const d=document.createElement("div");d.setAttribute("style",r.i.headerBannerUserMenuNotDisplayed),d.appendChild(p),d.appendChild(o);const m=(0,l.nF)(e=>b(e,p,o),50);p.addEventListener("click",m);let v=setTimeout(()=>null,0);return d.addEventListener("mouseover",e=>{clearTimeout(v),m(e);const t=document.getElementById("loggedInNav");t?.setAttribute("style",r.i.headerUserMenuNavigationMenu)}),d.addEventListener("mouseout",e=>{v=setTimeout(()=>m(e),200);const t=document.getElementById("loggedInNav");t?.setAttribute("style",r.i.headerUserMenuNavigationMenuNotDisplayed)}),d}(e,n,a):function(){const e=document.createElement("div");return e.setAttribute("style",r.i.headerBannerLogin),e.appendChild((0,o.loginStatusBox)(document,null,{})),e}(),y=document.createElement("div");y.setAttribute("style",r.i.headerBanner),y.appendChild(m);const w=document.createElement("div");if(w.setAttribute("style",r.i.headerBannerRightMenu),w.appendChild(x),d&&d.helpMenuList){const e=function(e,t){if(!t)return;const n=document.createElement("ul");n.setAttribute("style",r.i.headerUserMenuList),t.forEach(function(e){"url"===(e.url?"url":"onclick")?n.appendChild(g(h(e.label,e.url,e.target))):n.appendChild(g(f(e.label,e.onclick)))});const a=document.createElement("nav");a.setAttribute("style",r.i.headerUserMenuNavigationMenuNotDisplayed),a.setAttribute("aria-hidden","true"),a.setAttribute("id","helperNav"),a.appendChild(n);const o=document.createElement("div");o.setAttribute("style",r.i.headerBannerUserMenu),o.appendChild(a);const s=document.createElement("button");s.setAttribute("style",r.i.headerUserMenuTrigger),s.type="button";const c=document.createElement("img");c.src=e&&e.helpIcon?e.helpIcon:i.Pt.iconBase+p,c.setAttribute("style",r.i.headerUserMenuTriggerImg),o.appendChild(s),s.appendChild(c);const u=(0,l.nF)(e=>b(e,s,a),50);s.addEventListener("click",u);let d=setTimeout(()=>null,0);return o.addEventListener("mouseover",e=>{clearTimeout(d),u(e);const t=document.getElementById("helperNav");t?.setAttribute("style",r.i.headerUserMenuNavigationMenu)}),o.addEventListener("mouseout",e=>{d=setTimeout(()=>u(e),200);const t=document.getElementById("helperNav");t?.setAttribute("style",r.i.headerUserMenuNavigationMenuNotDisplayed)}),o}(d,d.helpMenuList);w.appendChild(e)}return y.appendChild(w),y}(t,n,v,d,m))}}function f(e,t){const n=document.createElement("button");return n.setAttribute("style",r.i.headerUserMenuButton),n.onmouseover=function(){n.setAttribute("style",r.i.headerUserMenuButtonHover)},n.onmouseout=function(){n.setAttribute("style",r.i.headerUserMenuButton)},n.addEventListener("click",t),n.innerText=e,n}function h(e,t,n){const i=document.createElement("a");return i.setAttribute("style",r.i.headerUserMenuLink),i.onmouseover=function(){i.setAttribute("style",r.i.headerUserMenuLinkHover)},i.onmouseout=function(){i.setAttribute("style",r.i.headerUserMenuLink)},i.href=t,i.innerText=e,n&&(i.target=n),i}function g(e){const t=document.createElement("li");return t.setAttribute("style",r.i.headerUserMenuListItem),t.appendChild(e),t}function b(e,t,n){const i="true"===t.getAttribute("aria-expanded"),a="mouseover"===e.type,o="mouseout"===e.type;i&&a||!i&&o||(t.setAttribute("aria-expanded",(!i).toString()),n.setAttribute("aria-hidden",i.toString()))}},3378(e,t,n){n.d(t,{LN:()=>s,Pt:()=>o,i1:()=>r});var i=n(7423);const a="https://solidos.github.io/solid-ui/src",o=(e=n.hmd(e)).scriptURI?{iconBase:e.scriptURI.slice(0,e.scriptURI.lastIndexOf("/"))+"/icons/",originalIconBase:e.scriptURI.slice(0,e.scriptURI.lastIndexOf("/"))+"/originalIcons/"}:"undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.iconBase?{iconBase:$SolidTestEnvironment.iconBase,originalIconBase:$SolidTestEnvironment.originalIconBase}:{iconBase:a+"/icons/",originalIconBase:a+"/originalIcons/"};(0,i.Rm)(" icons.iconBase is set to : "+o.iconBase);const s=o.iconBase,r=o.originalIconBase},4356(e,t,n){n.d(t,{Pt:()=>s.Pt,ns:()=>i.A});var i=n(1795),a=n(5923),o=n(6589),s=n(3378),r=n(8677),c=n(4158),l=n(7580),p=n(6127),u=n(8516),d=n(9509),m=n(8153),f=n(3605),h=n(5148),g=n(675),b=n(2174),v=n(6670),x=n(52),y=n(967),w=n(4608),A=n(1648),C=n(7134),E=n(5912);const k=window?window.document:null;"undefined"!=typeof window&&(window.UI={ns:i.A,acl:a.B,aclControl:a.u,create:o.v,createTypes:E,dom:k,icons:s.Pt,language:r,log:c,login:y,matrix:l.U,media:p.$,messageArea:u.v,infiniteMessageArea:d.r5,pad:m,participation:f,preferences:h,style:g.i,table:b.I,tabs:v,utils:x,widgets:w,initHeader:A.Of,initFooter:C.Ux})},4158(e,t,n){n.r(t),n.d(t,{LogLevel:()=>i,alert:()=>h,clear:()=>g,debug:()=>u,dumpHTML:()=>v,error:()=>m,escapeForXML:()=>w,info:()=>d,logAscending:()=>x,logDescending:()=>y,msg:()=>l,setInternals:()=>A,setLevel:()=>b,success:()=>f,warn:()=>p});let i=function(e){return e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Message=4]="Message",e[e.Success=8]="Success",e[e.Info=16]="Info",e[e.Debug=32]="Debug",e[e.All=63]="All",e}({}),a=7,o=!1,s=document,r=window;function c(e,t=4,n="mesg"){if(a&t)if(void 0!==s){const t=s.getElementById("status");if(!t)return;const i=s.createElement("span");i.setAttribute("class",n);const a=new Date;i.innerHTML=`${a.getHours()}:${a.getMinutes()}:${a.getSeconds()} [${n}] ${w(e)}<br/>`,o?t.insertBefore(i,t.firstChild):t.appendChild(i)}else"undefined"!=typeof console&&console.log(e)}function l(e){c(e)}function p(e){c(e,2,"warn")}function u(e){c(e,32,"dbug")}function d(e){c(e,16,"info")}function m(e){c(e,1,"eror")}function f(e){c(e,8,"good")}function h(e){r&&void 0!==r.alert?r.alert(e):p(e)}function g(){const e=s?.getElementById("status");e&&(e.innerHTML="")}function b(e){a=63,u("Log level is now "+e),a=e}function v(){if(!s)return;const e=a;a=63,u(s?.body?.innerHTML||""),a=e}function x(){o=!0}function y(){o=!1}function w(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A(e,t){r=e,s=t}},967(e,t,n){n.r(t),n.d(t,{ensureLoadedPreferences:()=>y,ensureLoadedProfile:()=>w,ensureLoggedIn:()=>x,filterAvailablePanes:()=>N,findAppInstances:()=>A,getUserRoles:()=>R,loginStatusBox:()=>S,newAppInstance:()=>j,registrationControl:()=>E,registrationList:()=>_,renderScopeHeadingRow:()=>k,renderSignInPopup:()=>T,scopeLabel:()=>C,selectWorkspace:()=>L});var i=n(4961),a=n(3138),o=n(7423),s=n(675),r=n(4158),c=n(1795),l=n(6247),p=n(52),u=n(4608);a.solidLogicSingleton.store;const{loadPreferences:d,loadProfile:m}=a.solidLogicSingleton.profile,{getScopedAppInstances:f,getRegistrations:h,loadAllTypeIndexes:g,getScopedAppsFromIndex:b,deleteTypeIndexRegistration:v}=a.solidLogicSingleton.typeIndex;function x(e){const t=a.authn.currentUser();return t?(a.authn.saveUser(t,e),Promise.resolve(e)):new Promise(t=>{a.authn.checkUser().then(n=>{if(n)return o.Rm(`logIn: Already logged in as ${n}`),t(e);if(!e.div||!e.dom)return t(e);const i=S(e.dom,n=>{a.authn.saveUser(n,e),t(e)});e.div.appendChild(i)})})}async function y(e){if(e.preferencesFile)return Promise.resolve(e);let t;try{e=await w(e);const n=await d(e.me);t,e.preferencesFile=n}catch(t){let n;if(t instanceof a.UnauthorizedError)n="Oops — you are not authenticated (properly logged in), so SolidOS cannot read your preferences file. Try logging out and then logging back in.",(0,r.alert)(n);else{if(t instanceof a.CrossOriginForbiddenError)return n=`Unauthorized: Assuming preference file blocked for origin ${window.location.origin}`,e.preferencesFileError=n,e;if(t instanceof a.SameOriginForbiddenError)return n="You are not authorized to read your preference file. This may be because you are using an untrusted web app.",o.R8(n),e;if(t instanceof a.NotEditableError)return n="You are not authorized to edit your preference file. This may be because you are using an untrusted web app.",o.R8(n),e;if(t instanceof a.WebOperationError)n="You are not authorized to edit your preference file. This may be because you are using an untrusted web app.",o.R8(n);else{if(!(t instanceof a.FetchError))throw new Error(`(via loadPrefs) ${t}`);n=`Strange: Error ${t.status} trying to read your preference file.${t.message}`,(0,r.alert)(n)}}e.preferencesFileError=n}return e}async function w(e){if(e.publicProfile)return e;try{const t=await x(e);if(!t.me)throw new Error("Could not log in");e.publicProfile=await m(t.me)}catch(t){throw e.div&&e.dom&&e.div.appendChild(u.errorMessageBlock(e.dom,t.message)),new Error(`Can't log in: ${t}`)}return e}async function A(e,t,n){let i=e.me?await f(t,e.me):[];return!0===n?i=i.filter(e=>"public"===e.scope.label):!1===n&&(i=i.filter(e=>"private"===e.scope.label)),e.instances=i.map(e=>e.instance),e}function C(e,t){return`${e.me&&e.me.sameTerm(t.agent)?"":p.label(t.agent)+" "}${t.label}`}async function E(e,t,n){function s(o){const s=function(e){const a=h(t,n),o=a.length?a[0]:u.newThing(e);return[(0,i.st)(o,c.A.solid("instance"),t,e),(0,i.st)(o,c.A.solid("forClass"),n,e)]}(o.index),r=`${C(e,o)} link to this ${e.noun}`;return u.buildCheckboxForm(e.dom,a.solidLogicSingleton.store,r,null,s,f,o.index)}const r=e.dom;if(!r||!e.div)throw new Error("registrationControl: need dom and div");const l=r.createElement("div");e.div.appendChild(l),e.me=a.authn.currentUser();const p=e.me;if(!p)return l.innerHTML='<p style="margin:2em;">(Log in to save a link to this)</p>',e;let d;try{d=await g(p)}catch(t){let n;return e.div&&e.preferencesFileError?(n="(Lists of stuff not available)",e.div.appendChild(r.createElement("p")).textContent=n):e.div&&(n=`registrationControl: Type indexes not available: ${t}`,e.div.appendChild(u.errorMessageBlock(e.dom,t))),o.Rm(n),e}l.innerHTML="<table><tbody></tbody></table>",l.setAttribute("style","font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;");const m=l.children[0].children[0],f=new i.BlankNode;for(const e of d){m.appendChild(r.createElement("tr")).appendChild(s(e))}return e}function k(e,t,n){const{dom:i}=e,a=C(e,n),o=i.createElement("tr"),s=o.appendChild(i.createElement("td"));s.setAttribute("colspan","3"),s.style.backgoundColor={private:"#fee",public:"#efe"}[n.label]||"white";const r=s.appendChild(i.createElement("h3"));return r.textContent=a+" links",r.style.textAlign="left",o}async function _(e,t){const n=e.dom,i=e.div,o=n.createElement("div");if(i.appendChild(o),e.me=a.authn.currentUser(),!e.me)return o.innerHTML='<p style="margin:2em;">(Log in list your stuff)</p>',e;const s=await g(e.me);o.innerHTML="<table><tbody></tbody></table>",o.setAttribute("style","font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;");const r=o.firstChild.firstChild;for(const i of s){const a=k(e,0,i);r.appendChild(a);const o=await b(i,t.type||null);0===o.length&&(a.style.display="none");for(const e of o){const t=u.personTR(n,c.A.solid("instance"),e.instance,{deleteFunction:async()=>{await v(e),r.removeChild(t)}});t.children[0].style.paddingLeft="3em",r.appendChild(t)}}return e}function T(e){const t=e.createElement("div");t.setAttribute("style","position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center;"),e.body.appendChild(t);const n=e.createElement("div");n.setAttribute("style","\n background-color: white;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -o-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n min-width: 400px;\n padding: 10px;\n z-index : 10;\n "),t.appendChild(n);const i=e.createElement("div");i.setAttribute("style","\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n "),n.appendChild(i);const o=e.createElement("label");o.setAttribute("style","margin-right: 5px; font-weight: 800"),o.innerText="Select an identity provider";const s=e.createElement("button");s.innerHTML='<img src="https://solidos.github.io/solid-ui/src/icons/noun_1180156.svg" style="width: 2em; height: 2em;" title="Cancel">',s.setAttribute("style","background-color: transparent; border: none;"),s.addEventListener("click",()=>{t.remove()}),i.appendChild(o),i.appendChild(s);const c=async e=>{try{a.solidLogicSingleton.store.updater.flagAuthorizationMetadata();const t=new URL(window.location.href).hash;t&&window.localStorage.setItem("preLoginRedirectHash",t),window.localStorage.setItem("loginIssuer",e);const n=new URL(window.location.href);n.hash="",await a.authSession.login({redirectUrl:n.href,oidcIssuer:e})}catch(e){(0,r.alert)(e.message)}},l=e.createElement("div");l.setAttribute("style","\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n ");const p=e.createElement("div");p.setAttribute("style","\n display: flex;\n flex-direction: row;\n ");const u=e.createElement("label");u.innerText="Enter the URL of your identity provider:",u.setAttribute("style","color: #888");const d=e.createElement("input");d.setAttribute("type","text"),d.setAttribute("style","margin-left: 0 !important; flex: 1; margin-right: 5px !important"),d.setAttribute("placeholder","https://example.com"),d.value=localStorage.getItem("loginIssuer")||"";const m=e.createElement("button");m.innerText="Go",m.setAttribute("style","margin-top: 12px; margin-bottom: 12px;"),m.addEventListener("click",()=>{c(d.value)}),l.appendChild(u),p.appendChild(d),p.appendChild(m),l.appendChild(p),n.appendChild(l);const f=e.createElement("div");f.setAttribute("style","\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n ");const h=e.createElement("label");h.innerText="Or pick an identity provider from the list below:",h.setAttribute("style","color: #888"),f.appendChild(h),(0,a.getSuggestedIssuers)().forEach(t=>{const n=e.createElement("button");n.innerText=t.name,n.setAttribute("style","height: 38px; margin-top: 10px"),n.addEventListener("click",()=>{c(t.uri)}),f.appendChild(n)}),n.appendChild(f)}function S(e,t=null,n={}){let i=(0,a.offlineTestID)();const p=e.createElement("div");function d(e){e&&(i=a.authn.saveUser(e),p.refresh(),t&&t(i.uri))}function m(e){const n=i;a.authSession.logout().then(function(){const e=`Your WebID was ${n}. It has been forgotten.`;i=null;try{(0,r.alert)(e)}catch(t){window.alert(e)}p.refresh(),t&&t(null)},e=>{(0,r.alert)("Fail to log out:"+e)})}function f(){i=a.authn.currentUser(),p.refresh()}return p.refresh=function(){const t=a.authSession.info;i=t&&t.webId&&t.isLoggedIn?a.solidLogicSingleton.store.sym(t.webId):null,(i&&p.me!==i.uri||!i&&p.me)&&(u.clearElement(p),i?p.appendChild(function(t,n){const i=n.buttonStyle||s.i.signInAndUpButtonStyle;let o="WebID logout";if(t){const e=a.solidLogicSingleton.store.any(t,c.A.foaf("nick"))||a.solidLogicSingleton.store.any(t,c.A.foaf("name"));e&&(o="Logout "+e.value)}const r=e.createElement("input");return r.setAttribute("type","button"),r.setAttribute("value",o),r.setAttribute("style",`${i}`),r.addEventListener("click",m,!1),r}(i,n)):p.appendChild(function(e,t,n={}){const i=(n=n||{}).buttonStyle||s.i.signInAndUpButtonStyle,r=e.createElement("div"),c="SolidSignInOrSignUpBox";o.Rm("widgets.signInOrSignUpBox"),r.setUserCallback=t,r.setAttribute("class",c),r.setAttribute("style","display:flex;");const p=e.createElement("input");r.appendChild(p),p.setAttribute("type","button"),p.setAttribute("value","Log in"),p.setAttribute("style",`${i}${s.i.headerBannerLoginInput}`+s.i.signUpBackground),a.authSession.events.on("login",()=>{const t=a.authn.currentUser();if(t){const n=t.uri,i=e.getElementsByClassName(c);o.Rm(`Logged in, ${i.length} panels to be serviced`);for(let t=0;t<i.length;t++){const a=i[t];if(a.setUserCallback)try{a.setUserCallback(n);const e=a.parentNode;e&&e.removeChild(a)}catch(t){o.Rm(`## Error satisfying login box: ${t}`),a.appendChild(u.errorMessageBlock(e,t))}}}}),p.addEventListener("click",()=>{const n=(0,a.offlineTestID)();if(n)return t(n.uri);T(e)},!1);const d=e.createElement("input");return r.appendChild(d),d.setAttribute("type","button"),d.setAttribute("value","Sign Up for Solid"),d.setAttribute("style",`${i}${s.i.headerBannerLoginInput}`+s.i.signInBackground),d.addEventListener("click",function(e){(new l.l).signup().then(function(e){o.Rm("signInOrSignUpBox signed up "+e),t(e)})},!1),r}(e,d,n))),p.me=i?i.uri:null},p.refresh(),f(),a.authSession.events.on("login",f),a.authSession.events.on("logout",f),p.me="99999",p.refresh(),p}function L(e,t,n){const r=t.noun,l=t.appPathSegment,p=(0,a.offlineTestID)(),d=e.createElement("div"),m={me:p,dom:e,div:d};function f(t,n){d.appendChild(u.errorMessageBlock(e,t,n))}function h(e){const t=a.solidLogicSingleton.store.any(e,c.A.space("uriPrefix"));let n;n=t?t.value:e.uri.split("#")[0],"/"!==n.slice(-1)&&(o.Rm(`${l}: No / at end of uriPrefix ${n}`),n=`${n}/`);const i=new Date;return n+=`${l}/id${i.getTime()}/`,n}return y(m).then(function(t){const o=t.me,l=t.preferencesFile;let p=null,m=a.solidLogicSingleton.store.each(o,c.A.space("workspace"),void 0,l);const g=a.solidLogicSingleton.store.each(o,c.A.space("storage"));0===m.length&&g&&(f(`You don't seem to have any workspaces. You have ${g.length} storage spaces.`,"white"),g.map(function(e){return m=m.concat(a.solidLogicSingleton.store.each(e,c.A.ldp("contains"))),m}).filter(e=>e.id?["public","private"].includes(e.id().toLowerCase()):"")),1===m.length&&(f(`Workspace used: ${m[0].uri}`,"white"),p=h(m[0]));const b=e.createElement("table");b.setAttribute("style","border-collapse:separate; border-spacing: 0.5em;"),d.appendChild(b),d.appendChild(e.createElement("hr"));const v=d.appendChild(e.createElement("p"));v.setAttribute("style",s.i.commentStyle),v.textContent=`Where would you like to store the data for the ${r}?\n Give the URL of the folder where you would like the data stored.\n It can be anywhere in solid world - this URI is just an idea.`;const x=d.appendChild(e.createElement("input"));x.setAttribute("type","text"),x.setAttribute("style",s.i.textInputStyle),x.size=80,x.label="base URL",x.autocomplete="on",p&&(x.value=p),t.baseField=x,d.appendChild(e.createElement("br"));const y=d.appendChild(e.createElement("button"));let w,A,C,E,k,_,T;y.setAttribute("style",s.i.buttonStyle),y.textContent=`Start new ${r} at this URI`,y.addEventListener("click",function(e){let t=x.value.replace(" ","%20");"/"!==t.slice(-1)&&(t+="/"),n(null,t)}),m=m.filter(function(e){return!a.solidLogicSingleton.store.holds(e,c.A.rdf("type"),c.A.space("MasterWorkspace"))});const S="height: 3em; margin: 1em; padding: 1em white; border-radius: 0.3em;",L=`${S}border: 0px;`;for(let t=0;t<m.length;t++){if(k=m[t],E=e.createElement("tr"),0===t&&(w=e.createElement("td"),w.setAttribute("rowspan",`${m.length}`),w.textContent="Choose a workspace for this:",w.setAttribute("style","vertical-align:middle;"),E.appendChild(w)),A=e.createElement("td"),_=a.solidLogicSingleton.store.anyValue(k,c.A.ui("style")),!_){const e=`#${(16777215&function(e){return e.split("").reduce(function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e},0)}(k.uri)|12632256).toString(16)}`;_=`color: black ; background-color: ${e};`}A.setAttribute("style",L+_),E.target=k.uri;let i=a.solidLogicSingleton.store.any(k,c.A.rdfs("label"));i||(i=k.uri.split("/").slice(-1)[0]||k.uri.split("/").slice(-2)[0]),A.textContent=i||"???",E.appendChild(A),0===t&&(C=e.createElement("td"),C.setAttribute("rowspan",`${m.length}1`),C.setAttribute("style","width:50%;"),E.appendChild(C)),b.appendChild(E),T=a.solidLogicSingleton.store.any(k,c.A.rdfs("comment")),T=T?T.value:"Use this workspace",A.addEventListener("click",function(t){C.textContent=T?T.value:"",C.setAttribute("style",L+_);const i=e.createElement("button");i.textContent="Continue";const a=h(k);x.value=a,i.addEventListener("click",function(e){i.disabled=!0,n(k,a),i.textContent="----\x3e"},!0),C.appendChild(i)},!0)}const j=e.createElement("tr");A=e.createElement("td"),A.setAttribute("style",S),A.textContent="+ Make a new workspace",A.addEventListener("click",async function(n){const o=b.appendChild(e.createElement("tr")).appendChild(e.createElement("td"));o.setAttribute("colspan","3"),o.style.padding="0.5em";const s=encodeURI(await u.askName(e,a.solidLogicSingleton.store,o,c.A.solid("URL"),c.A.space("Workspace"),"Workspace")),r=u.newThing(t.preferencesFile),l=[(0,i.st)(t.me,c.A.space("workspace"),r,t.preferencesFile),(0,i.st)(r,c.A.space("uriPrefix"),s,t.preferencesFile)];if(!a.solidLogicSingleton.store.updater)throw new Error("store has no updater");await a.solidLogicSingleton.store.updater.update([],l)}),j.appendChild(A),b.appendChild(j)}).catch(e=>{d.appendChild(u.errorMessageBlock(m.dom,e))}),d}function j(e,t,n){const i=function(e,t){n(e,t)},a=e.createElement("div"),o=e.createElement("button");return o.setAttribute("type","button"),a.appendChild(o),o.innerHTML=`Make new ${t.noun}`,o.addEventListener("click",n=>{a.appendChild(L(e,t,i))},!1),a.appendChild(o),a}async function R(){try{const{me:e,preferencesFile:t,preferencesFileError:n}=await y({});if(!t||n)throw new Error(n);return a.solidLogicSingleton.store.each(e,c.A.rdf("type"),null,t.doc())}catch(e){o.R8("Unable to fetch your preferences - this was the error: ",e)}return[]}async function N(e){const t=await R();return e.filter(e=>function(e,t){const n=e.audience||[];return n.reduce((e,n)=>e&&!!t.find(e=>e.equals(n)),!0)}(e,t))}a.authSession.events.on("logout",async()=>{const e=window.localStorage.getItem("loginIssuer");if(e)try{a.solidLogicSingleton.store.updater.flagAuthorizationMetadata();const t=new URL(e);t.pathname="/.well-known/openid-configuration";const n=await fetch(t.toString());if(200===n.status){const e=await n.json();e&&e.end_session_endpoint&&await fetch(e.end_session_endpoint,{credentials:"include"})}}catch(e){}window.location.reload()})},7580(e,t,n){n.d(t,{U:()=>i});const i={matrixForQuery:n(7659).p}},7659(e,t,n){n.d(t,{p:()=>s});var i=n(52),a=n(4961);const o=n(3138).solidLogicSingleton.store;function s(e,t,n,s,r,c,l){const p=e.createElement("table"),u=e.createElement("tr");u.appendChild(e.createElement("td")).setAttribute("class","MatrixCorner"),p.appendChild(u),p.lastHeader=u;let d=[];const m=[],f=function(e,t,n,a){for(;e.firstChild;)e.removeChild(e.firstChild);e.setAttribute("style",""),e.style.textAlign="center",c.cellFunction?c.cellFunction(e,t,n,a):(e.textContent=i.label(a),e.setAttribute("style","padding: 0.3em")),delete e.old},h=function(t){const n=t.toNT();if(m[n])return m[n];const s=e.createElement("tr"),r=s.appendChild(e.createElement("td"));r.setAttribute("style","padding: 0.3em;"),r.textContent=i.label(t),"NamedNode"===t.termType&&o.fetcher.nowOrWhenFetched(t.uri.split("#")[0],void 0,function(e,n,a){e&&(r.textContent=i.label(t))});for(let n=0;n<d.length;n++)f(s.appendChild(e.createElement("td")),a.fromNT(d[n]),t,null);s.dataValueNT=n,m[n]=s;for(let e=p.lastHeader.nextSibling;e;e=e.nextSibling)if(n>e.dataValueNT&&c&&c.yDecreasing||n<e.dataValueNT&&(!c||!c.yDecreasing))return p.insertBefore(s,e);return p.appendChild(s)},g=function(t){const n=t.toNT();let o=null;for(let e=0;e<d.length;e++){if(d[e]===n)return e;if(n>d[e]&&c.xDecreasing||n<d[e]&&!c.xDecreasing){d=d.slice(0,e).concat([n]).concat(d.slice(e)),o=e;break}}null===o&&(o=d.length,d.push(n));for(let n=p.firstChild;n;n=n.nextSibling){const s=n.dataValueNT,r=e.createElement("td");if(r.style.textAlign="center",n===p.firstChild?r.textContent=i.label(t):f(r,t,a.fromNT(s),null),o===d.length-1)n.appendChild(r);else{let e=n.firstChild;for(let t=0;t<o+1;t++)e=e.nextSibling;n.insertBefore(r,e)}}return o},b=function(){let e,t;const n=[],i=[];if(c.set_y)for(let e=0;e<c.set_y.length;e++)i[c.set_y[e]]=!0;if(c.set_x)for(let e=0;e<c.set_x.length;e++)n[g(c.set_x[e])+1]=!0;for(let o=1;o<p.children.length;o++){e=p.children[o];for(let o=1;o<e.children.length;o++)if(t=e.children[o],t.old){const n=a.fromNT(e.dataValueNT),i=a.fromNT(d[o-1]);f(t,i,n,null)}else i[e.dataValueNT]=!0,n[o]=!0}for(let t=0;t<p.children.length;t++)if(e=p.children[t],t>0&&!i[e.dataValueNT])delete m[e.dataValueNT],p.removeChild(e);else for(let t=e.children.length-1;t>0;t--){const i=e.children[t];n[t]||e.removeChild(i)}const o=[];for(let e=0;e<d.length;e++)n[e+1]&&o.push(d[e]);d=o};p.refresh=function(){!function(){for(let e=1;e<p.children.length;e++){const t=p.children[e];for(let e=1;e<t.children.length;e++)t.children[e].old=!0}}(),o.query(t,v,void 0,b)};const v=function(e){const t=e[n.toString()],i=e[s.toString()],a=e[r.toString()],o=h(i),c=g(t),l=o.children[c+1];f(l,t,i,a)};if(c.set_y)for(let e=0;e<c.set_y.length;e++)h(c.set_y[e]);if(c.set_x)for(let e=0;e<c.set_x.length;e++)g(c.set_x[e]);return o.query(t,v,void 0,l),p}},6127(e,t,n){n.d(t,{$:()=>a});var i=n(7008);const a={cameraCaptureControl:i.V,cameraButton:i.Y}},7008(e,t,n){n.d(t,{V:()=>l,Y:()=>p});var i=n(7423),a=n(3378),o=n(675),s=n(4608);const r=a.Pt.iconBase+"noun_Camera_1618446_000000.svg",c=a.Pt.iconBase+"noun_479395.svg";function l(e,t,n,r){const l=e.createElement("div");let p,u,d,m;const f=l.appendChild(e.createElement("table")),h=f.appendChild(e.createElement("tr")).appendChild(e.createElement("td"));h.setAttribute("colspan","4");const g=f.appendChild(e.createElement("tr"));g.appendChild(e.createElement("td")).appendChild(s.cancelButton(e)).addEventListener("click",e=>{A(),r(null)});const b=g.appendChild(e.createElement("td")).appendChild(s.button(e,c,"Retake"));b.addEventListener("click",e=>{h.removeChild(m),y()}),b.style.visibility="collapse";const v=g.appendChild(e.createElement("td")).appendChild(s.button(e,a.Pt.iconBase+"noun_10636.svg","Snap"));v.addEventListener("click",function(){m=e.createElement("canvas"),m.setAttribute("width",o.i.canvasWidth),m.setAttribute("height",o.i.canvasHeight),m.setAttribute("style",o.i.controlStyle),h.appendChild(m);m.getContext("2d").drawImage(d,0,0,m.width,m.height),d.parentNode.removeChild(d),m.toBlob(e=>{const t=`got blob type ${e.type} size ${e.size}`;i.Rm(t),p=n(),u=e,x.style.visibility="visible",b.style.visibility="visible",v.style.visibility="collapse"},"image/png")}),v.style.visibility="collapse";const x=g.appendChild(e.createElement("td")).appendChild(s.continueButton(e));function y(){if(d=h.appendChild(e.createElement("video")),d.setAttribute("controls","1"),d.setAttribute("autoplay","1"),d.setAttribute("style",o.i.controlStyle),!navigator.mediaDevices)throw new Error("navigator.mediaDevices not available");navigator.mediaDevices.getUserMedia(w).then(e=>{d.srcObject=e,v.style.visibility="visible",x.style.visibility="collapse",b.style.visibility="collapse"})}x.addEventListener("click",e=>{!function(e,n){const a=e.type;i.Rm("Putting "+e.size+" bytes of "+a+" to "+n),t.fetcher.webOperation("PUT",n.uri,{data:e,contentType:a}).then(e=>{i.Rm("ok saved "+n),A(),r(n)},e=>{A(),alert(e)})}(u,p)}),x.style.visibility="collapse";const w={video:!0};function A(){d&&d.srcObject&&d.srcObject.getVideoTracks().forEach(e=>e.stop())}return y(),l}function p(e,t,n,i){const a=e.createElement("div"),o=s.button(e,r,"Take picture");let c;async function p(e){a.removeChild(c),a.appendChild(o),i(e)}return a.appendChild(o),o.addEventListener("click",i=>{a.removeChild(o),c=l(e,t,n,p),a.appendChild(c)}),a}},8516(e,t,n){n.d(t,{v:()=>d});var i=n(3378),a=n(967),o=n(3138),s=n(1795),r=n(4961),c=n(675),l=n(52),p=n(4608);const u={icons:i.Pt,ns:s.A,rdf:r,style:c.i,widgets:p};function d(e,t,n,i,s){t=t||o.solidLogicSingleton.store,i=i.doc();const c=u.ns,p=r.Namespace("http://www.w3.org/2005/01/wf/flow#"),d=r.Namespace("http://purl.org/dc/terms/"),m=!!(s=s||{}).newestFirst,f="white-space: pre-wrap; width: 90%; font-size:100%; border: 0.07em solid #eee; padding: .2em 0.5em; margin: 0.1em 1em 0.1em 1em;",h=e.createElement("div");let g,b;const v=o.solidLogicSingleton.store.updater,x=function(t,n){const i=e.createElement("a");return n&&n.uri&&(i.setAttribute("href",n.uri),i.addEventListener("click",u.widgets.openHrefInOutlineMode,!0),i.setAttribute("style","color: #3B5998; text-decoration: none; ")),i.textContent=t,i},y=function(t,n){const i=e.createElement("pre");return i.setAttribute("style",n||"color: grey"),h.appendChild(i),i.appendChild(e.createTextNode(t)),i},w=function(e){y(e,"color: #800;")};function A(e){const t=o.solidLogicSingleton.store.any(e,u.ns.foaf("nick"));return t?""+t.value:""+l.label(e)}function C(t,n,i,a){const s=t.appendChild(x(A(n),n));n.uri&&o.solidLogicSingleton.store.fetcher.nowOrWhenFetched(n.doc(),void 0,function(e,t){s.textContent=A(n)}),t.appendChild(e.createElement("br")),t.appendChild(x(i,a))}function E(e,n){const i={};let a,o;for(a=n.firstChild;a;a=a.nextSibling)a.AJAR_subject&&(i[a.AJAR_subject.uri]=!0);const s=t.each(e,c.wf("message")),r={};for(s.forEach(function(e){r[e.uri]=!0,i[e.uri]||k(e)}),a=n.firstChild;a;)o=a.nextSibling,a.AJAR_subject&&!r[a.AJAR_subject.uri]&&n.removeChild(a),a=o}const k=function(e){const n={"?msg":e,"?creator":t.any(e,c.foaf("maker")),"?date":t.any(e,d("created")),"?content":t.any(e,c.sioc("content"))};_(n,!0)},_=function(i,a){const o=i["?creator"],s=i["?msg"],r=i["?date"],c=i["?content"],l=r.value,p=e.createElement("tr");p.AJAR_date=l,p.AJAR_subject=s;let d=!1;for(let e=g.firstChild;e;e=e.nextSibling)if(l>e.AJAR_date&&m||l<e.AJAR_date&&!m){g.insertBefore(p,e),d=!0;break}d||g.appendChild(p);const h=e.createElement("td");p.appendChild(h),C(h,o,u.widgets.shortDate(l),s);const b=e.createElement("td");p.appendChild(b);const x=e.createElement("p");x.setAttribute("style",f+(a?"background-color: #e8ffe8;":"background-color: #white;")),b.appendChild(x),x.textContent=c.value;const y=e.createElement("td");p.appendChild(y);const A=e.createElement("button");y.appendChild(A),A.textContent="-",p.setAttribute("class","hoverControl"),A.setAttribute("class","hoverControlHide"),A.setAttribute("style","color: red;"),A.addEventListener("click",function(i){y.removeChild(A);const a=e.createElement("button");a.textContent="cancel",y.appendChild(a).addEventListener("click",function(e){y.removeChild(o),y.removeChild(a),y.appendChild(A)},!1);const o=e.createElement("button");o.textContent="Delete message",y.appendChild(o).addEventListener("click",function(e){y.removeChild(o),y.removeChild(a),function(e){const i=t.statementsMatching(e).concat(t.statementsMatching(void 0,void 0,e));v.update(i,[],function(e,t,i){t?E(n,g):w("Cant delete messages:"+i)})}(s)},!1)},!1)};g=e.createElement("table"),g.fresh=!1,h.appendChild(g),g.setAttribute("style","width: 100%;");const T=function(){const o=e.createElement("tr"),s=e.createElement("td"),l=e.createElement("td"),p=e.createElement("td");o.appendChild(s),o.appendChild(l),o.appendChild(p),o.AJAR_date="9999-01-01T00:00:00Z";const m=function(){h.setAttribute("class","pendingedit"),h.disabled=!0;const a=[],s=new Date,l=""+s.getTime(),p=r.term(s),m=t.sym(i.uri+"#Msg"+l);a.push(new r.Statement(n,c.wf("message"),m,i)),a.push(new r.Statement(m,c.sioc("content"),t.literal(h.value),i)),a.push(new r.Statement(m,d("created"),p,i)),b&&a.push(new r.Statement(m,c.foaf("maker"),b,i));v.update([],a,function(n,i,a){if(i){const e={"?msg":m,"?content":t.literal(h.value),"?date":p,"?creator":b};_(e,!1),h.value="",h.setAttribute("class",""),h.disabled=!1}else o.appendChild(u.widgets.errorMessageBlock(e,"Error writing message: "+a))})};let h,g;o.appendChild(e.createElement("br"));const x={div:l,dom:e};return a.ensureLoggedIn(x).then(t=>{b=t.me,C(s,b,"",null),h=e.createElement("textarea"),l.innerHTML="",l.appendChild(h),h.rows=3,h.setAttribute("style",f+"background-color: #eef;"),h.addEventListener("keyup",function(e){13===e.keyCode&&(e.altKey||m())},!1),p.innerHTML="",g=u.widgets.button(e,u.icons.iconBase+"noun_383448.svg","Send"),g.setAttribute("style",u.style.buttonStyle+"float: right;"),g.addEventListener("click",m,!1),p.appendChild(g)}),o}();let S;if(m?g.insertBefore(T,g.firstChild):g.appendChild(T),s.query)S=s.query;else{S=new r.Query("Messages");const e={};["msg","date","creator","content"].forEach(function(t){S.vars.push(e[t]=r.variable(t))}),S.pat.add(n,p("message"),e.msg),S.pat.add(e.msg,c.dct("created"),e.date),S.pat.add(e.msg,c.foaf("maker"),e.creator),S.pat.add(e.msg,c.sioc("content"),e.content)}return t.query(S,_,void 0,function(){g.fresh=!0}),h.refresh=function(){E(n,g)},h}},6105(e,t,n){n.d(t,{A:()=>i});const i="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEzLjAxNTcgOS4yNzM2M0MxNC4yOTU0IDguMzQwMzEgMTUuMTI4OCA2LjgyOTg0IDE1LjEyODggNS4xMjgyQzE1LjEyODggMi4zMDA1MSAxMi44MjgzIDAgMTAuMDAwNiAwQzcuMTcyODkgMCA0Ljg3MjM4IDIuMzAwNTEgNC44NzIzOCA1LjEyODJDNC44NzIzOCA2LjgyOTg0IDUuNzA1NyA4LjM0MDMxIDYuOTg1NDcgOS4yNzM2M0MzLjgwNDIyIDEwLjQ5MSAxLjUzOTA2IDEzLjU3NTQgMS41MzkwNiAxNy4xNzk1QzEuNTM5MDYgMTguNzM0NyAyLjgwNDM0IDIwIDQuMzU5NTcgMjBIMTUuNjQxNkMxNy4xOTY4IDIwIDE4LjQ2MjEgMTguNzM0NyAxOC40NjIxIDE3LjE3OTVDMTguNDYyMSAxMy41NzU0IDE2LjE5NyAxMC40OTEgMTMuMDE1NyA5LjI3MzYzWk02LjQxMDg2IDUuMTI4MkM2LjQxMDg2IDMuMTQ4ODMgOC4wMjEyMSAxLjUzODQ4IDEwLjAwMDYgMS41Mzg0OEMxMS45OCAxLjUzODQ4IDEzLjU5MDMgMy4xNDg4MyAxMy41OTAzIDUuMTI4MkMxMy41OTAzIDcuMTA3NTggMTEuOTggOC43MTc5NyAxMC4wMDA2IDguNzE3OTdDOC4wMjEyMSA4LjcxNzk3IDYuNDEwODYgNy4xMDc1OCA2LjQxMDg2IDUuMTI4MlpNMTUuNjQxNiAxOC40NjE1SDQuMzU5NTdDMy42NTI2NiAxOC40NjE1IDMuMDc3NTQgMTcuODg2NCAzLjA3NzU0IDE3LjE3OTVDMy4wNzc1NCAxMy4zNjIgNi4xODMxNiAxMC4yNTY0IDEwLjAwMDYgMTAuMjU2NEMxMy44MTgxIDEwLjI1NjQgMTYuOTIzNyAxMy4zNjIgMTYuOTIzNyAxNy4xNzk1QzE2LjkyMzcgMTcuODg2NCAxNi4zNDg2IDE4LjQ2MTUgMTUuNjQxNiAxOC40NjE1WiIgZmlsbD0iIzMxNDE1OCIvPgo8L3N2Zz4K"},1795(e,t,n){n.d(t,{A:()=>s});var i=n(5386),a=n.n(i),o=n(4961);const s=a()(o)},8153(e,t,n){n.r(t),n.d(t,{getChunks:()=>h,lightColorHash:()=>m,manageParticipation:()=>p.manageParticipation,notepad:()=>f,notepadToHTML:()=>b,participationObject:()=>p.participationObject,recordParticipation:()=>p.recordParticipation,renderParticipants:()=>p.renderParticipants,xmlEncode:()=>g});var i=n(1795),a=n(4961),o=n(4608),s=n(52),r=n(7423),c=n(3138),l=n(675),p=n(3605);const u=c.solidLogicSingleton.store,d=(0,a.Namespace)("http://www.w3.org/ns/pim/pad#");function m(e){return e&&e.uri?"#"+(16777215&(t=e.uri,t.split("").reduce(function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e},0))|12632256).toString(16):"#ffffff";var t}function f(e,t,n,c,p){const d=(p=p||{}).exists,f=e.createElement("table"),h=u;if(c&&!c.uri)throw new Error("UI.pad.notepad: Invalid userid");const g=u.updater,b=(0,a.Namespace)("http://www.w3.org/ns/pim/pad#");f.setAttribute("style",l.i.notepadStyle);let v=null,x=null;if(p.statusArea){const t=p.statusArea.appendChild(e.createElement("table")).appendChild(e.createElement("tr"));v=t.appendChild(e.createElement("td")),x=t.appendChild(e.createElement("td")),v&&v.setAttribute("style",l.i.upstreamStatus),x&&x.setAttribute("style",l.i.downstreamStatus)}const y=function(t,n=!1){(0,r.Rm)(t),p.statusArea&&(n?v:x).appendChild((0,o.errorMessageBlock)(e,t,"pink"))},w=function(e){p.statusArea&&(p.statusArea.innerHTML="")},A=function(e,t,n){const a=e.subject;t=t||"";const o=l.i.baseStyle,s=l.i.headingCore,r=l.i.headingStyle,c=h.any(a,i.A.dc("author"));if(!t&&c){t="color: "+(n?"#888":"black")+"; background-color: "+m(c)+";"}let p=h.any(a,b("indent"));p=p?p.value:0;const u=p>=0?o+"text-indent: "+3*p+"em;":s+r[-1-p];e.setAttribute("style",u+t)},C=function(e){const i=e.subject;if(!i)throw new Error("No chunk for line to be deleted!");const o=h.any(void 0,b("next"),i),c=h.any(i,b("next"));if(o.sameTerm(n)&&c.sameTerm(n))return void(0,r.Rm)("You can't delete the only line.");const l=h.statementsMatching(i,void 0,void 0,t).concat(h.statementsMatching(void 0,void 0,i,t)),p=[(0,a.st)(o,b("next"),c,t)];if(i instanceof a.NamedNode){const e=i.uri.slice(-4);(0,r.Rm)("Deleting line "+e)}if(!g)throw new Error("have no updater");g.update(l,p,function(t,n,a,o){if(n){const t=e.parentNode;if(t){const e=t.previousSibling;t.parentNode&&t.parentNode.removeChild(t),e&&e.firstChild&&e.firstChild.focus()}}else if(o&&409===o.status)A(e,"color: black; background-color: #ffd;"),e.state=0,(0,s.beep)(.5,512),setTimeout(function(){R()},1e3);else{(0,r.Rm)(" removePart FAILED "+i+": "+a),(0,r.Rm)(" removePart was deleting :'"+l),A(e,"color: black; background-color: #fdd;");const t=o?o.status:" [no response field] ";y("Error "+t+" saving changes: "+String(a))}})},E=function(e,n){let o=null;e.addEventListener("keydown",function(i){if(!g)throw new Error("no updater");let o,s;switch(i.keyCode){case 13:{const t=i.shiftKey;if((0,r.Rm)("enter"),t?(s=h.any(void 0,b("next"),n),o="newlinesAfter"):(s=h.any(n,b("next")),o="newlinesBefore"),s[o]=s[o]||0,s[o]+=1,s[o]>1)return void(0,r.Rm)(" queueing newline queue = "+s[o]);(0,r.Rm)(" go ahead line before "+s[o]),_(e,t);break}case 8:if(0===e.value.length)switch((0,r.Rm)("Delete key line "+n.uri.slice(-4)+" state "+e.state),e.state){case 1:case 2:return void(e.state=4);case 3:case 4:return;case void 0:case 0:e.state=3,C(e),i.preventDefault();break;default:throw new Error("pad: Unexpected state "+e)}break;case 9:{const o=i.shiftKey?-1:1;!function(e,n,i){const o=h.statementsMatching(n,b("indent")),s=o.length?Number(o[0].object.value):0;if(s+i<-3)return;const c=s+i,l=(0,a.st)(n,b("indent"),c,t);if(!g)throw new Error("no updater");g.update(o,l,function(n,i,a){i?A(e):((0,r.Rm)("Indent change FAILED '"+c+"' for "+t+": "+a),A(e,"color: black; background-color: #fdd;"),g.requestDownstreamAction(t,R))})}(e,n,o),i.preventDefault();break}case 27:(0,r.Rm)("escape"),g.requestDownstreamAction(t,R),i.preventDefault();break;case 38:e.parentNode.previousSibling&&(e.parentNode.previousSibling.firstChild.focus(),i.preventDefault());break;case 40:e.parentNode.nextSibling&&(e.parentNode.nextSibling.firstChild.focus(),i.preventDefault())}});const c=function(e){const n=e.subject;A(e,void 0,!0);const o=h.any(n,i.A.sioc("content")).value,l=[(0,a.st)(n,i.A.sioc("content"),o,t)];let p;e.value&&(p=[(0,a.st)(n,i.A.sioc("content"),e.value,t)]);const u=e.value;if(e.lastSent&&o!==e.lastSent&&console.warn("Out of order, last sent expected '"+o+"' but found '"+e.lastSent+"'"),e.lastSent=u,!g)throw new Error("no updater");g.update(l,p,function(n,i,a,l){if(i)w(),A(e),(0,r.Rm)(" Patch ok '"+o+"' -> '"+u+"' "),4===e.state?(e.state=3,C(e)):3===e.state||(2===e.state?(e.state=1,c(e)):e.state=0);else if((0,r.Rm)(" patch FAILED "+l.status+" for '"+o+"' -> '"+u+"': "+a),409===l.status)A(e,"color: black; background-color: #fdd;"),e.state=0,(0,s.beep)(.5,512),setTimeout(function(){g.requestDownstreamAction(t,R)},1e3);else{A(e,"color: black; background-color: #fdd;");const t=l?.status;t&&502!==t&&503!==t?(e.state=0,y(" Error "+t+" sending data: "+a,!0),(0,s.beep)(1,128)):(e.lastSent=void 0,e.state=0,setTimeout(()=>{0!==e.state&&void 0!==e.state||(e.state=1,c(e))},2e3))}})};e.addEventListener("input",function(t){switch(A(e,void 0,!0),(0,r.Rm)("Input event state "+e.state+" value '"+e.value+"'"),e.state){case 3:case 4:case 2:return;case 1:return void(e.state=2);case 0:case void 0:null!==o&&clearTimeout(o),o=setTimeout(()=>{o=null,0!==e.state&&void 0!==e.state||(e.state=1,c(e))},400)}})},k=function(t,n,a){let o=h.any(n,i.A.sioc("content"));o=o?o.value:"";const s=e.createElement("tr");a?f.insertBefore(s,t):t&&t.nextSibling?f.insertBefore(s,t.nextSibling):f.appendChild(s);const l=s.appendChild(e.createElement("input"));return l.subject=n,l.setAttribute("type","text"),l.value=o,c?(A(l,""),E(l,n)):(A(l,"color: #222; background-color: #fff"),(0,r.Rm)("Note can't add listeners - not logged in")),l},_=function(e,s){const l=u;let p,d,m,f,h,v=0,x=null;e?("input"!==e.tagName.toLowerCase()&&(0,r.Rm)("return pressed when current document is: "+e.tagName),p=e.subject,v=l.any(p,b("indent")),v=v?Number(v.value):0,s?(d=l.any(void 0,b("next"),p),m=p,f=d,x="newlinesAfter"):(d=p,m=l.any(p,b("next")),f=m,x="newlinesBefore"),h=e.parentNode):(d=n,m=n,h=void 0);const y=(0,o.newThing)(t),w=y.uri.slice(-4),C=[(0,a.st)(d,b("next"),m,t)],E=[(0,a.st)(d,b("next"),y,t),(0,a.st)(y,b("next"),m,t),(0,a.st)(y,i.A.dc("author"),c,t),(0,a.st)(y,i.A.sioc("content"),"",t)];if(v>0&&E.push((0,a.st)(y,b("indent"),v,t)),(0,r.Rm)(" Fresh chunk "+w+" proposed"),!g)throw new Error("no updater");g.update(C,E,function(e,t,n,i){if(t){const e=k(h,y,s);A(e),e.focus(),x&&((0,r.Rm)(" Fresh chunk "+w+" updated, queue = "+f[x]),f[x]-=1,f[x]>0&&((0,r.Rm)(" Implementing queued newlines = "+m.newLinesBefore),_(e,s)))}else(0,r.Rm)(" ERROR writing new line "+w+": "+n)})},T=function(){const e={};let t=0;function a(e){y(e),t++}if(!h.the(n,b("next")))return a("No initial next pointer"),!1;let o,s=n;for(;o=h.the(s,b("next")),o||a("No next pointer from "+s),!o.sameTerm(n);){s=o;const t=o.uri.split("#")[1];if(e[o.uri])return a("Loop!"),!1;e[o.uri]=!0;let n=h.each(o,b("next")).length;1!==n&&a("Should be 1 not "+n+" next pointer for "+t),n=h.each(o,b("indent")).length,n>1&&a("Should be 0 or 1 not "+n+" indent for "+t),n=h.each(o,i.A.sioc("content")).length,1!==n&&a("Should be 1 not "+n+" contents for "+t),n=h.each(o,i.A.dc("author")).length,1!==n&&a("Should be 1 not "+n+" author for "+t);h.statementsMatching(void 0,i.A.sioc("contents")).forEach(function(t){e[t.subject.value]||a("Loose chunk! "+t.subject.value)})}return!t},S=function(){if(1!==h.each(n,b("next")).length){const e="Pad: Inconsistent data - NEXT pointers: "+h.each(n,b("next")).length;return(0,r.Rm)(e),void(p.statusArea&&(p.statusArea.textContent+=e))}let e;const t=[];for(let e=h.the(n,b("next"));!e.sameTerm(n);e=h.the(e,b("next")))for(let n=0;n<f.children.length;n++){const i=f.children[n];i.firstChild&&i.firstChild.subject.sameTerm(e)&&(t[e.uri]=i.firstChild)}for(let n=f.children.length-1;n>=0;n--)e=f.children[n],t[e.firstChild.subject.uri]||f.removeChild(e);e=f.firstChild;for(let a=h.the(n,b("next"));!a.sameTerm(n);a=h.the(a,b("next"))){const n=h.any(a,i.A.sioc("content")).value;if(e&&t[a.uri]){const t=e.firstChild;n!==t.value&&(t.value=n),A(t),t.state=0,delete t.lastSent,e=e.nextSibling}else k(e,a,!0)}},L=function(e){if(e.refresh)e.refresh();else for(let t=0;t<e.children.length;t++)L(e.children[t])};let j=!1;const R=function(){if(j)return void(0,r.Rm)(" Already reloading - stop");j=!0;let e=1e3;const n=function(){if((0,r.Rm)("try reload - timeout = "+e),!g)throw new Error("no updater");g.reload(g.store,t,function(i,a,o){j=!1,i?((0,r.Rm)(" reloaded OK"),w(),T()?L(f):y("CONSISTENCY CHECK FAILED")):0===o.status?(y("Network error refreshing the pad. Retrying in "+e/1e3),j=!0,e*=2,setTimeout(n,e)):y("Error "+o.status+"refreshing the pad:"+a+". Stopped. "+t)})};n()};if(f.refresh=S,f.reloadAndSync=R,c||(0,r.Rm)("Warning: must be logged in for pad to be edited"),d)(0,r.Rm)("Existing pad."),T()?(S(),h.holds(n,b("next"),n)&&_()):(0,r.Rm)(f.textContent="Inconsistent data. Abort");else{(0,r.Rm)("No pad exists - making new one.");const e=[(0,a.st)(n,i.A.rdf("type"),b("Notepad"),t),(0,a.st)(n,i.A.dc("author"),c,t),(0,a.st)(n,i.A.dc("created"),new Date,t),(0,a.st)(n,b("next"),n,t)];if(!g)throw new Error("no updater");g.update([],e,function(e,t,n){t?((0,r.Rm)("Initial pad created"),_()):y(n||"")})}return f}function h(e,t){const n=[];for(let i=t.the(e,d("next"));!i.sameTerm(e);i=t.the(i,d("next")))n.push(i);return n}function g(e){return e.replace("&","&amp;").replace("<","&lt;").replace(">","&gt;")}function b(e,t){const n=h(e,t);let a="<html>\n <head>\n";const o=t.anyValue(e,i.A.dct("title"));o&&(a+=` <title>${g(o)}</title>\n`),a+=" </head>\n <body>\n";let s=0;function r(e){for(;s>e;s--)a+="</ul>\n"}return n.forEach(e=>{const n=t.anyJS(e,d("indent")),o=t.anyJS(e,i.A.sioc("content"));if(!o)return;const c=g(o);if(n<0){r(0);const e=n>=-3?4+n:1;a+=`\n<h${e}>${c}</h${e}>\n`}else n>0?(r(n),function(e){for(;s<e;s++)a+="<ul>\n"}(n),a+=`<li>${c}</li>\n`):(r(n),a+=`<p>${c}</p>\n`)}),r(0),a+=" </body>\n</html>\n",a}},3605(e,t,n){n.r(t),n.d(t,{manageParticipation:()=>g,participationObject:()=>f,recordParticipation:()=>h,renderParticipants:()=>m});var i=n(7423),a=n(4961),o=n(1795),s=n(4608),r=n(52),c=n(8153),l=n(675),p=n(4762),u=n(3138);const d=u.solidLogicSingleton.store;function m(e,t,n,a,c,u){t.setAttribute("style",l.i.participantsStyle);const m=function(n){const i=d.any(n,o.A.wf("participant"));let a;if(!i)return a=e.createElement("tr"),a.textContent="???",a;const r=d.anyValue(n,o.A.ui("backgroundColor"))||p.A.participationDefaultBackground,c=e.createElement("div");c.setAttribute("style",l.i.participantsBlock),c.style.backgroundColor=r,a=(0,s.personTR)(e,null,i,u),t.appendChild(a);const m=e.createElement("td");return m.setAttribute("style",l.i.personTableTD),m.appendChild(c),a.insertBefore(m,a.firstChild),a},f=function(){const e=d.each(a,o.A.wf("participation")).map(function(e){return(0,i.Rm)("in participants"),[d.anyValue(e,o.A.cal("dtstart"))||"9999-12-31",e]});e.sort();const n=e.map(function(e){return e[1]});(0,r.syncTableToArray)(t,n,m)};return t.refresh=f,f(),t}function f(e,t,n){return new Promise(function(r,l){if(!n)throw new Error("No user id");const p=d.each(e,o.A.wf("participation")).filter(function(e){return d.holds(e,o.A.wf("participant"),n)});if(p.length>1){const e=[];for(const t of p){const n=d.anyValue(t,o.A.cal("dtstart"));n&&e.push([n,t])}e.sort(),i.R8("Multiple participation objects, picking earliest, in "+t),r(e[0][1])}if(p.length)r(p[0]);else{const i=(0,s.newThing)(t),p=[(0,a.st)(e,o.A.wf("participation"),i,t),(0,a.st)(i,o.A.wf("participant"),n,t),(0,a.st)(i,o.A.cal("dtstart"),new Date,t),(0,a.st)(i,o.A.ui("backgroundColor"),(0,c.lightColorHash)(n),t)];d.updater.update([],p,function(e,t,n){t?r(i):l(new Error("Error recording your participation: "+n))}),r(i)}})}function h(e,t,n){const r=u.authn.currentUser();if(!r)return;const l=d.each(e,o.A.wf("participation")).filter(function(e){return d.holds(e,o.A.wf("participant"),r)});if(l.length>1)throw new Error("Multiple records of your participation");if(l.length)return l[0];{if(!d.updater.editable(t))return i.Rm("Not recording participation, as no write access as "+r+" to "+t),null;const l=(0,s.newThing)(t),p=[(0,a.st)(e,o.A.wf("participation"),l,t),(0,a.st)(l,o.A.wf("participant"),r,t),(0,a.st)(l,o.A.cal("dtstart"),new Date,t),(0,a.st)(l,o.A.ui("backgroundColor"),(0,c.lightColorHash)(r),t)];return d.updater.update([],p,function(e,t,i){if(!t)throw new Error("Error recording your participation: "+i);n&&n.refresh&&n.refresh()}),l}}function g(e,t,n,i,a,o){const r=e.createElement("table");t.appendChild(r),m(e,r,0,i,0,o);try{h(i,n,r)}catch(n){t.appendChild((0,s.errorMessageBlock)(e,"Error recording your participation: "+n))}return r}},5148(e,t,n){n.r(t),n.d(t,{get:()=>d,getPreferencesForClass:()=>v,recordPersonalDefaults:()=>h,recordSharedPreferences:()=>f,renderPreferencesForm:()=>g,set:()=>m,value:()=>u});var i=n(4961),a=n(3138),o=n(7423),s=n(967),r=n(1795),c=n(3605),l=n(4608);const p=a.store,u=[];function d(e){return u[e]}function m(e,t){if("string"!=typeof t)throw o.Rm("Non-string value of preference "+e+": "+t),new Error("Non-string value of preference "+e+": "+t);this.value[e]=t}function f(e,t){return new Promise(function(n,a){const s=p.any(e,r.A.ui("sharedPreferences"));if(s)t.sharedPreferences=s,n(t);else{p.updater.editable(e.doc())||(o.Rm(` Cant make shared preferences, may not change ${e.doc}`),n(t));const s=i.sym(e.doc().uri+"#SharedPreferences"),c=[i.st(e,r.A.ui("sharedPreferences"),s,e.doc())];o.Rm("Creating shared preferences "+s),p.updater.update([],c,function(e,i,o){i?(t.sharedPreferences=s,n(t)):a(new Error("Error creating shared prefs: "+o))})}})}function h(e,t){return new Promise(function(n,a){(0,s.ensureLoadedPreferences)(t).then(t=>{if(!t.preferencesFile)return void o.Rm("Not doing private class preferences as no access to preferences file. "+t.preferencesFileError);const s=p.each(null,r.A.solid("forClass"),e,t.preferencesFile);let c,u,d=[];if(s.length){if(s.forEach(e=>{c=c||p.any(e,r.A.solid("personalDefaults"))}),c)return t.personalDefaults=c,void n(t);c=l.newThing(t.preferencesFile),u=s[0]}else u=l.newThing(t.preferencesFile),d=[i.st(u,r.A.rdf("type"),r.A.solid("TypeRegistration"),t.preferencesFile),i.st(u,r.A.solid("forClass"),e,t.preferencesFile)];c=l.newThing(t.preferencesFile),d.push(i.st(u,r.A.solid("personalDefaults"),c,t.preferencesFile)),p.updater.update([],d,function(i,o,s){o?(t.personalDefaults=c,n(t)):a(new Error("Setting preferences for "+e+": "+s))})},e=>{a(e)})})}function g(e,t,n,i){const a=i.dom.createElement("div");return c.participationObject(e,e.doc(),i.me).then(o=>{const s=i.dom;function r(e){a.appendChild(s.createElement("h5")).textContent=e}r("My view of this "+i.noun),l.appendForm(s,a,{},o,n,e.doc(),(e,t)=>{e||l.complain(i,t)}),r("Everyone's view of this "+i.noun),f(e,i).then(i=>{const o=i.sharedPreferences;l.appendForm(s,a,{},o,n,e.doc(),(e,t)=>{e||l.complain(i,t)}),r("My default view of any "+i.noun),h(t,i).then(e=>{l.appendForm(s,a,{},e.personalDefaults,n,e.preferencesFile,(t,n)=>{t||l.complain(e,n)})},e=>{l.complain(i,e)})})},e=>{a.appendChild(l.errorMessageBlock(i.dom,e))}),a}function b(e){return e.datatype?e.datatype.equals(r.A.xsd("boolean"))?"1"===e.value:e.datatype.equals(r.A.xsd("dateTime"))||e.datatype.equals(r.A.xsd("date"))?new Date(e.value):e.datatype.equals(r.A.xsd("integer"))||e.datatype.equals(r.A.xsd("float"))||e.datatype.equals(r.A.xsd("decimal"))?Number(e.value):e.value:e}function v(e,t,n,i){return new Promise(function(a,o){f(e,i).then(i=>{const s=i.sharedPreferences;if(i.me)c.participationObject(e,e.doc(),i.me).then(e=>{h(t,i).then(t=>{const i=[],o=t.personalDefaults;n.forEach(t=>{const n=p.any(e,t)||p.any(s,t)||p.any(o,t);n&&(i[t.uri]=b(n))}),a(i)},o)},o);else{const e=[];n.forEach(t=>{const n=p.any(s,t);n&&(e[t.uri]=b(n))}),a(e)}})})}},9417(e,t,n){n.d(t,{A:()=>i});const i={authEndpoint:"",fallbackAuthEndpoint:"https://databox.me/",signupEndpoint:"https://solidproject.org/get_a_pod",signupWindowHeight:600,signupWindowWidth:1024,key:"",cert:""}},6247(e,t,n){n.d(t,{l:()=>a});var i=n(9417);function a(e){this.config=e||i.A}a.prototype.listen=function(){return new Promise(function(e,t){const n=window.addEventListener?"addEventListener":"attachEvent";(0,window[n])("attachEvent"===n?"onmessage":"message",function(n){const i=n.data;if("User:"===i.slice(0,5)){const n=i.slice(5,i.length);return n&&n.length>0&&"http"===n.slice(0,4)?e(n):t(n)}},!0)})},a.prototype.signup=function(e){e=e||this.config.signupEndpoint;const t=this.config.signupWindowWidth,n=this.config.signupWindowHeight,i=window.screen.width/2-(t/2+10),a=window.screen.height/2-(n/2+50),o=e+"?origin="+encodeURIComponent(window.location.origin),s="resizable,scrollbars,status,width="+t+",height="+n+",left="+i+",top="+a;window.open(o,"Solid signup",s);const r=this;return new Promise(function(e){r.listen().then(function(t){return e(t)})})}},675(e,t,n){n.d(t,{i:()=>a});var i=n(4762);const a={checkboxStyle:"color: black; font-size: 100%; padding-left: 0.5 em; padding-right: 0.5 em;",checkboxInputStyle:"font-size: 150%; height: 1.2em; width: 1.2em; background-color: #eef; border-radius:0.2em; margin: 0.1em;",fieldLabelStyle:"color: #3B5998; text-decoration: none;",formSelectStyle:"background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;",textInputStyle:"background-color: #eef; padding: 0.5em; border: .05em solid #88c; border-radius:0.2em; font-size: 100%; margin:0.4em;",textInputStyleUneditable:"background-color: white; padding: 0.5em; border: .05em solid white; border-radius:0.2em; font-size: 100%; margin:0.4em;",buttonStyle:"background-color: #fff; padding: 0.7em; border: .01em solid white; border-radius:0.2em; font-size: 100%; margin: 0.3em;",commentStyle:"padding: 0.7em; border: none; font-size: 100%; white-space: pre-wrap;",iconStyle:"width: 3em; height: 3em; margin: 0.1em; border-radius: 1em;",smallButtonStyle:"margin: 0.2em; width: 1em; height:1em;",classIconStyle:"width: 3em; height: 3em; margin: 0.1em; border-radius: 0.2em; border: 0.1em solid green; padding: 0.2em; background-color: #efe;",confirmPopupStyle:"padding: 0.7em; border-radius: 0.2em; border: 0.1em solid orange; background-color: white; box-shadow: 0.5em 0.9em #888;",messageBodyStyle:"white-space: pre-wrap; width: 99%; font-size:100%; border: 0.07em solid #eee; border-radius:0.2em; padding: .3em 0.5em; margin: 0.1em;",pendingeditModifier:"color: #bbb;",personaBarStyle:"width: 100%; height: 4em; background-color: #eee; vertical-align: middle;",searchInputStyle:"border: 0.1em solid #444; border-radius: 0.2em; width: 100%; font-size: 100%; padding: 0.1em 0.6em; margin 0.2em;",autocompleteRowStyle:"border: 0.2em solid straw;",signInAndUpButtonStyle:"padding: 1em; border-radius:0.2em; font-size: 100%;",headerBannerLoginInput:"margin: 0.75em 0 0.75em 0.5em !important; padding: 0.5em !important;",signUpBackground:"background-color: #eef;",signInBackground:"background-color: #efe;",heading1Style:"font-size: 180%; font-weight: bold; color: #888888; padding: 0.5em; margin: 0.7em 0.0m;",heading2Style:"font-size: 130%; font-weight: bold; color: #888888; padding: 0.4em; margin: 0.7em 0.0em;",heading3Style:"font-size: 120%; font-weight: bold; color: #888888; padding: 0.3em; margin: 0.7em 0.0em;",heading4Style:"font-size: 110%; font-weight: bold; color: #888888; padding: 0.2em; margin: 0.7em 0.0em;",formHeadingStyle:"font-size: 110%; font-weight: bold; color: #888888; padding: 0.2em; margin: 0.7em 0.0em;",formTextInput:"font-size: 100%; margin: 0.1em; padding: 0.1em;",formGroupStyle:[`padding-left: 0em; border: 0.0em solid ${i.A.formBorderColor}; border-radius: 0.2em;`,`padding-left: 2em; border: 0.05em solid ${i.A.formBorderColor}; border-radius: 0.2em;`,`padding-left: 2em; border: 0.1em solid ${i.A.formBorderColor}; border-radius: 0.2em;`,`padding-left: 2em; border: 0.2em solid ${i.A.formBorderColor}; border-radius: 0.2em;`],formFieldLabelStyle:`color: ${i.A.lowProfileLinkColor}; text-decoration: none;`,formFieldNameBoxStyle:`padding: 0.3em; vertical-align: middle; width:${i.A.formFieldNameBoxWidth};`,multilineTextInputStyle:"font-size:100%; white-space: pre-wrap; background-color: #eef; border: 0.07em solid gray; padding: 1em 0.5em; margin: 1em 1em;",renderAsDivStyle:"display: flex; align-items: center; justify-content: space-between; height: 2.5em; padding: 1em;",imageDivStyle:"width:2.5em; padding:0.5em; height: 2.5em;",linkDivStyle:"width:2em; padding:0.5em; height: 4em;",aclControlBoxContainer:"margin: 1em;",aclControlBoxHeader:"font-size: 120%; margin: 0 0 1rem;",aclControlBoxStatus:"display: none; margin: 1rem 0;",aclControlBoxStatusRevealed:"display: block;",aclGroupContent:"maxWidth: 650;",accessGroupList:"display: grid; grid-template-columns: 1fr; margin: 1em; width: 100%;",accessGroupListItem:"display: grid; grid-template-columns: 100px auto 30%;",defaultsController:"display: flex;",defaultsControllerNotice:"color: #888; flexGrow: 1; fontSize: 80%;",bigButton:"background-color: white; border: 0.1em solid #888; border-radius: 0.3em; max-width: 50%; padding-bottom: 1em; padding-top: 1em;",group:"color: #888;",group1:"color: green;",group2:"color: #cc0;",group3:"color: orange;",group5:"color: red;",group9:"color: blue;",group13:"color: purple;",trustedAppAddApplicationsTable:"background-color: #eee;",trustedAppCancelButton:"float: right;",trustedAppControllerI:"border-color: orange; border-radius: 1em; border-width: 0.1em;",temporaryStatusInit:"background: green;",temporaryStatusEnd:"background: transparent; transition: background 5s linear;",headerUserMenuLink:"background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none;",headerUserMenuLinkHover:"background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; text-decoration: none; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%);",headerUserMenuTrigger:"background: none; border: 0; cursor: pointer; width: 60px; height: 60px;",headerUserMenuTriggerImg:"border-radius: 50%; height: 56px; width: 28px !important;",headerUserMenuButton:"background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%;",headerUserMenuButtonHover:"background: none; border: 0; color: black; cursor: pointer; display: block; font-family: Arial; font-size: 1em; text-align: left; padding: 1em; width: 100%; background-image: linear-gradient(to right, #7C4DFF 0%, #18A9E6 50%, #01C9EA 100%);",headerUserMenuList:"list-style: none; margin: 0; padding: 0;",headerUserMenuListDisplay:"list-style: none; margin: 0; padding: 0; display:true;",headerUserMenuNavigationMenu:"background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: true;",headerUserMenuNavigationMenuNotDisplayed:"background: white; border: solid 1px #000000; border-right: 0; position: absolute; right: 0; top: 60px; width: 200px; z-index: 1; display: none;",headerUserMenuListItem:"border-bottom: solid 1px #000000;",headerUserMenuPhoto:"border-radius: 50%; background-position: center; background-repeat: no-repeat; background-size: cover; height: 50px; width: 50px;",headerBanner:"box-shadow: 0px 1px 4px #000000; display: flex; justify-content: space-between; padding: 0 1.5em; margin-bottom: 4px;",headerBannerLink:"display: block;",headerBannerRightMenu:"display: flex;",headerBannerLogin:"margin-left: auto;",allChildrenVisible:"display:true;",headerBannerUserMenu:"border-left: solid 1px #000000; margin-left: auto;",headerBannerHelpMenu:"border-left: solid 1px #000000; margin-left: auto;",headerBannerIcon:"background-size: 65px 60px !important; height: 60px !important; width: 65px !important;",footer:"border-top: solid 1px $divider-color; font-size: 0.9em; padding: 0.5em 1.5em;",primaryButton:"background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;",primaryButtonHover:"background-color: #9f7dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;",primaryButtonNoBorder:"background-color: #ffffff; color: #7c4dff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;",primaryButtonNoBorderHover:"background-color: #7c4dff; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;",secondaryButton:"background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;",secondaryButtonHover:"background-color: #37cde6; color: #ffffff; font-family: Raleway, Roboto, sans-serif;border-radius: 0.25em; border-color: #7c4dff; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;",secondaryButtonNoBorder:"background-color: #ffffff; color: #01c9ea; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none;",secondaryButtonNoBorderHover:"background-color: #01c9ea; color: #ffffff; font-family: Raleway, Roboto, sans-serif; border-radius: 0.25em; border-color: #01c9ea; border: 1px solid; cursor: pointer; font-size: .8em; text-decoration: none; padding: 0.5em 4em; transition: 0.25s all ease-in-out; outline: none; transition: 0.25s all ease-in-out;",controlStyle:`border-radius: 0.5em; margin: 0.8em; width:${i.A.mediaModuleCanvasWidth}; height:${i.A.mediaModuleCanvasHeight};`,dragEvent:"background-color: #ccc; border: 0.25em dashed black; border-radius: 0.3em;",dropEvent:"background-color: white; border: 0em solid black;",restoreStyle:"background-color: white;",errorCancelButton:"width: 2em; height: 2em; align: right;",errorMessageBlockStyle:"margin: 0.1em; padding: 0.5em; border: 0.05em solid gray; color:black;",notepadStyle:"padding: 1em; overflow: auto; resize: horizontal; min-width: 40em;",upstreamStatus:"width: 50%;",downstreamStatus:"width: 50%;",baseStyle:"font-size: 100%; font-family: monospace; width: 100%; border: none; white-space: pre-wrap;",headingCore:"font-family: sans-serif; font-weight: bold; border: none;",headingStyle:["font-size: 110%; padding-top: 0.5em; padding-bottom: 0.5em; width: 100%;","font-size: 120%; padding-top: 1em; padding-bottom: 1em; width: 100%;","font-size: 150%; padding-top: 1em; padding-bottom: 1em; width: 100%;"],participantsStyle:"margin: 0.8em;",participantsBlock:"height: 1.5em; width: 1.5em; margin: 0.3em; border 0.01em solid #888;",personTableTD:"vertical-align: middle;",tabsNavElement:"margin: 0;",tabsRootElement:"display: flex; height: 100%; width: 100%;",tabsMainElement:"margin: 0; width:100%; height: 100%;",tabContainer:"list-style-type: none; display: flex; height: 100%; width: 100%; margin: 0; padding: 0;",makeNewSlot:"background: none; border: none; font: inherit; cursor: pointer;",ellipsis:"position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;",setStyle:function(e,t){e.style=a[t]}}},4762(e,t,n){n.d(t,{A:()=>i});const i={highlightColor:"#7C4DFF",formBorderColor:"#888888",formHeadingColor:"#888888",lowProfileLinkColor:"#3B5998",formFieldNameBoxWidth:"8em",mediaModuleCanvasWidth:"640",mediaModuleCanvasHeight:"480",textInputSize:20,tabBorderRadius:"0.2em",textInputBackgroundColor:"#eef",textInputBackgroundColorUneditable:"#fff",textInputColor:"#000",textInputColorPending:"#888",defaultErrorBackgroundColor:"#fee",participationDefaultBackground:"white",basicMaxLength:"4096"}},5561(e,t,n){n.d(t,{i:()=>i});
2
2
  /**
3
3
  * @version IconicMultiSelect v0.7.0
4
4
  * @licence MIT