@muze-nl/jsfs-solid 0.3.6 → 0.3.8
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.
- package/dist/browser.js +17 -16
- package/dist/browser.js.map +3 -3
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +3 -3
- package/package.json +1 -1
- package/package.json~ +1 -1
- package/src/SolidClient.js +17 -16
package/dist/browser.min.js
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
]`)}}list(e){let r=e&&e.length||0,n=new Array(r);for(let i=0;i<r;i++)n[i]=this._encodeObject(e[i]);return new bt(`(${n.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
20
20
|
`:`
|
|
21
21
|
}
|
|
22
|
-
`),this._subject=null),this._write=this._blockedWrite;let r=e&&((n,i)=>{r=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(r)}catch{}r&&r()}};function ea(t){let e=td[t];return e===void 0&&(t.length===1?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((t.charCodeAt(0)-55296)*1024+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var Us=zr(qn());var Ds=Symbol("iter");function Fr(t,e,r=4){if(r===0)return Object.assign(t,e);for(let n in e)t[n]=Fr(t[n]||Object.create(null),e[n],r-1);return t}function cf(t,e,r=4){let n=!1;for(let i in t)if(i in e){let s=r===0?null:cf(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}function df(t,e,r=4){let n=!1;for(let i in t)if(!(i in e))n=n||Object.create(null),n[i]=r===0?null:Fr({},t[i],r-1);else if(r!==0){let s=df(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}var Mr=class{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=e.factory||te}_termFromId(e){if(e[0]==="."){let r=this._entities,n=e.split(".");return this._factory.quad(this._termFromId(r[n[1]]),this._termFromId(r[n[2]]),this._termFromId(r[n[3]]),n[4]&&this._termFromId(r[n[4]]))}return Ke(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){let r=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object),s;return r&&n&&i&&(_t(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${n}.${i}.${s}`:`.${r}.${n}.${i}`]}return this._ids[Ne(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${_t(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Ne(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,n;if(e)for(r=e=`_:${e}`,n=1;this._ids[r];)r=e+n++;else do r=`_:b${this._blankNodeIndex++}`;while(this._ids[r]);return this._ids[r]=++this._id,this._entities[this._id]=r,this._factory.blankNode(r.substr(2))}},tt=class t{constructor(e,r){this._size=0,this._graphs=Object.create(null),!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||te,this._entityIndex=r.entityIndex||new Mr({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;let r=this._graphs,n,i;for(let s in r)for(let o in n=r[s].subjects)for(let a in i=n[o])e+=Object.keys(i[a]).length;return this._size=e}_addToIndex(e,r,n,i){let s=e[r]||(e[r]={}),o=s[n]||(s[n]={}),a=i in o;return a||(o[i]=null),!a}_removeFromIndex(e,r,n,i){let s=e[r],o=s[n];delete o[i];for(let a in o)return;delete s[n];for(let a in s)return;delete e[r]}*_findInIndex(e,r,n,i,s,o,a,l){let u,f,c,d=this._entities,h=this._termFromId(d[l]),y={subject:null,predicate:null,object:null};r&&((u=e,e={})[r]=u[r]);for(let _ in e)if(f=e[_]){y[s]=this._termFromId(d[_]),n&&((u=f,f={})[n]=u[n]);for(let x in f)if(c=f[x]){y[o]=this._termFromId(d[x]);let b=i?i in c?[i]:[]:Object.keys(c);for(let g=0;g<b.length;g++)y[a]=this._termFromId(d[b[g]]),yield this._factory.quad(y.subject,y.predicate,y.object,h)}}}_loop(e,r){for(let n in e)r(n)}_loopByKey0(e,r,n){let i,s;if(i=e[r])for(s in i)n(s)}_loopByKey1(e,r,n){let i,s;for(i in e)s=e[i],s[r]&&n(i)}_loopBy2Keys(e,r,n,i){let s,o,a;if((s=e[r])&&(o=s[n]))for(a in o)i(a)}_countInIndex(e,r,n,i){let s=0,o,a,l;r&&((o=e,e={})[r]=o[r]);for(let u in e)if(a=e[u]){n&&((o=a,a={})[n]=o[n]);for(let f in a)(l=a[f])&&(i?i in l&&s++:s+=Object.keys(l).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){let r=Object.create(null);return n=>{n in r||(r[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,n,i){r||(i=e.graph,n=e.object,r=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,r,n)?(this._addToIndex(s.predicates,r,n,e),this._addToIndex(s.objects,n,e,r),this._size=null,!0):!1}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}delete(e){return this.removeQuad(e),this}has(e,r,n,i){return e&&e.subject&&({subject:e,predicate:r,object:n,graph:i}=e),!this.readQuads(e,r,n,i).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,n,i){r||({subject:e,predicate:r,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;let s=this._graphs,o,a,l;if(!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(n=n&&this._termToNumericId(n))||!(o=s[i])||!(a=o.subjects[e])||!(l=a[r])||!(n in l))return!1;this._removeFromIndex(o.subjects,e,r,n),this._removeFromIndex(o.predicates,r,n,e),this._removeFromIndex(o.objects,n,e,r),this._size!==null&&this._size--;for(e in o.subjects)return!0;return delete s[i],!0}removeQuads(e){for(let r=0;r<e.length;r++)this.removeQuad(e[r])}remove(e){return e.on("data",r=>{this.removeQuad(r)}),e}removeMatches(e,r,n,i){let s=new Us.Readable({objectMode:!0}),o=this.readQuads(e,r,n,i);return s._read=a=>{for(;--a>=0;){let{done:l,value:u}=o.next();if(l){s.push(null);return}s.push(u)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,r,n,i){return[...this.readQuads(e,r,n,i)]}*readQuads(e,r,n,i){let s=this._getGraphs(i),o,a,l,u;if(!(e&&!(a=this._termToNumericId(e))||r&&!(l=this._termToNumericId(r))||n&&!(u=this._termToNumericId(n))))for(let f in s)(o=s[f])&&(a?u?yield*this._findInIndex(o.objects,u,a,l,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",f):l?yield*this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",f):u?yield*this._findInIndex(o.objects,u,null,null,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",f))}match(e,r,n,i){return new et(this,e,r,n,i,{entityIndex:this._entityIndex})}countQuads(e,r,n,i){let s=this._getGraphs(i),o=0,a,l,u,f;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||n&&!(f=this._termToNumericId(n)))return 0;for(let c in s)(a=s[c])&&(e?n?o+=this._countInIndex(a.objects,f,l,u):o+=this._countInIndex(a.subjects,l,u,f):r?o+=this._countInIndex(a.predicates,u,f,l):o+=this._countInIndex(a.objects,f,l,u));return o}forEach(e,r,n,i,s){this.some(o=>(e(o,this),!1),r,n,i,s)}every(e,r,n,i,s){return!this.some(o=>!e(o,this),r,n,i,s)}some(e,r,n,i,s){for(let o of this.readQuads(r,n,i,s))if(e(o,this))return!0;return!1}getSubjects(e,r,n){let i=[];return this.forSubjects(s=>{i.push(s)},e,r,n),i}forSubjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(a?l?this._loopBy2Keys(o.predicates,a,l,e):this._loopByKey1(o.subjects,a,e):l?this._loopByKey0(o.objects,l,e):this._loop(o.subjects,e))}getPredicates(e,r,n){let i=[];return this.forPredicates(s=>{i.push(s)},e,r,n),i}forPredicates(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(a?l?this._loopBy2Keys(o.objects,l,a,e):this._loopByKey0(o.subjects,a,e):l?this._loopByKey1(o.predicates,l,e):this._loop(o.predicates,e))}getObjects(e,r,n){let i=[];return this.forObjects(s=>{i.push(s)},e,r,n),i}forObjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(a?l?this._loopBy2Keys(o.subjects,a,l,e):this._loopByKey1(o.objects,a,e):l?this._loopByKey0(o.predicates,l,e):this._loop(o.objects,e))}getGraphs(e,r,n){let i=[];return this.forGraphs(s=>{i.push(s)},e,r,n),i}forGraphs(e,r,n,i){for(let s in this._graphs)this.some(o=>(e(o.graph),!0),r,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1}={}){let n={},i=r?()=>!0:(a,l)=>{throw new Error(`${a.value} ${l}`)},s=this.getQuads(null,O.rdf.rest,O.rdf.nil,null),o=e?[...s]:[];return s.forEach(a=>{let l=[],u=!1,f,c,d=a.graph,h=a.subject;for(;h&&!u;){let y=this.getQuads(null,null,h,null),_=this.getQuads(h,null,null,null),x,b=null,g=null,S=null;for(let w=0;w<_.length&&!u;w++)x=_[w],x.graph.equals(d)?f?u=i(h,"has non-list arcs out"):x.predicate.value===O.rdf.first?b?u=i(h,"has multiple rdf:first arcs"):o.push(b=x):x.predicate.value===O.rdf.rest?g?u=i(h,"has multiple rdf:rest arcs"):o.push(g=x):y.length?u=i(h,"can't be subject and object"):(f=x,c="subject"):u=i(h,"not confined to single graph");for(let w=0;w<y.length&&!u;++w)x=y[w],f?u=i(h,"can't have coreferences"):x.predicate.value===O.rdf.rest?S?u=i(h,"has incoming rdf:rest arcs"):S=x:(f=x,c="object");b?l.unshift(b.object):u=i(h,"has no list head"),h=S&&S.subject}u?e=!1:f&&(n[f[c].value]=l)}),e&&this.removeQuads(o),n}addAll(e){if(e instanceof et&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Fr(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof et&&(e=e.filtered),e===this)return!0;if(!(e instanceof t)||this._entityIndex!==e._entityIndex)return e.every(u=>this.has(u));let r=this._graphs,n=e._graphs,i,s,o,a,l;for(let u in n){if(!(i=r[u]))return!1;i=i.subjects;for(let f in s=n[u].subjects){if(!(o=i[f]))return!1;for(let c in a=s[f]){if(!(l=o[c]))return!1;for(let d in a[c])if(!(d in l))return!1}}}return!0}deleteMatches(e,r,n,i){for(let s of this.match(e,r,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof et&&(e=e.filtered),e===this)return new t({entityIndex:this._entityIndex});if(e instanceof t&&e._entityIndex===this._entityIndex){let r=new t({entityIndex:this._entityIndex}),n=df(this._graphs,e._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof et&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)e(n,this)&&r.add(n);return r}intersection(e){if(e instanceof et&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Fr(Object.create(null),this._graphs),r._size=this._size,r}else if(e instanceof t&&this._entityIndex===e._entityIndex){let r=new t({entityIndex:this._entityIndex}),n=cf(e._graphs,this._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>e.has(r))}map(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)r.add(e(n,this));return r}reduce(e,r){let n=this.readQuads(),i=r===void 0?n.next().value:r;for(let s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new _e().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Fr(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}*[Symbol.iterator](){yield*this.readQuads()}};function Re(t,e,r=0){let n=e[r];if(n&&!(n in t))return!1;let i=!1;for(let s in n?{[n]:t[n]}:t){let o=r===2?null:Re(t[s],e,r+1);o!==!1&&(i=i||Object.create(null),i[s]=o)}return i}var et=class t extends Us.Readable{constructor(e,r,n,i,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:n,object:i,graph:s,options:o})}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:n,predicate:i,subject:s}=this,o=this._filtered=new tt({factory:e._factory,entityIndex:this.options.entityIndex}),a,l,u;if(s&&!(a=o._termToNumericId(s))||i&&!(l=o._termToNumericId(i))||n&&!(u=o._termToNumericId(n)))return o;let f=e._getGraphs(r);for(let c in f){let d,h,y,_;(_=f[c])&&(!a&&l?(h=Re(_.predicates,[l,u,a]))&&(d=Re(_.subjects,[a,l,u]),y=Re(_.objects,[u,a,l])):u?(y=Re(_.objects,[u,a,l]))&&(d=Re(_.subjects,[a,l,u]),h=Re(_.predicates,[l,u,a])):(d=Re(_.subjects,[a,l,u]))&&(h=Re(_.predicates,[l,u,a]),y=Re(_.objects,[u,a,l])),d&&(o._graphs[c]={subjects:d,predicates:h,objects:y}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Ds]&&(this[Ds]=this[Symbol.iterator]());let r=this[Ds];for(;--e>=0;){let{done:n,value:i}=r.next();if(n){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,n,i){return this.filtered.deleteMatches(e,r,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,n,i,s){return this.filtered.every(e,r,n,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,r,n,i,s){return this.filtered.forEach(e,r,n,i,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,r,n,i,s){return this.filtered.some(e,r,n,i,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(e,r)}toString(){return new _e().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,n,i){return new t(this.filtered,e,r,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}};var Dr=class{dataset(e){return new tt(e)}};function pf(t){let e=[];for(let{subject:r,object:n}of t.match(null,te.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,te.defaultGraph())){let i=[...t.match(null,null,null,r)],s=[...t.match(null,null,null,n)];e.push({premise:i,conclusion:s})}return e}var Ur=class{constructor(e){this._store=e}_add(e,r,n,i,s){this._store._addToIndex(i.subjects,e,r,n)&&(this._store._addToIndex(i.predicates,r,n,e),this._store._addToIndex(i.objects,n,e,r),s())}_evaluatePremise(e,r,n,i=0){let s,o,a,l,u,[f,c,d]=e.premise[i].value,h=r[e.premise[i].content],y=!(a=f.value);for(a in y?h:{[a]:h[a]})if(l=h[a]){y&&(f.value=Number(a)),s=!(a=c.value);for(a in s?l:{[a]:l[a]})if(u=l[a]){s&&(c.value=Number(a)),o=!(a=d.value);for(a in o?u:{[a]:u[a]})o&&(d.value=Number(a)),i===e.premise.length-1?e.conclusion.forEach(_=>{this._add(_.subject.value,_.predicate.value,_.object.value,r,()=>{n(_)})}):this._evaluatePremise(e,r,n,i+1);o&&(d.value=null)}s&&(c.value=null)}y&&(f.value=null)}_evaluateRules(e,r,n){for(let i=0;i<e.length;i++)this._evaluatePremise(e[i],r,n)}_reasonGraphNaive(e,r){let n=[];function i(a){a.next&&a.next.forEach(l=>{n.push([a.subject.value,a.predicate.value,a.object.value,l])})}let s=a=>{a.forEach(l=>{this._add(l.subject.value,l.predicate.value,l.object.value,r,()=>{i(l)})})};this._evaluateRules(e,r,i);let o;for(;(o=n.pop())!==void 0;){let[a,l,u,f]=o,c=f.basePremise.subject.value;c||(f.basePremise.subject.value=a);let d=f.basePremise.predicate.value;d||(f.basePremise.predicate.value=l);let h=f.basePremise.object.value;h||(f.basePremise.object.value=u),f.premise.length===0?s(f.conclusion):this._evaluatePremise(f,r,i),c||(f.basePremise.subject.value=null),d||(f.basePremise.predicate.value=null),h||(f.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let n={},i=o=>o.termType==="Variable"?n[o.value]=n[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:i(o.subject),predicate:i(o.predicate),object:i(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(n)}}reason(e){Array.isArray(e)||(e=pf(e)),e=e.map(n=>this._createRule(n));for(let n of e)for(let i of e)for(let s=0;s<i.premise.length;s++){let o=i.premise[s];for(let a of n.conclusion){if($s(o.subject,a.subject)&&$s(o.predicate,a.predicate)&&$s(o.object,a.object)){let l=new Set,u=[];o.subject.value=o.subject.value||1,o.object.value=o.object.value||1,o.predicate.value=o.predicate.value||1;for(let f=0;f<i.premise.length;f++)f!==s&&u.push(hf(i.premise[f],l));(a.next=a.next||[]).push({premise:u,conclusion:i.conclusion,basePremise:o})}i.variables.forEach(l=>{l.value=null})}}for(let n of e){let i=new Set;n.premise=n.premise.map(s=>hf(s,i))}let r=this._store._getGraphs();for(let n in r)this._reasonGraphNaive(e,r[n]);this._store._size=null}};function hf({subject:t,predicate:e,object:r},n){let i=t.value||n.has(t)||(n.add(t),!1),s=e.value||n.has(e)||(n.add(e),!1),o=r.value||n.has(r)||(n.add(r),!1);return!i&&s?{content:"predicates",value:[e,r,t]}:o?{content:"objects",value:[r,t,e]}:{content:"subjects",value:[t,e,r]}}function $s(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var _f=zr(qn());var $r=class extends _f.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let r=new Pe(e),n,i,s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)}};e&&e.comments&&(s.onComment=o=>{this.emit("comment",o)}),r.parse({on:(o,a)=>{switch(o){case"data":n=a;break;case"end":i=a;break}}},s),this._transform=(o,a,l)=>{n(o),l()},this._flush=o=>{i(),o()}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),this}};var yf=zr(qn());var qr=class extends yf.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});let r=this._writer=new _e({write:(n,i,s)=>{this.push(n),s&&s()},end:n=>{this.push(null),n&&n()}},e);this._transform=(n,i,s)=>{r.addQuad(n,s)},this._flush=n=>{r.end(n)}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),e.on("prefix",(r,n)=>{this._writer.addPrefix(r,n)}),this}};var Wn={Lexer:ht,Parser:Pe,Writer:_e,Store:tt,StoreFactory:Dr,EntityIndex:Mr,StreamParser:$r,StreamWriter:qr,Util:Si,Reasoner:Ur,BaseIRI:yt,DataFactory:te,Term:ee,NamedNode:Ut,Literal:je,BlankNode:gr,Variable:wr,DefaultGraph:xr,Quad:Qe,Triple:Qe,termFromId:Ke,termToId:Ne};var kb=(t,e,r)=>{let n=new Wn.Parser({baseIRI:e,blankNodePrefix:"",format:r}),i=Object.create(null);return{quads:n.parse(t,null,(o,a)=>{i[o]=a.id}),prefixes:i}},jb=t=>new Promise((e,r)=>{let n=new Wn.Writer({format:t.type,prefixes:{...t.prefixes}}),i=t.prefixes.xsd,{quad:s,namedNode:o,literal:a,blankNode:l}=Wn.DataFactory,u=(b,g)=>{let S=g.a;if(Array.isArray(S)||(S=[S]),S?.length)for(let w of S)w=t.fullURI(w),n.addQuad(s(o(b),o(tn),o(w)))},f=(b,g)=>{if(!g)return;let S=c(g);for(let w of S)if(!(w.predicate.id=="id"||w.predicate.id=="a")){Array.isArray(w.object)||(w.object=[w.object]);for(let T of w.object)n.addQuad(s(o(b),w.predicate,T))}},c=b=>{let g=[];return Object.entries(b).forEach(S=>{let w=S[0],T=S[1],Ae=t.fullURI(w),U={predicate:o(Ae)};T instanceof ut?U.object=y(T):Array.isArray(T)?U.object=x(T):T instanceof lt?U.object=o(T.id):T instanceof He?U.object=_(T):h(T)?U.object=d(T):console.log("oldm-ns: encountered unknown object",T,w),g.push(U)}),g},d=b=>{let g=t.getType(b)||void 0;if(g)g==i+t.context.separator+"string"||g==i+t.context.separator+"number"?g=void 0:g=t.fullURI(g),g=o(g);else{let S=b?.language;S&&(g=S)}return b instanceof String?b=""+b:b instanceof Number&&(b=+b),a(b,g)},h=b=>b instanceof String||b instanceof Number||typeof b=="boolean"||typeof b=="string"||typeof b=="number",y=b=>{let g=[];for(let S of b)h(S)?g.push(d(S)):S.id?g.push(o(S.id)):g.push(_(S));return n.list(g)},_=b=>n.blank(c(b)),x=(b,g)=>{let S=[];for(let w of g)h(w)?S.push(d(w)):w instanceof lt?S.push(o(w.id)):w instanceof He?S.push(_(w)):w instanceof ut&&S.push(y(w));return S};Object.entries(t.subjects).forEach(([b,g])=>{b=t.shortURI(b,":"),u(b,g),f(b,g)}),n.end((b,g)=>{g?e(g):r(b)})});var bf={context:en,...ui,...qs};globalThis.oldm=bf;var zn=bf;function Ie(t){return[String,Boolean,Number,BigInt].includes(t?.constructor)}function Ws(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push(i=>r=="_"?n(i,r,"select"):{[r]:n(i,r,"select")}):Ie(n)?e.push(()=>r=="_"?n:{[r]:n}):e.push(i=>r=="_"?or(i[r]).select(n):{[r]:or(i[r]).select(n)});return e.length==1?e[0]:r=>{let n={};for(let i of e)Object.assign(n,i(r));return n}}function zs(t){let e=[];if(Array.isArray(t))e.push(Lb(...t));else if(t instanceof RegExp)e.push(r=>t.test(r));else if(t instanceof Function)e.push(r=>t(r));else if(Ie(t))e.push(r=>Array.isArray(r)?r.filter(n=>t==n).length>0:t==r);else{let r={};for(let[i,s]of Object.entries(t))r[i]=zs(s);let n=i=>{if(Array.isArray(i))return i.filter(s=>n(s)).length>0;if(Ie(i))return!1;for(let s in r){let o=r[s];if(!o(i?.[s]))return!1}return!0};e.push(n)}return e.length==1?e[0]:r=>{for(let n of e)if(!n(r))return!1;return!0}}var Nb=Symbol("asc"),Pb=Symbol("desc");function mf(t){let e=Object.entries(t),r=[];for(let[n,i]of e)if(i instanceof Function)r.push(i);else if(i===Nb)r.push((s,o)=>s[n]>o[n]?1:s[n]<o[n]?-1:0);else if(i===Pb)r.push((s,o)=>s[n]<o[n]?1:s[n]>o[n]?-1:0);else{if(Ie(i))throw new Error("Unknown sort order",i);{let s=mf(i);r.push((o,a)=>s(o[n],a[n]))}}return r.length==1?r[0]:(n,i)=>{for(let s of r){let o=s(n,i);if(o!==0)return o}return 0}}function gf(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push((i,s,o,a)=>(Ie(i)&&(i={}),s.reduce?i[r]=s.reduce(n,i[r]||[]):i[r]=n(i[r]||[],s,o,a),i)):Ie(n)?e.push(i=>(Ie(i)&&(i={}),i[r]=n,i)):e.push((i,s)=>(Ie(i)&&(i={}),i[r]=or(s[r]).reduce(n,[]),i));return e.length==1?e[0]:(r,n,i,s)=>{let o={};for(let a of e)Object.assign(o,a(r,n,i,s));return o}}function Ob(t,e){let r={};for(let n of t){let i=e(n);Array.isArray(i)||(i=[i]);for(let s of i){if(typeof s!="string"&&!(s instanceof String)){console.warn("JAQT: groupBy(selector) can only handle string values, got:",s);continue}r[s]||(r[s]=[]),r[s].push(n)}}return r}function wf(t,e){let r=e.shift();if(typeof r=="string"&&(r=Cb[r]),typeof r!="function")throw new Error("groupBy parameters must be either a property name or a pointer function (e.g.: _.name)");let n=Ob(t,r);if(e.length)for(let i in n)n[i]=wf(n[i],e);return n}function Lb(...t){let e=t.map(r=>zs(r));return r=>e.some(n=>n(r))}var Bb={apply(t,e,r){let n=t.apply(e,r);return typeof n=="object"?new Proxy(n,De):n}},De={get(t,e){let r=null;if(typeof e=="symbol"&&(r=t[e]),Array.isArray(t))switch(e){case"where":r=function(n){let i=zs(n);return new Proxy(t.filter(s=>i(s)),De)};break;case"select":r=function(n){let i=Ws(n);return new Proxy(t.map(i),De)};break;case"reduce":r=function(n,i=[]){let s=gf(n),o=t.reduce(s,i);return Array.isArray(o)?new Proxy(o,De):Ie(o)?o:new Proxy(o,Wr)};break;case"orderBy":r=function(n){let i=mf(n);return new Proxy(t.toSorted(i),De)};break;case"groupBy":r=function(...n){let i=wf(t,n);return new Proxy(i,Wr)};break}return!r&&t&&typeof t=="object"&&e==="select"&&(r=function(n){let i=Ws(n);return new Proxy(i(t),De)}),!r&&t&&typeof t[e]=="function"&&(r=new Proxy(t[e],Bb)),r||(r=t[e]),r}},Wr={get(t,e){let r=null;switch(e){case"select":r=function(n){let i=Ws(n),s={};for(let o in t)Array.isArray(t[o])?s[o]=new Proxy(t[o].map(i),De):s[o]=new Proxy(t[o],Wr);return s};break;case"reduce":r=function(n,i=[]){let s=gf(n),o={};for(let a in t)if(Array.isArray(t[a])){let l=t[a].reduce(s,i);Array.isArray(l)?o[a]=new Proxy(l,De):Ie(l)?o[a]=l:o[a]=new Proxy(l,Wr)}else o[a]=new Proxy(t[a],Wr);return o};break;default:Array.isArray(t[e])?r=or(t[e]):r=t[e];break}return r}},Gn={get(t,e){let r=null;switch(e){case"where":r=function(){return new Proxy(new sr,Gn)};break;case"reduce":case"select":r=function(){return null};break;case"orderBy":r=function(){return new Proxy(new sr,Gn)};break;case"groupBy":r=function(){return new Proxy(new sr,Gn)};break}return!r&&typeof t?.[e]=="function"&&(r=t[e]),r}},sr=class{toJSON(){return null}};function or(t){return!t||typeof t!="object"?new Proxy(new sr,Gn):new Proxy(t,De)}function Gs(t){return(e,r)=>{if(t?.length>0){let n=t.slice(),i=n.shift();for(;i;){if(Array.isArray(e)&&parseInt(i)!=i)return n.unshift(i),e.map(Gs(n));typeof e?.[i]<"u"?e=e[i]:e=null,i=n.shift()}return e}else return r&&r!=="_"?typeof e?.[r]<"u"?e[r]:null:e}}var xf=t=>(t||(t=[]),{get(e,r){if(r=="constructor"||typeof r=="symbol")return e[r];let n=t.concat([r]);return new Proxy(Gs(n),xf(n))},apply(e,r,n){let i=e(...n);return Array.isArray(i)&&(i=i.flat(1/0)),i}}),Cb=new Proxy(Gs(),xf());function Hn(t){t=Object.assign({contentType:"text/turtle",prefixes:{ldp:"http://www.w3.org/ns/ldp#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dct:"http://purl.org/dc/terms/",stat:"http://www.w3.org/ns/posix/stat#",turtle:"http://www.w3.org/ns/iana/media-types/text/turtle#",schem:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",pims:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:zn.n3Parser,writer:zn.n3Writer},t),t.prefixes.ldp||(t.prefixes.ldp="http://www.w3.org/ns/ldp#");let e=zn.context(t);return async function(n,i){if(n.headers.get("Accept")||(n=n.with({headers:{Accept:t.accept??t.contentType}})),n.method!=="GET"&&n.method!=="HEAD"&&n.data&&typeof n.data=="object"&&!(n.data instanceof ReadableStream)){let o=n.headers.get("Content-Type");(!o||isPlainText(o))&&(n=n.with({headers:{"Content-Type":t.contentType}})),Sf(n.headers.get("Content-Type"))&&(n=n.with({body:await e.writer(n.data)}))}let s=await i(n);if(s&&Sf(s.headers?.get("Content-Type"))){let a=await s.clone().text();try{let l=e.parse(a,n.url,s.headers.get("Content-Type"));return s.with({body:l})}catch{}}return s}}var Fb=[/^text\/turtle\b/,/^application\/n-quads\b/,/^text\/x-nquads\b/,/^appliction\/n-triples\b/,/^application\/trig\b/];function Sf(t){for(let e of Fb)if(e.exec(t))return!0;return!1}globalThis.oldmmw=Hn;var Ef=Hn;var rt=class extends ot{#e;#t;constructor(e,r="/",n={}){e=re(e).with(bo.oidcmw(n)).with(Ef(n)),r=E.collapse(r),super(e,r),this.#e=e,this.#t=r}get name(){return"SolidAdapter"}supportsDirectories(){return!0}async read(e){let r=await this.#e.get(E.collapse(e,this.#t)),n={type:this.getMimetype(r),name:E.filename(e),http:{headers:r.headers,status:r.status,url:r.url}};return r.data&&(n.data=r.data),n.type.match(/text\/.*/)?n.contents=await r.text():n.type.match(/application\/json.*/)?n.contents=await r.json():n.contents=await r.blob(),n}async list(e){let r=await this.read(e);if(r.data){if(!r.data.primary?.ldp$contains)throw new Error(e+" could not find ldp container",{cause:r});return or(r.data.primary.ldp$contains).where({a:"ldp$Resource"}).select({filename:n=>jsfs.path.filename(metro.url(n.id).pathname),path:n=>metro.url(n.id).pathname,type:n=>n.a.includes("ldp$Container")?"folder":"file"})}else throw new Error(e+" could not be parsed",{cause:r})}async mkdir(e){this.#e.put(E.collapse(e,this.#t))}async rmdir(e){this.#e.delete(E.collapse(e,this.#t))}};async function Vn(t,e){let r={prefixes:{ldp:"http://www.w3.org/ns/ldp#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dct:"http://purl.org/dc/terms/",stat:"http://www.w3.org/ns/posix/stat#",turtle:"http://www.w3.org/ns/iana/media-types/text/turtle#",schema:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",space:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:oldm.n3Parser,writer:oldm.n3Writer},n=Object.assign({},r,e);for(let a in r.prefixes)n.prefixes[a]||(n.prefixes[a]=r.prefixes[a]);let s=(await metro.client(oldmmw(n),metro.mw.getdata()).get(t))?.primary;if(!s||!s.solid$oidcIssuer)throw new Error("solidClient: "+t+" did not return valid solid profile");n.issuer=s.solid$oidcIssuer;let o=oldm.many(s.space$storage).map(a=>new jsfs.fs(new rt(a,"/",n)));return metro.api(metro.client(metro.oidc.oidcmw(n),oldmmw(n)),{profile:s,issuer:s.solid$oidcIssuer,inbox:s.ldp$inbox,id:function(){return metro.oidc.idToken(this.issuer)},logout:async function(){throw new Error("not yet implemented")},...o})}var c0={adapter:rt,client:Vn};globalThis.solidClient=Vn;globalThis.SolidAdapter=rt;})();
|
|
22
|
+
`),this._subject=null),this._write=this._blockedWrite;let r=e&&((n,i)=>{r=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(r)}catch{}r&&r()}};function ea(t){let e=td[t];return e===void 0&&(t.length===1?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((t.charCodeAt(0)-55296)*1024+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var Us=zr(qn());var Ds=Symbol("iter");function Fr(t,e,r=4){if(r===0)return Object.assign(t,e);for(let n in e)t[n]=Fr(t[n]||Object.create(null),e[n],r-1);return t}function cf(t,e,r=4){let n=!1;for(let i in t)if(i in e){let s=r===0?null:cf(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}function df(t,e,r=4){let n=!1;for(let i in t)if(!(i in e))n=n||Object.create(null),n[i]=r===0?null:Fr({},t[i],r-1);else if(r!==0){let s=df(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}var Mr=class{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=e.factory||te}_termFromId(e){if(e[0]==="."){let r=this._entities,n=e.split(".");return this._factory.quad(this._termFromId(r[n[1]]),this._termFromId(r[n[2]]),this._termFromId(r[n[3]]),n[4]&&this._termFromId(r[n[4]]))}return Ke(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){let r=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object),s;return r&&n&&i&&(_t(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${n}.${i}.${s}`:`.${r}.${n}.${i}`]}return this._ids[Ne(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${_t(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Ne(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,n;if(e)for(r=e=`_:${e}`,n=1;this._ids[r];)r=e+n++;else do r=`_:b${this._blankNodeIndex++}`;while(this._ids[r]);return this._ids[r]=++this._id,this._entities[this._id]=r,this._factory.blankNode(r.substr(2))}},tt=class t{constructor(e,r){this._size=0,this._graphs=Object.create(null),!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||te,this._entityIndex=r.entityIndex||new Mr({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;let r=this._graphs,n,i;for(let s in r)for(let o in n=r[s].subjects)for(let a in i=n[o])e+=Object.keys(i[a]).length;return this._size=e}_addToIndex(e,r,n,i){let s=e[r]||(e[r]={}),o=s[n]||(s[n]={}),a=i in o;return a||(o[i]=null),!a}_removeFromIndex(e,r,n,i){let s=e[r],o=s[n];delete o[i];for(let a in o)return;delete s[n];for(let a in s)return;delete e[r]}*_findInIndex(e,r,n,i,s,o,a,l){let u,f,c,d=this._entities,h=this._termFromId(d[l]),y={subject:null,predicate:null,object:null};r&&((u=e,e={})[r]=u[r]);for(let _ in e)if(f=e[_]){y[s]=this._termFromId(d[_]),n&&((u=f,f={})[n]=u[n]);for(let x in f)if(c=f[x]){y[o]=this._termFromId(d[x]);let b=i?i in c?[i]:[]:Object.keys(c);for(let g=0;g<b.length;g++)y[a]=this._termFromId(d[b[g]]),yield this._factory.quad(y.subject,y.predicate,y.object,h)}}}_loop(e,r){for(let n in e)r(n)}_loopByKey0(e,r,n){let i,s;if(i=e[r])for(s in i)n(s)}_loopByKey1(e,r,n){let i,s;for(i in e)s=e[i],s[r]&&n(i)}_loopBy2Keys(e,r,n,i){let s,o,a;if((s=e[r])&&(o=s[n]))for(a in o)i(a)}_countInIndex(e,r,n,i){let s=0,o,a,l;r&&((o=e,e={})[r]=o[r]);for(let u in e)if(a=e[u]){n&&((o=a,a={})[n]=o[n]);for(let f in a)(l=a[f])&&(i?i in l&&s++:s+=Object.keys(l).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){let r=Object.create(null);return n=>{n in r||(r[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,n,i){r||(i=e.graph,n=e.object,r=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,r,n)?(this._addToIndex(s.predicates,r,n,e),this._addToIndex(s.objects,n,e,r),this._size=null,!0):!1}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}delete(e){return this.removeQuad(e),this}has(e,r,n,i){return e&&e.subject&&({subject:e,predicate:r,object:n,graph:i}=e),!this.readQuads(e,r,n,i).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,n,i){r||({subject:e,predicate:r,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;let s=this._graphs,o,a,l;if(!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(n=n&&this._termToNumericId(n))||!(o=s[i])||!(a=o.subjects[e])||!(l=a[r])||!(n in l))return!1;this._removeFromIndex(o.subjects,e,r,n),this._removeFromIndex(o.predicates,r,n,e),this._removeFromIndex(o.objects,n,e,r),this._size!==null&&this._size--;for(e in o.subjects)return!0;return delete s[i],!0}removeQuads(e){for(let r=0;r<e.length;r++)this.removeQuad(e[r])}remove(e){return e.on("data",r=>{this.removeQuad(r)}),e}removeMatches(e,r,n,i){let s=new Us.Readable({objectMode:!0}),o=this.readQuads(e,r,n,i);return s._read=a=>{for(;--a>=0;){let{done:l,value:u}=o.next();if(l){s.push(null);return}s.push(u)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,r,n,i){return[...this.readQuads(e,r,n,i)]}*readQuads(e,r,n,i){let s=this._getGraphs(i),o,a,l,u;if(!(e&&!(a=this._termToNumericId(e))||r&&!(l=this._termToNumericId(r))||n&&!(u=this._termToNumericId(n))))for(let f in s)(o=s[f])&&(a?u?yield*this._findInIndex(o.objects,u,a,l,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",f):l?yield*this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",f):u?yield*this._findInIndex(o.objects,u,null,null,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",f))}match(e,r,n,i){return new et(this,e,r,n,i,{entityIndex:this._entityIndex})}countQuads(e,r,n,i){let s=this._getGraphs(i),o=0,a,l,u,f;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||n&&!(f=this._termToNumericId(n)))return 0;for(let c in s)(a=s[c])&&(e?n?o+=this._countInIndex(a.objects,f,l,u):o+=this._countInIndex(a.subjects,l,u,f):r?o+=this._countInIndex(a.predicates,u,f,l):o+=this._countInIndex(a.objects,f,l,u));return o}forEach(e,r,n,i,s){this.some(o=>(e(o,this),!1),r,n,i,s)}every(e,r,n,i,s){return!this.some(o=>!e(o,this),r,n,i,s)}some(e,r,n,i,s){for(let o of this.readQuads(r,n,i,s))if(e(o,this))return!0;return!1}getSubjects(e,r,n){let i=[];return this.forSubjects(s=>{i.push(s)},e,r,n),i}forSubjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(a?l?this._loopBy2Keys(o.predicates,a,l,e):this._loopByKey1(o.subjects,a,e):l?this._loopByKey0(o.objects,l,e):this._loop(o.subjects,e))}getPredicates(e,r,n){let i=[];return this.forPredicates(s=>{i.push(s)},e,r,n),i}forPredicates(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(a?l?this._loopBy2Keys(o.objects,l,a,e):this._loopByKey0(o.subjects,a,e):l?this._loopByKey1(o.predicates,l,e):this._loop(o.predicates,e))}getObjects(e,r,n){let i=[];return this.forObjects(s=>{i.push(s)},e,r,n),i}forObjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(a?l?this._loopBy2Keys(o.subjects,a,l,e):this._loopByKey1(o.objects,a,e):l?this._loopByKey0(o.predicates,l,e):this._loop(o.objects,e))}getGraphs(e,r,n){let i=[];return this.forGraphs(s=>{i.push(s)},e,r,n),i}forGraphs(e,r,n,i){for(let s in this._graphs)this.some(o=>(e(o.graph),!0),r,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1}={}){let n={},i=r?()=>!0:(a,l)=>{throw new Error(`${a.value} ${l}`)},s=this.getQuads(null,O.rdf.rest,O.rdf.nil,null),o=e?[...s]:[];return s.forEach(a=>{let l=[],u=!1,f,c,d=a.graph,h=a.subject;for(;h&&!u;){let y=this.getQuads(null,null,h,null),_=this.getQuads(h,null,null,null),x,b=null,g=null,S=null;for(let w=0;w<_.length&&!u;w++)x=_[w],x.graph.equals(d)?f?u=i(h,"has non-list arcs out"):x.predicate.value===O.rdf.first?b?u=i(h,"has multiple rdf:first arcs"):o.push(b=x):x.predicate.value===O.rdf.rest?g?u=i(h,"has multiple rdf:rest arcs"):o.push(g=x):y.length?u=i(h,"can't be subject and object"):(f=x,c="subject"):u=i(h,"not confined to single graph");for(let w=0;w<y.length&&!u;++w)x=y[w],f?u=i(h,"can't have coreferences"):x.predicate.value===O.rdf.rest?S?u=i(h,"has incoming rdf:rest arcs"):S=x:(f=x,c="object");b?l.unshift(b.object):u=i(h,"has no list head"),h=S&&S.subject}u?e=!1:f&&(n[f[c].value]=l)}),e&&this.removeQuads(o),n}addAll(e){if(e instanceof et&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Fr(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof et&&(e=e.filtered),e===this)return!0;if(!(e instanceof t)||this._entityIndex!==e._entityIndex)return e.every(u=>this.has(u));let r=this._graphs,n=e._graphs,i,s,o,a,l;for(let u in n){if(!(i=r[u]))return!1;i=i.subjects;for(let f in s=n[u].subjects){if(!(o=i[f]))return!1;for(let c in a=s[f]){if(!(l=o[c]))return!1;for(let d in a[c])if(!(d in l))return!1}}}return!0}deleteMatches(e,r,n,i){for(let s of this.match(e,r,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof et&&(e=e.filtered),e===this)return new t({entityIndex:this._entityIndex});if(e instanceof t&&e._entityIndex===this._entityIndex){let r=new t({entityIndex:this._entityIndex}),n=df(this._graphs,e._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof et&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)e(n,this)&&r.add(n);return r}intersection(e){if(e instanceof et&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Fr(Object.create(null),this._graphs),r._size=this._size,r}else if(e instanceof t&&this._entityIndex===e._entityIndex){let r=new t({entityIndex:this._entityIndex}),n=cf(e._graphs,this._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>e.has(r))}map(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)r.add(e(n,this));return r}reduce(e,r){let n=this.readQuads(),i=r===void 0?n.next().value:r;for(let s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new _e().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Fr(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}*[Symbol.iterator](){yield*this.readQuads()}};function Re(t,e,r=0){let n=e[r];if(n&&!(n in t))return!1;let i=!1;for(let s in n?{[n]:t[n]}:t){let o=r===2?null:Re(t[s],e,r+1);o!==!1&&(i=i||Object.create(null),i[s]=o)}return i}var et=class t extends Us.Readable{constructor(e,r,n,i,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:n,object:i,graph:s,options:o})}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:n,predicate:i,subject:s}=this,o=this._filtered=new tt({factory:e._factory,entityIndex:this.options.entityIndex}),a,l,u;if(s&&!(a=o._termToNumericId(s))||i&&!(l=o._termToNumericId(i))||n&&!(u=o._termToNumericId(n)))return o;let f=e._getGraphs(r);for(let c in f){let d,h,y,_;(_=f[c])&&(!a&&l?(h=Re(_.predicates,[l,u,a]))&&(d=Re(_.subjects,[a,l,u]),y=Re(_.objects,[u,a,l])):u?(y=Re(_.objects,[u,a,l]))&&(d=Re(_.subjects,[a,l,u]),h=Re(_.predicates,[l,u,a])):(d=Re(_.subjects,[a,l,u]))&&(h=Re(_.predicates,[l,u,a]),y=Re(_.objects,[u,a,l])),d&&(o._graphs[c]={subjects:d,predicates:h,objects:y}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Ds]&&(this[Ds]=this[Symbol.iterator]());let r=this[Ds];for(;--e>=0;){let{done:n,value:i}=r.next();if(n){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,n,i){return this.filtered.deleteMatches(e,r,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,n,i,s){return this.filtered.every(e,r,n,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,r,n,i,s){return this.filtered.forEach(e,r,n,i,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,r,n,i,s){return this.filtered.some(e,r,n,i,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(e,r)}toString(){return new _e().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,n,i){return new t(this.filtered,e,r,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}};var Dr=class{dataset(e){return new tt(e)}};function pf(t){let e=[];for(let{subject:r,object:n}of t.match(null,te.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,te.defaultGraph())){let i=[...t.match(null,null,null,r)],s=[...t.match(null,null,null,n)];e.push({premise:i,conclusion:s})}return e}var Ur=class{constructor(e){this._store=e}_add(e,r,n,i,s){this._store._addToIndex(i.subjects,e,r,n)&&(this._store._addToIndex(i.predicates,r,n,e),this._store._addToIndex(i.objects,n,e,r),s())}_evaluatePremise(e,r,n,i=0){let s,o,a,l,u,[f,c,d]=e.premise[i].value,h=r[e.premise[i].content],y=!(a=f.value);for(a in y?h:{[a]:h[a]})if(l=h[a]){y&&(f.value=Number(a)),s=!(a=c.value);for(a in s?l:{[a]:l[a]})if(u=l[a]){s&&(c.value=Number(a)),o=!(a=d.value);for(a in o?u:{[a]:u[a]})o&&(d.value=Number(a)),i===e.premise.length-1?e.conclusion.forEach(_=>{this._add(_.subject.value,_.predicate.value,_.object.value,r,()=>{n(_)})}):this._evaluatePremise(e,r,n,i+1);o&&(d.value=null)}s&&(c.value=null)}y&&(f.value=null)}_evaluateRules(e,r,n){for(let i=0;i<e.length;i++)this._evaluatePremise(e[i],r,n)}_reasonGraphNaive(e,r){let n=[];function i(a){a.next&&a.next.forEach(l=>{n.push([a.subject.value,a.predicate.value,a.object.value,l])})}let s=a=>{a.forEach(l=>{this._add(l.subject.value,l.predicate.value,l.object.value,r,()=>{i(l)})})};this._evaluateRules(e,r,i);let o;for(;(o=n.pop())!==void 0;){let[a,l,u,f]=o,c=f.basePremise.subject.value;c||(f.basePremise.subject.value=a);let d=f.basePremise.predicate.value;d||(f.basePremise.predicate.value=l);let h=f.basePremise.object.value;h||(f.basePremise.object.value=u),f.premise.length===0?s(f.conclusion):this._evaluatePremise(f,r,i),c||(f.basePremise.subject.value=null),d||(f.basePremise.predicate.value=null),h||(f.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let n={},i=o=>o.termType==="Variable"?n[o.value]=n[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:i(o.subject),predicate:i(o.predicate),object:i(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(n)}}reason(e){Array.isArray(e)||(e=pf(e)),e=e.map(n=>this._createRule(n));for(let n of e)for(let i of e)for(let s=0;s<i.premise.length;s++){let o=i.premise[s];for(let a of n.conclusion){if($s(o.subject,a.subject)&&$s(o.predicate,a.predicate)&&$s(o.object,a.object)){let l=new Set,u=[];o.subject.value=o.subject.value||1,o.object.value=o.object.value||1,o.predicate.value=o.predicate.value||1;for(let f=0;f<i.premise.length;f++)f!==s&&u.push(hf(i.premise[f],l));(a.next=a.next||[]).push({premise:u,conclusion:i.conclusion,basePremise:o})}i.variables.forEach(l=>{l.value=null})}}for(let n of e){let i=new Set;n.premise=n.premise.map(s=>hf(s,i))}let r=this._store._getGraphs();for(let n in r)this._reasonGraphNaive(e,r[n]);this._store._size=null}};function hf({subject:t,predicate:e,object:r},n){let i=t.value||n.has(t)||(n.add(t),!1),s=e.value||n.has(e)||(n.add(e),!1),o=r.value||n.has(r)||(n.add(r),!1);return!i&&s?{content:"predicates",value:[e,r,t]}:o?{content:"objects",value:[r,t,e]}:{content:"subjects",value:[t,e,r]}}function $s(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var _f=zr(qn());var $r=class extends _f.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let r=new Pe(e),n,i,s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)}};e&&e.comments&&(s.onComment=o=>{this.emit("comment",o)}),r.parse({on:(o,a)=>{switch(o){case"data":n=a;break;case"end":i=a;break}}},s),this._transform=(o,a,l)=>{n(o),l()},this._flush=o=>{i(),o()}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),this}};var yf=zr(qn());var qr=class extends yf.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});let r=this._writer=new _e({write:(n,i,s)=>{this.push(n),s&&s()},end:n=>{this.push(null),n&&n()}},e);this._transform=(n,i,s)=>{r.addQuad(n,s)},this._flush=n=>{r.end(n)}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),e.on("prefix",(r,n)=>{this._writer.addPrefix(r,n)}),this}};var Wn={Lexer:ht,Parser:Pe,Writer:_e,Store:tt,StoreFactory:Dr,EntityIndex:Mr,StreamParser:$r,StreamWriter:qr,Util:Si,Reasoner:Ur,BaseIRI:yt,DataFactory:te,Term:ee,NamedNode:Ut,Literal:je,BlankNode:gr,Variable:wr,DefaultGraph:xr,Quad:Qe,Triple:Qe,termFromId:Ke,termToId:Ne};var kb=(t,e,r)=>{let n=new Wn.Parser({baseIRI:e,blankNodePrefix:"",format:r}),i=Object.create(null);return{quads:n.parse(t,null,(o,a)=>{i[o]=a.id}),prefixes:i}},jb=t=>new Promise((e,r)=>{let n=new Wn.Writer({format:t.type,prefixes:{...t.prefixes}}),i=t.prefixes.xsd,{quad:s,namedNode:o,literal:a,blankNode:l}=Wn.DataFactory,u=(b,g)=>{let S=g.a;if(Array.isArray(S)||(S=[S]),S?.length)for(let w of S)w=t.fullURI(w),n.addQuad(s(o(b),o(tn),o(w)))},f=(b,g)=>{if(!g)return;let S=c(g);for(let w of S)if(!(w.predicate.id=="id"||w.predicate.id=="a")){Array.isArray(w.object)||(w.object=[w.object]);for(let T of w.object)n.addQuad(s(o(b),w.predicate,T))}},c=b=>{let g=[];return Object.entries(b).forEach(S=>{let w=S[0],T=S[1],Ae=t.fullURI(w),U={predicate:o(Ae)};T instanceof ut?U.object=y(T):Array.isArray(T)?U.object=x(T):T instanceof lt?U.object=o(T.id):T instanceof He?U.object=_(T):h(T)?U.object=d(T):console.log("oldm-ns: encountered unknown object",T,w),g.push(U)}),g},d=b=>{let g=t.getType(b)||void 0;if(g)g==i+t.context.separator+"string"||g==i+t.context.separator+"number"?g=void 0:g=t.fullURI(g),g=o(g);else{let S=b?.language;S&&(g=S)}return b instanceof String?b=""+b:b instanceof Number&&(b=+b),a(b,g)},h=b=>b instanceof String||b instanceof Number||typeof b=="boolean"||typeof b=="string"||typeof b=="number",y=b=>{let g=[];for(let S of b)h(S)?g.push(d(S)):S.id?g.push(o(S.id)):g.push(_(S));return n.list(g)},_=b=>n.blank(c(b)),x=(b,g)=>{let S=[];for(let w of g)h(w)?S.push(d(w)):w instanceof lt?S.push(o(w.id)):w instanceof He?S.push(_(w)):w instanceof ut&&S.push(y(w));return S};Object.entries(t.subjects).forEach(([b,g])=>{b=t.shortURI(b,":"),u(b,g),f(b,g)}),n.end((b,g)=>{g?e(g):r(b)})});var bf={context:en,...ui,...qs};globalThis.oldm=bf;var zn=bf;function Ie(t){return[String,Boolean,Number,BigInt].includes(t?.constructor)}function Ws(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push(i=>r=="_"?n(i,r,"select"):{[r]:n(i,r,"select")}):Ie(n)?e.push(()=>r=="_"?n:{[r]:n}):e.push(i=>r=="_"?or(i[r]).select(n):{[r]:or(i[r]).select(n)});return e.length==1?e[0]:r=>{let n={};for(let i of e)Object.assign(n,i(r));return n}}function zs(t){let e=[];if(Array.isArray(t))e.push(Lb(...t));else if(t instanceof RegExp)e.push(r=>t.test(r));else if(t instanceof Function)e.push(r=>t(r));else if(Ie(t))e.push(r=>Array.isArray(r)?r.filter(n=>t==n).length>0:t==r);else{let r={};for(let[i,s]of Object.entries(t))r[i]=zs(s);let n=i=>{if(Array.isArray(i))return i.filter(s=>n(s)).length>0;if(Ie(i))return!1;for(let s in r){let o=r[s];if(!o(i?.[s]))return!1}return!0};e.push(n)}return e.length==1?e[0]:r=>{for(let n of e)if(!n(r))return!1;return!0}}var Nb=Symbol("asc"),Pb=Symbol("desc");function mf(t){let e=Object.entries(t),r=[];for(let[n,i]of e)if(i instanceof Function)r.push(i);else if(i===Nb)r.push((s,o)=>s[n]>o[n]?1:s[n]<o[n]?-1:0);else if(i===Pb)r.push((s,o)=>s[n]<o[n]?1:s[n]>o[n]?-1:0);else{if(Ie(i))throw new Error("Unknown sort order",i);{let s=mf(i);r.push((o,a)=>s(o[n],a[n]))}}return r.length==1?r[0]:(n,i)=>{for(let s of r){let o=s(n,i);if(o!==0)return o}return 0}}function gf(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push((i,s,o,a)=>(Ie(i)&&(i={}),s.reduce?i[r]=s.reduce(n,i[r]||[]):i[r]=n(i[r]||[],s,o,a),i)):Ie(n)?e.push(i=>(Ie(i)&&(i={}),i[r]=n,i)):e.push((i,s)=>(Ie(i)&&(i={}),i[r]=or(s[r]).reduce(n,[]),i));return e.length==1?e[0]:(r,n,i,s)=>{let o={};for(let a of e)Object.assign(o,a(r,n,i,s));return o}}function Ob(t,e){let r={};for(let n of t){let i=e(n);Array.isArray(i)||(i=[i]);for(let s of i){if(typeof s!="string"&&!(s instanceof String)){console.warn("JAQT: groupBy(selector) can only handle string values, got:",s);continue}r[s]||(r[s]=[]),r[s].push(n)}}return r}function wf(t,e){let r=e.shift();if(typeof r=="string"&&(r=Cb[r]),typeof r!="function")throw new Error("groupBy parameters must be either a property name or a pointer function (e.g.: _.name)");let n=Ob(t,r);if(e.length)for(let i in n)n[i]=wf(n[i],e);return n}function Lb(...t){let e=t.map(r=>zs(r));return r=>e.some(n=>n(r))}var Bb={apply(t,e,r){let n=t.apply(e,r);return typeof n=="object"?new Proxy(n,De):n}},De={get(t,e){let r=null;if(typeof e=="symbol"&&(r=t[e]),Array.isArray(t))switch(e){case"where":r=function(n){let i=zs(n);return new Proxy(t.filter(s=>i(s)),De)};break;case"select":r=function(n){let i=Ws(n);return new Proxy(t.map(i),De)};break;case"reduce":r=function(n,i=[]){let s=gf(n),o=t.reduce(s,i);return Array.isArray(o)?new Proxy(o,De):Ie(o)?o:new Proxy(o,Wr)};break;case"orderBy":r=function(n){let i=mf(n);return new Proxy(t.toSorted(i),De)};break;case"groupBy":r=function(...n){let i=wf(t,n);return new Proxy(i,Wr)};break}return!r&&t&&typeof t=="object"&&e==="select"&&(r=function(n){let i=Ws(n);return new Proxy(i(t),De)}),!r&&t&&typeof t[e]=="function"&&(r=new Proxy(t[e],Bb)),r||(r=t[e]),r}},Wr={get(t,e){let r=null;switch(e){case"select":r=function(n){let i=Ws(n),s={};for(let o in t)Array.isArray(t[o])?s[o]=new Proxy(t[o].map(i),De):s[o]=new Proxy(t[o],Wr);return s};break;case"reduce":r=function(n,i=[]){let s=gf(n),o={};for(let a in t)if(Array.isArray(t[a])){let l=t[a].reduce(s,i);Array.isArray(l)?o[a]=new Proxy(l,De):Ie(l)?o[a]=l:o[a]=new Proxy(l,Wr)}else o[a]=new Proxy(t[a],Wr);return o};break;default:Array.isArray(t[e])?r=or(t[e]):r=t[e];break}return r}},Gn={get(t,e){let r=null;switch(e){case"where":r=function(){return new Proxy(new sr,Gn)};break;case"reduce":case"select":r=function(){return null};break;case"orderBy":r=function(){return new Proxy(new sr,Gn)};break;case"groupBy":r=function(){return new Proxy(new sr,Gn)};break}return!r&&typeof t?.[e]=="function"&&(r=t[e]),r}},sr=class{toJSON(){return null}};function or(t){return!t||typeof t!="object"?new Proxy(new sr,Gn):new Proxy(t,De)}function Gs(t){return(e,r)=>{if(t?.length>0){let n=t.slice(),i=n.shift();for(;i;){if(Array.isArray(e)&&parseInt(i)!=i)return n.unshift(i),e.map(Gs(n));typeof e?.[i]<"u"?e=e[i]:e=null,i=n.shift()}return e}else return r&&r!=="_"?typeof e?.[r]<"u"?e[r]:null:e}}var xf=t=>(t||(t=[]),{get(e,r){if(r=="constructor"||typeof r=="symbol")return e[r];let n=t.concat([r]);return new Proxy(Gs(n),xf(n))},apply(e,r,n){let i=e(...n);return Array.isArray(i)&&(i=i.flat(1/0)),i}}),Cb=new Proxy(Gs(),xf());function Hn(t){t=Object.assign({contentType:"text/turtle",prefixes:{ldp:"http://www.w3.org/ns/ldp#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dct:"http://purl.org/dc/terms/",stat:"http://www.w3.org/ns/posix/stat#",turtle:"http://www.w3.org/ns/iana/media-types/text/turtle#",schem:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",pims:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:zn.n3Parser,writer:zn.n3Writer},t),t.prefixes.ldp||(t.prefixes.ldp="http://www.w3.org/ns/ldp#");let e=zn.context(t);return async function(n,i){if(n.headers.get("Accept")||(n=n.with({headers:{Accept:t.accept??t.contentType}})),n.method!=="GET"&&n.method!=="HEAD"&&n.data&&typeof n.data=="object"&&!(n.data instanceof ReadableStream)){let o=n.headers.get("Content-Type");(!o||isPlainText(o))&&(n=n.with({headers:{"Content-Type":t.contentType}})),Sf(n.headers.get("Content-Type"))&&(n=n.with({body:await e.writer(n.data)}))}let s=await i(n);if(s&&Sf(s.headers?.get("Content-Type"))){let a=await s.clone().text();try{let l=e.parse(a,n.url,s.headers.get("Content-Type"));return s.with({body:l})}catch{}}return s}}var Fb=[/^text\/turtle\b/,/^application\/n-quads\b/,/^text\/x-nquads\b/,/^appliction\/n-triples\b/,/^application\/trig\b/];function Sf(t){for(let e of Fb)if(e.exec(t))return!0;return!1}globalThis.oldmmw=Hn;var Ef=Hn;var rt=class extends ot{#e;#t;constructor(e,r="/",n={}){e=re(e).with(bo.oidcmw(n)).with(Ef(n)),r=E.collapse(r),super(e,r),this.#e=e,this.#t=r}get name(){return"SolidAdapter"}supportsDirectories(){return!0}async read(e){let r=await this.#e.get(E.collapse(e,this.#t)),n={type:this.getMimetype(r),name:E.filename(e),http:{headers:r.headers,status:r.status,url:r.url}};return r.data&&(n.data=r.data),n.type.match(/text\/.*/)?n.contents=await r.text():n.type.match(/application\/json.*/)?n.contents=await r.json():n.contents=await r.blob(),n}async list(e){let r=await this.read(e);if(r.data){if(!r.data.primary?.ldp$contains)throw new Error(e+" could not find ldp container",{cause:r});return or(r.data.primary.ldp$contains).where({a:"ldp$Resource"}).select({filename:n=>jsfs.path.filename(metro.url(n.id).pathname),path:n=>metro.url(n.id).pathname,type:n=>n.a.includes("ldp$Container")?"folder":"file"})}else throw new Error(e+" could not be parsed",{cause:r})}async mkdir(e){this.#e.put(E.collapse(e,this.#t))}async rmdir(e){this.#e.delete(E.collapse(e,this.#t))}};async function Vn(t,e){let r={prefixes:{ldp:"http://www.w3.org/ns/ldp#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dct:"http://purl.org/dc/terms/",stat:"http://www.w3.org/ns/posix/stat#",turtle:"http://www.w3.org/ns/iana/media-types/text/turtle#",schema:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",space:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:oldm.n3Parser,writer:oldm.n3Writer},n=Object.assign({},r,e);for(let l in r.prefixes)n.prefixes[l]||(n.prefixes[l]=r.prefixes[l]);let s=(await metro.client(oldmmw(n),metro.mw.getdata()).get(t))?.primary;if(!s||!s.solid$oidcIssuer)throw new Error("solidClient: "+t+" did not return valid solid profile");n.issuer=s.solid$oidcIssuer;let o=oldm.many(s.space$storage).map(l=>new jsfs.fs(new rt(l.id,"/",n))),a=metro.client(metro.oidc.oidcmw(n),oldmmw(n));return Object.assign(a,{profile:s,issuer:s.solid$oidcIssuer.id,inbox:s.ldp$inbox.id,id:function(){return metro.oidc.idToken(this.issuer)},logout:async function(){throw new Error("not yet implemented")},...o}),a.id.bind(a),a.logout.bind(a),a}var c0={adapter:rt,client:Vn};globalThis.solidClient=Vn;globalThis.SolidAdapter=rt;})();
|
|
23
23
|
/*! Bundled license information:
|
|
24
24
|
|
|
25
25
|
ieee754/index.js:
|