@noeldemartin/solid-utils 0.1.1-next.f279ff39536b39493ea8febae8d8052a9a3b1365 → 0.2.0-next.1b9830994a89d900e969b890901e13f7f04df993
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/noeldemartin-solid-utils.cjs.js +1 -1
- package/dist/noeldemartin-solid-utils.cjs.js.map +1 -1
- package/dist/noeldemartin-solid-utils.d.ts +125 -18
- package/dist/noeldemartin-solid-utils.esm.js +1 -1
- package/dist/noeldemartin-solid-utils.esm.js.map +1 -1
- package/dist/noeldemartin-solid-utils.umd.js +90 -0
- package/dist/noeldemartin-solid-utils.umd.js.map +1 -0
- package/package.json +9 -9
- package/src/errors/MalformedSolidDocumentError.ts +2 -2
- package/src/errors/NetworkRequestError.ts +4 -4
- package/src/errors/NotFoundError.ts +2 -2
- package/src/errors/UnauthorizedError.ts +2 -2
- package/src/errors/UnsuccessfulNetworkRequestError.ts +23 -0
- package/src/errors/UnsupportedAuthorizationProtocolError.ts +16 -0
- package/src/errors/index.ts +2 -0
- package/src/helpers/auth.ts +104 -19
- package/src/helpers/interop.ts +63 -27
- package/src/helpers/io.ts +78 -47
- package/src/helpers/jsonld.ts +21 -1
- package/src/helpers/testing.ts +2 -2
- package/src/helpers/vocabs.ts +2 -1
- package/src/helpers/wac.ts +12 -2
- package/src/main.ts +1 -0
- package/src/models/SolidDocument.ts +41 -35
- package/src/models/SolidStore.ts +61 -0
- package/src/models/index.ts +2 -1
- package/src/testing/ResponseStub.ts +46 -0
- package/src/testing/faking.ts +36 -0
- package/src/testing/index.ts +3 -0
- package/src/testing/mocking.ts +34 -0
- package/src/types/n3.d.ts +9 -0
|
@@ -11,18 +11,35 @@ declare global {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
/// <reference types="jest" />
|
|
15
|
+
|
|
16
|
+
import type { GetClosureArgs } from '@noeldemartin/utils';
|
|
17
|
+
import type { GetClosureResult } from '@noeldemartin/utils';
|
|
18
|
+
import { JSError } from '@noeldemartin/utils';
|
|
19
|
+
import type { JSErrorOptions } from '@noeldemartin/utils';
|
|
16
20
|
import type { Quad } from 'rdf-js';
|
|
17
21
|
|
|
18
22
|
export declare type AnyFetch = (input: any, options?: any) => Promise<Response>;
|
|
19
23
|
|
|
24
|
+
export declare function compactJsonLDGraph(jsonld: JsonLDGraph): Promise<JsonLDGraph>;
|
|
25
|
+
|
|
26
|
+
export declare interface ContainerOptions {
|
|
27
|
+
baseUrl: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
export declare function createPrivateTypeIndex(user: SolidUserProfile, fetch?: Fetch): Promise<string>;
|
|
21
31
|
|
|
32
|
+
export declare function createPublicTypeIndex(user: SolidUserProfile, fetch?: Fetch): Promise<string>;
|
|
33
|
+
|
|
22
34
|
export declare function createSolidDocument(url: string, body: string, fetch?: Fetch): Promise<SolidDocument>;
|
|
23
35
|
|
|
24
36
|
export declare function defineIRIPrefix(name: string, value: string): void;
|
|
25
37
|
|
|
38
|
+
export declare interface DocumentOptions extends ContainerOptions {
|
|
39
|
+
containerUrl: string;
|
|
40
|
+
name: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
26
43
|
export declare interface EqualityResult {
|
|
27
44
|
success: boolean;
|
|
28
45
|
message: string;
|
|
@@ -37,9 +54,27 @@ export declare interface ExpandIRIOptions {
|
|
|
37
54
|
extraContext: RDFContext;
|
|
38
55
|
}
|
|
39
56
|
|
|
57
|
+
export declare function fakeContainerUrl(options?: Partial<ContainerOptions>): string;
|
|
58
|
+
|
|
59
|
+
export declare function fakeDocumentUrl(options?: Partial<DocumentOptions>): string;
|
|
60
|
+
|
|
61
|
+
export declare function fakeResourceUrl(options?: Partial<ResourceOptions>): string;
|
|
62
|
+
|
|
40
63
|
export declare type Fetch = TypedFetch | AnyFetch;
|
|
41
64
|
|
|
42
|
-
export declare function fetchLoginUserProfile(loginUrl: string,
|
|
65
|
+
export declare function fetchLoginUserProfile(loginUrl: string, options?: FetchLoginUserProfileOptions): Promise<SolidUserProfile | null>;
|
|
66
|
+
|
|
67
|
+
export declare interface FetchLoginUserProfileOptions {
|
|
68
|
+
required?: boolean;
|
|
69
|
+
fetch?: Fetch;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export declare type FetchMock = jest.Mock<GetClosureResult<Fetch>, GetClosureArgs<Fetch>> & Fetch & FetchMockMethods;
|
|
73
|
+
|
|
74
|
+
export declare interface FetchMockMethods {
|
|
75
|
+
mockResponse(body?: string, headers?: Record<string, string>, status?: number): void;
|
|
76
|
+
mockNotFoundResponse(): void;
|
|
77
|
+
}
|
|
43
78
|
|
|
44
79
|
export declare function fetchSolidDocument(url: string, fetch?: Fetch): Promise<SolidDocument>;
|
|
45
80
|
|
|
@@ -51,7 +86,9 @@ export declare function fetchSolidDocumentACL(documentUrl: string, fetch: Fetch)
|
|
|
51
86
|
|
|
52
87
|
export declare function fetchSolidDocumentIfFound(url: string, fetch?: Fetch): Promise<SolidDocument | null>;
|
|
53
88
|
|
|
54
|
-
export declare function
|
|
89
|
+
export declare function findContainerRegistrations(typeIndexUrl: string, type: string | string[], fetch?: Fetch): Promise<string[]>;
|
|
90
|
+
|
|
91
|
+
export declare function findInstanceRegistrations(typeIndexUrl: string, type: string | string[], fetch?: Fetch): Promise<string[]>;
|
|
55
92
|
|
|
56
93
|
export declare function installChaiPlugin(): void;
|
|
57
94
|
|
|
@@ -70,6 +107,7 @@ export declare type JsonLD = Partial<{
|
|
|
70
107
|
export declare function jsonldEquals(expected: JsonLD, actual: JsonLD): Promise<EqualityResult>;
|
|
71
108
|
|
|
72
109
|
export declare type JsonLDGraph = {
|
|
110
|
+
'@context'?: Record<string, unknown>;
|
|
73
111
|
'@graph': JsonLDResource[];
|
|
74
112
|
};
|
|
75
113
|
|
|
@@ -77,9 +115,9 @@ export declare type JsonLDResource = Omit<JsonLD, '@id'> & {
|
|
|
77
115
|
'@id': string;
|
|
78
116
|
};
|
|
79
117
|
|
|
80
|
-
export declare function jsonldToQuads(jsonld: JsonLD): Promise<Quad[]>;
|
|
118
|
+
export declare function jsonldToQuads(jsonld: JsonLD, baseIRI?: string): Promise<Quad[]>;
|
|
81
119
|
|
|
82
|
-
export declare class MalformedSolidDocumentError extends
|
|
120
|
+
export declare class MalformedSolidDocumentError extends JSError {
|
|
83
121
|
readonly documentUrl: string | null;
|
|
84
122
|
readonly documentFormat: SolidDocumentFormat;
|
|
85
123
|
readonly malformationDetails: string;
|
|
@@ -88,22 +126,26 @@ export declare class MalformedSolidDocumentError extends Error_2 {
|
|
|
88
126
|
|
|
89
127
|
export declare function mintJsonLDIdentifiers(jsonld: JsonLD): JsonLDResource;
|
|
90
128
|
|
|
91
|
-
export declare
|
|
129
|
+
export declare function mockFetch(): FetchMock;
|
|
130
|
+
|
|
131
|
+
export declare class NetworkRequestError extends JSError {
|
|
92
132
|
readonly url: string;
|
|
93
|
-
constructor(url: string, options?:
|
|
133
|
+
constructor(url: string, options?: JSErrorOptions);
|
|
94
134
|
}
|
|
95
135
|
|
|
96
136
|
export declare function normalizeSparql(sparql: string): string;
|
|
97
137
|
|
|
98
|
-
export declare class NotFoundError extends
|
|
138
|
+
export declare class NotFoundError extends JSError {
|
|
99
139
|
readonly url: string;
|
|
100
140
|
constructor(url: string);
|
|
101
141
|
}
|
|
102
142
|
|
|
103
143
|
export declare function parseResourceSubject(subject: string): SubjectParts;
|
|
104
144
|
|
|
145
|
+
export declare function parseTurtle(turtle: string, options?: Partial<ParsingOptions>): Promise<RDFGraphData>;
|
|
146
|
+
|
|
105
147
|
export declare interface ParsingOptions {
|
|
106
|
-
|
|
148
|
+
baseIRI: string;
|
|
107
149
|
normalizeBlankNodes: boolean;
|
|
108
150
|
}
|
|
109
151
|
|
|
@@ -115,20 +157,51 @@ export declare function quadToTurtle(quad: Quad): string;
|
|
|
115
157
|
|
|
116
158
|
export declare type RDFContext = Record<string, string>;
|
|
117
159
|
|
|
118
|
-
export declare
|
|
160
|
+
export declare interface RDFGraphData {
|
|
161
|
+
quads: Quad[];
|
|
162
|
+
containsRelativeIRIs: boolean;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export declare interface ResourceOptions extends DocumentOptions {
|
|
166
|
+
documentUrl: string;
|
|
167
|
+
hash: string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export declare class ResponseStub implements Response {
|
|
171
|
+
private rawBody;
|
|
172
|
+
readonly body: ReadableStream<Uint8Array> | null;
|
|
173
|
+
readonly bodyUsed: boolean;
|
|
174
|
+
readonly headers: Headers;
|
|
175
|
+
readonly ok: boolean;
|
|
176
|
+
readonly redirected: boolean;
|
|
177
|
+
readonly status: number;
|
|
178
|
+
readonly statusText: string;
|
|
179
|
+
readonly trailer: Promise<Headers>;
|
|
180
|
+
readonly type: ResponseType;
|
|
181
|
+
readonly url: string;
|
|
182
|
+
constructor(rawBody?: string, headers?: Record<string, string>, status?: number);
|
|
183
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
184
|
+
blob(): Promise<Blob>;
|
|
185
|
+
formData(): Promise<FormData>;
|
|
186
|
+
json(): Promise<unknown>;
|
|
187
|
+
text(): Promise<string>;
|
|
188
|
+
clone(): Response;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export declare class SolidDocument extends SolidStore {
|
|
119
192
|
readonly url: string;
|
|
120
193
|
readonly headers: Headers;
|
|
121
|
-
private quads;
|
|
122
194
|
constructor(url: string, quads: Quad[], headers: Headers);
|
|
123
|
-
|
|
195
|
+
isACPResource(): boolean;
|
|
124
196
|
isPersonalProfile(): boolean;
|
|
125
197
|
isStorage(): boolean;
|
|
198
|
+
isUserWritable(): boolean;
|
|
199
|
+
getUserPermissions(): SolidDocumentPermission[];
|
|
200
|
+
getPublicPermissions(): SolidDocumentPermission[];
|
|
126
201
|
getLastModified(): Date | null;
|
|
127
|
-
|
|
128
|
-
statement(subject?: string, predicate?: string, object?: string): Quad | null;
|
|
129
|
-
contains(subject: string, predicate?: string, object?: string): boolean;
|
|
130
|
-
getThing(subject: string): SolidThing;
|
|
202
|
+
protected expandIRI(iri: string): string;
|
|
131
203
|
private getLatestDocumentDate;
|
|
204
|
+
private getPermissionsFromWAC;
|
|
132
205
|
}
|
|
133
206
|
|
|
134
207
|
export declare function solidDocumentExists(url: string, fetch?: Fetch): Promise<boolean>;
|
|
@@ -137,6 +210,26 @@ export declare enum SolidDocumentFormat {
|
|
|
137
210
|
Turtle = "Turtle"
|
|
138
211
|
}
|
|
139
212
|
|
|
213
|
+
export declare enum SolidDocumentPermission {
|
|
214
|
+
Read = "read",
|
|
215
|
+
Write = "write",
|
|
216
|
+
Append = "append",
|
|
217
|
+
Control = "control"
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export declare class SolidStore {
|
|
221
|
+
private quads;
|
|
222
|
+
constructor(quads?: Quad[]);
|
|
223
|
+
isEmpty(): boolean;
|
|
224
|
+
getQuads(): Quad[];
|
|
225
|
+
addQuads(quads: Quad[]): void;
|
|
226
|
+
statements(subject?: string, predicate?: string, object?: string): Quad[];
|
|
227
|
+
statement(subject?: string, predicate?: string, object?: string): Quad | null;
|
|
228
|
+
contains(subject: string, predicate?: string, object?: string): boolean;
|
|
229
|
+
getThing(subject: string): SolidThing;
|
|
230
|
+
protected expandIRI(iri: string): string;
|
|
231
|
+
}
|
|
232
|
+
|
|
140
233
|
export declare class SolidThing {
|
|
141
234
|
readonly url: string;
|
|
142
235
|
private quads;
|
|
@@ -148,6 +241,8 @@ export declare class SolidThing {
|
|
|
148
241
|
export declare interface SolidUserProfile {
|
|
149
242
|
webId: string;
|
|
150
243
|
storageUrls: string[];
|
|
244
|
+
cloaked: boolean;
|
|
245
|
+
writableProfileUrl: string | null;
|
|
151
246
|
name?: string;
|
|
152
247
|
avatarUrl?: string;
|
|
153
248
|
oidcIssuerUrl?: string;
|
|
@@ -175,13 +270,25 @@ export declare function turtleToQuadsSync(turtle: string, options?: Partial<Pars
|
|
|
175
270
|
|
|
176
271
|
export declare type TypedFetch = (input: RequestInfo, options?: RequestInit) => Promise<Response>;
|
|
177
272
|
|
|
178
|
-
export declare class UnauthorizedError extends
|
|
273
|
+
export declare class UnauthorizedError extends JSError {
|
|
179
274
|
readonly url: string;
|
|
180
275
|
readonly responseStatus?: number;
|
|
181
276
|
constructor(url: string, responseStatus?: number);
|
|
182
277
|
get forbidden(): boolean | undefined;
|
|
183
278
|
}
|
|
184
279
|
|
|
280
|
+
export declare class UnsuccessfulNetworkRequestError extends JSError {
|
|
281
|
+
response: Response;
|
|
282
|
+
constructor(response: Response);
|
|
283
|
+
constructor(message: string, response: Response);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export declare class UnsupportedAuthorizationProtocolError extends JSError {
|
|
287
|
+
readonly url: string;
|
|
288
|
+
readonly protocol: string;
|
|
289
|
+
constructor(url: string, protocol: string, options?: JSErrorOptions);
|
|
290
|
+
}
|
|
291
|
+
|
|
185
292
|
export declare function updateSolidDocument(url: string, body: string, fetch?: Fetch): Promise<void>;
|
|
186
293
|
|
|
187
294
|
export { }
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.reflect.to-string-tag.js";import"core-js/modules/es.reflect.construct.js";import e from"@babel/runtime/helpers/esm/classCallCheck";import t from"@babel/runtime/helpers/esm/assertThisInitialized";import r from"@babel/runtime/helpers/esm/inherits";import n from"@babel/runtime/helpers/esm/possibleConstructorReturn";import o from"@babel/runtime/helpers/esm/getPrototypeOf";import s from"@babel/runtime/helpers/esm/defineProperty";import"core-js/modules/es.array.concat.js";import{Error as u,parseDate as a,stringMatchAll as i,objectWithoutEmpty as c,arr as l,tap as f,arrayFilter as p,arrayReplace as d,urlRoot as m,silenced as v,urlParentDirectory as h,urlRoute as j,objectDeepClone as y,urlParse as w,uuid as x,isObject as b,isArray as g,pull as k,arrayRemove as E,urlResolve as T,requireUrlParentDirectory as R}from"@noeldemartin/utils";import A from"@babel/runtime/helpers/esm/createClass";import I from"@babel/runtime/helpers/esm/asyncToGenerator";import P from"@babel/runtime/regenerator";import"core-js/modules/es.array.map.js";import"core-js/modules/esnext.async-iterator.map.js";import"core-js/modules/esnext.iterator.map.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.replace.js";import"core-js/modules/es.function.name.js";import"core-js/modules/es.array.from.js";import"core-js/modules/es.regexp.test.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.symbol.iterator.js";import S from"@babel/runtime/helpers/esm/toConsumableArray";import U from"@babel/runtime/helpers/esm/slicedToArray";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/esnext.async-iterator.filter.js";import"core-js/modules/esnext.iterator.constructor.js";import"core-js/modules/esnext.iterator.filter.js";import"core-js/modules/es.array.flat-map.js";import"core-js/modules/es.array.unscopables.flat-map.js";import"core-js/modules/esnext.async-iterator.flat-map.js";import"core-js/modules/esnext.iterator.flat-map.js";import"core-js/modules/esnext.async-iterator.for-each.js";import"core-js/modules/esnext.iterator.for-each.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.set.js";import"core-js/modules/es.string.iterator.js";import"core-js/modules/esnext.set.add-all.js";import"core-js/modules/esnext.set.delete-all.js";import"core-js/modules/esnext.set.difference.js";import"core-js/modules/esnext.set.every.js";import"core-js/modules/esnext.set.filter.js";import"core-js/modules/esnext.set.find.js";import"core-js/modules/esnext.set.intersection.js";import"core-js/modules/esnext.set.is-disjoint-from.js";import"core-js/modules/esnext.set.is-subset-of.js";import"core-js/modules/esnext.set.is-superset-of.js";import"core-js/modules/esnext.set.join.js";import"core-js/modules/esnext.set.map.js";import"core-js/modules/esnext.set.reduce.js";import"core-js/modules/esnext.set.some.js";import"core-js/modules/esnext.set.symmetric-difference.js";import"core-js/modules/esnext.set.union.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.join.js";import"core-js/modules/es.object.entries.js";import"core-js/modules/esnext.async-iterator.reduce.js";import"core-js/modules/esnext.iterator.reduce.js";import"core-js/modules/es.array.sort.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.promise.js";import"core-js/modules/es.array.flat.js";import"core-js/modules/es.array.unscopables.flat.js";import q from"md5";import{Writer as D,Parser as N,BlankNode as C,Quad as B}from"n3";import{toRDF as O,fromRDF as z}from"jsonld";import"core-js/modules/es.string.match.js";import"core-js/modules/es.array.find.js";import"core-js/modules/esnext.async-iterator.find.js";import"core-js/modules/esnext.iterator.find.js";import"core-js/modules/es.string.starts-with.js";import"core-js/modules/es.string.split.js";import"core-js/modules/es.object.values.js";import"core-js/modules/es.regexp.constructor.js";import"core-js/modules/es.regexp.sticky.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.object.keys.js";function L(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var M;!function(e){e.Turtle="Turtle"}(M||(M={}));var F=function(n){r(MalformedSolidDocumentError,u);var o=L(MalformedSolidDocumentError);function MalformedSolidDocumentError(r,n,u){var a;return e(this,MalformedSolidDocumentError),a=o.call(this,function(e,t,r){return e?"Malformed ".concat(t," document found at ").concat(e," - ").concat(r):"Malformed ".concat(t," document - ").concat(r)}(r,n,u)),s(t(a),"documentUrl",void 0),s(t(a),"documentFormat",void 0),s(t(a),"malformationDetails",void 0),a.documentUrl=r,a.documentFormat=n,a.malformationDetails=u,a}return MalformedSolidDocumentError}();function Q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var H=function(n){r(NetworkRequestError,u);var o=Q(NetworkRequestError);function NetworkRequestError(r,n){var u;return e(this,NetworkRequestError),u=o.call(this,"Request failed trying to fetch ".concat(r),n),s(t(u),"url",void 0),u.url=r,u}return NetworkRequestError}();function $(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var J=function(n){r(NotFoundError,u);var o=$(NotFoundError);function NotFoundError(r){var n;return e(this,NotFoundError),n=o.call(this,"Document with '".concat(r,"' url not found")),s(t(n),"url",void 0),n.url=r,n}return NotFoundError}();function W(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var _=function(n){r(UnauthorizedError,u);var o=W(UnauthorizedError);function UnauthorizedError(r,n){var u;return e(this,UnauthorizedError),u=o.call(this,function(e,t){return"Unauthorized".concat(403===t?" (Forbidden)":"",": ").concat(e)}(r,n)),s(t(u),"url",void 0),s(t(u),"responseStatus",void 0),u.url=r,u.responseStatus=n,u}return A(UnauthorizedError,[{key:"forbidden",get:function(){return void 0!==this.responseStatus?403===this.responseStatus:void 0}}]),UnauthorizedError}(),G={acl:"http://www.w3.org/ns/auth/acl#",foaf:"http://xmlns.com/foaf/0.1/",pim:"http://www.w3.org/ns/pim/space#",purl:"http://purl.org/dc/terms/",rdfs:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",schema:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",vcard:"http://www.w3.org/2006/vcard/ns#"};function X(e,t){G[e]=t}function K(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.startsWith("http"))return e;var r=e.split(":"),n=U(r,2),o=n[0],s=n[1];if(o&&s){var u,a,i,c=null!==(u=null!==(a=G[o])&&void 0!==a?a:null===(i=t.extraContext)||void 0===i?void 0:i[o])&&void 0!==u?u:null;if(!c)throw new Error("Can't expand IRI with unknown prefix: '".concat(e,"'"));return c+s}if(!t.defaultPrefix)throw new Error("Can't expand IRI without a default prefix: '".concat(e,"'"));return t.defaultPrefix+o}var V=function(){function t(r,n){e(this,t),s(this,"url",void 0),s(this,"quads",void 0),this.url=r,this.quads=n}return A(t,[{key:"value",value:function(e){var t;return null===(t=this.quads.find((function(t){return t.predicate.value===K(e)})))||void 0===t?void 0:t.object.value}},{key:"values",value:function(e){return this.quads.filter((function(t){return t.predicate.value===K(e)})).map((function(e){return e.object.value}))}}]),t}(),Y=function(){function t(r,n,o){e(this,t),s(this,"url",void 0),s(this,"headers",void 0),s(this,"quads",void 0),this.url=r,this.quads=n,this.headers=o}return A(t,[{key:"isEmpty",value:function(){return 0===this.statements.length}},{key:"isPersonalProfile",value:function(){return!!this.statement(this.url,K("rdfs:type"),K("foaf:PersonalProfileDocument"))}},{key:"isStorage",value:function(){var e;return!(null===(e=this.headers.get("Link"))||void 0===e||!e.match(/<http:\/\/www\.w3\.org\/ns\/pim\/space#Storage>;[^,]+rel="type"/))}},{key:"getLastModified",value:function(){var e,t,r,n;return null!==(e=null!==(t=null!==(r=a(this.headers.get("last-modified")))&&void 0!==r?r:a(null===(n=this.statement(this.url,"purl:modified"))||void 0===n?void 0:n.object.value))&&void 0!==t?t:this.getLatestDocumentDate())&&void 0!==e?e:null}},{key:"statements",value:function(e,t,r){var n=this;return this.quads.filter((function(o){return!(r&&o.object.value!==K(r,{defaultPrefix:n.url})||e&&o.subject.value!==K(e,{defaultPrefix:n.url})||t&&o.predicate.value!==K(t,{defaultPrefix:n.url}))}))}},{key:"statement",value:function(e,t,r){var n=this,o=this.quads.find((function(o){return!(r&&o.object.value!==K(r,{defaultPrefix:n.url})||e&&o.subject.value!==K(e,{defaultPrefix:n.url})||t&&o.predicate.value!==K(t,{defaultPrefix:n.url}))}));return null!=o?o:null}},{key:"contains",value:function(e,t,r){return null!==this.statement(e,t,r)}},{key:"getThing",value:function(e){var t=this.statements(e);return new V(e,t)}},{key:"getLatestDocumentDate",value:function(){var e=[].concat(S(this.statements(void 0,"purl:modified")),S(this.statements(void 0,"purl:created"))).map((function(e){return a(e.object.value)})).filter((function(e){return null!==e}));return e.length>0?e.reduce((function(e,t){return e>t?e:t})):null}}]),t}();function Z(e){return"@graph"in e}function ee(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return te(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return te(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,u=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){a=!0,s=e},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw s}}}}function te(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function re(e,t){return ne.apply(this,arguments)}function ne(){return(ne=I(P.mark((function e(t,r){var n,o,s;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={headers:{Accept:"text/turtle"}},e.prev=1,e.next=4,r(t,n);case 4:if(404!==(o=e.sent).status){e.next=7;break}throw new J(t);case 7:if(![401,403].includes(o.status)){e.next=9;break}throw new _(t,o.status);case 9:return e.next=11,o.text();case 11:return s=e.sent,e.abrupt("return",{body:s,headers:o.headers});case 15:if(e.prev=15,e.t0=e.catch(1),!(e.t0 instanceof _)){e.next=19;break}throw e.t0;case 19:if(!(e.t0 instanceof J)){e.next=21;break}throw e.t0;case 21:throw new H(t,{cause:e.t0});case 22:case"end":return e.stop()}}),e,null,[[1,15]])})))).apply(this,arguments)}function oe(e){var t,r=e.slice(0),n={},o=ee(l(e).flatMap((function(e,t){return f(p(["BlankNode"===e.object.termType?e.object.value:null,"BlankNode"===e.subject.termType?e.subject.value:null]),(function(e){return e.forEach((function(e){var r;return(null!==(r=n[e])&&void 0!==r?r:n[e]=new Set).add(t)}))}))})).filter().unique());try{var s=function(){var o,s=t.value,u=n[s],a=q(l(u).map((function(t){return e[t]})).filter((function(e){var t=e.subject,r=t.termType,n=t.value;return"BlankNode"===r&&n===s})).map((function(e){var t=e.predicate,r=e.object;return"BlankNode"===r.termType?t.value:t.value+r.value})).sorted().join()),i=ee(u);try{for(i.s();!(o=i.n()).done;){for(var c=o.value,f=r[c],p={subject:f.subject,object:f.object},m=0,v=Object.entries(p);m<v.length;m++){var h=U(v[m],2),j=h[0],y=h[1];"BlankNode"===y.termType&&y.value===s&&(p[j]=new C(a))}d(r,f,new B(p.subject,f.predicate,p.object))}}catch(e){i.e(e)}finally{i.f()}};for(o.s();!(t=o.n()).done;)s()}catch(e){o.e(e)}finally{o.f()}return r}function se(e,t,r){return ue.apply(this,arguments)}function ue(){return(ue=I(P.mark((function e(t,r,n){var o,s;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(o=n)&&void 0!==o?o:window.fetch.bind(window),e.next=3,ke(r);case 3:return s=e.sent,e.next=6,n(t,{method:"PUT",headers:{"Content-Type":"text/turtle"},body:r});case 6:return e.abrupt("return",new Y(t,s,new Headers({})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ae(e,t){return ie.apply(this,arguments)}function ie(){return(ie=I(P.mark((function e(t,r){var n,o,s,u;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,re(t,null!=r?r:window.fetch);case 2:return n=e.sent,o=n.body,s=n.headers,e.next=7,ke(o,{documentUrl:t});case 7:return u=e.sent,e.abrupt("return",new Y(t,u,s));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ce(e,t){return le.apply(this,arguments)}function le(){return(le=I(P.mark((function e(t,r){var n;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ae(t,r);case 3:return n=e.sent,e.abrupt("return",n);case 7:if(e.prev=7,e.t0=e.catch(0),e.t0 instanceof J){e.next=11;break}throw e.t0;case 11:return e.abrupt("return",null);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function fe(e){return pe.apply(this,arguments)}function pe(){return(pe=I(P.mark((function e(t){var r;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Z(t)){e.next=5;break}return e.next=3,Promise.all(t["@graph"].map(fe));case 3:return r=e.sent,e.abrupt("return",r.flat());case 5:return e.abrupt("return",O(t));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function de(e){var t=ge(e);return Object.entries(t).reduce((function(e,t){var r=U(t,2),n=r[0],o=r[1].map((function(e){return" "+je(e)})).sort().join("\n");return e.concat("".concat(n.toUpperCase()," DATA {\n").concat(o,"\n}"))}),[]).join(" ;\n")}function me(e){return ve.apply(this,arguments)}function ve(){return(ve=I(P.mark((function e(t){var r;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,z(t);case 2:return r=e.sent,e.abrupt("return",{"@graph":r});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function he(e){return(new D).quadsToString(e)}function je(e){return(new D).quadsToString([e]).slice(0,-1)}function ye(e,t){return we.apply(this,arguments)}function we(){return(we=I(P.mark((function e(t,r){var n;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ae(t,r);case 3:return n=e.sent,e.abrupt("return",!n.isEmpty());case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function xe(e){return be.apply(this,arguments)}function be(){return be=I(P.mark((function e(t){var r,n,o,s=arguments;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},n=i(t,/(\w+) DATA {([^}]+)}/g),o={},e.next=5,Promise.all(S(n).map(function(){var e=I(P.mark((function e(t){var n,s;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t[1].toLowerCase(),s=t[2],e.next=4,ke(s,r);case 4:o[n]=e.sent;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 5:return e.abrupt("return",o);case 6:case"end":return e.stop()}}),e)}))),be.apply(this,arguments)}function ge(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i(e,/(\w+) DATA {([^}]+)}/g),o={},s=ee(n);try{for(s.s();!(t=s.n()).done;){var u=t.value,a=u[1].toLowerCase(),c=u[2];o[a]=Te(c,r)}}catch(e){s.e(e)}finally{s.f()}return o}function ke(e){return Ee.apply(this,arguments)}function Ee(){return Ee=I(P.mark((function e(t){var r,n,o,s,u=arguments;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},n=c({baseIRI:r.documentUrl}),o=new N(n),s=[],e.abrupt("return",new Promise((function(e,n){o.parse(t,(function(t,o){var u;t?n(new F(null!==(u=r.documentUrl)&&void 0!==u?u:null,M.Turtle,t.message)):o?s.push(o):r.normalizeBlankNodes?e(oe(s)):e(s)}))})));case 5:case"end":return e.stop()}}),e)}))),Ee.apply(this,arguments)}function Te(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=c({baseIRI:t.documentUrl}),n=new N(r);try{var o=n.parse(e);return t.normalizeBlankNodes?oe(o):o}catch(e){var s,u;throw new F(null!==(s=t.documentUrl)&&void 0!==s?s:null,M.Turtle,null!==(u=e.message)&&void 0!==u?u:"")}}function Re(e,t,r){return Ae.apply(this,arguments)}function Ae(){return(Ae=I(P.mark((function e(t,r,n){var o;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(o=n)&&void 0!==o?o:window.fetch.bind(window),e.next=3,n(t,{method:"PATCH",headers:{"Content-Type":"application/sparql-update"},body:r});case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ie(e,t){return Pe.apply(this,arguments)}function Pe(){return(Pe=I(P.mark((function e(t,r){var n,o,s,u,a,i,l,f,p,d,m,y,w,x;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=j(t),e.next=3,ae(f,r);case 3:if((p=e.sent).isPersonalProfile()||p.contains(t,"solid:oidcIssuer")){e.next=6;break}throw new Error("".concat(t," is not a valid webId."));case 6:d=p.statements(t,"pim:storage").map((function(e){return e.object.value})),m=p.statement(t,"solid:publicTypeIndex"),y=p.statement(t,"solid:privateTypeIndex"),w=h(f);case 10:if(!w||0!==d.length){e.next=20;break}return e.next=13,v(ae(w,r));case 13:if(null==(x=e.sent)||!x.isStorage()){e.next=17;break}return d.push(w),e.abrupt("break",20);case 17:w=h(w),e.next=10;break;case 20:return e.abrupt("return",c({webId:t,storageUrls:d,name:null!==(n=null===(o=p.statement(t,"vcard:fn"))||void 0===o?void 0:o.object.value)&&void 0!==n?n:null===(s=p.statement(t,"foaf:name"))||void 0===s?void 0:s.object.value,avatarUrl:null!==(u=null===(a=p.statement(t,"vcard:hasPhoto"))||void 0===a?void 0:a.object.value)&&void 0!==u?u:null===(i=p.statement(t,"foaf:img"))||void 0===i?void 0:i.object.value,oidcIssuerUrl:null===(l=p.statement(t,"solid:oidcIssuer"))||void 0===l?void 0:l.object.value,publicTypeIndexUrl:null==m?void 0:m.object.value,privateTypeIndexUrl:null==y?void 0:y.object.value}));case 21:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Se(e,t){return Ue.apply(this,arguments)}function Ue(){return(Ue=I(P.mark((function e(t,r){var n,o,s;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=v((function(e){return Ie(e,r)})),e.next=3,s(t);case 3:if(e.t2=o=e.sent,e.t1=null!==e.t2,!e.t1){e.next=7;break}e.t1=void 0!==o;case 7:if(!e.t1){e.next=11;break}e.t3=o,e.next=14;break;case 11:return e.next=13,s(t.replace(/\/$/,"").concat("/profile/card#me"));case 13:e.t3=e.sent;case 14:if(e.t4=n=e.t3,e.t0=null!==e.t4,!e.t0){e.next=18;break}e.t0=void 0!==n;case 18:if(!e.t0){e.next=22;break}e.t5=n,e.next=25;break;case 22:return e.next=24,s(m(t).concat("/profile/card#me"));case 24:e.t5=e.sent;case 25:return e.abrupt("return",e.t5);case 26:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qe(e){var t=function(e){return e.path&&e.path.startsWith("/")?e.path.match(/^\/[^/]*$/)?"/":"/".concat(l(e.path.split("/")).filter().slice(0,-1).join("/"),"/").replace("//","/"):null}(e);return e.protocol&&e.domain?"".concat(e.protocol,"://").concat(e.domain).concat(null!=t?t:"/"):t}function De(e){var t;if("@type"in e&&!("@value"in e)){e["@id"]=null!==(t=e["@id"])&&void 0!==t?t:x();for(var r=0,n=Object.values(e);r<n.length;r++){var o=n[r];b(o)&&De(o),g(o)&&o.forEach((function(e){return b(e)&&De(e)}))}}}function Ne(e){return f(y(e),(function(e){return De(e)}))}function Ce(e){var t=w(e);return t?c({containerUrl:qe(t),documentName:t.path?t.path.split("/").pop():null,resourceHash:t.fragment}):{}}function Be(e,t){return Oe.apply(this,arguments)}function Oe(){return(Oe=I(P.mark((function e(t,r){var n,o,s;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=null!==(n=r)&&void 0!==n?n:window.fetch.bind(r),o=t.storageUrls[0],s="".concat(o,"settings/privateTypeIndex"),e.next=5,ye(s,r);case 5:if(!e.sent){e.next=9;break}e.t0="".concat(o,"settings/privateTypeIndex-").concat(x()),e.next=10;break;case 9:e.t0=s;case 10:return e.abrupt("return",e.t0);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ze(e,t){return Le.apply(this,arguments)}function Le(){return(Le=I(P.mark((function e(t,r){var n,o,s;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=null!==(n=r)&&void 0!==n?n:window.fetch.bind(r),e.next=3,Be(t,r);case 3:return o=e.sent,"\n <> a\n <http://www.w3.org/ns/solid/terms#TypeIndex>,\n <http://www.w3.org/ns/solid/terms#UnlistedDocument> .\n ",s="\n INSERT DATA {\n <".concat(t.webId,"> <http://www.w3.org/ns/solid/terms#privateTypeIndex> <").concat(o,"> .\n }\n "),e.next=8,Promise.all([se(o,"\n <> a\n <http://www.w3.org/ns/solid/terms#TypeIndex>,\n <http://www.w3.org/ns/solid/terms#UnlistedDocument> .\n ",r),Re(t.webId,s,r)]);case 8:return e.abrupt("return",o);case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(e,t,r){return Fe.apply(this,arguments)}function Fe(){return(Fe=I(P.mark((function e(t,r,n){var o,s,u;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ae(t,n);case 2:return s=e.sent,u=s.statements(void 0,"rdfs:type","solid:TypeRegistration").find((function(e){return s.contains(e.subject.value,"solid:forClass",r)&&s.contains(e.subject.value,"solid:instanceContainer")})),e.abrupt("return",u&&null!==(o=s.getThing(u.subject.value))&&void 0!==o?o:null);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Qe(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return He(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return He(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,u=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){a=!0,s=e},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw s}}}}function He(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function $e(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var Je={},We={"%uuid%":"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},_e=function(n){r(ExpectedQuadAssertionError,u);var o=$e(ExpectedQuadAssertionError);function ExpectedQuadAssertionError(r){var n;return e(this,ExpectedQuadAssertionError),n=o.call(this,"Couldn't find the following triple: ".concat(je(r))),s(t(n),"expectedQuad",void 0),n.expectedQuad=r,n}return ExpectedQuadAssertionError}();function Ge(e,t){var r,n=Qe(e);try{var o=function(){var e=r.value,n=t.find((function(t){return n=t,function(e,t){if(e.termType!==t.termType)return!1;if("Literal"===e.termType&&"Literal"===t.termType){if(e.datatype.value!==t.datatype.value)return!1;if(!Xe(e.value))return"http://www.w3.org/2001/XMLSchema#dateTime"===e.datatype.value?new Date(e.value).getTime()===new Date(t.value).getTime():e.value===t.value}return Ke(e.value,t.value)}((r=e).object,n.object)&&Ke(r.subject.value,n.subject.value)&&Ke(r.predicate.value,n.predicate.value);var r,n}));if(!n)throw new _e(e);E(t,n)};for(n.s();!(r=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}}function Xe(e){return/\[\[(.*\]\[)?([^\]]+)\]\]/.test(e)}function Ke(e,t){var r,n;return Xe(e)?(null!==(n=(r=Je)[e])&&void 0!==n?n:r[e]=function(e){var t,r=[],n=[],o=e,s=Qe(i(e,/\[\[((.*?)\]\[)?([^\]]+)\]\]/g));try{for(s.s();!(t=s.n()).done;){var u=t.value;u[2]&&r.push(u[2]),n.push(u[3]),o=o.replace(u[0],"%PATTERN".concat(n.length-1,"%"))}}catch(e){s.e(e)}finally{s.f()}o=o.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");for(var a=0,c=Object.entries(n);a<c.length;a++){var l,f=U(c[a],2),p=f[0],d=f[1];o=o.replace("%PATTERN".concat(p,"%"),null!==(l=We[d])&&void 0!==l?l:d)}return new RegExp(o)}(e)).test(t):e===t}function Ve(){Je={}}function Ye(e,t){return Ze.apply(this,arguments)}function Ze(){return(Ze=I(P.mark((function e(t,r){var n,o,s,u,a;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ve(),e.next=3,fe(t);case 3:return n=e.sent,e.next=6,fe(r);case 6:if(o=e.sent,s=he(n),u=he(o),a=function(e,t){return{success:e,message:t,expected:s,actual:u}},n.length===o.length){e.next=12;break}return e.abrupt("return",a(!1,"Expected ".concat(n.length," triples, found ").concat(o.length,".")));case 12:e.prev=12,Ge(n,o),e.next=21;break;case 16:if(e.prev=16,e.t0=e.catch(12),e.t0 instanceof _e){e.next=20;break}throw e.t0;case 20:return e.abrupt("return",a(!1,e.t0.message));case 21:return e.abrupt("return",a(!0,"jsonld matches"));case 22:case"end":return e.stop()}}),e,null,[[12,16]])})))).apply(this,arguments)}function et(e,t){var r;Ve();for(var n=ge(e,{normalizeBlankNodes:!0}),o=ge(t,{normalizeBlankNodes:!0}),s=function(r,n){return{success:r,message:n,expected:e,actual:t}},u=0,a=Object.keys(n);u<a.length;u++){var i=a[u];if(!(i in o))return s(!1,"Couldn't find expected ".concat(i," operation."));var c=k(n,i),l=k(o,i);if(c.length!==l.length)return s(!1,"Expected ".concat(c.length," ").concat(i," triples, found ").concat(l.length,"."));try{Ge(c,l)}catch(e){if(!(e instanceof _e))throw e;return s(!1,"Couldn't find the following ".concat(i," triple: ").concat(je(e.expectedQuad)))}}var f=null!==(r=Object.keys(o)[0])&&void 0!==r?r:null;return f?s(!1,"Did not expect to find ".concat(f," triples.")):s(!0,"sparql matches")}function tt(e,t){Ve();var r=Te(e,{normalizeBlankNodes:!0}),n=Te(t,{normalizeBlankNodes:!0}),o=function(r,n){return{success:r,message:n,expected:e,actual:t}};if(r.length!==n.length)return o(!1,"Expected ".concat(r.length," triples, found ").concat(n.length,"."));try{Ge(r,n)}catch(e){if(!(e instanceof _e))throw e;return o(!1,e.message)}return o(!0,"turtle matches")}function rt(e,t){return nt.apply(this,arguments)}function nt(){return(nt=I(P.mark((function e(t,r){var n,o,s,u,a,i,c;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=null!==(n=r)&&void 0!==n?n:window.fetch.bind(window),e.next=3,r(t,{method:"HEAD"});case 3:if(a=e.sent,i=null!==(o=a.headers.get("Link"))&&void 0!==o?o:"",c=null!==(s=null===(u=i.match(/<([^>]+)>;\s*rel="acl"/))||void 0===u?void 0:u[1])&&void 0!==s?s:null){e.next=8;break}throw new Error("Could not find ACL Resource for '".concat(t,"'"));case 8:return e.abrupt("return",T(R(t),c));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ot(e,t,r){return st.apply(this,arguments)}function st(){return(st=I(P.mark((function e(t,r,n){var o,s,u;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(o=n)||void 0===o){e.next=4;break}e.t0=o,e.next=7;break;case 4:return e.next=6,rt(t,r);case 6:e.t0=e.sent;case 7:return n=e.t0,e.next=10,ce(null!==(u=n)&&void 0!==u?u:"",r);case 10:if(e.t2=s=e.sent,e.t1=null!==e.t2,!e.t1){e.next=14;break}e.t1=void 0!==s;case 14:if(!e.t1){e.next=18;break}e.t3=s,e.next=21;break;case 18:return e.next=20,ot(R(t),r);case 20:e.t3=e.sent;case 21:return e.abrupt("return",e.t3);case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ut(e,t){return at.apply(this,arguments)}function at(){return(at=I(P.mark((function e(t,r){var n,o;return P.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,rt(t,r);case 2:return n=e.sent,e.next=5,ot(t,r,n);case 5:return o=e.sent,e.abrupt("return",c({url:n,effectiveUrl:o.url,document:o}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var it={turtle:function(e){var t=this._obj,r=this.assert.bind(this),n=tt(e,t);r(n.success,n.message,"",n.expected,n.actual)},sparql:function(e){var t=this._obj,r=this.assert.bind(this),n=et(e,t);r(n.success,n.message,"",n.expected,n.actual)}};function ct(){chai.use((function(e){return Object.entries(it).forEach((function(t){var r=U(t,2),n=r[0],o=r[1];return e.Assertion.addMethod(n,o)}))}))}function lt(e,t){var r=e.success,n=t.context.utils;return{pass:r,message:r?function(){return[e.message,n.matcherHint(t.hint)].join("\n\n")}:function(){return[e.message,n.matcherHint(t.hint),["Expected: not ".concat(n.printExpected(t.expected)),"Received: ".concat(n.printReceived(t.received))].join("\n")].join("\n\n")}}}var ft={toEqualJsonLD:function(e,t){var r=this;return I(P.mark((function n(){var o;return P.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Ye(t,e);case 2:return o=n.sent,n.abrupt("return",lt(o,{context:r,hint:"toEqualJsonLD",expected:t,received:e}));case 4:case"end":return n.stop()}}),n)})))()},toEqualSparql:function(e,t){return lt(et(t,e),{context:this,hint:"toEqualSparql",expected:de(t),received:de(e)})}};function pt(){expect.extend(ft)}export{F as MalformedSolidDocumentError,H as NetworkRequestError,J as NotFoundError,Y as SolidDocument,M as SolidDocumentFormat,V as SolidThing,_ as UnauthorizedError,ze as createPrivateTypeIndex,se as createSolidDocument,X as defineIRIPrefix,K as expandIRI,Se as fetchLoginUserProfile,ae as fetchSolidDocument,ut as fetchSolidDocumentACL,ce as fetchSolidDocumentIfFound,Me as findContainerRegistration,ct as installChaiPlugin,pt as installJestPlugin,Z as isJsonLDGraph,Ye as jsonldEquals,fe as jsonldToQuads,Ne as mintJsonLDIdentifiers,de as normalizeSparql,Ce as parseResourceSubject,je as quadToTurtle,me as quadsToJsonLD,he as quadsToTurtle,ye as solidDocumentExists,et as sparqlEquals,xe as sparqlToQuads,ge as sparqlToQuadsSync,tt as turtleEquals,ke as turtleToQuads,Te as turtleToQuadsSync,Re as updateSolidDocument};
|
|
1
|
+
import"core-js/modules/es.object.to-string.js";import"core-js/modules/es.reflect.to-string-tag.js";import"core-js/modules/es.reflect.construct.js";import e from"@babel/runtime/helpers/esm/classCallCheck";import t from"@babel/runtime/helpers/esm/assertThisInitialized";import r from"@babel/runtime/helpers/esm/inherits";import n from"@babel/runtime/helpers/esm/possibleConstructorReturn";import o from"@babel/runtime/helpers/esm/getPrototypeOf";import s from"@babel/runtime/helpers/esm/defineProperty";import"core-js/modules/es.array.concat.js";import{JSError as u,parseDate as a,stringMatch as i,arrayFilter as c,objectWithoutEmpty as l,stringMatchAll as f,arr as p,tap as d,arrayReplace as m,urlRoot as v,silenced as h,arrayUnique as y,urlParentDirectory as b,urlRoute as w,objectDeepClone as j,urlParse as x,uuid as g,isObject as k,isArray as R,pull as E,arrayRemove as I,urlResolve as P,requireUrlParentDirectory as O,stringToSlug as A,fail as T}from"@noeldemartin/utils";import U from"@babel/runtime/helpers/esm/createClass";import"core-js/modules/es.object.keys.js";import"core-js/modules/es.symbol.js";import"core-js/modules/es.array.filter.js";import"core-js/modules/esnext.async-iterator.filter.js";import"core-js/modules/esnext.iterator.filter.js";import"core-js/modules/es.object.get-own-property-descriptor.js";import"core-js/modules/es.object.get-own-property-descriptors.js";import q from"@babel/runtime/helpers/esm/slicedToArray";import S from"@babel/runtime/helpers/esm/asyncToGenerator";import C from"@babel/runtime/regenerator";import"core-js/modules/esnext.async-iterator.for-each.js";import"core-js/modules/esnext.iterator.constructor.js";import"core-js/modules/esnext.iterator.for-each.js";import"core-js/modules/web.dom-collections.for-each.js";import"core-js/modules/es.array.map.js";import"core-js/modules/esnext.async-iterator.map.js";import"core-js/modules/esnext.iterator.map.js";import"core-js/modules/es.object.entries.js";import"core-js/modules/esnext.async-iterator.some.js";import"core-js/modules/esnext.iterator.some.js";import"core-js/modules/es.object.values.js";import"core-js/modules/es.array.find.js";import"core-js/modules/esnext.async-iterator.find.js";import"core-js/modules/esnext.iterator.find.js";import"core-js/modules/es.regexp.exec.js";import"core-js/modules/es.string.replace.js";import D from"@babel/runtime/helpers/esm/toConsumableArray";import"core-js/modules/es.array.slice.js";import"core-js/modules/es.string.starts-with.js";import"core-js/modules/es.string.split.js";import"core-js/modules/es.function.name.js";import"core-js/modules/es.array.from.js";import"core-js/modules/es.regexp.test.js";import"core-js/modules/es.symbol.description.js";import"core-js/modules/es.symbol.iterator.js";import"core-js/modules/es.array.flat-map.js";import"core-js/modules/es.array.unscopables.flat-map.js";import"core-js/modules/esnext.async-iterator.flat-map.js";import"core-js/modules/esnext.iterator.flat-map.js";import"core-js/modules/es.array.iterator.js";import"core-js/modules/es.set.js";import"core-js/modules/es.string.iterator.js";import"core-js/modules/esnext.set.add-all.js";import"core-js/modules/esnext.set.delete-all.js";import"core-js/modules/esnext.set.difference.js";import"core-js/modules/esnext.set.every.js";import"core-js/modules/esnext.set.filter.js";import"core-js/modules/esnext.set.find.js";import"core-js/modules/esnext.set.intersection.js";import"core-js/modules/esnext.set.is-disjoint-from.js";import"core-js/modules/esnext.set.is-subset-of.js";import"core-js/modules/esnext.set.is-superset-of.js";import"core-js/modules/esnext.set.join.js";import"core-js/modules/esnext.set.map.js";import"core-js/modules/esnext.set.reduce.js";import"core-js/modules/esnext.set.some.js";import"core-js/modules/esnext.set.symmetric-difference.js";import"core-js/modules/esnext.set.union.js";import"core-js/modules/web.dom-collections.iterator.js";import"core-js/modules/es.array.join.js";import"core-js/modules/esnext.async-iterator.reduce.js";import"core-js/modules/esnext.iterator.reduce.js";import"core-js/modules/es.array.sort.js";import"core-js/modules/es.promise.js";import"core-js/modules/es.array.includes.js";import"core-js/modules/es.array.flat.js";import"core-js/modules/es.array.unscopables.flat.js";import B from"md5";import{compactJsonLD as N,jsonLDToRDF as z,TurtleParser as L,jsonLDFromRDF as M,TurtleWriter as Q,createBlankNode as W,createQuad as F}from"@noeldemartin/solid-utils-external";import"core-js/modules/es.string.match.js";import"core-js/modules/es.string.includes.js";import"core-js/modules/es.regexp.constructor.js";import"core-js/modules/es.regexp.sticky.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.string.ends-with.js";import{faker as H}from"@noeldemartin/faker";import"core-js/modules/es.object.assign.js";function $(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var _;!function(e){e.Turtle="Turtle"}(_||(_={}));var J=function(n){r(MalformedSolidDocumentError,u);var o=$(MalformedSolidDocumentError);function MalformedSolidDocumentError(r,n,u){var a;return e(this,MalformedSolidDocumentError),a=o.call(this,function(e,t,r){return e?"Malformed ".concat(t," document found at ").concat(e," - ").concat(r):"Malformed ".concat(t," document - ").concat(r)}(r,n,u)),s(t(a),"documentUrl",void 0),s(t(a),"documentFormat",void 0),s(t(a),"malformationDetails",void 0),a.documentUrl=r,a.documentFormat=n,a.malformationDetails=u,a}return MalformedSolidDocumentError}();function G(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var X=function(n){r(NetworkRequestError,u);var o=G(NetworkRequestError);function NetworkRequestError(r,n){var u;return e(this,NetworkRequestError),u=o.call(this,"Request failed trying to fetch ".concat(r),n),s(t(u),"url",void 0),u.url=r,u}return NetworkRequestError}();function K(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var V=function(n){r(NotFoundError,u);var o=K(NotFoundError);function NotFoundError(r){var n;return e(this,NotFoundError),n=o.call(this,"Document with '".concat(r,"' url not found")),s(t(n),"url",void 0),n.url=r,n}return NotFoundError}();function Y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var Z=function(n){r(UnauthorizedError,u);var o=Y(UnauthorizedError);function UnauthorizedError(r,n){var u;return e(this,UnauthorizedError),u=o.call(this,function(e,t){return"Unauthorized".concat(403===t?" (Forbidden)":"",": ").concat(e)}(r,n)),s(t(u),"url",void 0),s(t(u),"responseStatus",void 0),u.url=r,u.responseStatus=n,u}return U(UnauthorizedError,[{key:"forbidden",get:function(){return void 0!==this.responseStatus?403===this.responseStatus:void 0}}]),UnauthorizedError}();function ee(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var te=function(n){r(UnsuccessfulRequestError,u);var o=ee(UnsuccessfulRequestError);function UnsuccessfulRequestError(r,n){var u;return e(this,UnsuccessfulRequestError),u=o.call(this,function(e,t){var r;return t=null!==(r=t)&&void 0!==r?r:e,"string"==typeof e?"".concat(e," (returned ").concat(t.status," status code)"):"Request to ".concat(t.url," returned ").concat(t.status," status code")}(r,n)),s(t(u),"response",void 0),u.response=null!=n?n:r,u}return UnsuccessfulRequestError}();function re(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var ne=function(n){r(UnsupportedAuthorizationProtocolError,u);var o=re(UnsupportedAuthorizationProtocolError);function UnsupportedAuthorizationProtocolError(r,n,u){var a;return e(this,UnsupportedAuthorizationProtocolError),a=o.call(this,"The resource at ".concat(r," is using an unsupported authorization protocol (").concat(n,")"),u),s(t(a),"url",void 0),s(t(a),"protocol",void 0),a.url=r,a.protocol=n,a}return UnsupportedAuthorizationProtocolError}(),oe={acl:"http://www.w3.org/ns/auth/acl#",foaf:"http://xmlns.com/foaf/0.1/",pim:"http://www.w3.org/ns/pim/space#",purl:"http://purl.org/dc/terms/",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",schema:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",vcard:"http://www.w3.org/2006/vcard/ns#"};function se(e,t){oe[e]=t}function ue(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.startsWith("http"))return e;var r=e.split(":"),n=q(r,2),o=n[0],s=n[1];if(o&&s){var u,a,i,c=null!==(u=null!==(a=oe[o])&&void 0!==a?a:null===(i=t.extraContext)||void 0===i?void 0:i[o])&&void 0!==u?u:null;if(!c)throw new Error("Can't expand IRI with unknown prefix: '".concat(e,"'"));return c+s}if(!t.defaultPrefix)throw new Error("Can't expand IRI without a default prefix: '".concat(e,"'"));return t.defaultPrefix+o}var ae,ie=function(){function t(r,n){e(this,t),s(this,"url",void 0),s(this,"quads",void 0),this.url=r,this.quads=n}return U(t,[{key:"value",value:function(e){var t;return null===(t=this.quads.find((function(t){return t.predicate.value===ue(e)})))||void 0===t?void 0:t.object.value}},{key:"values",value:function(e){return this.quads.filter((function(t){return t.predicate.value===ue(e)})).map((function(e){return e.object.value}))}}]),t}(),ce=function(){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e(this,t),s(this,"quads",void 0),this.quads=r}return U(t,[{key:"isEmpty",value:function(){return 0===this.statements.length}},{key:"getQuads",value:function(){return this.quads.slice(0)}},{key:"addQuads",value:function(e){var t;(t=this.quads).push.apply(t,D(e))}},{key:"statements",value:function(e,t,r){var n=this;return this.quads.filter((function(o){return!(r&&o.object.value!==n.expandIRI(r)||e&&o.subject.value!==n.expandIRI(e)||t&&o.predicate.value!==n.expandIRI(t))}))}},{key:"statement",value:function(e,t,r){var n=this,o=this.quads.find((function(o){return!(r&&o.object.value!==n.expandIRI(r)||e&&o.subject.value!==n.expandIRI(e)||t&&o.predicate.value!==n.expandIRI(t))}));return null!=o?o:null}},{key:"contains",value:function(e,t,r){return null!==this.statement(e,t,r)}},{key:"getThing",value:function(e){var t=this.statements(e);return new ie(e,t)}},{key:"expandIRI",value:function(e){return ue(e)}}]),t}();function le(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}!function(e){e.Read="read",e.Write="write",e.Append="append",e.Control="control"}(ae||(ae={}));var fe=function(n){r(u,ce);var o=le(u);function u(r,n,a){var i;return e(this,u),i=o.call(this,n),s(t(i),"url",void 0),s(t(i),"headers",void 0),i.url=r,i.headers=a,i}return U(u,[{key:"isACPResource",value:function(){var e;return!(null===(e=this.headers.get("Link"))||void 0===e||!e.match(/<http:\/\/www\.w3\.org\/ns\/solid\/acp#AccessControlResource>;[^,]+rel="type"/))}},{key:"isPersonalProfile",value:function(){return!!this.statement(this.url,ue("rdf:type"),ue("foaf:PersonalProfileDocument"))}},{key:"isStorage",value:function(){var e;return!(null===(e=this.headers.get("Link"))||void 0===e||!e.match(/<http:\/\/www\.w3\.org\/ns\/pim\/space#Storage>;[^,]+rel="type"/))}},{key:"isUserWritable",value:function(){return this.getUserPermissions().includes(ae.Write)}},{key:"getUserPermissions",value:function(){return this.getPermissionsFromWAC("user")}},{key:"getPublicPermissions",value:function(){return this.getPermissionsFromWAC("public")}},{key:"getLastModified",value:function(){var e,t,r,n;return null!==(e=null!==(t=null!==(r=a(this.headers.get("last-modified")))&&void 0!==r?r:a(null===(n=this.statement(this.url,"purl:modified"))||void 0===n?void 0:n.object.value))&&void 0!==t?t:this.getLatestDocumentDate())&&void 0!==e?e:null}},{key:"expandIRI",value:function(e){return ue(e,{defaultPrefix:this.url})}},{key:"getLatestDocumentDate",value:function(){var e=[].concat(D(this.statements(void 0,"purl:modified")),D(this.statements(void 0,"purl:created"))).map((function(e){return a(e.object.value)})).filter((function(e){return null!==e}));return e.length>0?e.reduce((function(e,t){return e>t?e:t})):null}},{key:"getPermissionsFromWAC",value:function(e){var t,r,n,o=null!==(t=this.headers.get("WAC-Allow"))&&void 0!==t?t:"",s=null!==(r=null===(n=i(o,new RegExp("".concat(e,'="([^"]+)"'))))||void 0===n?void 0:n[1])&&void 0!==r?r:"";return c([s.includes("read")&&ae.Read,s.includes("write")&&ae.Write,s.includes("append")&&ae.Append,s.includes("control")&&ae.Control])}}]),u}();function pe(e){return de.apply(this,arguments)}function de(){return(de=S(C.mark((function e(t){var r;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N(t,{});case 2:if(!("@graph"in(r=e.sent))){e.next=5;break}return e.abrupt("return",r);case 5:if(!("@id"in r)){e.next=7;break}return e.abrupt("return",{"@graph":[r]});case 7:return e.abrupt("return",{"@graph":[]});case 8:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function me(e){return"@graph"in e}function ve(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return he(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return he(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,u=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){a=!0,s=e},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw s}}}}function he(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ye(e,t){return be.apply(this,arguments)}function be(){return(be=S(C.mark((function e(t,r){var n,o,s;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={headers:{Accept:"text/turtle"}},e.prev=1,e.next=4,r(t,n);case 4:if(404!==(o=e.sent).status){e.next=7;break}throw new V(t);case 7:if(![401,403].includes(o.status)){e.next=9;break}throw new Z(t,o.status);case 9:return e.next=11,o.text();case 11:return s=e.sent,e.abrupt("return",{body:s,headers:o.headers});case 15:if(e.prev=15,e.t0=e.catch(1),!(e.t0 instanceof Z)){e.next=19;break}throw e.t0;case 19:if(!(e.t0 instanceof V)){e.next=21;break}throw e.t0;case 21:throw new X(t,{cause:e.t0});case 22:case"end":return e.stop()}}),e,null,[[1,15]])})))).apply(this,arguments)}function we(e){var t,r=e.slice(0),n={},o=ve(p(e).flatMap((function(e,t){return d(c(["BlankNode"===e.object.termType?e.object.value:null,"BlankNode"===e.subject.termType?e.subject.value:null]),(function(e){return e.forEach((function(e){var r;return(null!==(r=n[e])&&void 0!==r?r:n[e]=new Set).add(t)}))}))})).filter().unique());try{var s=function(){var o,s=t.value,u=n[s],a=B(p(u).map((function(t){return e[t]})).filter((function(e){var t=e.subject,r=t.termType,n=t.value;return"BlankNode"===r&&n===s})).map((function(e){var t=e.predicate,r=e.object;return"BlankNode"===r.termType?t.value:t.value+r.value})).sorted().join()),i=ve(u);try{for(i.s();!(o=i.n()).done;){for(var c=o.value,l=r[c],f={subject:l.subject,object:l.object},d=0,v=Object.entries(f);d<v.length;d++){var h=q(v[d],2),y=h[0],b=h[1];"BlankNode"===b.termType&&b.value===s&&(f[y]=W(a))}m(r,l,F(f.subject,l.predicate,f.object))}}catch(e){i.e(e)}finally{i.f()}};for(o.s();!(t=o.n()).done;)s()}catch(e){o.e(e)}finally{o.f()}return r}function je(e,t,r){return xe.apply(this,arguments)}function xe(){return(xe=S(C.mark((function e(t,r,n){var o,s;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(o=n)&&void 0!==o?o:window.fetch.bind(window),e.next=3,Le(r);case 3:return s=e.sent,e.next=6,n(t,{method:"PUT",headers:{"Content-Type":"text/turtle"},body:r});case 6:return e.abrupt("return",new fe(t,s,new Headers({})));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(e,t){return ke.apply(this,arguments)}function ke(){return(ke=S(C.mark((function e(t,r){var n,o,s,u;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ye(t,null!=r?r:window.fetch);case 2:return n=e.sent,o=n.body,s=n.headers,e.next=7,Le(o,{baseIRI:t});case 7:return u=e.sent,e.abrupt("return",new fe(t,u,s));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Re(e,t){return Ee.apply(this,arguments)}function Ee(){return(Ee=S(C.mark((function e(t,r){var n;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ge(t,r);case 3:return n=e.sent,e.abrupt("return",n);case 7:if(e.prev=7,e.t0=e.catch(0),e.t0 instanceof V){e.next=11;break}throw e.t0;case 11:return e.abrupt("return",null);case 12:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function Ie(e,t){return Pe.apply(this,arguments)}function Pe(){return(Pe=S(C.mark((function e(t,r){var n;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!me(t)){e.next=5;break}return e.next=3,Promise.all(t["@graph"].map((function(e){return Ie(e,r)})));case 3:return n=e.sent,e.abrupt("return",n.flat());case 5:return e.abrupt("return",z(t,{base:r}));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oe(e){var t=ze(e);return Object.entries(t).reduce((function(e,t){var r=q(t,2),n=r[0],o=r[1].map((function(e){return" "+Se(e)})).sort().join("\n");return e.concat("".concat(n.toUpperCase()," DATA {\n").concat(o,"\n}"))}),[]).join(" ;\n")}function Ae(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({baseIRI:t.baseIRI}),n=new L(r),o={quads:[],containsRelativeIRIs:!1};return new Promise((function(r,s){var u=n._resolveRelativeIRI;n._resolveRelativeIRI=function(){return o.containsRelativeIRIs=!0,n._resolveRelativeIRI=u,n._resolveRelativeIRI.apply(n,arguments)},n.parse(e,(function(e,n){var u;e?s(new J(null!==(u=t.baseIRI)&&void 0!==u?u:null,_.Turtle,e.message)):n?o.quads.push(n):r(o)}))}))}function Te(e){return Ue.apply(this,arguments)}function Ue(){return(Ue=S(C.mark((function e(t){var r;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,M(t);case 2:return r=e.sent,e.abrupt("return",{"@graph":r});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qe(e){return(new Q).quadsToString(e)}function Se(e){return(new Q).quadsToString([e]).slice(0,-1)}function Ce(e,t){return De.apply(this,arguments)}function De(){return(De=S(C.mark((function e(t,r){var n;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,ge(t,r);case 3:return n=e.sent,e.abrupt("return",!n.isEmpty());case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",!1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})))).apply(this,arguments)}function Be(e){return Ne.apply(this,arguments)}function Ne(){return Ne=S(C.mark((function e(t){var r,n,o,s=arguments;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},n=f(t,/(\w+) DATA {([^}]+)}/g),o={},e.next=5,Promise.all(D(n).map(function(){var e=S(C.mark((function e(t){var n,s;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t[1].toLowerCase(),s=t[2],e.next=4,Le(s,r);case 4:o[n]=e.sent;case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 5:return e.abrupt("return",o);case 6:case"end":return e.stop()}}),e)}))),Ne.apply(this,arguments)}function ze(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=f(e,/(\w+) DATA {([^}]+)}/g),o={},s=ve(n);try{for(s.s();!(t=s.n()).done;){var u=t.value,a=u[1].toLowerCase(),i=u[2];o[a]=Qe(i,r)}}catch(e){s.e(e)}finally{s.f()}return o}function Le(e){return Me.apply(this,arguments)}function Me(){return Me=S(C.mark((function e(t){var r,n,o,s=arguments;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=s.length>1&&void 0!==s[1]?s[1]:{},e.next=3,Ae(t,r);case 3:return n=e.sent,o=n.quads,e.abrupt("return",o);case 6:case"end":return e.stop()}}),e)}))),Me.apply(this,arguments)}function Qe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=l({baseIRI:t.baseIRI}),n=new L(r);try{var o=n.parse(e);return t.normalizeBlankNodes?we(o):o}catch(e){var s,u;throw new J(null!==(s=t.baseIRI)&&void 0!==s?s:null,_.Turtle,null!==(u=e.message)&&void 0!==u?u:"")}}function We(e,t,r){return Fe.apply(this,arguments)}function Fe(){return(Fe=S(C.mark((function e(t,r,n){var o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(o=n)&&void 0!==o?o:window.fetch.bind(window),e.next=3,n(t,{method:"PATCH",headers:{"Content-Type":"application/sparql-update"},body:r});case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function He(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $e(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?He(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):He(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _e(e,t){return Je.apply(this,arguments)}function Je(){return Je=S(C.mark((function e(t,r){var n,o,u,a,i,c;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=new ce(t.getQuads()),a=s({},t.url,t),i=function(e){e.statements(void 0,"foaf:isPrimaryTopicOf").map((function(e){return e.object.value})).forEach((function(e){var t;return a[e]=null!==(t=a[e])&&void 0!==t?t:null})),e.statements(void 0,"foaf:primaryTopic").map((function(e){return e.subject.value})).forEach((function(e){var t;return a[e]=null!==(t=a[e])&&void 0!==t?t:null}))},c=function(){var e=S(C.mark((function e(){var t,n,o,s,c;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0,n=Object.entries(a);case 1:if(!(t<n.length)){e.next=23;break}if(o=q(n[t],2),s=o[0],null===o[1]){e.next=5;break}return e.abrupt("continue",20);case 5:return e.prev=5,e.next=8,ge(s,r);case 8:c=e.sent,a[s]=c,u.addQuads(c.getQuads()),i(c),e.next=20;break;case 14:if(e.prev=14,e.t0=e.catch(5),!(e.t0 instanceof Z)){e.next=19;break}return a[s]=!1,e.abrupt("continue",20);case 19:throw e.t0;case 20:t++,e.next=1;break;case 23:case"end":return e.stop()}}),e,null,[[5,14]])})));return function(){return e.apply(this,arguments)}}(),i(t);case 5:return e.next=7,c();case 7:if(Object.values(a).some((function(e){return null===e}))){e.next=5;break}case 8:return e.abrupt("return",{store:u,cloaked:Object.values(a).some((function(e){return!1===e})),writableProfileUrl:t.isUserWritable()?t.url:null!==(n=null===(o=Object.values(a).find((function(e){return!!e&&e.isUserWritable()})))||void 0===o?void 0:o.url)&&void 0!==n?n:null});case 9:case"end":return e.stop()}}),e)}))),Je.apply(this,arguments)}function Ge(e,t){return Xe.apply(this,arguments)}function Xe(){return(Xe=S(C.mark((function e(t,r){var n,o,s,u,a,i,c,f,p,d,m,v,j,x,g,k,R,E;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f=w(t),e.next=3,ge(f,r);case 3:if((p=e.sent).isPersonalProfile()||p.contains(t,"solid:oidcIssuer")){e.next=6;break}throw new Error("".concat(t," is not a valid webId."));case 6:return e.next=8,_e(p,r);case 8:d=e.sent,m=d.store,v=d.writableProfileUrl,j=d.cloaked,x=m.statements(t,"pim:storage").map((function(e){return e.object.value})),g=m.statement(t,"solid:publicTypeIndex"),k=m.statement(t,"solid:privateTypeIndex"),R=b(f);case 16:if(!R||0!==x.length){e.next=26;break}return e.next=19,h(ge(R,r));case 19:if(null==(E=e.sent)||!E.isStorage()){e.next=23;break}return x.push(R),e.abrupt("break",26);case 23:R=b(R),e.next=16;break;case 26:return e.abrupt("return",$e({webId:t,cloaked:j,writableProfileUrl:v,storageUrls:y(x)},l({name:null!==(n=null===(o=m.statement(t,"vcard:fn"))||void 0===o?void 0:o.object.value)&&void 0!==n?n:null===(s=m.statement(t,"foaf:name"))||void 0===s?void 0:s.object.value,avatarUrl:null!==(u=null===(a=m.statement(t,"vcard:hasPhoto"))||void 0===a?void 0:a.object.value)&&void 0!==u?u:null===(i=m.statement(t,"foaf:img"))||void 0===i?void 0:i.object.value,oidcIssuerUrl:null===(c=m.statement(t,"solid:oidcIssuer"))||void 0===c?void 0:c.object.value,publicTypeIndexUrl:null==g?void 0:g.object.value,privateTypeIndexUrl:null==k?void 0:k.object.value})));case 27:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ke(e){return Ve.apply(this,arguments)}function Ve(){return Ve=S(C.mark((function e(t){var r,n,o,s,u=arguments;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(o=u.length>1&&void 0!==u[1]?u[1]:{}).required){e.next=3;break}return e.abrupt("return",Ge(t,o.fetch));case 3:return s=h((function(e){return Ge(e,o.fetch)})),e.next=6,s(t);case 6:if(e.t2=n=e.sent,e.t1=null!==e.t2,!e.t1){e.next=10;break}e.t1=void 0!==n;case 10:if(!e.t1){e.next=14;break}e.t3=n,e.next=17;break;case 14:return e.next=16,s(t.replace(/\/$/,"").concat("/profile/card#me"));case 16:e.t3=e.sent;case 17:if(e.t4=r=e.t3,e.t0=null!==e.t4,!e.t0){e.next=21;break}e.t0=void 0!==r;case 21:if(!e.t0){e.next=25;break}e.t5=r,e.next=28;break;case 25:return e.next=27,s(v(t).concat("/profile/card#me"));case 27:e.t5=e.sent;case 28:return e.abrupt("return",e.t5);case 29:case"end":return e.stop()}}),e)}))),Ve.apply(this,arguments)}function Ye(e){var t=function(e){return e.path&&e.path.startsWith("/")?e.path.match(/^\/[^/]*$/)?"/":"/".concat(p(e.path.split("/")).filter().slice(0,-1).join("/"),"/").replace("//","/"):null}(e);return e.protocol&&e.domain?"".concat(e.protocol,"://").concat(e.domain).concat(null!=t?t:"/"):t}function Ze(e){var t;if("@type"in e&&!("@value"in e)){e["@id"]=null!==(t=e["@id"])&&void 0!==t?t:g();for(var r=0,n=Object.values(e);r<n.length;r++){var o=n[r];k(o)&&Ze(o),R(o)&&o.forEach((function(e){return k(e)&&Ze(e)}))}}}function et(e){return d(j(e),(function(e){return Ze(e)}))}function tt(e){var t=x(e);return t?l({containerUrl:Ye(t),documentName:t.path?t.path.split("/").pop():null,resourceHash:t.fragment}):{}}function rt(e,t,r){return nt.apply(this,arguments)}function nt(){return(nt=S(C.mark((function e(t,r,n){var o,s,u;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null!==(o=n)&&void 0!==o?o:window.fetch.bind(n),s=t.storageUrls[0],u="".concat(s,"settings/").concat(r,"TypeIndex"),e.next=5,Ce(u,n);case 5:if(!e.sent){e.next=9;break}e.t0="".concat(s,"settings/").concat(r,"TypeIndex-").concat(g()),e.next=10;break;case 9:e.t0=u;case 10:return e.abrupt("return",e.t0);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ot(e,t,r){return st.apply(this,arguments)}function st(){return(st=S(C.mark((function e(t,r,n){var o,s,u,a;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==t.writableProfileUrl){e.next=2;break}throw new Error("Can't create type index without a writable profile document");case 2:return n=null!==(o=n)&&void 0!==o?o:window.fetch.bind(n),e.next=5,rt(t,r,n);case 5:return s=e.sent,u="public"===r?"<> a <http://www.w3.org/ns/solid/terms#TypeIndex> .":"\n <> a\n <http://www.w3.org/ns/solid/terms#TypeIndex>,\n <http://www.w3.org/ns/solid/terms#UnlistedDocument> .\n ",a="\n INSERT DATA {\n <".concat(t.webId,"> <http://www.w3.org/ns/solid/terms#").concat(r,"TypeIndex> <").concat(s,"> .\n }\n "),e.next=10,Promise.all([je(s,u,n),We(t.writableProfileUrl,a,n)]);case 10:return e.abrupt("return",s);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ut(e,t,r,n){return at.apply(this,arguments)}function at(){return(at=S(C.mark((function e(t,r,n,o){var s,u;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ge(t,o);case 2:return s=e.sent,u=Array.isArray(r)?r:[r],e.abrupt("return",u.map((function(e){return s.statements(void 0,"rdf:type","solid:TypeRegistration").filter((function(t){return s.contains(t.subject.value,"solid:forClass",e)})).map((function(e){return s.statements(e.subject.value,n)})).flat().map((function(e){return e.object.value})).filter((function(e){return!!e}))})).flat());case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function it(e,t){return ct.apply(this,arguments)}function ct(){return(ct=S(C.mark((function e(t,r){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ot(t,"public",r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lt(e,t){return ft.apply(this,arguments)}function ft(){return(ft=S(C.mark((function e(t,r){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ot(t,"private",r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function pt(e,t,r){return dt.apply(this,arguments)}function dt(){return(dt=S(C.mark((function e(t,r,n){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ut(t,r,"solid:instanceContainer",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function mt(e,t,r){return vt.apply(this,arguments)}function vt(){return(vt=S(C.mark((function e(t,r,n){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",ut(t,r,"solid:instance",n));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ht(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return yt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yt(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,u=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){a=!0,s=e},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw s}}}}function yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function bt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,s=o(e);if(t){var u=o(this).constructor;r=Reflect.construct(s,arguments,u)}else r=s.apply(this,arguments);return n(this,r)}}var wt={},jt={"%uuid%":"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"},xt=function(n){r(ExpectedQuadAssertionError,u);var o=bt(ExpectedQuadAssertionError);function ExpectedQuadAssertionError(r){var n;return e(this,ExpectedQuadAssertionError),n=o.call(this,"Couldn't find the following triple: ".concat(Se(r))),s(t(n),"expectedQuad",void 0),n.expectedQuad=r,n}return ExpectedQuadAssertionError}();function gt(e,t){var r,n=ht(e);try{var o=function(){var e=r.value,n=t.find((function(t){return n=t,function(e,t){if(e.termType!==t.termType)return!1;if("Literal"===e.termType&&"Literal"===t.termType){if(e.datatype.value!==t.datatype.value)return!1;if(!kt(e.value))return"http://www.w3.org/2001/XMLSchema#dateTime"===e.datatype.value?new Date(e.value).getTime()===new Date(t.value).getTime():e.value===t.value}return Rt(e.value,t.value)}((r=e).object,n.object)&&Rt(r.subject.value,n.subject.value)&&Rt(r.predicate.value,n.predicate.value);var r,n}));if(!n)throw new xt(e);I(t,n)};for(n.s();!(r=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}}function kt(e){return/\[\[(.*\]\[)?([^\]]+)\]\]/.test(e)}function Rt(e,t){var r,n;return kt(e)?(null!==(n=(r=wt)[e])&&void 0!==n?n:r[e]=function(e){var t,r=[],n=[],o=e,s=ht(f(e,/\[\[((.*?)\]\[)?([^\]]+)\]\]/g));try{for(s.s();!(t=s.n()).done;){var u=t.value;u[2]&&r.push(u[2]),n.push(u[3]),o=o.replace(u[0],"%PATTERN".concat(n.length-1,"%"))}}catch(e){s.e(e)}finally{s.f()}o=o.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");for(var a=0,i=Object.entries(n);a<i.length;a++){var c,l=q(i[a],2),p=l[0],d=l[1];o=o.replace("%PATTERN".concat(p,"%"),null!==(c=jt[d])&&void 0!==c?c:d)}return new RegExp(o)}(e)).test(t):e===t}function Et(){wt={}}function It(e,t){return Pt.apply(this,arguments)}function Pt(){return(Pt=S(C.mark((function e(t,r){var n,o,s,u,a;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Et(),e.next=3,Ie(t);case 3:return n=e.sent,e.next=6,Ie(r);case 6:if(o=e.sent,s=qe(n),u=qe(o),a=function(e,t){return{success:e,message:t,expected:s,actual:u}},n.length===o.length){e.next=12;break}return e.abrupt("return",a(!1,"Expected ".concat(n.length," triples, found ").concat(o.length,".")));case 12:e.prev=12,gt(n,o),e.next=21;break;case 16:if(e.prev=16,e.t0=e.catch(12),e.t0 instanceof xt){e.next=20;break}throw e.t0;case 20:return e.abrupt("return",a(!1,e.t0.message));case 21:return e.abrupt("return",a(!0,"jsonld matches"));case 22:case"end":return e.stop()}}),e,null,[[12,16]])})))).apply(this,arguments)}function Ot(e,t){var r;Et();for(var n=ze(e,{normalizeBlankNodes:!0}),o=ze(t,{normalizeBlankNodes:!0}),s=function(r,n){return{success:r,message:n,expected:e,actual:t}},u=0,a=Object.keys(n);u<a.length;u++){var i=a[u];if(!(i in o))return s(!1,"Couldn't find expected ".concat(i," operation."));var c=E(n,i),l=E(o,i);if(c.length!==l.length)return s(!1,"Expected ".concat(c.length," ").concat(i," triples, found ").concat(l.length,"."));try{gt(c,l)}catch(e){if(!(e instanceof xt))throw e;return s(!1,"Couldn't find the following ".concat(i," triple: ").concat(Se(e.expectedQuad)))}}var f=null!==(r=Object.keys(o)[0])&&void 0!==r?r:null;return f?s(!1,"Did not expect to find ".concat(f," triples.")):s(!0,"sparql matches")}function At(e,t){Et();var r=Qe(e,{normalizeBlankNodes:!0}),n=Qe(t,{normalizeBlankNodes:!0}),o=function(r,n){return{success:r,message:n,expected:e,actual:t}};if(r.length!==n.length)return o(!1,"Expected ".concat(r.length," triples, found ").concat(n.length,"."));try{gt(r,n)}catch(e){if(!(e instanceof xt))throw e;return o(!1,e.message)}return o(!0,"turtle matches")}function Tt(e,t){return Ut.apply(this,arguments)}function Ut(){return(Ut=S(C.mark((function e(t,r){var n,o,s,u,a,i,c;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=null!==(n=r)&&void 0!==n?n:window.fetch.bind(window),e.next=3,r(t,{method:"HEAD"});case 3:if(a=e.sent,i=null!==(o=a.headers.get("Link"))&&void 0!==o?o:"",c=null!==(s=null===(u=i.match(/<([^>]+)>;\s*rel="acl"/))||void 0===u?void 0:u[1])&&void 0!==s?s:null){e.next=8;break}throw new Error("Could not find ACL Resource for '".concat(t,"'"));case 8:return e.abrupt("return",P(O(t),c));case 9:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qt(e,t,r){return St.apply(this,arguments)}function St(){return(St=S(C.mark((function e(t,r,n){var o,s,u;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(o=n)||void 0===o){e.next=4;break}e.t0=o,e.next=7;break;case 4:return e.next=6,Tt(t,r);case 6:e.t0=e.sent;case 7:return n=e.t0,e.next=10,Re(null!==(s=n)&&void 0!==s?s:"",r);case 10:if(u=e.sent){e.next=13;break}return e.abrupt("return",qt(O(t),r));case 13:if(!u.isACPResource()){e.next=15;break}throw new ne(t,"ACP");case 15:return e.abrupt("return",u);case 16:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ct(e,t){return Dt.apply(this,arguments)}function Dt(){return(Dt=S(C.mark((function e(t,r){var n,o;return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Tt(t,r);case 2:return n=e.sent,e.next=5,qt(t,r,n);case 5:return o=e.sent,e.abrupt("return",l({url:n,effectiveUrl:o.url,document:o}));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Bt={turtle:function(e){var t=this._obj,r=this.assert.bind(this),n=At(e,t);r(n.success,n.message,"",n.expected,n.actual)},sparql:function(e){var t=this._obj,r=this.assert.bind(this),n=Ot(e,t);r(n.success,n.message,"",n.expected,n.actual)}};function Nt(){chai.use((function(e){return Object.entries(Bt).forEach((function(t){var r=q(t,2),n=r[0],o=r[1];return e.Assertion.addMethod(n,o)}))}))}function zt(e,t){var r=e.success,n=t.context.utils;return{pass:r,message:r?function(){return[e.message,n.matcherHint(t.hint)].join("\n\n")}:function(){return[e.message,n.matcherHint(t.hint),["Expected: not ".concat(n.printExpected(t.expected)),"Received: ".concat(n.printReceived(t.received))].join("\n")].join("\n\n")}}}var Lt={toEqualJsonLD:function(e,t){var r=this;return S(C.mark((function n(){var o;return C.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,It(t,e);case 2:return o=n.sent,n.abrupt("return",zt(o,{context:r,hint:"toEqualJsonLD",expected:t,received:e}));case 4:case"end":return n.stop()}}),n)})))()},toEqualSparql:function(e,t){return zt(Ot(t,e),{context:this,hint:"toEqualSparql",expected:Oe(t),received:Oe(e)})}};function Mt(){expect.extend(Lt)}function Qt(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=null!==(e=t.baseUrl)&&void 0!==e?e:H.internet.url();return r.endsWith("/")?r:r+"/"}function Wt(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null!==(e=r.containerUrl)&&void 0!==e?e:Qt(r),o=null!==(t=r.name)&&void 0!==t?t:H.random.word();return n+A(o)}function Ft(){var e,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=null!==(e=r.documentUrl)&&void 0!==e?e:Wt(r),o=null!==(t=r.hash)&&void 0!==t?t:"it";return n+"#"+o}function Ht(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var $t=function(){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;e(this,t),s(this,"rawBody",void 0),s(this,"body",void 0),s(this,"bodyUsed",void 0),s(this,"headers",void 0),s(this,"ok",void 0),s(this,"redirected",void 0),s(this,"status",void 0),s(this,"statusText",void 0),s(this,"trailer",void 0),s(this,"type",void 0),s(this,"url",void 0),this.rawBody=r,this.headers=new Headers(n),this.status=o}var r,n,o,u,a;return U(t,[{key:"arrayBuffer",value:(a=S(C.mark((function e(){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("ResponseStub.arrayBuffer is not implemented");case 1:case"end":return e.stop()}}),e)}))),function(){return a.apply(this,arguments)})},{key:"blob",value:(u=S(C.mark((function e(){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("ResponseStub.blob is not implemented");case 1:case"end":return e.stop()}}),e)}))),function(){return u.apply(this,arguments)})},{key:"formData",value:(o=S(C.mark((function e(){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("ResponseStub.formData is not implemented");case 1:case"end":return e.stop()}}),e)}))),function(){return o.apply(this,arguments)})},{key:"json",value:(n=S(C.mark((function e(){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",JSON.parse(this.rawBody));case 1:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"text",value:(r=S(C.mark((function e(){return C.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.rawBody);case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"clone",value:function(){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ht(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ht(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},this)}}]),t}();function _t(){var e=[],t={mockResponse:function(t,r,n){e.push(new $t(t,r,n))},mockNotFoundResponse:function(){e.push(new $t("",{},404))}},r=jest.fn(S(C.mark((function t(){var r;return C.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",null!==(r=e.shift())&&void 0!==r?r:T("fetch mock called without response"));case 1:case"end":return t.stop()}}),t)}))));return Object.assign(r,t),r}export{J as MalformedSolidDocumentError,X as NetworkRequestError,V as NotFoundError,$t as ResponseStub,fe as SolidDocument,_ as SolidDocumentFormat,ae as SolidDocumentPermission,ce as SolidStore,ie as SolidThing,Z as UnauthorizedError,te as UnsuccessfulNetworkRequestError,ne as UnsupportedAuthorizationProtocolError,pe as compactJsonLDGraph,lt as createPrivateTypeIndex,it as createPublicTypeIndex,je as createSolidDocument,se as defineIRIPrefix,ue as expandIRI,Qt as fakeContainerUrl,Wt as fakeDocumentUrl,Ft as fakeResourceUrl,Ke as fetchLoginUserProfile,ge as fetchSolidDocument,Ct as fetchSolidDocumentACL,Re as fetchSolidDocumentIfFound,pt as findContainerRegistrations,mt as findInstanceRegistrations,Nt as installChaiPlugin,Mt as installJestPlugin,me as isJsonLDGraph,It as jsonldEquals,Ie as jsonldToQuads,et as mintJsonLDIdentifiers,_t as mockFetch,Oe as normalizeSparql,tt as parseResourceSubject,Ae as parseTurtle,Se as quadToTurtle,Te as quadsToJsonLD,qe as quadsToTurtle,Ce as solidDocumentExists,Ot as sparqlEquals,Be as sparqlToQuads,ze as sparqlToQuadsSync,At as turtleEquals,Le as turtleToQuads,Qe as turtleToQuadsSync,We as updateSolidDocument};
|
|
2
2
|
//# sourceMappingURL=noeldemartin-solid-utils.esm.js.map
|